Keun Soo Yim | a4a6d53 | 2016-06-08 09:11:40 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | |
Keun Soo Yim | 6d8a16b | 2016-06-30 19:29:02 -0700 | [diff] [blame] | 17 | #ifndef __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_ |
| 18 | #define __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_ |
Keun Soo Yim | a4a6d53 | 2016-06-08 09:11:40 -0700 | [diff] [blame] | 19 | |
Keun Soo Yim | 8f3ca75 | 2016-07-18 14:37:04 -0700 | [diff] [blame^] | 20 | #include <VtsDriverCommUtil.h> |
| 21 | |
Keun Soo Yim | a4a6d53 | 2016-06-08 09:11:40 -0700 | [diff] [blame] | 22 | namespace android { |
| 23 | namespace vts { |
| 24 | |
Keun Soo Yim | 8f3ca75 | 2016-07-18 14:37:04 -0700 | [diff] [blame^] | 25 | // Launches a server which accepts connection requests from drivers. |
Keun Soo Yim | 1f340b9 | 2016-07-09 12:42:33 -0700 | [diff] [blame] | 26 | extern int StartSocketServerForDriver(const string& callback_socket_name, |
| 27 | int runner_port); |
Keun Soo Yim | a4a6d53 | 2016-06-08 09:11:40 -0700 | [diff] [blame] | 28 | |
Keun Soo Yim | 8f3ca75 | 2016-07-18 14:37:04 -0700 | [diff] [blame^] | 29 | // Class which contains actual methods to handle the callback requests. |
| 30 | class SocketServerForDriver : public VtsDriverCommUtil { |
| 31 | public: |
| 32 | SocketServerForDriver(int sock, int runner_port) |
| 33 | : runner_port_(runner_port), |
| 34 | VtsDriverCommUtil(sock_) {} |
| 35 | |
| 36 | // Starts to process requests. |
| 37 | void Start(); |
| 38 | |
| 39 | // Sends a RPC call to the runner. |
| 40 | void RpcCallToRunner(const char* id); |
| 41 | |
| 42 | private: |
| 43 | // ID of a socket to communicate with a connected driver. |
| 44 | int sock_; |
| 45 | |
| 46 | // TCP port number of a runner's callback server. |
| 47 | int runner_port_; |
| 48 | }; |
| 49 | |
Keun Soo Yim | a4a6d53 | 2016-06-08 09:11:40 -0700 | [diff] [blame] | 50 | } // namespace vts |
| 51 | } // namespace android |
| 52 | |
Keun Soo Yim | 6d8a16b | 2016-06-30 19:29:02 -0700 | [diff] [blame] | 53 | #endif // __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_ |