5 * Copyright (C) 2007-2012 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_PROVIDER_H
23 #define __CONNMAN_PROVIDER_H
26 #include <connman/types.h>
34 * @title: Provider premitives
35 * @short_description: Functions for handling providers
38 enum connman_provider_type {
39 CONNMAN_PROVIDER_TYPE_UNKNOWN = 0,
40 CONNMAN_PROVIDER_TYPE_VPN = 1,
43 enum connman_provider_state {
44 CONNMAN_PROVIDER_STATE_UNKNOWN = 0,
45 CONNMAN_PROVIDER_STATE_IDLE = 1,
46 CONNMAN_PROVIDER_STATE_CONNECT = 2,
47 CONNMAN_PROVIDER_STATE_READY = 3,
48 CONNMAN_PROVIDER_STATE_DISCONNECT = 4,
49 CONNMAN_PROVIDER_STATE_FAILURE = 5,
52 enum connman_provider_error {
53 CONNMAN_PROVIDER_ERROR_UNKNOWN = 0,
54 CONNMAN_PROVIDER_ERROR_CONNECT_FAILED = 1,
55 CONNMAN_PROVIDER_ERROR_LOGIN_FAILED = 2,
56 CONNMAN_PROVIDER_ERROR_AUTH_FAILED = 3,
59 struct connman_provider;
60 struct connman_ipaddress;
62 #define connman_provider_ref(provider) \
63 connman_provider_ref_debug(provider, __FILE__, __LINE__, __func__)
65 #define connman_provider_unref(provider) \
66 connman_provider_unref_debug(provider, __FILE__, __LINE__, __func__)
68 struct connman_provider *
69 connman_provider_ref_debug(struct connman_provider *provider,
70 const char *file, int line, const char *caller);
71 void connman_provider_unref_debug(struct connman_provider *provider,
72 const char *file, int line, const char *caller);
74 int connman_provider_set_string(struct connman_provider *provider,
75 const char *key, const char *value);
76 const char *connman_provider_get_string(struct connman_provider *provider,
79 int connman_provider_set_state(struct connman_provider *provider,
80 enum connman_provider_state state);
82 int connman_provider_indicate_error(struct connman_provider *provider,
83 enum connman_provider_error error);
85 void connman_provider_set_index(struct connman_provider *provider, int index);
86 int connman_provider_get_index(struct connman_provider *provider);
88 void connman_provider_set_data(struct connman_provider *provider, void *data);
89 void *connman_provider_get_data(struct connman_provider *provider);
90 int connman_provider_set_ipaddress(struct connman_provider *provider,
91 struct connman_ipaddress *ipaddress);
92 int connman_provider_set_pac(struct connman_provider *provider,
94 int connman_provider_set_domain(struct connman_provider *provider,
96 int connman_provider_set_nameservers(struct connman_provider *provider,
97 const char *nameservers);
98 int connman_provider_append_route(struct connman_provider *provider,
99 const char *key, const char *value);
101 const char *connman_provider_get_driver_name(struct connman_provider *provider);
102 const char *connman_provider_get_save_group(struct connman_provider *provider);
104 struct connman_provider_driver {
106 enum connman_provider_type type;
107 int (*probe) (struct connman_provider *provider);
108 int (*remove) (struct connman_provider *provider);
109 int (*connect) (struct connman_provider *provider);
110 int (*disconnect) (struct connman_provider *provider);
111 int (*save) (struct connman_provider *provider, GKeyFile *keyfile);
114 int connman_provider_driver_register(struct connman_provider_driver *driver);
115 void connman_provider_driver_unregister(struct connman_provider_driver *driver);
121 #endif /* __CONNMAN_PROVIDER_H */