Catalli's threaded switch
[sliver-openvswitch.git] / lib / dhcp-client.h
1 /*
2  * Copyright (c) 2008, 2010 Nicira Networks.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef DHCP_CLIENT_H
18 #define DHCP_CLIENT_H 1
19
20 #include <stdbool.h>
21 #include <stdint.h>
22
23 struct dhclient;
24 struct dhcp_msg;
25 struct netdev;
26 int dhclient_create(const char *netdev,
27                     void (*modify_request)(struct dhcp_msg *, void *aux),
28                     bool (*validate_offer)(const struct dhcp_msg *, void *aux),
29                     void *aux, struct dhclient **);
30 void dhclient_set_max_timeout(struct dhclient *, unsigned int max_timeout);
31 void dhclient_destroy(struct dhclient *);
32
33 struct netdev *dhclient_get_netdev(struct dhclient *);
34 const char *dhclient_get_name(const struct dhclient *);
35
36 void dhclient_init(struct dhclient *, uint32_t requested_ip);
37 void dhclient_release(struct dhclient *);
38 void dhclient_force_renew(struct dhclient *, int deadline);
39 bool dhclient_is_bound(const struct dhclient *);
40 bool dhclient_changed(struct dhclient *);
41
42 const char *dhclient_get_state(const struct dhclient *);
43 unsigned int dhclient_get_state_elapsed(const struct dhclient *);
44 unsigned int dhclient_get_lease_remaining(const struct dhclient *);
45
46 uint32_t dhclient_get_ip(const struct dhclient *);
47 uint32_t dhclient_get_netmask(const struct dhclient *);
48 uint32_t dhclient_get_router(const struct dhclient *);
49 const struct dhcp_msg *dhclient_get_config(const struct dhclient *);
50
51 int dhclient_configure_netdev(struct dhclient *);
52 int dhclient_update_resolv_conf(struct dhclient *);
53
54 void dhclient_run(struct dhclient *);
55 void dhclient_wait(struct dhclient *);
56
57 #endif /* dhcp-client.h */