printf("Internet state changed callback, state : %d\n", state);
}
+static void test_dhcp_state_changed_callback(connection_dhcp_state_e state,
+ const char *interface_name, connection_error_e result, void *user_data)
+{
+ printf("DHCP state changed callback, ifname: %s, state: %d, result: %d\n",
+ interface_name, state, result);
+}
+
static void test_profile_state_callback(connection_profile_state_e state, void* user_data)
{
char *profile_name;
connection_set_ethernet_cable_state_changed_cb(connection,
test_get_ethernet_cable_state_callback, NULL);
connection_set_internet_state_changed_cb(connection, test_internet_state_changed_callback, NULL);
+ connection_set_dhcp_state_changed_cb(connection, test_dhcp_state_changed_callback, NULL);
} else {
printf("Client registration failed [%s]\n", test_print_error(err));
return -1;
return 1;
}
+int test_get_dhcp_state(void)
+{
+ int rv = 0;
+ connection_dhcp_state_e dhcp_state;
+ char if_name[40] = {0};
+
+ if (test_get_user_string("Input Interface name: ", if_name, 40) == false)
+ return -1;
+
+ g_strstrip(if_name);
+
+ rv = connection_get_dhcp_state(connection, if_name, &dhcp_state);
+
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to get DHCP state [%s]\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Retval = [%s], DHCP state [%d]\n", test_print_error(rv), dhcp_state);
+
+ return 1;
+}
+
int test_reset_profile(void)
{
int type, sim_id, rv;
printf("v - Get all cellular default profiles\n");
printf("w - Get mac address\n");
printf("x - Get ethernet cable state\n");
+ printf("y - Get DHCP state\n");
printf("B - Add IPv6 new route\n");
printf("C - Remove IPv6 route\n");
printf("D - Add new route entry\n");
case 'x':
rv = test_get_ethernet_cable_state();
break;
+ case 'y':
+ rv = test_get_dhcp_state();
+ break;
case 'B':
rv = test_add_route_ipv6();
break;