blob: c17dc0d5ed32e8772be5595c7af1dcc5ba519e0a [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;
Chenbo Feng6b0d6252018-10-15 12:01:32 -070027class TrafficController;
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070028
29class FwmarkServer : public SocketListener {
30public:
Chenbo Feng9944ba82017-10-10 17:33:20 -070031 explicit FwmarkServer(NetworkController* networkController, EventReporter* eventReporter,
32 TrafficController* trafficCtrl);
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070033
Chenbo Feng9944ba82017-10-10 17:33:20 -070034 static constexpr const char* SOCKET_NAME = "fwmarkd";
Lorenzo Colitti548bbd42017-08-28 23:05:12 +090035
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070036private:
37 // Overridden from SocketListener:
38 bool onDataAvailable(SocketClient* client);
39
Sreeram Ramachandran3a069e62014-06-22 11:02:57 -070040 // Returns 0 on success or a negative errno value on failure.
Sreeram Ramachandrane09b20a2014-07-05 17:15:14 -070041 int processClient(SocketClient* client, int* socketFd);
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070042
43 NetworkController* const mNetworkController;
Michal Karpinski7d374532016-10-06 19:33:55 +010044 EventReporter* mEventReporter;
Chenbo Feng9944ba82017-10-10 17:33:20 -070045 TrafficController* mTrafficCtrl;
Sreeram Ramachandran030b36e2014-05-11 21:04:03 -070046};
47
Lorenzo Colitti7035f222017-02-13 18:29:00 +090048} // namespace net
49} // namespace android
50
Sreeram Ramachandranf4cfad32014-05-21 08:54:07 -070051#endif // NETD_SERVER_FWMARK_SERVER_H