5 * Copyright (C) 2007-2009 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>
34 * @title: Network premitives
35 * @short_description: Functions for handling networks
38 enum connman_network_type {
39 CONNMAN_NETWORK_TYPE_UNKNOWN = 0,
40 CONNMAN_NETWORK_TYPE_ETHERNET = 1,
41 CONNMAN_NETWORK_TYPE_WIFI = 2,
42 CONNMAN_NETWORK_TYPE_WIMAX = 3,
43 CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8,
44 CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9,
45 CONNMAN_NETWORK_TYPE_CELLULAR = 10,
46 CONNMAN_NETWORK_TYPE_MBM = 22,
47 CONNMAN_NETWORK_TYPE_HSO = 23,
48 CONNMAN_NETWORK_TYPE_VENDOR = 10000,
51 enum connman_network_protocol {
52 CONNMAN_NETWORK_PROTOCOL_UNKNOWN = 0,
53 CONNMAN_NETWORK_PROTOCOL_IP = 1,
56 enum connman_network_error {
57 CONNMAN_NETWORK_ERROR_UNKNOWN = 0,
58 CONNMAN_NETWORK_ERROR_ASSOCIATE_FAIL = 1,
61 struct connman_network;
63 struct connman_network *connman_network_create(const char *identifier,
64 enum connman_network_type type);
65 struct connman_network *connman_network_ref(struct connman_network *network);
66 void connman_network_unref(struct connman_network *network);
68 enum connman_network_type connman_network_get_type(struct connman_network *network);
69 const char *connman_network_get_identifier(struct connman_network *network);
71 const char *connman_network_get_path(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_protocol(struct connman_network *network,
76 enum connman_network_protocol protocol);
77 void connman_network_set_group(struct connman_network *network,
79 const char *connman_network_get_group(struct connman_network *network);
81 int connman_network_set_available(struct connman_network *network,
82 connman_bool_t available);
83 connman_bool_t connman_network_get_available(struct connman_network *network);
84 int connman_network_set_associating(struct connman_network *network,
85 connman_bool_t associating);
86 void connman_network_set_error(struct connman_network *network,
87 enum connman_network_error error);
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 int connman_network_set_address(struct connman_network *network,
95 const void *address, unsigned int size);
96 int connman_network_set_name(struct connman_network *network,
98 int connman_network_set_strength(struct connman_network *network,
99 connman_uint8_t strength);
100 int connman_network_set_roaming(struct connman_network *network,
101 connman_bool_t roaming);
103 int connman_network_set_string(struct connman_network *network,
104 const char *key, const char *value);
105 const char *connman_network_get_string(struct connman_network *network,
107 int connman_network_set_bool(struct connman_network *network,
108 const char *key, connman_bool_t value);
109 connman_bool_t connman_network_get_bool(struct connman_network *network,
111 int connman_network_set_uint8(struct connman_network *network,
112 const char *key, connman_uint8_t value);
113 connman_uint8_t connman_network_get_uint8(struct connman_network *network,
115 int connman_network_set_uint16(struct connman_network *network,
116 const char *key, connman_uint16_t value);
117 connman_uint16_t connman_network_get_uint16(struct connman_network *network,
119 int connman_network_set_blob(struct connman_network *network,
120 const char *key, const void *data, unsigned int size);
121 const void *connman_network_get_blob(struct connman_network *network,
122 const char *key, unsigned int *size);
124 struct connman_device *connman_network_get_device(struct connman_network *network);
126 void *connman_network_get_data(struct connman_network *network);
127 void connman_network_set_data(struct connman_network *network, void *data);
129 struct connman_network_driver {
131 enum connman_network_type type;
133 int (*probe) (struct connman_network *network);
134 void (*remove) (struct connman_network *network);
135 int (*connect) (struct connman_network *network);
136 int (*disconnect) (struct connman_network *network);
139 int connman_network_driver_register(struct connman_network_driver *driver);
140 void connman_network_driver_unregister(struct connman_network_driver *driver);
146 #endif /* __CONNMAN_NETWORK_H */