1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
/*
*
* Connection Manager
*
* Copyright (C) 2007-2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __CONNMAN_NETWORK_H
#define __CONNMAN_NETWORK_H
#include <stdbool.h>
#include <stdint.h>
#include <dbus/dbus.h>
#include <connman/device.h>
#include <connman/ipconfig.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined TIZEN_EXT
#define WIFI_ENCYPTION_MODE_LEN_MAX 6
#define WIFI_BSSID_LEN_MAX 6
#define MAC_ADDRESS_LENGTH 18
#endif
/**
* SECTION:network
* @title: Network premitives
* @short_description: Functions for handling networks
*/
enum connman_network_type {
CONNMAN_NETWORK_TYPE_UNKNOWN = 0,
CONNMAN_NETWORK_TYPE_ETHERNET = 1,
CONNMAN_NETWORK_TYPE_WIFI = 2,
CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8,
CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9,
CONNMAN_NETWORK_TYPE_CELLULAR = 10,
CONNMAN_NETWORK_TYPE_GADGET = 11,
CONNMAN_NETWORK_TYPE_VENDOR = 10000,
};
enum connman_network_error {
CONNMAN_NETWORK_ERROR_UNKNOWN = 0,
CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL = 1,
CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL = 2,
CONNMAN_NETWORK_ERROR_INVALID_KEY = 3,
CONNMAN_NETWORK_ERROR_CONNECT_FAIL = 4,
#if defined TIZEN_EXT
CONNMAN_NETWORK_ERROR_DHCP_FAIL = 5,
CONNMAN_NETWORK_ERROR_BLOCKED = 6,
#else
CONNMAN_NETWORK_ERROR_BLOCKED = 5,
#endif
};
#if defined TIZEN_EXT
struct connman_bssids {
unsigned char bssid[WIFI_BSSID_LEN_MAX];
uint16_t strength;
uint16_t frequency;
uint16_t assoc_reject_cnt;
bool is_last_connected;
#if defined TIZEN_EXT_INS
int score_last_connected_bssid;
int score_assoc_reject;
int score_frequency;
int score_strength;
#endif
int ins_score;
};
/* Backward compatible
* modes of available network */
typedef enum {
IEEE80211_UNKNOWN,
IEEE80211_MODE_B,
IEEE80211_MODE_BG,
IEEE80211_MODE_BGN,
IEEE80211_MODE_A,
IEEE80211_MODE_AN,
IEEE80211_MODE_ANAC,
} ieee80211_modes_e;
/* connection mode of connected network
* based on current linkspeed */
typedef enum {
CONNECTION_MODE_IEEE80211_UNKNOWN,
CONNECTION_MODE_IEEE80211B,
CONNECTION_MODE_IEEE80211G,
CONNECTION_MODE_IEEE80211N,
CONNECTION_MODE_IEEE80211A,
CONNECTION_MODE_IEEE80211AC,
} connection_mode_e;
#endif
#define CONNMAN_NETWORK_PRIORITY_LOW -100
#define CONNMAN_NETWORK_PRIORITY_DEFAULT 0
#define CONNMAN_NETWORK_PRIORITY_HIGH 100
struct connman_network;
struct connman_network *connman_network_create(const char *identifier,
enum connman_network_type type);
#define connman_network_ref(network) \
connman_network_ref_debug(network, __FILE__, __LINE__, __func__)
#define connman_network_unref(network) \
connman_network_unref_debug(network, __FILE__, __LINE__, __func__)
struct connman_network *
connman_network_ref_debug(struct connman_network *network,
const char *file, int line, const char *caller);
void connman_network_unref_debug(struct connman_network *network,
const char *file, int line, const char *caller);
enum connman_network_type connman_network_get_type(struct connman_network *network);
const char *connman_network_get_identifier(struct connman_network *network);
void connman_network_set_index(struct connman_network *network, int index);
int connman_network_get_index(struct connman_network *network);
void connman_network_set_group(struct connman_network *network,
const char *group);
const char *connman_network_get_group(struct connman_network *network);
bool connman_network_get_connecting(struct connman_network *network);
#if defined TIZEN_EXT
void connman_network_set_connecting(struct connman_network *network);
#endif
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
bool connman_network_check_validity(struct connman_network *network);
#endif /* defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET */
int connman_network_set_available(struct connman_network *network,
bool available);
bool connman_network_get_available(struct connman_network *network);
int connman_network_set_associating(struct connman_network *network,
bool associating);
void connman_network_set_error(struct connman_network *network,
enum connman_network_error error);
int connman_network_set_connected(struct connman_network *network,
bool connected);
bool connman_network_get_connected(struct connman_network *network);
void connman_network_set_connected_dhcp_later(struct connman_network *network,
uint32_t sec);
bool connman_network_get_associating(struct connman_network *network);
void connman_network_clear_hidden(void *user_data);
int connman_network_connect_hidden(struct connman_network *network,
char *identity, char* passphrase, void *user_data);
void connman_network_set_ipv4_method(struct connman_network *network,
enum connman_ipconfig_method method);
void connman_network_set_ipv6_method(struct connman_network *network,
enum connman_ipconfig_method method);
int connman_network_set_ipaddress(struct connman_network *network,
struct connman_ipaddress *ipaddress);
int connman_network_set_nameservers(struct connman_network *network,
const char *nameservers);
int connman_network_set_domain(struct connman_network *network,
const char *domain);
#if defined TIZEN_EXT
/*
* Description: Network client requires additional wifi specific info
*/
int connman_network_set_bssid(struct connman_network *network,
const unsigned char *bssid);
unsigned char *connman_network_get_bssid(struct connman_network *network);
int connman_network_set_maxrate(struct connman_network *network,
unsigned int maxrate);
int connman_network_set_maxspeed(struct connman_network *network,
int maxrate);
unsigned int connman_network_get_maxrate(struct connman_network *network);
int connman_network_get_maxspeed(struct connman_network *network);
int connman_network_set_enc_mode(struct connman_network *network,
const char *encryption_mode);
const char *connman_network_get_enc_mode(struct connman_network *network);
int connman_network_set_rsn_mode(struct connman_network *network,
bool rsn_mode);
int connman_network_set_proxy(struct connman_network *network,
const char *proxies);
void connman_network_clear_associating(struct connman_network *network);
int connman_network_set_keymgmt(struct connman_network *network,
unsigned int keymgmt);
unsigned int connman_network_get_keymgmt(struct connman_network *network);
int connman_network_set_disconnect_reason(struct connman_network *network,
int reason_code);
int connman_network_get_disconnect_reason(struct connman_network *network);
int connman_network_get_assoc_status_code(struct connman_network *network);
int connman_network_set_assoc_status_code(struct connman_network *network,
int assoc_status_code);
int connman_network_set_countrycode(struct connman_network *network, const
unsigned char *country_code);
unsigned char *connman_network_get_countrycode(struct connman_network *network);
int connman_network_set_bssid_list(struct connman_network *network,
GSList *bssids);
void *connman_network_get_bssid_list(struct connman_network *network);
#if defined TIZEN_EXT
int connman_network_set_last_connected_bssid(struct connman_network *network,
const unsigned char *bssid);
unsigned char *connman_network_get_last_connected_bssid(struct connman_network *network);
void connman_network_set_assoc_reject_table(struct connman_network *network,
GHashTable *assoc_reject_table);
GHashTable *connman_network_get_assoc_reject_table(struct connman_network *network);
#endif
int connman_network_set_phy_mode(struct connman_network *network,
ieee80211_modes_e mode);
ieee80211_modes_e connman_network_get_phy_mode(struct connman_network *network);
int connman_network_set_connection_mode(struct connman_network *network,
connection_mode_e mode);
connection_mode_e connman_network_get_connection_mode(struct connman_network *network);
#endif
int connman_network_set_name(struct connman_network *network,
const char *name);
int connman_network_set_strength(struct connman_network *network,
uint8_t strength);
uint8_t connman_network_get_strength(struct connman_network *network);
int connman_network_set_frequency(struct connman_network *network,
uint16_t frequency);
uint16_t connman_network_get_frequency(struct connman_network *network);
int connman_network_set_wifi_channel(struct connman_network *network,
uint16_t channel);
uint16_t connman_network_get_wifi_channel(struct connman_network *network);
int connman_network_set_string(struct connman_network *network,
const char *key, const char *value);
const char *connman_network_get_string(struct connman_network *network,
const char *key);
int connman_network_set_bool(struct connman_network *network,
const char *key, bool value);
bool connman_network_get_bool(struct connman_network *network,
const char *key);
int connman_network_set_blob(struct connman_network *network,
const char *key, const void *data, unsigned int size);
const void *connman_network_get_blob(struct connman_network *network,
const char *key, unsigned int *size);
#if defined TIZEN_EXT
void connman_network_set_vsie_list(struct connman_network *network, GSList *vsie_list);
void *connman_network_get_vsie_list(struct connman_network *network);
#endif
struct connman_device *connman_network_get_device(struct connman_network *network);
void *connman_network_get_data(struct connman_network *network);
void connman_network_set_data(struct connman_network *network, void *data);
void connman_network_update(struct connman_network *network);
struct connman_network_driver {
const char *name;
enum connman_network_type type;
int priority;
int (*probe) (struct connman_network *network);
void (*remove) (struct connman_network *network);
int (*connect) (struct connman_network *network);
int (*disconnect) (struct connman_network *network);
#if defined TIZEN_EXT
int (*merge) (struct connman_network *network);
#endif
};
int connman_network_driver_register(struct connman_network_driver *driver);
void connman_network_driver_unregister(struct connman_network_driver *driver);
void connman_network_append_acddbus(DBusMessageIter *dict,
struct connman_network *network);
#ifdef __cplusplus
}
#endif
#endif /* __CONNMAN_NETWORK_H */
|