blob: 4d109c029cadffcdf8852e592906dba62f55aab9 [file] [log] [blame]
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Sreeram Ramachandranf4cfad32014-05-21 08:54:07 -070017#ifndef NETD_SERVER_FWMARK_SERVER_H
18#define NETD_SERVER_FWMARK_SERVER_H
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070019
Michal Karpinski7d374532016-10-06 19:33:55 +010020#include "android/net/metrics/INetdEventListener.h"
21#include "EventReporter.h"
Sreeram Ramachandrane09b20a2014-07-05 17:15:14 -070022#include "sysutils/SocketListener.h"
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070023
Lorenzo Colitti7035f222017-02-13 18:29:00 +090024namespace android {
25namespace net {
26
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070027class NetworkController;
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070028
29class FwmarkServer : public SocketListener {
30public:
Michal Karpinski7d374532016-10-06 19:33:55 +010031 explicit FwmarkServer(NetworkController* networkController, EventReporter* eventReporter);
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070032
Lorenzo Colitti548bbd42017-08-28 23:05:12 +090033 static constexpr const char* SOCKET_NAME = "fwmarkd";
34
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070035private:
36 // Overridden from SocketListener:
37 bool onDataAvailable(SocketClient* client);
38
Sreeram Ramachandran3a069e62014-06-22 11:02:57 -070039 // Returns 0 on success or a negative errno value on failure.
Sreeram Ramachandrane09b20a2014-07-05 17:15:14 -070040 int processClient(SocketClient* client, int* socketFd);
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070041
42 NetworkController* const mNetworkController;
Michal Karpinski7d374532016-10-06 19:33:55 +010043 EventReporter* mEventReporter;
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070044};
45
Lorenzo Colitti7035f222017-02-13 18:29:00 +090046} // namespace net
47} // namespace android
48
Sreeram Ramachandranf4cfad32014-05-21 08:54:07 -070049#endif // NETD_SERVER_FWMARK_SERVER_H