2018-02-08 12:47:31 +00:00
|
|
|
#ifndef SERVER_H
|
|
|
|
#define SERVER_H
|
|
|
|
|
2018-02-08 14:16:27 +00:00
|
|
|
#include <SDL2/SDL_net.h>
|
2018-01-22 10:22:31 +00:00
|
|
|
#include "command.h"
|
|
|
|
|
2018-02-08 14:16:27 +00:00
|
|
|
struct server {
|
|
|
|
process_t process;
|
|
|
|
TCPsocket server_socket;
|
|
|
|
TCPsocket device_socket;
|
|
|
|
SDL_bool adb_reverse_enabled;
|
|
|
|
};
|
2018-01-23 14:46:34 +00:00
|
|
|
|
2018-02-08 14:16:27 +00:00
|
|
|
#define SERVER_INITIALIZER { \
|
|
|
|
.process = PROCESS_NONE, \
|
|
|
|
.server_socket = NULL, \
|
|
|
|
.device_socket = NULL, \
|
|
|
|
.adb_reverse_enabled = SDL_FALSE, \
|
|
|
|
}
|
|
|
|
|
|
|
|
// init default values
|
|
|
|
void server_init(struct server *server);
|
|
|
|
|
|
|
|
// push, enable tunnel et start the server
|
|
|
|
SDL_bool server_start(struct server *server, const char *serial, Uint16 local_port,
|
|
|
|
Uint16 max_size, Uint32 bit_rate);
|
|
|
|
|
|
|
|
// block until the communication with the server is established
|
2018-02-09 14:18:09 +00:00
|
|
|
TCPsocket server_connect_to(struct server *server, const char *serial, Uint32 timeout_ms);
|
2018-02-08 14:16:27 +00:00
|
|
|
|
|
|
|
// disconnect and kill the server process
|
|
|
|
void server_stop(struct server *server, const char *serial);
|
2018-02-08 12:47:31 +00:00
|
|
|
|
2018-02-09 11:59:36 +00:00
|
|
|
// close and release sockets
|
|
|
|
void server_destroy(struct server *server);
|
|
|
|
|
2018-02-08 12:47:31 +00:00
|
|
|
#endif
|