blob: 8a9c72ec37c0ca9c60f0a31abfc375aeecc03238 [file] [log] [blame]
/*
* Copyright 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_
#define __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_
#include <VtsDriverCommUtil.h>
#include "test/vts/proto/AndroidSystemControlMessage.pb.h"
namespace android {
namespace vts {
// Launches a server which accepts connection requests from drivers.
extern int StartSocketServerForDriver(const string& callback_socket_name,
int runner_port);
// Class which contains actual methods to handle the callback requests.
class SocketServerForDriver : public VtsDriverCommUtil {
public:
SocketServerForDriver(int sock, int runner_port)
: VtsDriverCommUtil(sock),
runner_port_(runner_port) {}
// Starts to process requests.
void Start();
// Sends a RPC call to the runner.
void RpcCallToRunner(const AndroidSystemCallbackRequestMessage& message);
private:
// TCP port number of a runner's callback server.
int runner_port_;
};
} // namespace vts
} // namespace android
#endif // __VTS_AGENT_SOCKET_SERVER_FOR_DRIVER_H_