5 * Copyright (C) 2007-2010 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
25 #include <connman/types.h>
26 #include <connman/device.h>
27 #include <connman/ipconfig.h>
35 * @title: Network premitives
36 * @short_description: Functions for handling networks
39 enum connman_network_type {
40 CONNMAN_NETWORK_TYPE_UNKNOWN = 0,
41 CONNMAN_NETWORK_TYPE_ETHERNET = 1,
42 CONNMAN_NETWORK_TYPE_WIFI = 2,
43 CONNMAN_NETWORK_TYPE_WIMAX = 3,
44 CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8,
45 CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9,
46 CONNMAN_NETWORK_TYPE_CELLULAR = 10,
47 CONNMAN_NETWORK_TYPE_VENDOR = 10000,
50 enum connman_network_error {
51 CONNMAN_NETWORK_ERROR_UNKNOWN = 0,
52 CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL = 1,
53 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL = 2,
54 CONNMAN_NETWORK_ERROR_INVALID_KEY = 3,
55 CONNMAN_NETWORK_ERROR_CONNECT_FAIL = 4,
58 #define CONNMAN_NETWORK_PRIORITY_LOW -100
59 #define CONNMAN_NETWORK_PRIORITY_DEFAULT 0
60 #define CONNMAN_NETWORK_PRIORITY_HIGH 100
62 struct connman_network;
64 struct connman_network *connman_network_create(const char *identifier,
65 enum connman_network_type type);
66 struct connman_network *connman_network_ref(struct connman_network *network);
67 void connman_network_unref(struct connman_network *network);
69 enum connman_network_type connman_network_get_type(struct connman_network *network);
70 const char *connman_network_get_identifier(struct connman_network *network);
72 void connman_network_set_index(struct connman_network *network, int index);
73 int connman_network_get_index(struct connman_network *network);
75 void connman_network_set_group(struct connman_network *network,
77 const char *connman_network_get_group(struct connman_network *network);
79 connman_bool_t connman_network_get_connecting(struct connman_network *network);
80 int connman_network_set_available(struct connman_network *network,
81 connman_bool_t available);
82 connman_bool_t connman_network_get_available(struct connman_network *network);
83 int connman_network_set_associating(struct connman_network *network,
84 connman_bool_t associating);
85 void connman_network_set_error(struct connman_network *network,
86 enum connman_network_error error);
87 void connman_network_clear_error(struct connman_network *network);
88 int connman_network_set_connected(struct connman_network *network,
89 connman_bool_t connected);
90 connman_bool_t connman_network_get_connected(struct connman_network *network);
92 connman_bool_t connman_network_get_associating(struct connman_network *network);
94 void connman_network_set_ipv4_method(struct connman_network *network,
95 enum connman_ipconfig_method method);
96 void connman_network_set_ipv6_method(struct connman_network *network,
97 enum connman_ipconfig_method method);
98 int connman_network_set_ipaddress(struct connman_network *network,
99 struct connman_ipaddress *ipaddress);
100 int connman_network_set_nameservers(struct connman_network *network,
101 const char *nameservers);
102 int connman_network_set_domain(struct connman_network *network,
104 #if defined TIZEN_EXT
106 * Description: Telephony plug-in requires manual PROXY setting function
108 int connman_network_set_proxy(struct connman_network *network,
109 const char *proxies);
111 * Description: Network client requires additional wifi specific info
113 int connman_network_set_bssid(struct connman_network *network,
114 const unsigned char *bssid);
115 unsigned char *connman_network_get_bssid(struct connman_network *network);
117 int connman_network_set_maxrate(struct connman_network *network,
118 unsigned int maxrate);
119 unsigned int connman_network_get_maxrate(struct connman_network *network);
121 int connman_network_set_enc_mode(struct connman_network *network,
122 const char *encryption_mode);
123 const char *connman_network_get_enc_mode(struct connman_network *network);
125 const char *connman_network_get_ifname(struct connman_network *network);
128 int connman_network_set_name(struct connman_network *network,
130 int connman_network_set_strength(struct connman_network *network,
131 connman_uint8_t strength);
132 connman_uint8_t connman_network_get_strength(struct connman_network *network);
133 int connman_network_set_roaming(struct connman_network *network,
134 connman_bool_t roaming);
135 int connman_network_set_frequency(struct connman_network *network,
136 connman_uint16_t frequency);
137 connman_uint16_t connman_network_get_frequency(struct connman_network *network);
138 int connman_network_set_wifi_channel(struct connman_network *network,
139 connman_uint16_t channel);
140 connman_uint16_t connman_network_get_wifi_channel(struct connman_network *network);
142 int connman_network_set_string(struct connman_network *network,
143 const char *key, const char *value);
144 const char *connman_network_get_string(struct connman_network *network,
146 int connman_network_set_bool(struct connman_network *network,
147 const char *key, connman_bool_t value);
148 connman_bool_t connman_network_get_bool(struct connman_network *network,
150 int connman_network_set_blob(struct connman_network *network,
151 const char *key, const void *data, unsigned int size);
152 const void *connman_network_get_blob(struct connman_network *network,
153 const char *key, unsigned int *size);
155 struct connman_device *connman_network_get_device(struct connman_network *network);
157 void *connman_network_get_data(struct connman_network *network);
158 void connman_network_set_data(struct connman_network *network, void *data);
160 void connman_network_update(struct connman_network *network);
162 struct connman_network_driver {
164 enum connman_network_type type;
166 int (*probe) (struct connman_network *network);
167 void (*remove) (struct connman_network *network);
168 int (*connect) (struct connman_network *network);
169 int (*disconnect) (struct connman_network *network);
172 int connman_network_driver_register(struct connman_network_driver *driver);
173 void connman_network_driver_unregister(struct connman_network_driver *driver);
179 #endif /* __CONNMAN_NETWORK_H */