1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/*
*
* Connection Manager
*
* Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __CONNMAN_PROVIDER_H
#define __CONNMAN_PROVIDER_H
#include <connman/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* SECTION:provider
* @title: Provider premitives
* @short_description: Functions for handling providers
*/
enum connman_provider_type {
CONNMAN_PROVIDER_TYPE_UNKNOWN = 0,
CONNMAN_PROVIDER_TYPE_VPN = 1,
};
enum connman_provider_state {
CONNMAN_PROVIDER_STATE_UNKNOWN = 0,
CONNMAN_PROVIDER_STATE_IDLE = 1,
CONNMAN_PROVIDER_STATE_CONNECT = 2,
CONNMAN_PROVIDER_STATE_READY = 3,
CONNMAN_PROVIDER_STATE_DISCONNECT = 4,
CONNMAN_PROVIDER_STATE_FAILURE = 5,
};
enum connman_provider_error {
CONNMAN_PROVIDER_ERROR_UNKNOWN = 0,
CONNMAN_PROVIDER_ERROR_CONNECT_FAILED = 1,
};
struct connman_provider;
struct connman_provider *connman_provider_ref(struct connman_provider *provider);
void connman_provider_unref(struct connman_provider *provider);
int connman_provider_set_string(struct connman_provider *provider,
const char *key, const char *value);
const char *connman_provider_get_string(struct connman_provider *provider,
const char *key);
int connman_provider_set_state(struct connman_provider *provider,
enum connman_provider_state state);
void connman_provider_set_index(struct connman_provider *provider, int index);
int connman_provider_get_index(struct connman_provider *provider);
void connman_provider_set_data(struct connman_provider *provider, void *data);
void *connman_provider_get_data(struct connman_provider *provider);
void connman_provider_set_gateway(struct connman_provider *provider,
const char *gateway);
void connman_provider_set_address(struct connman_provider *provider,
const char *address);
void connman_provider_set_netmask(struct connman_provider *provider,
const char *netmask);
void connman_provider_set_dns(struct connman_provider *provider,
const char *dns);
void connman_provider_set_domain(struct connman_provider *provider,
const char *domain);
int connman_provider_append_route(struct connman_provider *provider,
const char *host, const char *netmask,
const char *gateway);
const char *connman_provider_get_driver_name(struct connman_provider *provider);
struct connman_provider_driver {
const char *name;
enum connman_provider_type type;
int (*probe) (struct connman_provider *provider);
int (*remove) (struct connman_provider *provider);
int (*connect) (struct connman_provider *provider);
int (*disconnect) (struct connman_provider *provider);
};
int connman_provider_driver_register(struct connman_provider_driver *driver);
void connman_provider_driver_unregister(struct connman_provider_driver *driver);
#ifdef __cplusplus
}
#endif
#endif /* __CONNMAN_PROVIDER_H */
|