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_WIFI = 1,
41 CONNMAN_NETWORK_TYPE_WIMAX = 2,
42 CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN = 8,
43 CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN = 9,
44 CONNMAN_NETWORK_TYPE_HSO = 23,
45 CONNMAN_NETWORK_TYPE_VENDOR = 10000,
48 enum connman_network_protocol {
49 CONNMAN_NETWORK_PROTOCOL_UNKNOWN = 0,
50 CONNMAN_NETWORK_PROTOCOL_IP = 1,
51 CONNMAN_NETWORK_PROTOCOL_PPP = 2,
54 struct connman_network;
56 struct connman_network *connman_network_create(const char *identifier,
57 enum connman_network_type type);
58 struct connman_network *connman_network_ref(struct connman_network *network);
59 void connman_network_unref(struct connman_network *network);
61 enum connman_network_type connman_network_get_type(struct connman_network *network);
62 const char *connman_network_get_identifier(struct connman_network *network);
64 const char *connman_network_get_path(struct connman_network *network);
65 void connman_network_set_index(struct connman_network *network, int index);
66 int connman_network_get_index(struct connman_network *network);
68 void connman_network_set_protocol(struct connman_network *network,
69 enum connman_network_protocol protocol);
70 void connman_network_set_group(struct connman_network *network,
73 int connman_network_set_available(struct connman_network *network,
74 connman_bool_t available);
75 connman_bool_t connman_network_get_available(struct connman_network *network);
76 int connman_network_set_associating(struct connman_network *network,
77 connman_bool_t associating);
78 int connman_network_set_connected(struct connman_network *network,
79 connman_bool_t connected);
80 connman_bool_t connman_network_get_connected(struct connman_network *network);
82 int connman_network_set_address(struct connman_network *network,
83 const void *address, unsigned int size);
84 int connman_network_set_name(struct connman_network *network,
86 int connman_network_set_strength(struct connman_network *network,
87 connman_uint8_t strength);
89 int connman_network_set_string(struct connman_network *network,
90 const char *key, const char *value);
91 const char *connman_network_get_string(struct connman_network *network,
93 int connman_network_set_uint8(struct connman_network *network,
94 const char *key, connman_uint8_t value);
95 connman_uint8_t connman_network_get_uint8(struct connman_network *network,
97 int connman_network_set_uint16(struct connman_network *network,
98 const char *key, connman_uint16_t value);
99 connman_uint16_t connman_network_get_uint16(struct connman_network *network,
101 int connman_network_set_blob(struct connman_network *network,
102 const char *key, const void *data, unsigned int size);
103 const void *connman_network_get_blob(struct connman_network *network,
104 const char *key, unsigned int *size);
106 struct connman_device *connman_network_get_device(struct connman_network *network);
108 void *connman_network_get_data(struct connman_network *network);
109 void connman_network_set_data(struct connman_network *network, void *data);
111 struct connman_network_driver {
113 enum connman_network_type type;
115 int (*probe) (struct connman_network *network);
116 void (*remove) (struct connman_network *network);
117 int (*connect) (struct connman_network *network);
118 int (*disconnect) (struct connman_network *network);
121 int connman_network_driver_register(struct connman_network_driver *driver);
122 void connman_network_driver_unregister(struct connman_network_driver *driver);
128 #endif /* __CONNMAN_NETWORK_H */