CONNMAN_SERVICE_ERROR_INVALID_KEY,
} connman_service_error_e;
+typedef enum {
+ CONNMAN_IP_TYPE_V4,
+ CONNMAN_IP_TYPE_V6,
+} connman_ip_type_e;
+
int inm_connman_init();
int inm_connman_deinit();
int inm_connman_get_connections(GVariant **connections);
int inm_connman_get_current_service_type(connman_service_type_e *type);
int inm_connman_get_current_service_iface(gchar **ifname);
+int inm_connman_get_current_service_ip(connman_ip_type_e type, gchar **ip);
int inm_connman_get_current_service_gateway(gchar **gateway_ip);
int inm_connman_tech_get_state(connman_service_type_e type,
return ret;
}
+int inm_connman_get_current_service_ip(connman_ip_type_e type, gchar **ip)
+{
+ connman_service_s *service = NULL;
+ char ip_str[INET6_ADDRSTRLEN] = {0,};
+ int ret = INM_CONNMAN_ERROR_NONE;
+
+ __INM_FUNC_ENTER__;
+
+ service = __get_current_service();
+ if (service == NULL) {
+ INM_LOGW("No current connections");
+ __INM_FUNC_EXIT__;
+ return INM_CONNMAN_ERROR_NO_CONNECTION;
+ }
+
+ if (type == CONNMAN_IP_TYPE_V4)
+ inet_ntop(AF_INET, &(service->ip.address), ip_str, INET_ADDRSTRLEN);
+ else if (type == CONNMAN_IP_TYPE_V6)
+ inet_ntop(AF_INET6, &(service->ipv6.address), ip_str, INET6_ADDRSTRLEN);
+
+ if (strlen(ip_str) != 0)
+ *ip = g_strdup(ip_str);
+ else
+ ret = INM_CONNMAN_ERROR_OPERATION_FAILED;
+
+ __INM_FUNC_EXIT__;
+ return ret;
+}
+
int inm_connman_get_current_service_gateway(gchar **gateway_ip)
{
connman_service_s *service = NULL;