From: SeokYeon Hwang Date: Sat, 30 May 2015 15:00:21 +0000 (+0900) Subject: emul_state: added refined function for detecting tap netclient X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~399 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fed2d779014c37ce64d1c9db45cd2e07dd748052;p=sdk%2Femulator%2Fqemu.git emul_state: added refined function for detecting tap netclient Change-Id: I39da8cc3c3ee1e351ca4d36a98561651f8e449d4 Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index ba14a68153..9b2d162927 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -32,7 +32,6 @@ #include "emul_state.h" #include -#include "sysemu/sysemu.h" #include "emulator_common.h" #if defined(CONFIG_LINUX) @@ -45,8 +44,10 @@ extern bool hax_allowed; extern bool hax_allowed; #endif +#include "sysemu/sysemu.h" #include "block/block_int.h" #include "sysemu/block-backend.h" +#include "net/net.h" #include "emulator_options.h" #include "skin/maruskin_server.h" @@ -185,10 +186,30 @@ bool is_emul_tap_enable(void) void set_emul_tap_enable(bool enable) { - LOG_INFO("%s: %s", __func__, enable ? "true" : "false"); + LOG_INFO("%s: %s\n", __func__, enable ? "true" : "false"); _emul_info.tap_enable = enable; } +bool is_netclient_tap_attached(void) +{ + NetClientState *ncs[MAX_QUEUE_NUM]; + int queues, i; + + queues = qemu_find_net_clients_except(NULL, ncs, + NET_CLIENT_OPTIONS_KIND_NIC, + MAX_QUEUE_NUM); + for (i = 0; i < queues; ++i) { + if (ncs[i]->info->type == NET_CLIENT_OPTIONS_KIND_TAP && + (ncs[i]->peer->info->type == NET_CLIENT_OPTIONS_KIND_NIC || + // for legacy -net option. + ncs[i]->peer->info->type == NET_CLIENT_OPTIONS_KIND_HUBPORT)) { + return true; + } + } + + return false; +} + void set_emul_guest_ip(char *ip) { strncpy(_emul_info.guest_ip, ip, strlen(ip)); diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index a8454b3dad..76577610c6 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -211,6 +211,7 @@ bool get_emuld_connection(void); bool get_sdb_connection(void); const char* get_drive_image_file(void); const char* get_http_proxy_addr(void); +bool is_netclient_tap_attached(void); /* multi-touch */ MultiTouchState *get_emul_multi_touch_state(void);