6 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef __CONNMAN_NETWORK_H
24 #define __CONNMAN_NETWORK_H
26 #include <connman/types.h>
27 #include <connman/device.h>
28 #include <connman/ipconfig.h>
36 * @title: Network premitives
37 * @short_description: Functions for handling networks
40 enum connman_network_type {
41 CONNMAN_NETWORK_TYPE_UNKNOWN = 0,
42 CONNMAN_NETWORK_TYPE_ETHERNET = 1,
43 CONNMAN_NETWORK_TYPE_WIFI = 2,
44 CONNMAN_NETWORK_TYPE_WIMAX = 3,
45 CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8,
46 CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9,
47 CONNMAN_NETWORK_TYPE_CELLULAR = 10,
48 CONNMAN_NETWORK_TYPE_VENDOR = 10000,
51 enum connman_network_error {
52 CONNMAN_NETWORK_ERROR_UNKNOWN = 0,
53 CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL = 1,
54 CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL = 2,
55 CONNMAN_NETWORK_ERROR_INVALID_KEY = 3,
56 CONNMAN_NETWORK_ERROR_CONNECT_FAIL = 4,
59 #define CONNMAN_NETWORK_PRIORITY_LOW -100
60 #define CONNMAN_NETWORK_PRIORITY_DEFAULT 0
61 #define CONNMAN_NETWORK_PRIORITY_HIGH 100
63 struct connman_network;
65 struct connman_network *connman_network_create(const char *identifier,
66 enum connman_network_type type);
67 struct connman_network *connman_network_ref(struct connman_network *network);
68 void connman_network_unref(struct connman_network *network);
70 enum connman_network_type connman_network_get_type(struct connman_network *network);
71 const char *connman_network_get_identifier(struct connman_network *network);
73 struct connman_element *connman_network_get_element(
74 struct connman_network *network);
75 void connman_network_set_index(struct connman_network *network, int index);
76 int connman_network_get_index(struct connman_network *network);
78 void connman_network_set_group(struct connman_network *network,
80 const char *connman_network_get_group(struct connman_network *network);
82 connman_bool_t connman_network_get_connecting(struct connman_network *network);
83 int connman_network_set_available(struct connman_network *network,
84 connman_bool_t available);
85 connman_bool_t connman_network_get_available(struct connman_network *network);
86 int connman_network_set_associating(struct connman_network *network,
87 connman_bool_t associating);
88 void connman_network_set_error(struct connman_network *network,
89 enum connman_network_error error);
90 void connman_network_clear_error(struct connman_network *network);
91 int connman_network_set_connected(struct connman_network *network,
92 connman_bool_t connected);
93 connman_bool_t connman_network_get_connected(struct connman_network *network);
95 connman_bool_t connman_network_get_associating(struct connman_network *network);
97 void connman_network_set_ipv4_method(struct connman_network *network,
98 enum connman_ipconfig_method method);
99 void connman_network_set_ipv6_method(struct connman_network *network,
100 enum connman_ipconfig_method method);
101 int connman_network_set_ipaddress(struct connman_network *network,
102 struct connman_ipaddress *ipaddress);
103 int connman_network_set_nameservers(struct connman_network *network,
104 const char *nameservers);
105 int connman_network_set_domain(struct connman_network *network,
107 int connman_network_set_pac(struct connman_network *network,
109 int connman_network_set_name(struct connman_network *network,
111 int connman_network_set_strength(struct connman_network *network,
112 connman_uint8_t strength);
113 int connman_network_set_roaming(struct connman_network *network,
114 connman_bool_t roaming);
116 int connman_network_set_string(struct connman_network *network,
117 const char *key, const char *value);
118 const char *connman_network_get_string(struct connman_network *network,
120 int connman_network_set_bool(struct connman_network *network,
121 const char *key, connman_bool_t value);
122 connman_bool_t connman_network_get_bool(struct connman_network *network,
124 int connman_network_set_uint8(struct connman_network *network,
125 const char *key, connman_uint8_t value);
126 connman_uint8_t connman_network_get_uint8(struct connman_network *network,
128 int connman_network_set_uint16(struct connman_network *network,
129 const char *key, connman_uint16_t value);
130 connman_uint16_t connman_network_get_uint16(struct connman_network *network,
132 int connman_network_set_blob(struct connman_network *network,
133 const char *key, const void *data, unsigned int size);
134 const void *connman_network_get_blob(struct connman_network *network,
135 const char *key, unsigned int *size);
137 struct connman_device *connman_network_get_device(struct connman_network *network);
139 void *connman_network_get_data(struct connman_network *network);
140 void connman_network_set_data(struct connman_network *network, void *data);
142 void connman_network_update(struct connman_network *network);
144 struct connman_network_driver {
146 enum connman_network_type type;
148 int (*probe) (struct connman_network *network);
149 void (*remove) (struct connman_network *network);
150 int (*connect) (struct connman_network *network);
151 int (*disconnect) (struct connman_network *network);
154 int connman_network_driver_register(struct connman_network_driver *driver);
155 void connman_network_driver_unregister(struct connman_network_driver *driver);
161 #endif /* __CONNMAN_NETWORK_H */