X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=test%2Fconnection_test.c;h=4a63bac9377269e2d2ea5c926da8c4c18823c6ab;hb=afff118d65ed2025921408235af65e78ca97cb32;hp=4fec7719f3a1b4355bdd80afdbedb2759c0cd4ab;hpb=13abe82fb0662b4c9efdf528dd5b10e4688a7c33;p=platform%2Fcore%2Fapi%2Fconnection.git diff --git a/test/connection_test.c b/test/connection_test.c index 4fec771..4a63bac 100755 --- a/test/connection_test.c +++ b/test/connection_test.c @@ -22,6 +22,7 @@ #include #include "net_connection.h" +#include "connection_extension.h" #include @@ -230,6 +231,10 @@ static const char *test_print_error(connection_error_e error) return "CONNECTION_ERROR_PERMISSION_DENIED"; case CONNECTION_ERROR_NOT_SUPPORTED: return "CONNECTION_ERROR_NOT_SUPPORTED"; + case CONNECTION_ERROR_NOT_INITIALIZED: + return "CONNECTION_ERROR_NOT_INITIALIZED"; + case CONNECTION_ERROR_ALREADY_INITIALIZED: + return "CONNECTION_ERROR_ALREADY_INITIALIZED"; default: return "CONNECTION_ERROR_UNKNOWN"; } @@ -350,28 +355,22 @@ static bool test_get_user_selected_profile(connection_profile_h *profile, bool s return false; } - if (profile_type == CONNECTION_PROFILE_TYPE_WIFI) { - char *essid; - connection_profile_get_wifi_essid(profile_h, &essid); - printf("%d. state:[%s], profile name:%s, essid:%s\n", - profile_count, test_print_state(profile_state), - profile_name, (essid) ? essid : ""); - g_free(essid); - - profile_list[profile_count] = profile_h; - profile_count++; - } else { + printf("%d. state:[%s], profile name:%s", profile_count, + test_print_state(profile_state), profile_name); + if (profile_type == CONNECTION_PROFILE_TYPE_CELLULAR) { connection_cellular_service_type_e service_type; - if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) + if (connection_profile_get_cellular_service_type( + profile_h, &service_type) != + CONNECTION_ERROR_NONE) printf("Fail to get cellular service type!\n"); - printf("%d. state:[%s], profile name:%s[%s]\n", - profile_count, test_print_state(profile_state), - profile_name, test_print_cellular_service_type(service_type)); - - profile_list[profile_count] = profile_h; - profile_count++; + printf("[%s]", + test_print_cellular_service_type(service_type)); } + printf("\n"); + + profile_list[profile_count] = profile_h; + profile_count++; g_free(profile_name); if (profile_count >= 100) @@ -539,9 +538,35 @@ static int test_update_wifi_info(connection_profile_h profile) return 1; } +static int test_update_dns_info(connection_profile_h profile, + connection_address_family_e address_family) +{ + int rv = 0; + char input_str[100] = {0,}; + if (test_get_user_string("Input DNS 1 Address - (Enter for skip) :", input_str, 100)) { + rv = connection_profile_set_dns_address(profile, + 1, + address_family, + input_str); + if (rv != CONNECTION_ERROR_NONE) + return -1; + + if (test_get_user_string("Input DNS 2 Address - (Enter for skip) :", input_str, 100)) { + rv = connection_profile_set_dns_address(profile, + 2, + address_family, + input_str); + if (rv != CONNECTION_ERROR_NONE) + return -1; + } + } + return 1; +} + static int test_update_ip_info(connection_profile_h profile, connection_address_family_e address_family) { int rv = 0; + int input_int = 0; char input_str[100] = {0,}; if (test_get_user_string("Input IP Address - (Enter for skip) :", input_str, 100)) { @@ -560,32 +585,25 @@ static int test_update_ip_info(connection_profile_h profile, connection_address_ return -1; } - if (test_get_user_string("Input Gateway - (Enter for skip) :", input_str, 100)) { - rv = connection_profile_set_gateway_address(profile, + if (test_get_user_int("Input Prefix Length - (Enter for skip) :", &input_int)) { + rv = connection_profile_set_prefix_length(profile, address_family, - input_str); + input_int); if (rv != CONNECTION_ERROR_NONE) return -1; } - if (test_get_user_string("Input DNS 1 Address - (Enter for skip) :", input_str, 100)) { - rv = connection_profile_set_dns_address(profile, - 1, + if (test_get_user_string("Input Gateway - (Enter for skip) :", input_str, 100)) { + rv = connection_profile_set_gateway_address(profile, address_family, input_str); if (rv != CONNECTION_ERROR_NONE) return -1; - - if (test_get_user_string("Input DNS 2 Address - (Enter for skip) :", input_str, 100)) { - rv = connection_profile_set_dns_address(profile, - 2, - address_family, - input_str); - if (rv != CONNECTION_ERROR_NONE) - return -1; - } } + if (test_update_dns_info(profile, address_family) < 0) + return -1; + return 1; } @@ -636,21 +654,48 @@ static int test_update_proxy_info(connection_profile_h profile, connection_addre return 1; } + + static int test_update_network_info(connection_profile_h profile) { int rv = 0; int input_int = 0; + int dns_input = 0; int address_family = 0; test_get_user_int("Input Address Family (0:IPv4 1:IPv6) :", &address_family); - if (test_get_user_int("Input IPv4 Address Type (DHCP:1, Static:2)" + if (test_get_user_int("Input IPv4/IPv6 Address Type (DHCP:1, Static:2, Auto:3)" " - (Enter for skip) :", &input_int)) { switch (input_int) { case 1: rv = connection_profile_set_ip_config_type(profile, - address_family, - CONNECTION_IP_CONFIG_TYPE_DYNAMIC); + address_family, + CONNECTION_IP_CONFIG_TYPE_DYNAMIC); + if (test_get_user_int("Input DNS Address Type (Static:1, DHCP:2)" + " - (Enter for skip) :", &dns_input)) { + switch (dns_input) { + case CONNECTION_DNS_CONFIG_TYPE_STATIC: + rv = connection_profile_set_dns_config_type( + profile, + address_family, + CONNECTION_DNS_CONFIG_TYPE_STATIC); + if (rv != CONNECTION_ERROR_NONE) + return -1; + if (test_update_dns_info(profile, + address_family) == -1) + return -1; + break; + case CONNECTION_DNS_CONFIG_TYPE_DYNAMIC: + rv = connection_profile_set_dns_config_type( + profile, + address_family, + CONNECTION_DNS_CONFIG_TYPE_DYNAMIC); + if (rv != CONNECTION_ERROR_NONE) + return -1; + break; + } + } break; case 2: rv = connection_profile_set_ip_config_type(profile, @@ -665,6 +710,11 @@ static int test_update_network_info(connection_profile_h profile) if (test_update_proxy_info(profile, address_family) == -1) return -1; break; + case 3: + rv = connection_profile_set_ip_config_type(profile, + address_family, + CONNECTION_IP_CONFIG_TYPE_AUTO); + break; default: return -1; } @@ -811,14 +861,18 @@ static void test_print_wifi_info(connection_profile_h profile) static void test_print_network_info(connection_profile_h profile, connection_address_family_e address_family) { char *interface_name = NULL; - connection_ip_config_type_e ip_type; char *ip = NULL; char *subnet = NULL; char *gateway = NULL; + char *dhcp_server = NULL; + int dhcp_lease_duration = 0; char *dns1 = NULL; char *dns2 = NULL; - connection_proxy_type_e proxy_type; char *proxy = NULL; + int prefix_len; + connection_ip_config_type_e ip_type; + connection_proxy_type_e proxy_type; + connection_dns_config_type_e dns_type; if (connection_profile_get_network_interface_name(profile, &interface_name) != CONNECTION_ERROR_NONE) printf("Fail to get interface name!\n"); @@ -829,8 +883,18 @@ static void test_print_network_info(connection_profile_h profile, connection_add if (connection_profile_get_ip_config_type(profile, address_family, &ip_type) != CONNECTION_ERROR_NONE) printf("Fail to get ipconfig type!\n"); - else - printf("Ipconfig type : %d\n", ip_type); + else { + if (ip_type == CONNECTION_IP_CONFIG_TYPE_STATIC) + printf("ip type : %s\n", "CONNECTION_IP_CONFIG_TYPE_STATIC"); + else if (ip_type == CONNECTION_IP_CONFIG_TYPE_DYNAMIC) + printf("ip type : %s\n", "CONNECTION_IP_CONFIG_TYPE_DYNAMIC"); + else if (ip_type == CONNECTION_IP_CONFIG_TYPE_AUTO) + printf("ip type : %s\n", "CONNECTION_IP_CONFIG_TYPE_AUTO"); + else if (ip_type == CONNECTION_IP_CONFIG_TYPE_FIXED) + printf("ip type : %s\n", "CONNECTION_IP_CONFIG_TYPE_FIXED"); + else + printf("ip type : %s\n", "CONNECTION_IP_CONFIG_TYPE_NONE"); + } if (connection_profile_get_ip_address(profile, address_family, &ip) != CONNECTION_ERROR_NONE) printf("Fail to get IP address!\n"); @@ -839,6 +903,26 @@ static void test_print_network_info(connection_profile_h profile, connection_add g_free(ip); } + if (connection_profile_get_gateway_address(profile, address_family, &gateway) != CONNECTION_ERROR_NONE) + printf("Fail to get gateway!\n"); + else { + printf("Gateway : %s\n", gateway); + g_free(gateway); + } + + if (connection_profile_get_dhcp_server_address(profile, address_family, &dhcp_server) != CONNECTION_ERROR_NONE) + printf("Fail to get DHCP Server address!\n"); + else { + printf("DHCP Server : %s\n", dhcp_server); + g_free(dhcp_server); + } + + if (connection_profile_get_dhcp_lease_duration(profile, address_family, &dhcp_lease_duration) != CONNECTION_ERROR_NONE) + printf("Fail to get DHCP lease duration!\n"); + else { + printf("DHCP lease duration : %d\n", dhcp_lease_duration); + } + if (connection_profile_get_subnet_mask(profile, address_family, &subnet) != CONNECTION_ERROR_NONE) printf("Fail to get subnet mask!\n"); else { @@ -846,11 +930,20 @@ static void test_print_network_info(connection_profile_h profile, connection_add g_free(subnet); } - if (connection_profile_get_gateway_address(profile, address_family, &gateway) != CONNECTION_ERROR_NONE) - printf("Fail to get gateway!\n"); + if (connection_profile_get_prefix_length(profile, address_family, &prefix_len) != CONNECTION_ERROR_NONE) + printf("Fail to get prefix length!\n"); + else + printf("Prefix length : %d\n", prefix_len); + + if (connection_profile_get_dns_config_type(profile, address_family, &dns_type) != CONNECTION_ERROR_NONE) + printf("Fail to get DNS configuration type!\n"); else { - printf("Gateway : %s\n", gateway); - g_free(gateway); + if (dns_type == CONNECTION_DNS_CONFIG_TYPE_STATIC) + printf("DNS config type : %s\n", "CONNECTION_DNS_CONFIG_TYPE_STATIC"); + else if (dns_type == CONNECTION_DNS_CONFIG_TYPE_DYNAMIC) + printf("DNS config type : %s\n", "CONNECTION_DNS_CONFIG_TYPE_DYNAMIC"); + else + printf("DNS config type : %s\n", "CONNECTION_DNS_CONFIG_TYPE_NONE"); } if (connection_profile_get_dns_address(profile, 1, address_family, &dns1) != CONNECTION_ERROR_NONE) @@ -869,8 +962,14 @@ static void test_print_network_info(connection_profile_h profile, connection_add if (connection_profile_get_proxy_type(profile, &proxy_type) != CONNECTION_ERROR_NONE) printf("Fail to get proxy type!\n"); - else - printf("Proxy type : %d\n", proxy_type); + else { + if (proxy_type == CONNECTION_PROXY_TYPE_DIRECT) + printf("proxy type : %s\n", "CONNECTION_PROXY_TYPE_DIRECT"); + else if (proxy_type == CONNECTION_PROXY_TYPE_AUTO) + printf("proxy type : %s\n", "CONNECTION_PROXY_TYPE_AUTO"); + else + printf("proxy type : %s\n", "CONNECTION_PROXY_TYPE_MANUAL"); + } if (connection_profile_get_proxy_address(profile, address_family, &proxy) != CONNECTION_ERROR_NONE) printf("Fail to get proxy!\n"); @@ -934,6 +1033,65 @@ int test_deregister_client(void) return 1; } +int test_register_client_cs(void) +{ + int tid = 0; + test_get_user_int("Input a TID in C# API :", &tid); + + int err = connection_create_cs(tid, &connection); + + if (CONNECTION_ERROR_NONE == err) { + connection_set_type_changed_cb(connection, test_type_changed_callback, NULL); + connection_set_ip_address_changed_cb(connection, test_ip_changed_callback, NULL); + connection_set_proxy_address_changed_cb(connection, test_proxy_changed_callback, NULL); + connection_set_ethernet_cable_state_chaged_cb(connection, + test_get_ethernet_cable_state_callback, NULL); + } else { + printf("Client registration failed [%s]\n", test_print_error(err)); + return -1; + } + + printf("Client registration success\n"); + return 1; +} + +int test_deregister_client_cs(void) +{ + int rv = 0; + GSList *list; + connection_profile_h profile; + int tid = 0; + + test_get_user_int("Input a TID in C# API :", &tid); + + if (connection != NULL) + rv = connection_destroy_cs(tid, connection); + else { + printf("Cannot deregister : Handle is NULL\n"); + rv = CONNECTION_ERROR_INVALID_OPERATION; + } + + if (rv != CONNECTION_ERROR_NONE) { + printf("Client deregistration fail [%s]\n", test_print_error(rv)); + return -1; + } + + if (state_cb_list) { + for (list = state_cb_list; list; list = list->next) { + profile = list->data; + connection_profile_destroy(profile); + } + + g_slist_free(state_cb_list); + state_cb_list = NULL; + } + + connection = NULL; + printf("Client deregistration success\n"); + + return 1; +} + int test_get_network_state(void) { int rv = 0; @@ -1417,6 +1575,7 @@ int test_get_profile_info(void) { connection_profile_type_e prof_type; connection_profile_state_e profile_state; + connection_profile_state_e profile_ipv6_state; connection_profile_h profile; char *profile_name = NULL; int address_family = 0; @@ -1434,11 +1593,18 @@ int test_get_profile_info(void) } if (connection_profile_get_state(profile, &profile_state) != CONNECTION_ERROR_NONE) { - printf("Fail to get profile state\n"); + printf("Fail to get profile IPv4 state\n"); return -1; } else printf("Profile State : %s\n", test_print_state(profile_state)); + if (connection_profile_get_ipv6_state(profile, &profile_ipv6_state) != CONNECTION_ERROR_NONE) { + printf("Fail to get profile IPv6 state\n"); + return -1; + } else + printf("Profile IPv6 State : %s\n", test_print_state(profile_ipv6_state)); + + if (connection_profile_get_type(profile, &prof_type) != CONNECTION_ERROR_NONE) return -1; @@ -1739,6 +1905,147 @@ int test_remove_route_ipv6(void) return 1; } +int test_add_route_entry(void) +{ + char ip_addr[100] = {0}; + char gateway[100] = {0}; + char if_name[40] = {0}; + int input; + bool input_rv; + int rv = 0; + + input_rv = test_get_user_int("Input Address type to get" + "(1:IPV4, 2:IPV6):", &input); + + if (input_rv == false) { + printf("Invalid input!!\n"); + return -1; + } + + switch (input) { + case 1: + if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false) + return -1; + + if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 100) == false) + return -1; + + if (test_get_user_string("Input Gateway - (Enter for skip) :", gateway, 100) == false) + return -1; + + g_strstrip(ip_addr); + g_strstrip(gateway); + g_strstrip(if_name); + rv = connection_add_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV4, if_name, ip_addr, gateway); + if (rv != CONNECTION_ERROR_NONE) { + printf("Fail to get add new route [%d]\n", rv); + return -1; + } + printf("Add Route successfully\n"); + break; + + case 2: + if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false) + return -1; + + if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 100) == false) + return -1; + + if (test_get_user_string("Input Gateway - (Enter for skip) :", gateway, 100) == false) + return -1; + + g_strstrip(ip_addr); + g_strstrip(gateway); + g_strstrip(if_name); + rv = connection_add_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6, if_name, ip_addr, gateway); + if (rv != CONNECTION_ERROR_NONE) { + printf("Fail to get add new route [%d]\n", rv); + return -1; + } + printf("Add Route successfully\n"); + break; + + default: + printf("Wrong IP address family!!\n"); + return -1; + + } + + return 1; + +} + +int test_remove_route_entry(void) +{ + char ip_addr[100] = {0}; + char gateway[100] = {0}; + char if_name[40] = {0}; + int input; + bool input_rv; + int rv = 0; + + input_rv = test_get_user_int("Input Address type to get" + "(1:IPV4, 2:IPV6):", &input); + + if (input_rv == false) { + printf("Invalid input!!\n"); + return -1; + } + + switch (input) { + case 1: + if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false) + return -1; + + if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 100) == false) + return -1; + + if (test_get_user_string("Input Gateway - (Enter for skip) :", gateway, 100) == false) + return -1; + + g_strstrip(ip_addr); + g_strstrip(gateway); + g_strstrip(if_name); + rv = connection_remove_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV4, if_name, ip_addr, gateway); + if (rv != CONNECTION_ERROR_NONE) { + printf("Fail to remove the route [%s]\n", test_print_error(rv)); + return -1; + } + printf("Remove Route successfully\n"); + + break; + + case 2: + if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false) + return -1; + + if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 100) == false) + return -1; + + if (test_get_user_string("Input Gateway - (Enter for skip) :", gateway, 100) == false) + return -1; + + g_strstrip(ip_addr); + g_strstrip(gateway); + g_strstrip(if_name); + rv = connection_remove_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6, if_name, ip_addr, gateway); + if (rv != CONNECTION_ERROR_NONE) { + printf("Fail to remove the route [%d]\n", rv); + return -1; + } + printf("Remove Route successfully\n"); + break; + + default: + printf("Wrong IP address family!!\n"); + return -1; + + } + + return 1; + +} + int test_get_bt_state(void) { int rv = 0; @@ -1851,6 +2158,229 @@ int test_reset_profile(void) return 1; } +static bool test_get_ipv6_address_callback(char *ipv6_address, void* user_data) +{ + printf("IPv6 Address : %s\n", ipv6_address); + return true; +} + +int test_foreach_ipv6_address(void) +{ + int rv = 0; + int type; + connection_type_e conn_type; + + test_get_user_int("Input Connection Type(1: WiFi 2: Ethernet) :", &type); + + switch (type) { + case 1: + conn_type = CONNECTION_TYPE_WIFI; + break; + case 2: + conn_type = CONNECTION_TYPE_ETHERNET; + break; + default: + printf("Wrong number!!\n"); + return -1; + } + + rv = connection_foreach_ipv6_address(connection, conn_type, test_get_ipv6_address_callback, NULL); + if (rv != CONNECTION_ERROR_NONE) { + printf("Fail to get IPv6 address\n"); + return -1; + } + + return 1; +} + +int test_is_metered_network(void) +{ + int rv = 0; + bool metered_state; + + rv = connection_is_metered_network(connection, &metered_state); + + if (rv != CONNECTION_ERROR_NONE) { + printf("Fail to get metered state [%s]\n", test_print_error(rv)); + return -1; + } + + printf("Retval = [%s] metered state [%s]\n", + test_print_error(rv), metered_state ? "TRUE" : "FALSE"); + + return 1; +} + +int test_start_tcpdump(void) +{ + if (connection_profile_start_tcpdump(connection) != CONNECTION_ERROR_NONE) { + return -1; + } + + printf("Successfully started tcpdump\n"); + + return 1; +} + +int test_stop_tcpdump(void) +{ + if (connection_profile_stop_tcpdump(connection) != CONNECTION_ERROR_NONE) { + return -1; + } + + printf("Successfully stopped tcpdump\n"); + + return 1; +} + +int test_get_tcpdump_state(void) +{ + gboolean tcpdump_state = FALSE; + + if (connection_profile_get_tcpdump_state(connection, &tcpdump_state) != CONNECTION_ERROR_NONE) { + return -1; + } + + printf("tcpdump %s running\n", tcpdump_state ? "is" : "is not"); + + return 1; +} + +int test_mptcp_enable(void) +{ + int rv = 0; + bool supported = false; + rv = connection_mptcp_is_supported(connection, &supported); + if (rv != CONNECTION_ERROR_NONE) { + printf("Failure[%s]\n", test_print_error(rv)); + return -1; + } + printf("MPTCP Support: %d\n", supported); + + rv = connection_mptcp_enable(connection, CONNECTION_MPTCP_ENABLE_ALL); + if (rv != CONNECTION_ERROR_NONE) { + printf("Failure[%s]\n", test_print_error(rv)); + return -1; + } + return 1; +} + +int test_mptcp_disable(void) +{ + int rv = 0; + rv = connection_mptcp_disable(connection); + + if (rv != CONNECTION_ERROR_NONE) { + printf("Failure[%s]\n", test_print_error(rv)); + return -1; + } + return 1; +} + +int test_mptcp_set_path_manager(void) +{ + int rv = 0; + int input = 0; + rv = test_get_user_int("Input Path Manager (1: default, 2: fullmesh)", &input); + + switch (input) { + case 1: + rv = connection_mptcp_set_path_manager(connection, CONNECTION_MPTCP_PM_DEFAULT); + break; + case 2: + rv = connection_mptcp_set_path_manager(connection, CONNECTION_MPTCP_PM_FULLMESH); + break; + default: + printf("Invalid input!!\n"); + return -1; + } + + if (rv != CONNECTION_ERROR_NONE) { + printf("Failure[%s]\n", test_print_error(rv)); + return -1; + } + + return 1; +} + +int test_mptcp_get_path_manager(void) +{ + int rv = 0; + connection_mptcp_path_manager_e pm; + + rv = connection_mptcp_get_path_manager(connection, &pm); + if (rv != CONNECTION_ERROR_NONE) { + printf("Failure[%s]\n", test_print_error(rv)); + return -1; + } + + switch (pm) { + case CONNECTION_MPTCP_PM_DEFAULT: + printf("Path Manager: Default\n"); + break; + case CONNECTION_MPTCP_PM_FULLMESH: + printf("Path Manager: FullMesh\n"); + break; + default: + printf("Error: Invalid Path Manager\n"); + return -1; + } + + return 1; +} + +int test_mptcp_set_scheduler(void) +{ + int rv = 0; + int input = 0; + rv = test_get_user_int("Input Scheduler (1: default, 2: roundrobin)", &input); + + switch (input) { + case 1: + rv = connection_mptcp_set_scheduler(connection, CONNECTION_MPTCP_SCHEDULER_DEFAULT); + break; + case 2: + rv = connection_mptcp_set_scheduler(connection, CONNECTION_MPTCP_SCHEDULER_ROUNDROBIN); + break; + default: + printf("Invalid input!!\n"); + return -1; + } + + if (rv != CONNECTION_ERROR_NONE) { + printf("Failure[%s]\n", test_print_error(rv)); + return -1; + } + + return 1; +} + +int test_mptcp_get_scheduler(void) +{ + int rv = 0; + connection_mptcp_scheduler_e scheduler; + + rv = connection_mptcp_get_scheduler(connection, &scheduler); + if (rv != CONNECTION_ERROR_NONE) { + printf("Failure[%s]\n", test_print_error(rv)); + return -1; + } + + switch (scheduler) { + case CONNECTION_MPTCP_SCHEDULER_DEFAULT: + printf("Scheduler: Default\n"); + break; + case CONNECTION_MPTCP_SCHEDULER_ROUNDROBIN: + printf("Scheduler: RountRobin\n"); + break; + default: + printf("Error: Invalid Scheduler\n"); + return -1; + } + + return 1; +} + int main(int argc, char **argv) { GMainLoop *mainloop; @@ -1884,8 +2414,10 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) } if (*a == '\n' || *a == '\r') { +/* Public API */ printf("\n\n Network Connection API Test App\n\n"); printf("Options..\n"); + printf(LOG_BLUE "[Public APIs]\n" LOG_END); printf(LOG_GREEN "1 - Create Handle and set callbacks\n" LOG_END); printf("2 - Destroy Handle(unset callbacks automatically)\n"); printf(LOG_GREEN "3 - Get network state\n" LOG_END); @@ -1921,11 +2453,29 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) printf("x - Get ethernet cable state\n"); printf("B - Add IPv6 new route\n"); printf("C - Remove IPv6 route\n"); + printf("D - Add new route entry\n"); + printf("E - Remove route entry\n"); + printf("F - Get all IPv6 address\n"); + printf("G - Get metered state\n"); +/* Extension API */ + printf(LOG_BLUE "[Extension API]\n" LOG_END); + printf("H - Start TCP Dump\n"); + printf("I - Stop TCP Dump\n"); + printf("J - Get TCP Dump State\n"); + printf("K - Enable MPTCP (internal)\n"); + printf("L - Disable MPTCP (internal)\n"); + printf("M - Set MPTCP Path Manager (internal)\n"); + printf("N - Get MPTCP Path Manager (internal)\n"); + printf("O - Set MPTCP Scheduler (internal)\n"); + printf("P - Get MPTCP Scheduler (internal)\n"); + printf(LOG_GREEN "Q - Create Handle and set callbacks in C# API\n" LOG_END); + printf("R - Destroy Handle(unset callbacks automatically in C# API)\n"); printf(LOG_RED "0 - Exit \n" LOG_END); printf("ENTER - Show options menu.......\n"); } switch (a[0]) { +/* Public API */ case '1': rv = test_register_client(); break; @@ -2031,6 +2581,53 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) case 'C': rv = test_remove_route_ipv6(); break; + case 'D': + rv = test_add_route_entry(); + break; + case 'E': + rv = test_remove_route_entry(); + break; + case 'F': + rv = test_foreach_ipv6_address(); + break; + case 'G': + rv = test_is_metered_network(); + break; +/* Extension API */ + case 'H': + rv = test_start_tcpdump(); + break; + case 'I': + rv = test_stop_tcpdump(); + break; + case 'J': + rv = test_get_tcpdump_state(); + break; + case 'K': + rv = test_mptcp_enable(); + break; + case 'L': + rv = test_mptcp_disable(); + break; + case 'M': + rv = test_mptcp_set_path_manager(); + break; + case 'N': + rv = test_mptcp_get_path_manager(); + break; + case 'O': + rv = test_mptcp_set_scheduler(); + break; + case 'P': + rv = test_mptcp_get_scheduler(); + break; + case 'Q': + rv = test_register_client_cs(); + break; + case 'R': + rv = test_deregister_client_cs(); + break; + } if (rv == 1)