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 17 #ifndef __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_ 18 #define __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_ 19 20 #include <VtsDriverCommUtil.h> 21 #include "test/vts/proto/AndroidSystemControlMessage.pb.h" 22 23 namespace android { 24 namespace vts { 25 26 // Launches a server which accepts connection requests from drivers. 27 extern int StartSocketServerForDriver(const string& callback_socket_name, 28 int runner_port); 29 30 // Class which contains actual methods to handle the callback requests. 31 class SocketServerForDriver : public VtsDriverCommUtil { 32 public: SocketServerForDriver(int sock,int runner_port)33 SocketServerForDriver(int sock, int runner_port) 34 : VtsDriverCommUtil(sock), 35 runner_port_(runner_port) {} 36 37 // Starts to process requests. 38 void Start(); 39 40 // Sends a RPC call to the runner. 41 void RpcCallToRunner(const AndroidSystemCallbackRequestMessage& message); 42 43 private: 44 // TCP port number of a runner's callback server. 45 int runner_port_; 46 }; 47 48 } // namespace vts 49 } // namespace android 50 51 #endif // __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_ 52