Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 1 | /* |
| 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 Ramachandran | f4cfad3 | 2014-05-21 08:54:07 -0700 | [diff] [blame] | 17 | #ifndef NETD_SERVER_FWMARK_SERVER_H |
| 18 | #define NETD_SERVER_FWMARK_SERVER_H |
Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 19 | |
Michal Karpinski | 7d37453 | 2016-10-06 19:33:55 +0100 | [diff] [blame] | 20 | #include "EventReporter.h" |
Sreeram Ramachandran | e09b20a | 2014-07-05 17:15:14 -0700 | [diff] [blame] | 21 | #include "sysutils/SocketListener.h" |
Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 22 | |
Lorenzo Colitti | 7035f22 | 2017-02-13 18:29:00 +0900 | [diff] [blame] | 23 | namespace android { |
| 24 | namespace net { |
| 25 | |
Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 26 | class NetworkController; |
Chenbo Feng | 6b0d625 | 2018-10-15 12:01:32 -0700 | [diff] [blame^] | 27 | class TrafficController; |
Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 28 | |
| 29 | class FwmarkServer : public SocketListener { |
| 30 | public: |
Chenbo Feng | 9944ba8 | 2017-10-10 17:33:20 -0700 | [diff] [blame] | 31 | explicit FwmarkServer(NetworkController* networkController, EventReporter* eventReporter, |
| 32 | TrafficController* trafficCtrl); |
Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 33 | |
Chenbo Feng | 9944ba8 | 2017-10-10 17:33:20 -0700 | [diff] [blame] | 34 | static constexpr const char* SOCKET_NAME = "fwmarkd"; |
Lorenzo Colitti | 548bbd4 | 2017-08-28 23:05:12 +0900 | [diff] [blame] | 35 | |
Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 36 | private: |
| 37 | // Overridden from SocketListener: |
| 38 | bool onDataAvailable(SocketClient* client); |
| 39 | |
Sreeram Ramachandran | 3a069e6 | 2014-06-22 11:02:57 -0700 | [diff] [blame] | 40 | // Returns 0 on success or a negative errno value on failure. |
Sreeram Ramachandran | e09b20a | 2014-07-05 17:15:14 -0700 | [diff] [blame] | 41 | int processClient(SocketClient* client, int* socketFd); |
Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 42 | |
| 43 | NetworkController* const mNetworkController; |
Michal Karpinski | 7d37453 | 2016-10-06 19:33:55 +0100 | [diff] [blame] | 44 | EventReporter* mEventReporter; |
Chenbo Feng | 9944ba8 | 2017-10-10 17:33:20 -0700 | [diff] [blame] | 45 | TrafficController* mTrafficCtrl; |
Sreeram Ramachandran | 030b36e | 2014-05-11 21:04:03 -0700 | [diff] [blame] | 46 | }; |
| 47 | |
Lorenzo Colitti | 7035f22 | 2017-02-13 18:29:00 +0900 | [diff] [blame] | 48 | } // namespace net |
| 49 | } // namespace android |
| 50 | |
Sreeram Ramachandran | f4cfad3 | 2014-05-21 08:54:07 -0700 | [diff] [blame] | 51 | #endif // NETD_SERVER_FWMARK_SERVER_H |