SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include/)
-SET(dependents "dlog vconf capi-base-common glib-2.0 network")
+SET(dependents "dlog vconf capi-base-common glib-2.0 winet-lib connman-lib")
SET(pc_dependents "capi-base-common")
INCLUDE(FindPkgConfig)
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#ifndef __NET_CONNECTION_PRIVATE_H__
#define __NET_CONNECTION_PRIVATE_H__
#include <dlog.h>
-#include <network-cm-intf.h>
-#include <network-wifi-intf.h>
+#include <connman-lib-common.h>
+#include "net_cm_intf.h"
#include "net_connection.h"
#undef LOG_TAG
default: \
LOGI(format, ## args); \
} \
- } while(0)
+ } while (0)
#define CONNECTION_MUTEX_LOCK _connection_inter_mutex_lock()
#define CONNECTION_MUTEX_UNLOCK _connection_inter_mutex_unlock()
extern "C" {
#endif /* __cplusplus */
-typedef struct _connection_handle_s
-{
+typedef struct _connection_handle_s {
connection_type_changed_cb type_changed_callback;
connection_address_changed_cb ip_changed_callback;
connection_address_changed_cb proxy_changed_callback;
bool _connection_libnet_deinit(void);
bool _connection_libnet_get_wifi_state(connection_wifi_state_e *state);
bool _connection_libnet_get_ethernet_state(connection_ethernet_state_e *state);
-bool _connection_libnet_get_bluetooth_state(connection_bt_state_e* state);
+bool _connection_libnet_get_bluetooth_state(connection_bt_state_e *state);
bool _connection_libnet_check_profile_validity(connection_profile_h profile);
bool _connection_libnet_check_profile_cb_validity(connection_profile_h profile);
int _connection_libnet_get_profile_iterator(connection_iterator_type_e type,
int _connection_libnet_get_cellular_service_profile(connection_cellular_service_type_e type, connection_profile_h *profile);
int _connection_libnet_set_cellular_service_profile_sync(connection_cellular_service_type_e type, connection_profile_h profile);
int _connection_libnet_set_cellular_service_profile_async(connection_cellular_service_type_e type,
- connection_profile_h profile, connection_set_default_cb callback, void* user_data);
+ connection_profile_h profile, connection_set_default_cb callback, void *user_data);
int _connection_libnet_close_profile(connection_profile_h profile, connection_closed_cb callback, void *user_data);
int _connection_libnet_add_route(const char *interface_name, const char *host_address);
void _connection_libnet_add_to_profile_list(connection_profile_h profile);
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(network)
+BuildRequires: pkgconfig(winet-lib)
+BuildRequires: pkgconfig(connman-lib)
%description
Network Connection library in Tizen C API
%description devel
Network Connection library in Tizen C API (Development)
+%package test
+Summary: Test case for connection (DEV)
+Requires: %{name} = %{version}
+
+%description test
+Test case for connection (DEV). Some test programs to test the APIs
+and interfaces about connection or other inner code.
+
%prep
%setup -q
cp %{SOURCE1001} .
%{_includedir}/network/*.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-network-connection.so
+
+%files test
+%manifest %{name}.manifest
+%{_libdir}/winet-capi-test/capi-network-connection-test
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
int rv = 0;
net_profile_info_t *profile_info = profile;
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
-
+ TODO:
rv = net_add_profile(profile_info->ProfileInfo.Pdp.ServiceType, (net_profile_info_t*)profile);
+
if (rv != NET_ERR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "net_add_profile Failed = %d\n", rv);
return CONNECTION_ERROR_OPERATION_FAILED;
}
-
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
int rv = 0;
net_profile_info_t *profile_info = profile;
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
-
+ TODO:
rv = net_delete_profile(profile_info->ProfileName);
if (rv != NET_ERR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "net_delete_profile Failed = %d\n", rv);
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+/*
int rv = 0;
net_profile_info_t *profile_info = profile;
+ TODO:
rv = net_modify_profile(profile_info->ProfileName, (net_profile_info_t*)profile);
if (rv != NET_ERR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "net_modify_profile Failed = %d\n", rv);
return CONNECTION_ERROR_OPERATION_FAILED;
}
+*/
return CONNECTION_ERROR_NONE;
}
#define HTTP_PROXY "http_proxy"
+/*
static net_dev_info_t* __profile_get_net_info(net_profile_info_t *profile_info)
{
switch (profile_info->profile_type) {
default:
return NULL;
}
+
+ return NULL;
}
static char* __profile_convert_ip_to_string(net_addr_t *ip_addr)
return proxy;
}
+*/
connection_cellular_service_type_e _profile_convert_to_connection_cellular_service_type(net_service_type_t svc_type)
{
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = g_try_malloc0(sizeof(net_profile_info_t));
if (profile_info == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
*profile = (connection_profile_h)profile_info;
_connection_libnet_add_to_profile_list(*profile);
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
*cloned_profile = g_try_malloc0(sizeof(net_profile_info_t));
if (*cloned_profile == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
memcpy(*cloned_profile, origin_profile, sizeof(net_profile_info_t));
_connection_libnet_add_to_profile_list(*cloned_profile);
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
char *prof_id = strrchr(profile_info->ProfileName, '/');
if (*profile_id == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
switch (profile_info->profile_type) {
default:
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ */
if (*profile_name == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
switch (profile_info->profile_type) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid profile type\n");
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
*interface_name = g_strdup(net_info->DevName);
if (*interface_name == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
}
net_profile_info_t profile_info_local;
+ /*
net_profile_info_t *profile_info = profile;
+ TODO:
if (net_get_profile_info(profile_info->ProfileName, &profile_info_local) != NET_ERR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Error!!! net_get_profile_info() failed\n");
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
memcpy(profile, &profile_info_local, sizeof(net_profile_info_t));
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
*state = _profile_convert_to_cp_state(profile_info->ProfileState);
if (*state < 0)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
return CONNECTION_ERROR_NONE;
}
if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6)
return CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED;
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
default:
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
*ip_address = __profile_convert_ip_to_string(&net_info->IpAddr);
if (*ip_address == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
*subnet_mask = __profile_convert_ip_to_string(&net_info->SubnetMask);
if (*subnet_mask == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
*gateway_address = __profile_convert_ip_to_string(&net_info->GatewayAddr);
if (*gateway_address == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
*dns_address = __profile_convert_ip_to_string(&net_info->DnsAddr[order-1]);
if (*dns_address == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
const char *proxy;
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
default:
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
const char *proxy;
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (*proxy_address == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
default:
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
net_info->IpAddr.Data.Ipv4.s_addr = 0;
else if (inet_aton(ip_address, &(net_info->IpAddr.Data.Ipv4)) == 0)
return CONNECTION_ERROR_INVALID_PARAMETER;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
net_info->SubnetMask.Data.Ipv4.s_addr = 0;
else if (inet_aton(subnet_mask, &(net_info->SubnetMask.Data.Ipv4)) == 0)
return CONNECTION_ERROR_INVALID_PARAMETER;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
net_info->GatewayAddr.Data.Ipv4.s_addr = 0;
else if (inet_aton(gateway_address, &(net_info->GatewayAddr.Data.Ipv4)) == 0)
return CONNECTION_ERROR_INVALID_PARAMETER;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
if (net_info->DnsCount < order)
net_info->DnsCount = order;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
default:
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
net_dev_info_t *net_info = __profile_get_net_info(profile_info);
if (net_info == NULL)
net_info->ProxyAddr[0] = '\0';
else
g_strlcpy(net_info->ProxyAddr, proxy_address, NET_PROXY_LEN_MAX);
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
*essid = g_strdup(profile_info->ProfileInfo.Wlan.essid);
if (*essid == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
*bssid = g_strdup(profile_info->ProfileInfo.Wlan.bssid);
if (*bssid == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
return CONNECTION_ERROR_INVALID_PARAMETER;
*rssi = (int)profile_info->ProfileInfo.Wlan.Strength;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
return CONNECTION_ERROR_INVALID_PARAMETER;
*frequency = (int)profile_info->ProfileInfo.Wlan.frequency;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
return CONNECTION_ERROR_INVALID_PARAMETER;
*max_speed = (int)profile_info->ProfileInfo.Wlan.max_rate;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
default:
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
default:
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
default:
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
g_strlcpy(profile_info->ProfileInfo.Wlan.security_info.authentication.psk.pskKey,
passphrase, NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN);
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_WIFI)
*supported = true;
else
*supported = false;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
int network_type;
net_profile_info_t *profile_info = profile;
default:
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid service type Passed\n");
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR)
*apn = g_strdup(profile_info->ProfileInfo.Pdp.Apn);
if (*apn == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR)
g_free(*user_name);
return CONNECTION_ERROR_OUT_OF_MEMORY;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR)
*home_url = g_strdup(profile_info->ProfileInfo.Pdp.HomeURL);
if (*home_url == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR)
*is_roaming = true;
else
*is_roaming = false;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR)
default:
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR)
return CONNECTION_ERROR_INVALID_PARAMETER;
g_strlcpy(profile_info->ProfileInfo.Pdp.Apn, apn, NET_PDP_APN_LEN_MAX+1);
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR)
g_strlcpy(profile_info->ProfileInfo.Pdp.AuthInfo.UserName, user_name, NET_PDP_AUTH_USERNAME_LEN_MAX+1);
g_strlcpy(profile_info->ProfileInfo.Pdp.AuthInfo.Password, password, NET_PDP_AUTH_PASSWORD_LEN_MAX+1);
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR)
return CONNECTION_ERROR_INVALID_PARAMETER;
g_strlcpy(profile_info->ProfileInfo.Pdp.HomeURL, home_url, NET_HOME_URL_LEN_MAX);
+ */
return CONNECTION_ERROR_NONE;
}
--- /dev/null
+/*
+* Network Wi-Fi library
+*
+* Copyright (c) 2014-2015 Intel Corporation. All rights reserved.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#ifndef __NET_CM_INTF_H__
+#define __NET_CM_INTF_H__
+
+#include "net_pm_wlan.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/**
+ * \addtogroup common_info
+ * \{
+*/
+
+/**
+* @enum net_cm_network_status_t
+* This enum indicates network status
+*/
+typedef enum {
+ /** Service unknown */
+ NET_STATUS_UNKNOWN,
+ /** Not connected / Suspended / Idle / Connecting/ Disconnecting/ Killing*/
+ NET_STATUS_UNAVAILABLE,
+ /** Active */
+ NET_STATUS_AVAILABLE,
+} net_cm_network_status_t;
+
+/**
+ * @brief Enumerations of statistics type.
+ */
+typedef enum {
+ NET_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0, /**< Last received data */
+ NET_STATISTICS_TYPE_LAST_SENT_DATA = 1, /**< Last sent data */
+ NET_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
+ NET_STATISTICS_TYPE_TOTAL_SENT_DATA = 3, /**< Total sent data */
+} net_statistics_type_e;
+
+/**
+ * \}
+ */
+
+/**
+ * @enum net_state_type_t
+ * This enumeration defines the service state type.
+ */
+typedef enum {
+ /** Not defined */
+ NET_STATE_TYPE_UNKNOWN = 0x00,
+ /** Idle state */
+ NET_STATE_TYPE_IDLE,
+ /** Failure state */
+ NET_STATE_TYPE_FAILURE,
+ /** Association state */
+ NET_STATE_TYPE_ASSOCIATION,
+ /** Configuration state */
+ NET_STATE_TYPE_CONFIGURATION,
+ /** Ready state */
+ NET_STATE_TYPE_READY,
+ /** Online state */
+ NET_STATE_TYPE_ONLINE,
+ /** Login state */
+ NET_STATE_TYPE_DISCONNECT,
+} net_state_type_t;
+
+/**
+ * This is the profile structure.
+ */
+typedef struct {
+ /** Device Type of the profile */
+ net_device_t profile_type;
+ /** Profile name */
+ char ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
+ /** Service state */
+ net_state_type_t ProfileState;
+ /** Favourite flag */
+ char Favourite;
+} net_profile_info_t;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __NET_CM_INTF_H__ */
--- /dev/null
+/*
+ * Network Client Library
+ *
+ * Copyright 2011-2013 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __NET_PM_CONFIG_H__
+#define __NET_PM_CONFIG_H__
+
+#include <netinet/in.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/**
+ * @file net_pm_config.h
+ * @brief This file defines the constants and enumerations used by Profile Manager with the application/Connection Manager.
+*/
+
+/**
+ * \addtogroup profile_managing
+ * \{
+*/
+
+/*===========================================================================
+ CONSTANTS
+=============================================================================*/
+
+/** Profile name max length */
+#define NET_PROFILE_NAME_LEN_MAX 512
+
+/** Home URL max length in profile account */
+#define NET_HOME_URL_LEN_MAX 512
+
+/** Maximum length of IPv4 string type e.g., "165.213.173.105". This length does not include NULL in the last byte. */
+#define NETPM_IPV4_STR_LEN_MAX 15
+
+/** Minimum length of IPv4 string type e.g., "0.0.0.0". This length does not include NULL in the last byte. */
+#define NETPM_IPV4_STR_LEN_MIN 7
+
+/** This is for MCC + MNC string */
+#define NET_SIM_INFO_LEN 10
+
+/** Maximum length of username in PDP profile. (used in authentication parameters) [3GPP Defined variable] */
+#define NET_PDP_AUTH_USERNAME_LEN_MAX 32
+
+/** Maximum length of password in PDP profile (used in authentication parameters) [3GPP Defined variable] */
+#define NET_PDP_AUTH_PASSWORD_LEN_MAX 32
+
+/** Maximum length of APN in PDP profile [3GPP Defined variable] */
+#define NET_PDP_APN_LEN_MAX 100
+
+/** Maximum length of proxy string */
+#define NET_PROXY_LEN_MAX 64
+
+/** MAX number of DNS Address */
+#define NET_DNS_ADDR_MAX 2
+
+/** Maximum length of device name */
+#define NET_MAX_DEVICE_NAME_LEN 32
+
+/** Maximum length of MAC address
+ * As per IEEE802.11 spec, BSSID format: xx:xx:xx:xx:xx:xx*/
+#define NET_MAX_MAC_ADDR_LEN 17
+
+/*===========================================================================
+ ENUMS
+=============================================================================*/
+
+/**
+ * @enum net_device_t
+ * Profile Type
+ */
+typedef enum {
+ /** Unknown device */
+ NET_DEVICE_UNKNOWN = 0x0,
+
+ /** Default device */
+ NET_DEVICE_DEFAULT = 0x1,
+
+ /** GPRS & WCDMA device */
+ NET_DEVICE_CELLULAR = 0x2,
+
+ /** WLAN device */
+ NET_DEVICE_WIFI = 0x3,
+
+ /** Serial USB device */
+ NET_DEVICE_USB = 0x4,
+
+ /** Ethernet device */
+ NET_DEVICE_ETHERNET = 0x5,
+
+ /** Bluetooth device */
+ NET_DEVICE_BLUETOOTH = 0x6,
+
+ /** Count of device type */
+ NET_DEVICE_MAX = 0x7,
+} net_device_t;
+
+/**
+ * @enum net_addr_type_t
+ * Address Type
+ */
+typedef enum {
+
+ /** IPV4 Address type */
+ NET_ADDR_IPV4 = 0x0,
+
+ /** IPV6 Address type */
+ NET_ADDR_IPV6 = 0x1,
+} net_addr_type_t;
+
+/**
+ * @enum net_auth_type_t
+ * PDP Authentication Type
+ */
+typedef enum {
+
+ /** No authentication */
+ NET_PDP_AUTH_NONE = 0x0,
+
+ /** PAP authentication */
+ NET_PDP_AUTH_PAP = 0x1,
+
+ /** CHAP authentication */
+ NET_PDP_AUTH_CHAP = 0x2,
+} net_auth_type_t;
+
+/**
+ * @enum net_proxy_type_t
+ * This enumeration defines the proxy method type.
+ */
+typedef enum {
+ /** Not defined */
+ NET_PROXY_TYPE_UNKNOWN = 0x00,
+ /** Direct connection */
+ NET_PROXY_TYPE_DIRECT = 0x01,
+ /** Auto configuration(Use PAC file)
+ * If URL property is not set, DHCP/WPAD auto-discover will be tried */
+ NET_PROXY_TYPE_AUTO = 0x02,
+ /** Manual configuration */
+ NET_PROXY_TYPE_MANUAL = 0x03,
+} net_proxy_type_t;
+
+/**
+* @enum net_service_type_t
+* This enum indicates network connection type
+*/
+typedef enum {
+ /** Unknown type \n
+ */
+ NET_SERVICE_UNKNOWN = 0x00,
+
+ /** Mobile Internet Type \n
+ Network connection is established in Cellular network for Internet \n
+ */
+ NET_SERVICE_INTERNET = 0x01,
+
+ /** Mobile MMS Type \n
+ Network connection is established in Cellular network for MMS \n
+ */
+ NET_SERVICE_MMS = 0x02,
+
+ /** Prepaid Mobile Internet Type \n
+ Network connection is established in Cellular network for prepaid internet service.\n
+ This service supports to establish network connection in prepaid sim case\n
+ */
+ NET_SERVICE_PREPAID_INTERNET = 0x03,
+
+ /** Prepaid Mobile MMS Type \n
+ Network Connection is established in Cellular network for prepaid MMS service. \n
+ This profile supports to establish network connection in prepaid sim case\n
+ */
+ NET_SERVICE_PREPAID_MMS = 0x04,
+
+ /** Mobile Tethering Type \n
+ Network connection is established in Cellular network for Tethering \n
+ */
+ NET_SERVICE_TETHERING = 0x05,
+
+ /** Specific application Type \n
+ Network connection is established in Cellular network for Specific applications \n
+ */
+ NET_SERVICE_APPLICATION = 0x06,
+
+ /** Deprecated type
+ */
+ NET_SERVICE_WAP = 0x06,
+} net_service_type_t;
+
+
+/**
+ * @enum net_ip_config_type_t
+ * Net IP configuration Type
+ */
+typedef enum {
+ /** Manual IP configuration */
+ NET_IP_CONFIG_TYPE_STATIC = 0x01,
+
+ /** Config ip using DHCP client*/
+ NET_IP_CONFIG_TYPE_DYNAMIC,
+
+ /** Config IP from Auto IP pool (169.254/16)
+ * Later with DHCP client, if available */
+ NET_IP_CONFIG_TYPE_AUTO_IP,
+
+ /** Indicates an IP address that can not be modified */
+ NET_IP_CONFIG_TYPE_FIXED,
+
+ /** Don't use any method */
+ NET_IP_CONFIG_TYPE_OFF,
+} net_ip_config_type_t;
+
+/*===========================================================================
+ STRUCTURES AND OTHER TYPEDEFS
+=============================================================================*/
+
+/**
+ * IP Address
+ */
+typedef union {
+ /** IP Version 4 address */
+ struct in_addr Ipv4;
+
+ /** IP Version 6 address */
+ struct in6_addr Ipv6;
+} ip_addr_t;
+
+/**
+ * Network Address information
+ */
+typedef struct {
+ /** Address Type: IPv4 or IPv6 */
+ net_addr_type_t Type;
+
+ /** IP Address */
+ ip_addr_t Data;
+} net_addr_t;
+
+/**
+ * Below structure is used to export proxy info
+ */
+typedef struct {
+ /** Proxy info */
+ char proxy_addr[NET_PROXY_LEN_MAX+1];
+} net_proxy_t;
+
+/**
+ * Below structure is used to export profile name
+ */
+typedef struct {
+ /** Profile name */
+ char ProfileName[NET_PROFILE_NAME_LEN_MAX+1];
+} net_profile_name_t;
+
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __NET_PM_CONFIG_H__ */
--- /dev/null
+/*
+* Network Wi-Fi library
+*
+* Copyright (c) 2014-2015 Intel Corporation. All rights reserved.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+#ifndef __NET_PM_WLAN_H__
+#define __NET_PM_WLAN_H__
+
+#include "net_pm_config.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/** \file net_pm_wlan.h
+ \brief This file contains constants, enums, tructs, and function
+ prototypes that are used by Wlan related sources internally.
+ This File defines the WLAN exported Data Structures.
+
+*/
+
+/**
+ * \addtogroup profile_managing
+ * \{
+*/
+
+/*
+=============================================================================
+ CONSTANTS
+=============================================================================
+*/
+/**
+ * Length of essid
+ * As per IEEE802.11 standard , SSID Length should be 32 Char
+ */
+#define NET_WLAN_ESSID_LEN 32
+
+/**
+ * Length of WPS PIN code
+ * WPS PIN code should be 4 or 8 digits
+ */
+#define NET_WLAN_MAX_WPSPIN_LEN 8
+
+/**
+ * Passphrase length should be between 8..63,
+ * If we plan to use encrypted key(hex value generated by wpa_passphrase),
+ * then we have to set this value to some higher number
+ *
+ */
+#define NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN 65
+
+/**
+ * Length of WEP Key
+ * Max of 10 Hex digits allowed in case of 64 bit encryption
+ * Max of 26 Hex digits allowed in case of 128 bit encryption
+ */
+#define NETPM_WLAN_MAX_WEP_KEY_LEN 26
+
+/**
+ * These lengths depends on authentication server being used,
+ * In case of freeradius server Max allowed length for username/password is 255
+ * Let us restrict this value to some optimal value say 50.
+ * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
+ */
+#define NETPM_WLAN_USERNAME_LEN 50
+
+/**
+ * These lengths depends on authentication server being used,
+ * In case of freeradius server Max allowed length for username/password is 255
+ * Let us restrict this value to some optimal value say 50.
+ * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
+ */
+#define NETPM_WLAN_PASSWORD_LEN 50
+
+/**
+ * length of CA Cert file name
+ * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
+ */
+#define NETPM_WLAN_CA_CERT_FILENAME_LEN 50
+
+/**
+ * length of Client Cert file name
+ * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
+ */
+#define NETPM_WLAN_CLIENT_CERT_FILENAME_LEN 50
+
+/**
+ * length of private key file name
+ * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
+ */
+#define NETPM_WLAN_PRIVATE_KEY_FILENAME_LEN 50
+
+/**
+ * length of Private key password
+ * Used by EAP-TLS, optional for EAP-TTLS and EAP-PEAP
+ */
+#define NETPM_WLAN_PRIVATE_KEY_PASSWD_LEN 50
+
+/*===========================================================================
+ ENUMS
+=============================================================================*/
+
+/**
+* @enum net_wifi_state_t
+* This enum indicates wifi state
+*/
+typedef enum {
+ /** Unknown state */
+ WIFI_UNKNOWN = 0x00,
+ /** Wi-Fi is Off */
+ WIFI_OFF,
+ /** Wi-Fi is On(idle/failure) */
+ WIFI_ON,
+ /** Trying to connect(association/configuration) */
+ WIFI_CONNECTING,
+ /** Wi-Fi is connected to an AP(ready/online) */
+ WIFI_CONNECTED,
+ /** Trying to disconnect(connected,
+ * but disconnecting process is on going)
+ */
+ WIFI_DISCONNECTING,
+} net_wifi_state_t;
+
+/**
+*@enum net_wifi_background_scan_mode_t
+* This enum indicates background scanning mode.
+*/
+typedef enum {
+ /** scan cycle : 4, 8, 16, ...128s */
+ WIFI_BGSCAN_MODE_EXPONENTIAL = 0x00,
+ /** scan cycle : 10s */
+ WIFI_BGSCAN_MODE_PERIODIC,
+} net_wifi_background_scan_mode_t;
+
+/**
+*@enum net_wifi_wps_type_t
+* This enum indicates WPS type.
+*/
+typedef enum {
+ /** WPS type is PBC */
+ WIFI_WPS_PBC = 0x00,
+ /** WPS type is PIN */
+ WIFI_WPS_PIN
+} net_wifi_wps_type_t;
+
+/**src/include/net_pm_wlan.h
+ * @enum wlan_security_mode_type_t
+ * Below security modes are used in infrastructure and ad-hoc mode
+ * For now all EAP security mechanisms are provided only in infrastructure mode
+ */
+typedef enum {
+ /** Security disabled */
+ WLAN_SEC_MODE_NONE = 0x01,
+ /** WEP */
+ WLAN_SEC_MODE_WEP,
+ /** EAP */
+ WLAN_SEC_MODE_IEEE8021X,
+ /** WPA-PSK */
+ WLAN_SEC_MODE_WPA_PSK,
+ /** WPA2-PSK */
+ WLAN_SEC_MODE_WPA2_PSK,
+} wlan_security_mode_type_t;
+
+/**
+ * @enum wlan_encryption_mode_type_t
+ * Below encryption modes are used in infrastructure and ad-hoc mode
+ */
+typedef enum {
+ /** Not defined */
+ WLAN_ENC_MODE_UNKNOWN = 0x00,
+ /** Encryption disabled */
+ WLAN_ENC_MODE_NONE,
+ /** WEP */
+ WLAN_ENC_MODE_WEP,
+ /** TKIP */
+ WLAN_ENC_MODE_TKIP,
+ /** AES */
+ WLAN_ENC_MODE_AES,
+ /** TKIP and AES are both supported */
+ WLAN_ENC_MODE_TKIP_AES_MIXED,
+} wlan_encryption_mode_type_t;
+
+/**
+ * @enum wlan_connection_mode_type_t
+ * WLAN Operation Mode
+ * @see net_pm_wlan_profile_info_t
+ */
+typedef enum {
+ /** auto connection mode */
+ NETPM_WLAN_CONNMODE_AUTO = 0x01,
+ /** Connection mode Adhoc */
+ NETPM_WLAN_CONNMODE_ADHOC,
+ /** Infra connection mode */
+ NETPM_WLAN_CONNMODE_INFRA,
+} wlan_connection_mode_type_t;
+
+/**
+ * @enum wlan_eap_type_t
+ * EAP type
+ * @see wlan_eap_info_t
+ */
+typedef enum {
+ /** EAP PEAP type */
+ WLAN_SEC_EAP_TYPE_PEAP = 0x01,
+ /** EAP TLS type */
+ WLAN_SEC_EAP_TYPE_TLS,
+ /** EAP TTLS type */
+ WLAN_SEC_EAP_TYPE_TTLS,
+ /** EAP SIM type */
+ WLAN_SEC_EAP_TYPE_SIM,
+ /** EAP AKA type */
+ WLAN_SEC_EAP_TYPE_AKA,
+} wlan_eap_type_t;
+
+/**
+ * @enum wlan_eap_auth_type_t
+ * EAP phase2 authentication type
+ * @see wlan_eap_info_t
+ */
+typedef enum {
+ /** EAP phase2 authentication none */
+ WLAN_SEC_EAP_AUTH_NONE = 0x01,
+ /** EAP phase2 authentication PAP */
+ WLAN_SEC_EAP_AUTH_PAP,
+ /** EAP phase2 authentication MSCHAP */
+ WLAN_SEC_EAP_AUTH_MSCHAP,
+ /** EAP phase2 authentication MSCHAPv2 */
+ WLAN_SEC_EAP_AUTH_MSCHAPV2,
+ /** EAP phase2 authentication GTC */
+ WLAN_SEC_EAP_AUTH_GTC,
+ /** EAP phase2 authentication MD5 */
+ WLAN_SEC_EAP_AUTH_MD5,
+} wlan_eap_auth_type_t;
+
+/*======================================================================
+ STRUCTURES AND OTHER TYPEDEFS
+=====================================================++================*/
+
+/**
+ * Below structure is used to export essid
+ */
+typedef struct {
+ /** ESSID */
+ char essid[NET_WLAN_ESSID_LEN+1];
+} net_essid_t;
+
+/**
+ * Below structure is used by WPA-PSK or WPA2-PSK
+ * @remark To see the maximum length of PSK passphrase key.
+ * @see wlan_auth_info_t
+ */
+typedef struct {
+ /** key value for WPA-PSK or WPA2-PSK */
+ char pskKey[NETPM_WLAN_MAX_PSK_PASSPHRASE_LEN + 1];
+} wlan_psk_info_t;
+
+/**
+ * Below structure is used by WEP
+ * @remark To see the maximum length of WEP key.
+ * @see wlan_auth_info_t
+ */
+typedef struct {
+ /** key value for WEP */
+ char wepKey[NETPM_WLAN_MAX_WEP_KEY_LEN + 1];
+} wlan_wep_info_t;
+
+/**
+ * Below structure is used by EAP
+ * @see wlan_auth_info_t
+ */
+typedef struct {
+ /** User name */
+ char username[NETPM_WLAN_USERNAME_LEN+1];
+ /** Password */
+ char password[NETPM_WLAN_PASSWORD_LEN+1];
+
+ /**
+ * Following fields are mandatory for EAP-TLS,
+ * Optional for EAP-TTLS and EAP-PEAP
+ */
+ /**
+ * For EAP-TTLS and EAP-PEAP only ca_cert_filename[]
+ * can also be provided
+ */
+ /* Used to authenticate server */
+ char ca_cert_filename[NETPM_WLAN_CA_CERT_FILENAME_LEN+1];
+ /** client certificate file name */
+ char client_cert_filename[NETPM_WLAN_CLIENT_CERT_FILENAME_LEN+1];
+ /** private key file name */
+ char private_key_filename[NETPM_WLAN_PRIVATE_KEY_FILENAME_LEN+1];
+ /** private key password */
+ char private_key_passwd[NETPM_WLAN_PRIVATE_KEY_PASSWD_LEN+1];
+
+ /** eap type */
+ wlan_eap_type_t eap_type;
+ /** eap phase2 authentication type */
+ wlan_eap_auth_type_t eap_auth;
+} wlan_eap_info_t;
+
+/**
+ * At any point of time only one security mechanism is supported
+ * @see wlan_security_info_t
+ */
+typedef union {
+ /** Wep Authentication */
+ wlan_wep_info_t wep;
+ /** psk Authentication */
+ wlan_psk_info_t psk;
+ /** eap Authentication */
+ wlan_eap_info_t eap;
+} wlan_auth_info_t;
+
+/**
+ * This is main security information structure
+ * @see net_pm_wlan_profile_info_t
+ */
+typedef struct {
+ /** security mode type */
+ wlan_security_mode_type_t sec_mode;
+ /** encryption mode type */
+ wlan_encryption_mode_type_t enc_mode;
+ /** authentication information */
+ wlan_auth_info_t authentication;
+ /** If WPS is supported, then this property will be set to TRUE */
+ char wps_support;
+} wlan_security_info_t;
+
+/**
+ * This is the structure to connect with WPS network.
+ */
+typedef struct {
+ /** PBC / PIN */
+ net_wifi_wps_type_t type;
+
+ /** Optional. This pin is needed when the user input PIN code */
+ char pin[NET_WLAN_MAX_WPSPIN_LEN + 1];
+} net_wifi_wps_info_t;
+
+/**
+ * This is the profile structure to connect hidden WiFi network.
+ */
+typedef struct {
+ /** Basic feature */
+ char essid[NET_WLAN_ESSID_LEN + 1];
+
+ /** Infrastructure / ad-hoc / auto mode */
+ wlan_connection_mode_type_t wlan_mode;
+
+ /** Security mode and authentication info */
+ wlan_security_info_t security_info;
+} net_wifi_connection_info_t;
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __NET_PM_WLAN_H__ */
#include <string.h>
#include <glib.h>
#include <vconf/vconf.h>
+#include <winet-wifi.h>
+#include <connman-lib.h>
#include "net_connection_private.h"
static GSList *prof_handle_list = NULL;
static struct _profile_list_s profile_iterator = {0, 0, NULL};
static struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL, false};
+/*
static connection_error_e __libnet_convert_to_cp_error_type(net_err_t err_type)
{
switch (err_type) {
return "UNKNOWN";
}
}
+*/
static void __libnet_set_opened_cb(connection_opened_cb user_cb, void *user_data)
{
}
}
+/*
static void __libnet_opened_cb(connection_error_e result)
{
if (libnet.opened_cb)
libnet.opened_cb = NULL;
libnet.opened_user_data = NULL;
}
+*/
static void __libnet_set_closed_cb(connection_closed_cb user_cb, void *user_data)
{
}
}
+/*
static void __libnet_closed_cb(connection_error_e result)
{
if (libnet.closed_cb)
libnet.closed_cb = NULL;
libnet.closed_user_data = NULL;
}
+*/
static void __libnet_set_default_cb(connection_set_default_cb user_cb, void *user_data)
{
}
}
+/*
static void __libnet_default_cb(connection_error_e result)
{
if (libnet.set_default_cb)
if (state >= 0 && cb_info->callback)
cb_info->callback(state, cb_info->user_data);
}
+*/
static void __libnet_clear_profile_list(struct _profile_list_s *profile_list)
{
profile_list->profiles = NULL;
}
-static void __libnet_evt_cb(net_event_info_t* event_cb, void* user_data)
-{
- bool is_requested = false;
- connection_error_e result = CONNECTION_ERROR_NONE;
-
- switch (event_cb->Event) {
- case NET_EVENT_OPEN_RSP:
- is_requested = true;
- /* fall through */
- case NET_EVENT_OPEN_IND:
- result = __libnet_convert_to_cp_error_type(event_cb->Error);
- CONNECTION_LOG(CONNECTION_INFO, "Got connection open %s : %s\n",
- (is_requested) ? "RSP":"IND",
- __libnet_convert_cp_error_type_to_string(result));
-
- if (is_requested)
- __libnet_opened_cb(result);
-
- switch (event_cb->Error) {
- case NET_ERR_NONE:
- case NET_ERR_ACTIVE_CONNECTION_EXISTS:
- CONNECTION_LOG(CONNECTION_INFO, "'Open connection' succeeded\n");
-
- __libnet_state_changed_cb(event_cb->ProfileName, CONNECTION_PROFILE_STATE_CONNECTED);
- return;
- default:
- CONNECTION_LOG(CONNECTION_ERROR, "'Open connection' failed!! [%s]\n",
- __libnet_convert_cp_error_type_to_string(result));
- }
-
- __libnet_state_changed_cb(event_cb->ProfileName, CONNECTION_PROFILE_STATE_DISCONNECTED);
-
- break;
- case NET_EVENT_CLOSE_RSP:
- is_requested = true;
- /* fall through */
- case NET_EVENT_CLOSE_IND:
- result = __libnet_convert_to_cp_error_type(event_cb->Error);
- CONNECTION_LOG(CONNECTION_INFO, "Got connection close %s : %s\n",
- (is_requested) ? "RSP":"IND",
- __libnet_convert_cp_error_type_to_string(result));
-
- if (is_requested)
- __libnet_closed_cb(result);
-
- switch (event_cb->Error) {
- case NET_ERR_NONE:
- CONNECTION_LOG(CONNECTION_INFO, "'Close connection' succeeded!\n");
-
- __libnet_state_changed_cb(event_cb->ProfileName, CONNECTION_PROFILE_STATE_DISCONNECTED);
- return;
- default:
- CONNECTION_LOG(CONNECTION_ERROR, "'Close connection' failed!! [%s]\n",
- __libnet_convert_cp_error_type_to_string(result));
- }
-
- break;
- case NET_EVENT_NET_STATE_IND:
- CONNECTION_LOG(CONNECTION_INFO, "Got State changed IND\n");
-
- if (event_cb->Datalength != sizeof(net_state_type_t))
- return;
-
- net_state_type_t *profile_state = (net_state_type_t*)event_cb->Data;
- connection_profile_state_e cp_state = _profile_convert_to_cp_state(*profile_state);
-
- CONNECTION_LOG(CONNECTION_INFO,
- "Profile State : %s, profile name : %s\n",
- __libnet_convert_cp_state_to_string(cp_state),
- event_cb->ProfileName);
-
- __libnet_state_changed_cb(event_cb->ProfileName, cp_state);
-
- break;
- case NET_EVENT_WIFI_SCAN_IND:
- case NET_EVENT_WIFI_SCAN_RSP:
- CONNECTION_LOG(CONNECTION_INFO, "Got wifi scan IND\n");
- break;
- case NET_EVENT_WIFI_POWER_IND:
- case NET_EVENT_WIFI_POWER_RSP:
- CONNECTION_LOG(CONNECTION_INFO, "Got wifi power IND\n");
- break;
- case NET_EVENT_CELLULAR_SET_DEFAULT_RSP:
- result = __libnet_convert_to_cp_error_type(event_cb->Error);
- CONNECTION_LOG(CONNECTION_INFO, "Got set default profile RSP %d\n", result);
- __libnet_default_cb(result);
- break;
- case NET_EVENT_WIFI_WPS_RSP:
- CONNECTION_LOG(CONNECTION_INFO, "Got wifi WPS RSP\n");
- /* fall through */
- default :
- CONNECTION_LOG(CONNECTION_ERROR, "Error! Unknown Event\n\n");
- break;
- }
-}
-
int __libnet_get_connected_count(struct _profile_list_s *profile_list)
{
int count = 0;
void __libnet_copy_connected_profile(net_profile_info_t **dest, struct _profile_list_s *source)
{
+ /*
int i = 0;
for (;i < source->count;i++) {
(*dest)++;
}
}
+ */
}
bool _connection_libnet_init(void)
int rv;
if (!libnet.registered) {
- rv = net_register_client_ext((net_event_cb_t)__libnet_evt_cb, NET_DEVICE_DEFAULT, NULL);
- if (rv != NET_ERR_NONE)
+ rv = connman_lib_init();
+ if (rv != CONNMAN_LIB_ERR_NONE)
return false;
libnet.registered = true;
bool _connection_libnet_deinit(void)
{
if (libnet.registered) {
- if (net_deregister_client_ext(NET_DEVICE_DEFAULT) != NET_ERR_NONE)
- return false;
+ connman_lib_deinit();
libnet.registered = false;
bool _connection_libnet_get_wifi_state(connection_wifi_state_e *state)
{
- net_wifi_state_t wlan_state;
+ net_wifi_state_t wlan_state = WIFI_OFF;
+ /*
net_profile_name_t profile_name;
-
+ TODO:
if (net_get_wifi_state(&wlan_state, &profile_name) != NET_ERR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Error!! net_get_wifi_state() failed.\n");
return false;
}
-
+ */
switch (wlan_state) {
case WIFI_OFF:
*state = CONNECTION_WIFI_STATE_DEACTIVATED;
bool _connection_libnet_get_ethernet_state(connection_ethernet_state_e* state)
{
struct _profile_list_s ethernet_profiles = {0, 0, NULL};
+ /*
+ TODO:
net_get_profile_list(NET_DEVICE_ETHERNET, ðernet_profiles.profiles, ðernet_profiles.count);
-
+ */
if (ethernet_profiles.count == 0) {
*state = CONNECTION_ETHERNET_STATE_DEACTIVATED;
return true;
{
int i = 0;
struct _profile_list_s bluetooth_profiles = {0, 0, NULL};
+ /*
+ TODO:
net_get_profile_list(NET_DEVICE_BLUETOOTH, &bluetooth_profiles.profiles, &bluetooth_profiles.count);
+ */
if (bluetooth_profiles.count == 0) {
*state = CONNECTION_BT_STATE_DEACTIVATED;
int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, connection_profile_iterator_h* profile_iter_h)
{
int count = 0;
- int rv;
+ /*int rv;*/
net_profile_info_t *profiles = NULL;
struct _profile_list_s all_profiles = {0, 0, NULL};
__libnet_clear_profile_list(&profile_iterator);
-
+ /*
+ TODO:
rv = net_get_profile_list(NET_DEVICE_MAX, &all_profiles.profiles, &all_profiles.count);
if (rv != NET_ERR_NONE) {
} else
return CONNECTION_ERROR_OPERATION_FAILED;
}
+ */
*profile_iter_h = &profile_iterator;
int _connection_libnet_get_current_profile(connection_profile_h *profile)
{
net_profile_info_t active_profile;
- int rv;
-
+ /*int rv;*/
+ /*
+ TODO:
rv = net_get_active_net_info(&active_profile);
+
if (rv == NET_ERR_NO_SERVICE)
return CONNECTION_ERROR_NO_CONNECTION;
else if (rv != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
*profile = g_try_malloc0(sizeof(net_profile_info_t));
if (*profile == NULL)
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
-
+ TODO:
if (net_open_connection_with_profile(profile_info->ProfileName) != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
__libnet_set_opened_cb(callback, user_data);
int _connection_libnet_get_cellular_service_profile(connection_cellular_service_type_e type, connection_profile_h *profile)
{
+/*
int i = 0;
int j = 0;
int rv = NET_ERR_NONE;
struct _profile_list_s cellular_profiles = {0, 0, NULL};
+ TODO:
rv = net_get_profile_list(NET_DEVICE_CELLULAR, &cellular_profiles.profiles, &cellular_profiles.count);
if (rv != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
done:
prof_handle_list = g_slist_append(prof_handle_list, *profile);
+*/
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
connection_cellular_service_type_e service_type;
if (service_type != type)
return CONNECTION_ERROR_INVALID_PARAMETER;
-
+ TODO:
if (net_set_default_cellular_service_profile(profile_info->ProfileName) != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
return CONNECTION_ERROR_NONE;
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
connection_cellular_service_type_e service_type;
if (service_type != type)
return CONNECTION_ERROR_INVALID_PARAMETER;
-
+ TODO:
if (net_set_default_cellular_service_profile_async(profile_info->ProfileName) != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
__libnet_set_default_cb(callback, user_data);
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ /*
net_profile_info_t *profile_info = profile;
-
+ TODO:
if (net_close_connection(profile_info->ProfileName) != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
__libnet_set_closed_cb(callback, user_data);
CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
-
+ /*
+ TODO:
if (net_add_route(host_address, interface_name) != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
return CONNECTION_ERROR_NONE;
}
int _connection_libnet_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type)
{
+ /*
+ TODO:
if (net_set_statistics(device_type, statistics_type) != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
return CONNECTION_ERROR_NONE;
}
int _connection_libnet_get_statistics(net_statistics_type_e statistics_type, unsigned long long *size)
{
+ /*
+ TODO:
if (net_get_statistics(NET_DEVICE_WIFI, statistics_type, size) != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
+ */
return CONNECTION_ERROR_NONE;
}
SET(fw_test "${fw_name}-test")
-SET(dependents "capi-base-common glib-2.0 network")
+SET(dependents "capi-base-common glib-2.0")
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_test} REQUIRED ${dependents})
aux_source_directory(. sources)
FOREACH(src ${sources})
GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
- MESSAGE("${src_name}")
- ADD_EXECUTABLE(${src_name} ${src})
- TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
+ MESSAGE("${fw_test}")
+ ADD_EXECUTABLE(${fw_test} ${src})
+ TARGET_LINK_LIBRARIES(${fw_test} ${fw_name} ${${fw_test}_LDFLAGS})
+ INSTALL(TARGETS ${fw_test} DESTINATION ${LIB_INSTALL_DIR}/winet-capi-test/)
ENDFOREACH()