#include <glib.h>
#include "net_connection.h"
+#include "connection_extension.h"
#include <tizen_error.h>
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 main(int argc, char **argv)
{
}
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);
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(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;
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;
+
}
if (rv == 1)