-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 /* F0-FF */
};
-int base64_decode(char *text, unsigned char *dst, int numBytes )
+int base64_decode(const char *text, unsigned char *dst, int numBytes )
{
const char* cp;
int space_idx = 0, phase;
}
-int base64_encode(char *text, int numBytes, char **encodedText)
+int base64_encode(const char *text, int numBytes, char **encodedText)
{
unsigned char input[3] = {0,0,0};
unsigned char output[4] = {0,0,0,0};
#include "maru_common.h"
-int base64_decode(char *text, unsigned char *dst, int numBytes);
-int base64_encode(char *text, int numBytes, char **encodedText);
+int base64_decode(const char *text, unsigned char *dst, int numBytes);
+int base64_encode(const char *text, int numBytes, char **encodedText);
clients = QTAILQ_HEAD_INITIALIZER(clients);
static ECS_State *current_ecs;
-static int port;
static pthread_mutex_t mutex_clilist = PTHREAD_MUTEX_INITIALIZER;
return cmd->flags & MONITOR_CMD_ASYNC;
}
+/*
static void monitor_user_noop(Monitor *mon, const QObject *data) {
}
static int do_screen_dump(Monitor *mon, const QDict *qdict, QObject **ret_data) {
- vga_hw_screen_dump(qdict_get_str(qdict, "filename"));
+ //vga_hw_screen_dump(qdict_get_str(qdict, "filename"));
return 0;
}
QObject **ret_data) {
return 0;
}
+*/
static const mon_cmd_t qmp_cmds[] = {
//#include "qmp-commands-old.h"
}
static int ecs_add_client(ECS_State *cs, int fd) {
- const char* welcome;
ECS_Client *clii = g_malloc0(sizeof(ECS_Client));
if (NULL == clii) {
LOG("Add an ecs client. fd: %d", fd);
- welcome = WELCOME_MESSAGE;
-
- //send_to_client(fd, welcome);
-
pthread_mutex_unlock(&mutex_clilist);
return 0;
#endif
static void alive_checker(void *opaque) {
+ /*
ECS_State *cs = opaque;
ECS_Client *clii;
QObject *obj;
return;
}
- /*
QTAILQ_FOREACH(clii, &clients, next)
{
if (1 == clii->keep_alive) {
}
#endif
-static int check_port(void) {
+int get_ecs_port(void) {
int port = HOST_LISTEN_PORT;
int try = EMULATOR_SERVER_NUM;
return -1;
}
-int get_ecs_port(void) {
- return port;
-}
-
static void* ecs_initialize(void* args) {
int ret = 1;
ECS_State *cs = NULL;
Error *local_err = NULL;
Monitor* mon = NULL;
char host_port[16];
+ int port = -1;
start_logging();
LOG("ecs starts initializing.");
return NULL;
}
- port = check_port();
+ port = (int) args;
if (port < 0) {
LOG("None of port is available.");
return NULL;
return 0;
}
-int start_ecs(void) {
+int start_ecs(int port) {
pthread_t thread_id;
- if (0 != pthread_create(&thread_id, NULL, ecs_initialize, NULL)) {
+ if (0 != pthread_create(&thread_id, NULL, ecs_initialize, (void*) port)) {
LOG("pthread creation failed.");
return -1;
}
#define HOST_LISTEN_ADDR "127.0.0.1"
#define HOST_LISTEN_PORT 27000
#define EMULATOR_SERVER_NUM 3
-#define WELCOME_MESSAGE "### Welcome to ECS service. ###\n"
#define COMMANDS_TYPE "type"
#define COMMANDS_DATA "data"
} ECS_Client;
-int start_ecs(void);
+int start_ecs(int port);
int stop_ecs(void);
+int get_ecs_port(void);
void ecs_vprintf(const char *type, const char *fmt, va_list ap);
void ecs_printf(const char *type, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
-int get_ecs_port(void);
-
bool handle_protobuf_msg(ECS_Client* cli, char* data, const int len);
bool ntf_to_injector(const char* data, const int len);
#include "qmp-commands.h"
#include "ecs.h"
+#include "base64.h"
+#include "mloop_event.h"
#include "hw/maru_virtio_evdi.h"
#include "hw/maru_virtio_sensor.h"
+#include "hw/maru_virtio_nfc.h"
#include "skin/maruskin_operation.h"
// utility functions
-void* build_master(ECS__Master* master, int* payloadsize)
+static void* build_master(ECS__Master* master, int* payloadsize)
{
int len_pack = ecs__master__get_packed_size(master);
*payloadsize = len_pack + 4;
{
LOG("ecs_startinfo_req");
-
int hostkbd_status = mloop_evcmd_get_hostkbd_status();
LOG("hostkbd_status = %d", hostkbd_status);
}
}
-
send_to_evdi(route_ij, sndbuf, sndlen);
g_free(sndbuf);
bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg)
{
char cmd[10];
- char* data;
+ char* data = NULL;
memset(cmd, 0, 10);
strcpy(cmd, msg->category);
type_length length = (type_length) msg->length;
gchar log_path[PATH_MAX] = { 0, };
int tizen_base_port;
+int tizen_ecs_port;
char tizen_target_path[PATH_MAX];
char tizen_target_img_path[PATH_MAX];
tizen_base_port = get_sdb_base_port();
+ tizen_ecs_port = get_ecs_port();
+
+ qemu_add_opts(&qemu_ecs_opts);
+
+ start_ecs(tizen_ecs_port);
+
get_host_proxy(http_proxy, https_proxy, ftp_proxy, socks_proxy);
/* using "DNS" provided by default QEMU */
g_strlcpy(dns, DEFAULT_QEMU_DNS_IP, strlen(DEFAULT_QEMU_DNS_IP) + 1);
int guest_server_port = tizen_base_port + SDB_UDP_SENSOR_INDEX;
start_guest_server(guest_server_port);
- qemu_add_opts(&qemu_ecs_opts);
-
- start_ecs();
-
mloop_ev_init();
}