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 connman_uint8_t connman_network_get_strength(struct connman_network *network);
114 int connman_network_set_roaming(struct connman_network *network,
115 connman_bool_t roaming);
116 int connman_network_set_frequency(struct connman_network *network,
117 connman_uint16_t frequency);
118 connman_uint16_t connman_network_get_frequency(struct connman_network *network);
119 int connman_network_set_wifi_channel(struct connman_network *network,
120 connman_uint16_t channel);
121 connman_uint16_t connman_network_get_wifi_channel(struct connman_network *network);
123 int connman_network_set_string(struct connman_network *network,
124 const char *key, const char *value);
125 const char *connman_network_get_string(struct connman_network *network,
127 int connman_network_set_bool(struct connman_network *network,
128 const char *key, connman_bool_t value);
129 connman_bool_t connman_network_get_bool(struct connman_network *network,
131 int connman_network_set_blob(struct connman_network *network,
132 const char *key, const void *data, unsigned int size);
133 const void *connman_network_get_blob(struct connman_network *network,
134 const char *key, unsigned int *size);
136 struct connman_device *connman_network_get_device(struct connman_network *network);
138 void *connman_network_get_data(struct connman_network *network);
139 void connman_network_set_data(struct connman_network *network, void *data);
141 void connman_network_update(struct connman_network *network);
143 int connman_network_register(struct connman_network *network);
144 void connman_network_unregister(struct connman_network *network);
146 struct connman_network_driver {
148 enum connman_network_type type;
150 int (*probe) (struct connman_network *network);
151 void (*remove) (struct connman_network *network);
152 int (*connect) (struct connman_network *network);
153 int (*disconnect) (struct connman_network *network);
156 int connman_network_driver_register(struct connman_network_driver *driver);
157 void connman_network_driver_unregister(struct connman_network_driver *driver);
163 #endif /* __CONNMAN_NETWORK_H */