2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <glib-object.h>
23 #include <sys/socket.h>
24 #include <netinet/in.h>
25 #include <arpa/inet.h>
29 #include "tethering.h"
31 #define DISABLE_REASON_TEXT_LEN 64
32 #define COMMON_STR_BUF_LEN 32
34 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data);
37 tethering_enabled_cb enabled_cb;
38 tethering_disabled_cb disabled_cb;
39 tethering_connection_state_changed_cb changed_cb;
40 tethering_wifi_security_type_changed_cb security_type_changed_cb;
41 tethering_wifi_ssid_visibility_changed_cb ssid_visibility_changed_cb;
42 tethering_wifi_passphrase_changed_cb passphrase_changed_cb;
45 tethering_h th = NULL;
47 static bool __is_err(tethering_error_e ret)
52 case TETHERING_ERROR_INVALID_PARAMETER:
53 err_msg = "Wrong parameter is used";
56 case TETHERING_ERROR_OUT_OF_MEMORY:
57 err_msg = "Memory is not enough";
60 case TETHERING_ERROR_NONE:
63 case TETHERING_ERROR_NOT_ENABLED:
64 err_msg = "Tethering is not enabled";
67 case TETHERING_ERROR_OPERATION_FAILED:
68 err_msg = "Operation is failed";
71 case TETHERING_ERROR_RESOURCE_BUSY:
72 err_msg = "Resource is busy";
76 err_msg = "This should not be happened";
80 g_print("##ERR: %s\n", err_msg);
85 static const char *__convert_tethering_type_to_str(const tethering_type_e type)
87 static char str_buf[COMMON_STR_BUF_LEN] = {0, };
90 case TETHERING_TYPE_USB:
91 g_strlcpy(str_buf, "USB Tethering", sizeof(str_buf));
94 case TETHERING_TYPE_WIFI:
95 g_strlcpy(str_buf, "Wi-Fi Tethering", sizeof(str_buf));
98 case TETHERING_TYPE_BT:
99 g_strlcpy(str_buf, "Bluetooth Tethering", sizeof(str_buf));
103 g_strlcpy(str_buf, "Unknown", sizeof(str_buf));
110 static const char *__convert_disabled_code_to_str(const tethering_disabled_cause_e code)
112 static char str_buf[DISABLE_REASON_TEXT_LEN] = {0, };
115 case TETHERING_DISABLED_BY_USB_DISCONNECTION:
116 strncpy(str_buf, "disabled due to usb disconnection", sizeof(str_buf));
119 case TETHERING_DISABLED_BY_FLIGHT_MODE:
120 strncpy(str_buf, "disabled due to flight mode on", sizeof(str_buf));
123 case TETHERING_DISABLED_BY_LOW_BATTERY:
124 strncpy(str_buf, "disabled due to low battery", sizeof(str_buf));
127 case TETHERING_DISABLED_BY_NETWORK_CLOSE:
128 strncpy(str_buf, "disabled due to pdp network close", sizeof(str_buf));
131 case TETHERING_DISABLED_BY_TIMEOUT:
132 strncpy(str_buf, "disabled due to timeout", sizeof(str_buf));
135 case TETHERING_DISABLED_BY_OTHERS:
136 strncpy(str_buf, "disabled by other apps", sizeof(str_buf));
139 case TETHERING_DISABLED_BY_REQUEST:
140 strncpy(str_buf, "disabled by my request", sizeof(str_buf));
143 case TETHERING_DISABLED_BY_WIFI_ON:
144 strncpy(str_buf, "disabled by Wi-Fi station on", sizeof(str_buf));
147 case TETHERING_DISABLED_BY_BT_OFF:
148 strncpy(str_buf, "disabled by bluetooth off", sizeof(str_buf));
152 strncpy(str_buf, "disabled by unknown reason", sizeof(str_buf));
159 static void __register_cbs(tethering_h th, __tethering_cbs *cbs, void *user_data)
161 tethering_error_e ret = TETHERING_ERROR_NONE;
163 ret = tethering_set_enabled_cb(th, TETHERING_TYPE_ALL,
164 cbs->enabled_cb, user_data);
165 if (__is_err(ret) == true)
166 g_print("tethering_set_enabled_cb is failed\n");
168 ret = tethering_set_disabled_cb(th, TETHERING_TYPE_ALL,
169 cbs->disabled_cb, user_data);
170 if (__is_err(ret) == true)
171 g_print("tethering_set_disabled_cb is failed\n");
173 ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_ALL,
174 cbs->changed_cb, user_data);
175 if (__is_err(ret) == true)
176 g_print("tethering_set_connection_state_changed_cb is failed\n");
178 ret = tethering_wifi_set_security_type_changed_cb(th,
179 cbs->security_type_changed_cb, user_data);
180 if (__is_err(ret) == true)
181 g_print("tethering_wifi_set_security_type_changed_cb is failed\n");
183 ret = tethering_wifi_set_ssid_visibility_changed_cb(th,
184 cbs->ssid_visibility_changed_cb, user_data);
185 if (__is_err(ret) == true)
186 g_print("tethering_wifi_set_ssid_visibility_changed_cb is failed\n");
188 ret = tethering_wifi_set_passphrase_changed_cb(th,
189 cbs->passphrase_changed_cb, user_data);
190 if (__is_err(ret) == true)
191 g_print("tethering_wifi_set_passphrase_changed_cb is failed\n");
196 static void __deregister_cbs(tethering_h th)
198 tethering_error_e ret = TETHERING_ERROR_NONE;
200 ret = tethering_unset_enabled_cb(th, TETHERING_TYPE_ALL);
201 if (__is_err(ret) == true)
202 g_print("tethering_unset_enabled_cb is failed\n");
204 ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_ALL);
205 if (__is_err(ret) == true)
206 g_print("tethering_unset_disabled_cb is failed\n");
208 ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_ALL);
209 if (__is_err(ret) == true)
210 g_print("tethering_unset_connection_state_changed_cb is failed\n");
212 ret = tethering_wifi_unset_security_type_changed_cb(th);
213 if (__is_err(ret) == true)
214 g_print("tethering_wifi_unset_security_type_changed_cb is failed\n");
216 ret = tethering_wifi_unset_ssid_visibility_changed_cb(th);
217 if (__is_err(ret) == true)
218 g_print("tethering_wifi_unset_ssid_visibility_changed_cb is failed\n");
220 ret = tethering_wifi_unset_passphrase_changed_cb(th);
221 if (__is_err(ret) == true)
222 g_print("tethering_wifi_unset_passphrase_changed_cb is failed\n");
227 /* Tethering callbacks */
228 static void __enabled_cb(tethering_error_e error, tethering_type_e type, bool is_requested, void *data)
230 if (__is_err(error)) {
234 g_print("## %s is not enabled. error code[0x%X]\n",
235 __convert_tethering_type_to_str(type),
241 g_print("## %s is enabled successfully\n",
242 __convert_tethering_type_to_str(type));
244 g_print("## %s is enabled by other app\n",
245 __convert_tethering_type_to_str(type));
250 static void __disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data)
252 if (__is_err(error)) {
253 if (code != TETHERING_DISABLED_BY_REQUEST)
256 g_print("## %s is not disabled. error code[0x%X]\n",
257 __convert_tethering_type_to_str(type), error);
261 g_print("## %s is %s\n",
262 __convert_tethering_type_to_str(type),
263 __convert_disabled_code_to_str(code));
268 static void __connection_state_changed_cb(tethering_client_h client, bool open, void *data)
270 tethering_client_h clone = NULL;
271 tethering_type_e type;
272 char *ip_address = NULL;
273 char *mac_address = NULL;
274 char *hostname = NULL;
276 tethering_client_clone(&clone, client);
278 g_print("tetheirng_client_clone is failed\n");
282 tethering_client_get_tethering_type(clone, &type);
283 tethering_client_get_ip_address(clone,
284 TETHERING_ADDRESS_FAMILY_IPV4, &ip_address);
285 tethering_client_get_mac_address(clone, &mac_address);
286 tethering_client_get_name(clone, &hostname);
289 g_print("## New station Type [%s], IP [%s], MAC [%s], hostname [%s]\n",
290 __convert_tethering_type_to_str(type),
291 ip_address, mac_address, hostname);
293 g_print("## Disconnected station Type [%s], IP [%s], MAC [%s], hostname [%s]\n",
294 __convert_tethering_type_to_str(type),
295 ip_address, mac_address, hostname);
305 tethering_client_destroy(clone);
310 static void __data_usage_cb(tethering_error_e result, unsigned long long received_data,
311 unsigned long long sent_data, void *user_data)
313 g_print("__data_usage_cb\n");
315 if (result != TETHERING_ERROR_NONE) {
316 g_print("tethering_get_data_usage is failed. error[0x%X]\n", result);
320 g_print("## Received data : %llu bytes\n", received_data);
321 g_print("## Sent data : %llu bytes\n", sent_data);
326 static void __settings_reloaded_cb(tethering_error_e result, void *user_data)
328 g_print("__settings_reloaded_cb\n");
330 if (result != TETHERING_ERROR_NONE) {
331 g_print("tethering_wifi_reload_settings is failed. error[0x%X]\n", result);
335 g_print("## Wi-Fi tethering setting is reloaded\n");
340 static bool __clients_foreach_cb(tethering_client_h client, void *data)
342 tethering_client_h clone = NULL;
343 tethering_type_e type;
344 char *ip_address = NULL;
345 char *mac_address = NULL;
346 char *hostname = NULL;
348 /* Clone internal information */
349 if (tethering_client_clone(&clone, client) != TETHERING_ERROR_NONE) {
350 g_print("tethering_client_clone is failed\n");
354 /* Get information */
355 if (tethering_client_get_tethering_type(clone, &type) != TETHERING_ERROR_NONE)
356 g_print("tethering_client_get_type is failed\n");
358 if (tethering_client_get_ip_address(clone, TETHERING_ADDRESS_FAMILY_IPV4, &ip_address) != TETHERING_ERROR_NONE)
359 g_print("tethering_client_get_ip_address is failed\n");
361 if (tethering_client_get_mac_address(clone, &mac_address) != TETHERING_ERROR_NONE)
362 g_print("tethering_client_get_mac_address is failed\n");
364 if (tethering_client_get_name(clone, &hostname) != TETHERING_ERROR_NONE)
365 g_print("tethering_client_get_hostname is failed\n");
367 /* End of getting information */
369 g_print("\n< Client Info. >\n");
370 g_print("\tType %s\n", __convert_tethering_type_to_str(type));
371 g_print("\tIP Address %s\n", ip_address);
372 g_print("\tMAC Address : %s\n", mac_address);
373 g_print("\tHostname : %s\n", hostname);
375 /* Destroy cloned objects */
383 tethering_client_destroy(clone);
385 /* Continue iteration */
389 static void __security_type_changed_cb(tethering_wifi_security_type_e changed_type, void *user_data)
391 g_print("Wi-Fi Tethering Security type is changed to [%s]\n",
392 changed_type == TETHERING_WIFI_SECURITY_TYPE_NONE ?
393 "open" : "wpa2-psk");
397 static void __ssid_visibility_changed_cb(bool changed_visible, void *user_data)
399 g_print("SSID visibility for Wi-Fi tethering changed to [%s]\n",
400 changed_visible ? "visible" : "invisible");
404 static void __passphrase_changed_cb(void *user_data)
406 g_print("Wi-Fi Tethering passphrase is changed\n");
409 /* End of tethering callbacks */
411 static void __print_interface_info(tethering_h th, tethering_type_e type)
413 char *interface = NULL;
414 char *mac_address = NULL;
415 char *ip_address = NULL;
416 char *gateway_address = NULL;
417 char *subnet_mask = NULL;
419 if (tethering_is_enabled(th, type) == FALSE) {
420 g_print("%s is not enabled\n",
421 __convert_tethering_type_to_str(type));
425 tethering_get_network_interface_name(th, type, &interface);
426 tethering_get_mac_address(th, type, &mac_address);
427 tethering_get_ip_address(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
429 tethering_get_gateway_address(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
431 tethering_get_subnet_mask(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
434 g_print("interface name : %s\n", interface);
435 g_print("mac address : %s\n", mac_address);
436 g_print("ip address : %s\n", ip_address);
437 g_print("gateway address: %s\n", gateway_address);
438 g_print("subnet mask : %s\n", subnet_mask);
447 free(gateway_address);
454 static void __print_wifi_tethering_setting(tethering_h th)
457 char *passphrase = NULL;
458 bool visibility = false;
461 tethering_wifi_security_type_e security_type = TETHERING_WIFI_SECURITY_TYPE_NONE;
462 tethering_wifi_mode_type_e hw_mode = TETHERING_WIFI_MODE_TYPE_G;
464 int error = TETHERING_ERROR_NONE;
466 error = tethering_wifi_get_ssid(th, &ssid);
467 if (error != TETHERING_ERROR_NONE)
470 g_print("\n\t** WiFi tethering SSID : %s\n", ssid);
472 error = tethering_wifi_get_passphrase(th, &passphrase);
473 if (error != TETHERING_ERROR_NONE)
476 g_print("\t** WiFi tethering passphrase : %s\n", passphrase);
478 error = tethering_wifi_get_ssid_visibility(th, &visibility);
479 if (error != TETHERING_ERROR_NONE)
482 g_print("\t** WiFi tethering ssid visibility : %s\n",
483 visibility ? "visible" : "invisible");
485 error = tethering_wifi_get_security_type(th, &security_type);
486 if (error != TETHERING_ERROR_NONE)
489 g_print("\t** WiFi tethering security_type : %s\n",
491 TETHERING_WIFI_SECURITY_TYPE_NONE ?
492 "open" : "wpa2-psk");
494 error = tethering_wifi_get_mac_filter(th, &mac_filter);
495 if (error != TETHERING_ERROR_NONE)
498 g_print("\t** WiFi tethering mac filter : %s\n",
499 mac_filter ? "enable" : "disable");
501 error = tethering_wifi_get_mode(th, &hw_mode);
502 if (error != TETHERING_ERROR_NONE)
505 g_print("\t** WiFi tethering mode : %d\n", hw_mode);
507 error = tethering_wifi_get_channel(th, &channel);
508 if (error != TETHERING_ERROR_NONE)
511 g_print("\t** WiFi tethering channel : %d\n", channel);
521 bool __get_tethering_type(tethering_type_e *type)
526 printf("Select tethering type (1:Wi-Fi, 2:BT, 3:USB 4:ALL)\n");
527 ret = scanf("%9d", &sel);
529 printf("scanf is failed!!\n");
535 *type = TETHERING_TYPE_WIFI;
538 *type = TETHERING_TYPE_BT;
541 *type = TETHERING_TYPE_USB;
544 *type = TETHERING_TYPE_ALL;
547 printf("Invalid input!!\n");
554 static int test_tethering_create(void)
556 int ret = tethering_create(&th);
557 __tethering_cbs cbs = {
558 __enabled_cb, __disabled_cb,
559 __connection_state_changed_cb, __security_type_changed_cb,
560 __ssid_visibility_changed_cb, __passphrase_changed_cb};
562 if (__is_err(ret) == false) __register_cbs(th, &cbs, NULL);
564 printf("Tethering create is failed\n");
567 printf("Tethering create and register callback success\n");
572 static int test_tethering_destroy(void)
574 int ret = TETHERING_ERROR_NONE;
576 __deregister_cbs(th);
578 ret = tethering_destroy(th);
579 if (__is_err(ret) == true) {
580 printf("Tethering destroy is failed\n");
587 static int test_tethering_enable(void)
589 int ret = TETHERING_ERROR_NONE;
590 tethering_type_e type;
592 if (!__get_tethering_type(&type))
595 ret = tethering_enable(th, type);
596 if (__is_err(ret) == true) {
597 printf("Fail to enable tethering\n");
603 static int test_tethering_disable(void)
605 int ret = TETHERING_ERROR_NONE;
606 tethering_type_e type;
608 if (!__get_tethering_type(&type))
611 ret = tethering_disable(th, type);
612 if (__is_err(ret) == true) {
613 printf("Fail to disable tethering\n");
619 static int test_tethering_get_client_info(void)
622 tethering_type_e type;
624 if (!__get_tethering_type(&type))
627 ret = tethering_foreach_connected_clients(th, type,
628 __clients_foreach_cb, NULL);
629 if (__is_err(ret) == true) {
630 printf("Fail to disable tethering\n");
637 static int test_tethering_get_interface_info(void)
639 tethering_type_e type;
641 if (!__get_tethering_type(&type))
644 __print_interface_info(th, type);
649 static int test_tethering_get_data_usage(void)
651 int ret = tethering_get_data_usage(th, __data_usage_cb, NULL);
653 if (__is_err(ret) == true) {
654 printf("Fail to get data usage!!\n");
661 static int test_tethering_wifi_get_setting(void)
663 __print_wifi_tethering_setting(th);
667 static int test_tethering_wifi_set_ssid(void)
672 printf("Input SSID for Wi-Fi tethering: ");
673 ret = scanf("%99s", ssid);
675 printf("scanf is failed!!\n");
679 ret = tethering_wifi_set_ssid(th, ssid);
680 if (__is_err(ret) == true) {
681 printf("Fail to set wifi ssid!!\n");
688 static int test_tethering_wifi_set_security_type(void)
693 printf("Input security type for Wi-Fi tethering (0:NONE, 1:WPA2_PSK)");
694 ret = scanf("%9d", &security_type);
696 printf("scanf is failed!!\n");
700 ret = tethering_wifi_set_security_type(th, security_type);
701 if (__is_err(ret) == true) {
702 printf("Fail to set security type!!\n");
709 int test_tethering_wifi_set_visibility(void)
714 printf("Input security type for Wi-Fi tethering (0:invisible, 1:visible)");
715 ret = scanf("%9d", &visibility);
717 printf("scanf is failed!!\n");
721 ret = tethering_wifi_set_ssid_visibility(th, visibility);
722 if (__is_err(ret) == true) {
723 printf("Fail to set visibility!!\n");
730 static int test_tethering_wifi_set_passphrase(void)
733 char passphrase[100];
735 printf("Input passphrase for Wi-Fi tethering: ");
736 ret = scanf("%99s", passphrase);
738 printf("scanf is failed!!\n");
742 ret = tethering_wifi_set_passphrase(th, passphrase);
743 if (__is_err(ret) == true) {
744 printf("Fail to set passphrase!!\n");
751 static int test_tethering_wifi_set_channel(void)
756 printf("Input channel for Wi-Fi tethering: ");
757 ret = scanf("%d", &channel);
759 ret = tethering_wifi_set_channel(th, channel);
760 if (__is_err(ret) == true) {
761 printf("Fail to set channel!!\n");
768 static int test_tethering_wifi_set_mode(void)
773 printf("Input hw_mode for Wi-Fi tethering(0-b, 1-g, 2-a, 3-ad): ");
774 ret = scanf("%d", &type);
776 ret = tethering_wifi_set_mode(th, type);
777 if (__is_err(ret) == true) {
778 printf("Fail to set mode!!\n");
785 static int test_tethering_wifi_enable_dhcp(void)
790 printf("Input (0-Disable, 1-Enable): ");
791 ret = scanf("%d", &enable);
793 ret = tethering_wifi_enable_dhcp(th, enable);
794 if (__is_err(ret) == true) {
795 printf("Fail to enable dhcp server!!\n");
802 static int test_tethering_wifi_set_dhcp_range(void)
805 char rangestart[16], rangestop[16];
807 printf("Input range (ex: 192.168.0.50 192.168.0.150): ");
809 ret = scanf("%15s %15s", rangestart, rangestop);
811 ret = tethering_wifi_set_dhcp_range(th, rangestart, rangestop);
812 if (__is_err(ret) == true) {
813 printf("Fail to set dhcp range and enable dhcp server!!\n");
820 static int test_tethering_wifi_is_dhcp_enabled(void)
825 ret = tethering_wifi_is_dhcp_enabled(th, &enabled);
827 if (__is_err(ret) == true) {
828 printf("Fail to get dhcp server status!!\n");
831 printf("DHCP server is %s\n", enabled ? "enabled" : "disabled");
837 static int test_tethering_wifi_set_mac_filtering(void)
842 printf("Input mac filtering option (0: disable, 1: enable): ");
843 ret = scanf("%d", &enable);
845 ret = tethering_wifi_set_mac_filter(th, enable);
846 if (__is_err(ret) == true) {
847 printf("Fail to set mac filtering!!\n");
854 static int test_tethering_manage_mac_list(void)
860 printf("Select MAC list to modify (0: allowed mac list, 1: blocked mac list): ");
861 ret = scanf("%d", &list);
863 printf("Select option (0: Add, 1: Remove): ");
864 ret = scanf("%d", &option);
866 printf("Input MAC Address to add/remove allowed/blocked mac list: ");
867 ret = scanf("%99s", mac);
869 printf("scanf is failed!!\n");
873 if (!list && !option) {
874 /* Add to allowed mac list*/
875 ret = tethering_wifi_add_allowed_mac_list(th, mac);
876 } else if (!list && option) {
877 /* Remove from allowed mac list */
878 ret = tethering_wifi_remove_allowed_mac_list(th, mac);
879 } else if (list && !option) {
880 /* Add to blocked mac list */
881 ret = tethering_wifi_add_blocked_mac_list(th, mac);
882 } else if (list && option) {
883 /* Remove from blocked mac list */
884 ret = tethering_wifi_remove_blocked_mac_list(th, mac);
886 printf("Input Failed!!\n");
896 static int test_tethering_wifi_reload_settings(void)
898 int ret = tethering_wifi_reload_settings(th, __settings_reloaded_cb, NULL);
900 if (__is_err(ret) == true) {
901 printf("Fail to reload wifi tethering!!\n");
907 int main(int argc, char **argv)
911 #if !GLIB_CHECK_VERSION(2, 36, 0)
914 mainloop = g_main_loop_new(NULL, false);
916 GIOChannel *channel = g_io_channel_unix_new(0);
917 g_io_add_watch(channel, (G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL), test_thread, NULL);
918 printf("Test Thread created...\n");
919 g_main_loop_run(mainloop);
924 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
929 printf("Event received from stdin\n");
933 if (rv <= 0 || a[0] == '0')
936 if (a[0] == '\n' || a[0] == '\r') {
937 printf("\n\n Network Connection API Test App\n\n");
938 printf("Options..\n");
939 printf("1 - Tethering create and set callbacks\n");
940 printf("2 - Tethering destroy\n");
941 printf("3 - Enable Tethering\n");
942 printf("4 - Disable Tethering\n");
943 printf("5 - Get client information\n");
944 printf("6 - Get interface information\n");
945 printf("7 - Get data usage\n");
946 printf("8 - Get Wi-Fi tethering setting\n");
947 printf("a - Set Wi-Fi tethering SSID\n");
948 printf("b - Set Wi-Fi tethering security type\n");
949 printf("c - Set Wi-Fi tethering visibility\n");
950 printf("d - Set Wi-Fi tethering passphrase\n");
951 printf("e - Set Wi-Fi tethering mac filtering\n");
952 printf("f - Add/Remove MAC adress to/from allowed/blocked list\n");
953 printf("k - Reload Wi-Fi tethering\n");
954 printf("m - Set Wi-Fi channel\n");
955 printf("n - Set Wi-Fi hw_mode\n");
956 printf("o - Enable dhcp server\n");
957 printf("p - Enable dhcp server with range\n");
958 printf("q - Is dhcp server enabled?\n");
959 printf("0 - Exit \n");
960 printf("ENTER - Show options menu.......\n");
965 rv = test_tethering_create();
968 rv = test_tethering_destroy();
971 rv = test_tethering_enable();
974 rv = test_tethering_disable();
977 rv = test_tethering_get_client_info();
980 rv = test_tethering_get_interface_info();
983 rv = test_tethering_get_data_usage();
986 rv = test_tethering_wifi_get_setting();
989 rv = test_tethering_wifi_set_ssid();
992 rv = test_tethering_wifi_set_security_type();
995 rv = test_tethering_wifi_set_visibility();
998 rv = test_tethering_wifi_set_passphrase();
1001 rv = test_tethering_wifi_set_mac_filtering();
1004 rv = test_tethering_manage_mac_list();
1007 rv = test_tethering_wifi_reload_settings();
1010 rv = test_tethering_wifi_set_channel();
1013 rv = test_tethering_wifi_set_mode();
1016 rv = test_tethering_wifi_enable_dhcp();
1019 rv = test_tethering_wifi_set_dhcp_range();
1022 rv = test_tethering_wifi_is_dhcp_enabled();
1027 printf("Operation succeeded!\n");
1029 printf("Operation failed!\n");