inet: IPv6 network route setting API
[platform/upstream/connman.git] / include / dhcp.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
6  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef __CONNMAN_DHCP_H
23 #define __CONNMAN_DHCP_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * SECTION:dhcp
31  * @title: DHCP premitives
32  * @short_description: Functions for handling DHCP
33  */
34
35 enum connman_dhcp_state {
36         CONNMAN_DHCP_STATE_UNKNOWN  = 0,
37         CONNMAN_DHCP_STATE_IDLE     = 1,
38         CONNMAN_DHCP_STATE_BOUND    = 2,
39         CONNMAN_DHCP_STATE_RENEW    = 3,
40         CONNMAN_DHCP_STATE_FAIL     = 4,
41 };
42
43 #define CONNMAN_DHCP_PRIORITY_LOW      -100
44 #define CONNMAN_DHCP_PRIORITY_DEFAULT     0
45 #define CONNMAN_DHCP_PRIORITY_HIGH      100
46
47 struct connman_dhcp;
48
49 struct connman_dhcp *connman_dhcp_ref(struct connman_dhcp *dhcp);
50 void connman_dhcp_unref(struct connman_dhcp *dhcp);
51
52 int connman_dhcp_get_index(struct connman_dhcp *dhcp);
53 char *connman_dhcp_get_interface(struct connman_dhcp *dhcp);
54
55 void connman_dhcp_set_value(struct connman_dhcp *dhcp,
56                                         const char *key, const char *value);
57
58 void connman_dhcp_bound(struct connman_dhcp *dhcp);
59 void connman_dhcp_renew(struct connman_dhcp *dhcp);
60 void connman_dhcp_release(struct connman_dhcp *dhcp);
61 void connman_dhcp_fail(struct connman_dhcp *dhcp);
62
63 void *connman_dhcp_get_data(struct connman_dhcp *dhcp);
64 void connman_dhcp_set_data(struct connman_dhcp *dhcp, void *data);
65
66 struct connman_dhcp_driver {
67         const char *name;
68         int priority;
69         int (*request) (struct connman_dhcp *dhcp);
70         int (*release) (struct connman_dhcp *dhcp);
71         int (*renew) (struct connman_dhcp *dhcp);
72 };
73
74 int connman_dhcp_driver_register(struct connman_dhcp_driver *driver);
75 void connman_dhcp_driver_unregister(struct connman_dhcp_driver *driver);
76
77 #ifdef __cplusplus
78 }
79 #endif
80
81 #endif /* __CONNMAN_DHCP_H */