2 * Copyright (c) 2011-2013 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.
17 #ifndef __NET_CONNECTION_PRIVATE_H__
18 #define __NET_CONNECTION_PRIVATE_H__
21 #include <network-cm-intf.h>
22 #include <network-wifi-intf.h>
24 #include "net_connection.h"
28 #endif /* __cplusplus */
31 #define LOG_TAG "CAPI_NETWORK_CONNECTION"
33 #define CONNECTION_INFO 1
34 #define CONNECTION_ERROR 2
35 #define CONNECTION_WARN 3
39 FEATURE_TYPE_TELEPHONY = 0,
40 FEATURE_TYPE_WIFI = 1,
41 FEATURE_TYPE_TETHERING_BLUETOOTH = 2
42 } enable_feature_type_e;
46 CONNECTION_CELLULAR_SUBSCRIBER_1 = 0x00,
47 CONNECTION_CELLULAR_SUBSCRIBER_2 = 0x01,
48 } connection_cellular_subscriber_id_e;
50 #define CONNECTION_LOG(log_level, format, args...) \
52 switch (log_level) { \
53 case CONNECTION_ERROR: \
54 LOGE(format, ## args); \
56 case CONNECTION_WARN: \
57 LOGW(format, ## args); \
60 LOGI(format, ## args); \
64 #define CONNECTION_MUTEX_LOCK _connection_inter_mutex_lock()
65 #define CONNECTION_MUTEX_UNLOCK _connection_inter_mutex_unlock()
67 #define SECURE_CONNECTION_LOG(log_level, format, args...) \
69 switch (log_level) { \
70 case CONNECTION_ERROR: \
71 SECURE_LOGE(format, ## args); \
73 case CONNECTION_WARN: \
74 SECURE_LOGW(format, ## args); \
77 SECURE_LOGI(format, ## args); \
81 #define VCONF_TELEPHONY_DEFAULT_DATA_SERVICE \
82 "db/telephony/dualsim/default_data_service"
84 bool _connection_is_created(void);
86 typedef struct _connection_handle_s
88 connection_type_changed_cb type_changed_callback;
89 connection_address_changed_cb ip_changed_callback;
90 connection_address_changed_cb proxy_changed_callback;
91 void *state_changed_user_data;
92 void *ip_changed_user_data;
93 void *proxy_changed_user_data;
94 } connection_handle_s;
97 int _connection_libnet_init(void);
98 bool _connection_libnet_deinit(void);
99 int _connection_libnet_get_wifi_state(connection_wifi_state_e *state);
100 int _connection_libnet_get_ethernet_state(connection_ethernet_state_e *state);
101 int _connection_libnet_get_bluetooth_state(connection_bt_state_e* state);
102 bool _connection_libnet_check_profile_validity(connection_profile_h profile);
103 bool _connection_libnet_check_profile_cb_validity(connection_profile_h profile);
104 int _connection_libnet_get_profile_iterator(connection_iterator_type_e type,
105 connection_profile_iterator_h *profile_iterator);
106 bool _connection_libnet_iterator_has_next(connection_profile_iterator_h profile_iterator);
107 int _connection_libnet_get_iterator_next(connection_profile_iterator_h profile_iter_h, connection_profile_h *profile);
108 int _connection_libnet_destroy_iterator(connection_profile_iterator_h profile_iter_h);
109 int _connection_libnet_get_current_profile(connection_profile_h *profile);
110 int _connection_libnet_reset_profile(connection_reset_option_e type, connection_cellular_subscriber_id_e id, connection_reset_cb callback, void *user_data);
111 int _connection_libnet_open_profile(connection_profile_h profile, connection_opened_cb callback, void *user_data);
112 int _connection_libnet_get_cellular_service_profile(connection_cellular_service_type_e type, connection_profile_h *profile);
113 int _connection_libnet_set_cellular_service_profile_sync(connection_cellular_service_type_e type, connection_profile_h profile);
114 int _connection_libnet_set_cellular_service_profile_async(connection_cellular_service_type_e type,
115 connection_profile_h profile, connection_set_default_cb callback, void* user_data);
116 int _connection_libnet_close_profile(connection_profile_h profile, connection_closed_cb callback, void *user_data);
117 int _connection_libnet_add_route(const char *interface_name, const char *host_address);
118 int _connection_libnet_remove_route(const char *interface_name, const char *host_address);
119 void _connection_libnet_add_to_profile_list(connection_profile_h profile);
120 void _connection_libnet_remove_from_profile_list(connection_profile_h profile);
121 bool _connection_libnet_add_to_profile_cb_list(connection_profile_h profile,
122 connection_profile_state_changed_cb callback, void *user_data);
123 bool _connection_libnet_remove_from_profile_cb_list(connection_profile_h profile);
124 int _connection_libnet_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type);
125 int _connection_libnet_get_statistics(net_statistics_type_e statistics_type, unsigned long long *size);
126 int _connection_libnet_check_get_privilege();
127 int _connection_libnet_check_profile_privilege();
129 bool _connection_libnet_get_is_check_enable_feature();
130 bool _connection_libnet_get_enable_feature_state(enable_feature_type_e feature_type);
131 int _connection_libnet_check_enable_feature();
133 guint _connection_callback_add(GSourceFunc func, gpointer user_data);
134 void _connection_callback_cleanup(void);
136 connection_cellular_service_type_e _profile_convert_to_connection_cellular_service_type(net_service_type_t svc_type);
137 connection_profile_state_e _profile_convert_to_cp_state(net_state_type_t state);
138 net_service_type_t _connection_profile_convert_to_libnet_cellular_service_type(connection_cellular_service_type_e svc_type);
139 net_state_type_t _connection_profile_convert_to_net_state(connection_profile_state_e state);
141 int _connection_libnet_set_cellular_subscriber_id(connection_profile_h profile, connection_cellular_subscriber_id_e sim_id);
142 void _connection_inter_mutex_lock(void);
143 void _connection_inter_mutex_unlock(void);
147 #endif /* __cplusplus */