5 * Copyright (C) 2007-2013 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef __CONNMAN_NETWORK_H
23 #define __CONNMAN_NETWORK_H
28 #include <connman/device.h>
29 #include <connman/ipconfig.h>
37 * @title: Network premitives
38 * @short_description: Functions for handling networks
41 enum connman_network_type {
42 CONNMAN_NETWORK_TYPE_UNKNOWN = 0,
43 CONNMAN_NETWORK_TYPE_ETHERNET = 1,
44 CONNMAN_NETWORK_TYPE_WIFI = 2,
45 CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8,
46 CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9,
47 CONNMAN_NETWORK_TYPE_CELLULAR = 10,
48 CONNMAN_NETWORK_TYPE_GADGET = 11,
49 CONNMAN_NETWORK_TYPE_VENDOR = 10000,
52 enum connman_network_error {
53 CONNMAN_NETWORK_ERROR_UNKNOWN = 0,
54 CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL = 1,
55 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL = 2,
56 CONNMAN_NETWORK_ERROR_INVALID_KEY = 3,
57 CONNMAN_NETWORK_ERROR_CONNECT_FAIL = 4,
59 CONNMAN_NETWORK_ERROR_DHCP_FAIL = 5,
63 #define CONNMAN_NETWORK_PRIORITY_LOW -100
64 #define CONNMAN_NETWORK_PRIORITY_DEFAULT 0
65 #define CONNMAN_NETWORK_PRIORITY_HIGH 100
67 struct connman_network;
69 struct connman_network *connman_network_create(const char *identifier,
70 enum connman_network_type type);
72 #define connman_network_ref(network) \
73 connman_network_ref_debug(network, __FILE__, __LINE__, __func__)
75 #define connman_network_unref(network) \
76 connman_network_unref_debug(network, __FILE__, __LINE__, __func__)
78 struct connman_network *
79 connman_network_ref_debug(struct connman_network *network,
80 const char *file, int line, const char *caller);
81 void connman_network_unref_debug(struct connman_network *network,
82 const char *file, int line, const char *caller);
84 enum connman_network_type connman_network_get_type(struct connman_network *network);
85 const char *connman_network_get_identifier(struct connman_network *network);
87 void connman_network_set_index(struct connman_network *network, int index);
88 int connman_network_get_index(struct connman_network *network);
90 void connman_network_set_group(struct connman_network *network,
92 const char *connman_network_get_group(struct connman_network *network);
94 bool connman_network_get_connecting(struct connman_network *network);
95 int connman_network_set_available(struct connman_network *network,
97 bool connman_network_get_available(struct connman_network *network);
98 int connman_network_set_associating(struct connman_network *network,
100 void connman_network_set_error(struct connman_network *network,
101 enum connman_network_error error);
102 int connman_network_set_connected(struct connman_network *network,
104 bool connman_network_get_connected(struct connman_network *network);
106 bool connman_network_get_associating(struct connman_network *network);
108 void connman_network_clear_hidden(void *user_data);
109 int connman_network_connect_hidden(struct connman_network *network,
110 char *identity, char* passphrase, void *user_data);
112 void connman_network_set_ipv4_method(struct connman_network *network,
113 enum connman_ipconfig_method method);
114 void connman_network_set_ipv6_method(struct connman_network *network,
115 enum connman_ipconfig_method method);
116 int connman_network_set_ipaddress(struct connman_network *network,
117 struct connman_ipaddress *ipaddress);
118 int connman_network_set_nameservers(struct connman_network *network,
119 const char *nameservers);
120 int connman_network_set_domain(struct connman_network *network,
122 #if defined TIZEN_EXT
124 * Description: Network client requires additional wifi specific info
126 int connman_network_set_bssid(struct connman_network *network,
127 const unsigned char *bssid);
128 unsigned char *connman_network_get_bssid(struct connman_network *network);
130 int connman_network_set_maxrate(struct connman_network *network,
131 unsigned int maxrate);
132 unsigned int connman_network_get_maxrate(struct connman_network *network);
134 int connman_network_set_enc_mode(struct connman_network *network,
135 const char *encryption_mode);
136 const char *connman_network_get_enc_mode(struct connman_network *network);
138 int connman_network_set_rsn_selected(struct connman_network *network,
141 int connman_network_set_proxy(struct connman_network *network,
142 const char *proxies);
144 void connman_network_clear_associating(struct connman_network *network);
145 int connman_network_set_is_hs20AP(struct connman_network *network,
146 unsigned int isHS20AP);
147 unsigned int connman_network_get_is_hs20AP(struct connman_network *network);
149 int connman_network_set_keymgmt(struct connman_network *network,
150 unsigned int keymgmt);
151 unsigned int connman_network_get_keymgmt(struct connman_network *network);
152 int connman_network_set_disconnect_reason(struct connman_network *network,
154 int connman_network_get_disconnect_reason(struct connman_network *network);
157 int connman_network_set_name(struct connman_network *network,
159 int connman_network_set_strength(struct connman_network *network,
161 uint8_t connman_network_get_strength(struct connman_network *network);
162 int connman_network_set_frequency(struct connman_network *network,
164 uint16_t connman_network_get_frequency(struct connman_network *network);
165 int connman_network_set_wifi_channel(struct connman_network *network,
167 uint16_t connman_network_get_wifi_channel(struct connman_network *network);
169 int connman_network_set_string(struct connman_network *network,
170 const char *key, const char *value);
171 const char *connman_network_get_string(struct connman_network *network,
173 int connman_network_set_bool(struct connman_network *network,
174 const char *key, bool value);
175 bool connman_network_get_bool(struct connman_network *network,
177 int connman_network_set_blob(struct connman_network *network,
178 const char *key, const void *data, unsigned int size);
179 const void *connman_network_get_blob(struct connman_network *network,
180 const char *key, unsigned int *size);
182 struct connman_device *connman_network_get_device(struct connman_network *network);
184 void *connman_network_get_data(struct connman_network *network);
185 void connman_network_set_data(struct connman_network *network, void *data);
187 void connman_network_update(struct connman_network *network);
189 struct connman_network_driver {
191 enum connman_network_type type;
193 int (*probe) (struct connman_network *network);
194 void (*remove) (struct connman_network *network);
195 int (*connect) (struct connman_network *network);
196 int (*disconnect) (struct connman_network *network);
197 #if defined TIZEN_EXT
198 int (*merge) (struct connman_network *network);
202 int connman_network_driver_register(struct connman_network_driver *driver);
203 void connman_network_driver_unregister(struct connman_network_driver *driver);
209 #endif /* __CONNMAN_NETWORK_H */