From 4df0eb6b86afafa6177578e8661eb80ff1d70e01 Mon Sep 17 00:00:00 2001 From: Munkyu Im Date: Tue, 12 May 2015 17:12:57 +0900 Subject: [PATCH] Revert "net: remove get/set host ip" This reverts commit ed4a07e79ff064ba3c7814188b1e1785c7a1d0d4. Change-Id: I6085a41c3ffdd17c506edba45881d10c58772dc4 Signed-off-by: Munkyu Im --- tizen/src/emul_state.c | 30 ++++++++++++++++++++++++++++++ tizen/src/emul_state.h | 3 +++ tizen/src/emulator_common.h | 1 + 3 files changed, 34 insertions(+) diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 0bbc9ebcf9..94534b31ee 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -195,6 +195,36 @@ char* get_emul_guest_ip(void) return _emul_info.guest_ip; } +void set_emul_host_ip(char *kernel_cmdline) +{ +#ifdef SUPPORT_LEGACY_ARGS + char *buf = strstr(kernel_cmdline, HOST_IP_PREFIX); +#else + char *buf = get_variable("host_ip"); +#endif + if (buf) { + char buf_host_ip[MAXLEN] = {0,}; + int len = strlen(HOST_IP_PREFIX); + int i, j; + int max_len = strlen(buf); + for(i = len, j = 0; i < max_len; i++) { + if (buf[i] == ' ' || buf[i] == '\0') + break; + buf_host_ip[j++] = buf[i]; + } + + buf_host_ip[j] = '\0'; + LOG_INFO("host_ip information=%s\n", buf_host_ip); + strncpy(_emul_info.host_ip, buf_host_ip, sizeof(_emul_info.host_ip)); + } +} + +char* get_emul_host_ip(void) +{ + LOG_INFO("host ip: %s\n", _emul_info.guest_ip); + return _emul_info.host_ip; +} + /* maximum number of touch point */ void set_emul_max_touch_point(int cnt) { diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 6923ed1633..5b0e7fd2ad 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -104,6 +104,7 @@ typedef struct EmulatorConfigInfo { bool tap_enable; char guest_ip[16]; + char host_ip[16]; int spice_port; char *vm_name; @@ -152,6 +153,7 @@ void set_emul_max_touch_point(int cnt); void set_emul_vm_base_port(int port); void set_emul_ecs_port(int port); void set_emul_guest_ip(char *ip); +void set_emul_host_ip(char *ip); void set_emul_vm_name(char *vm_name); void set_emul_skin_path(char *path); void set_emul_gpu_accel(bool enable); @@ -202,6 +204,7 @@ int get_host_lock_key_state_darwin(int key); int get_emul_caps_lock_state(void); int get_emul_num_lock_state(void); char* get_emul_guest_ip(void); +char* get_emul_host_ip(void); bool is_emul_tap_enable(void); char* get_emul_http_proxy_addr(void); char* get_emul_http_proxy_port(void); diff --git a/tizen/src/emulator_common.h b/tizen/src/emulator_common.h index a29efff56f..34142b2df5 100644 --- a/tizen/src/emulator_common.h +++ b/tizen/src/emulator_common.h @@ -60,6 +60,7 @@ #define JAVA_MAX_COMMAND_LENGTH 1024 #define MAXLEN 512 #define HTTP_PROXY_PREFIX "http_proxy=" +#define HOST_IP_PREFIX "host_ip=" #define JAR_SKINFILE "emulator-skin.jar" -- 2.34.1