blob: b013582c374974ea54343c236168dedf98c84f36 [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 "EventReporter.h"
Sreeram Ramachandrane09b20a2014-07-05 17:15:14 -070021#include "sysutils/SocketListener.h"
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070022
Lorenzo Colitti7035f222017-02-13 18:29:00 +090023namespace android {
24namespace net {
25
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070026class NetworkController;
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070027
28class FwmarkServer : public SocketListener {
29public:
Patrick Rohrb371bc32022-02-01 22:43:23 +010030 explicit FwmarkServer(NetworkController* networkController, EventReporter* eventReporter);
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070031
Chenbo Feng9944ba82017-10-10 17:33:20 -070032 static constexpr const char* SOCKET_NAME = "fwmarkd";
Lorenzo Colitti548bbd42017-08-28 23:05:12 +090033
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070034private:
35 // Overridden from SocketListener:
36 bool onDataAvailable(SocketClient* client);
37
Sreeram Ramachandran3a069e62014-06-22 11:02:57 -070038 // Returns 0 on success or a negative errno value on failure.
Sreeram Ramachandrane09b20a2014-07-05 17:15:14 -070039 int processClient(SocketClient* client, int* socketFd);
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070040
41 NetworkController* const mNetworkController;
Michal Karpinski7d374532016-10-06 19:33:55 +010042 EventReporter* mEventReporter;
Ken Chen89863932020-02-21 16:30:47 +080043 bool mRedirectSocketCalls;
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