]>
Commit | Line | Data |
---|---|---|
011feef8 PF |
1 | #ifndef foosddhcpclienthfoo |
2 | #define foosddhcpclienthfoo | |
3 | ||
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright (C) 2013 Intel Corporation. All rights reserved. | |
8 | ||
9 | systemd is free software; you can redistribute it and/or modify it | |
10 | under the terms of the GNU Lesser General Public License as published by | |
11 | the Free Software Foundation; either version 2.1 of the License, or | |
12 | (at your option) any later version. | |
13 | ||
14 | systemd is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | Lesser General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU Lesser General Public License | |
20 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
21 | ***/ | |
22 | ||
04c01369 | 23 | #include <inttypes.h> |
46a66b79 | 24 | #include <net/ethernet.h> |
04c01369 LP |
25 | #include <netinet/in.h> |
26 | #include <sys/types.h> | |
011feef8 | 27 | |
fe8db0c5 | 28 | #include "sd-dhcp-lease.h" |
71d35b6b | 29 | #include "sd-event.h" |
d3d8ac2f | 30 | |
04c01369 LP |
31 | #include "_sd-common.h" |
32 | ||
33 | _SD_BEGIN_DECLARATIONS; | |
34 | ||
3e3d8f78 | 35 | enum { |
03748142 DH |
36 | SD_DHCP_CLIENT_EVENT_STOP = 0, |
37 | SD_DHCP_CLIENT_EVENT_IP_ACQUIRE = 1, | |
38 | SD_DHCP_CLIENT_EVENT_IP_CHANGE = 2, | |
39 | SD_DHCP_CLIENT_EVENT_EXPIRED = 3, | |
40 | SD_DHCP_CLIENT_EVENT_RENEW = 4, | |
3e3d8f78 PF |
41 | }; |
42 | ||
22805d92 BG |
43 | enum { |
44 | SD_DHCP_OPTION_PAD = 0, | |
45 | SD_DHCP_OPTION_SUBNET_MASK = 1, | |
46 | SD_DHCP_OPTION_TIME_OFFSET = 2, | |
47 | SD_DHCP_OPTION_ROUTER = 3, | |
48 | SD_DHCP_OPTION_DOMAIN_NAME_SERVER = 6, | |
49 | SD_DHCP_OPTION_HOST_NAME = 12, | |
50 | SD_DHCP_OPTION_BOOT_FILE_SIZE = 13, | |
51 | SD_DHCP_OPTION_DOMAIN_NAME = 15, | |
52 | SD_DHCP_OPTION_ROOT_PATH = 17, | |
53 | SD_DHCP_OPTION_ENABLE_IP_FORWARDING = 19, | |
54 | SD_DHCP_OPTION_ENABLE_IP_FORWARDING_NL = 20, | |
55 | SD_DHCP_OPTION_POLICY_FILTER = 21, | |
56 | SD_DHCP_OPTION_INTERFACE_MDR = 22, | |
57 | SD_DHCP_OPTION_INTERFACE_TTL = 23, | |
58 | SD_DHCP_OPTION_INTERFACE_MTU_AGING_TIMEOUT = 24, | |
59 | SD_DHCP_OPTION_INTERFACE_MTU = 26, | |
60 | SD_DHCP_OPTION_BROADCAST = 28, | |
61 | SD_DHCP_OPTION_STATIC_ROUTE = 33, | |
62 | SD_DHCP_OPTION_NTP_SERVER = 42, | |
63 | SD_DHCP_OPTION_VENDOR_SPECIFIC = 43, | |
64 | SD_DHCP_OPTION_REQUESTED_IP_ADDRESS = 50, | |
65 | SD_DHCP_OPTION_IP_ADDRESS_LEASE_TIME = 51, | |
66 | SD_DHCP_OPTION_OVERLOAD = 52, | |
67 | SD_DHCP_OPTION_MESSAGE_TYPE = 53, | |
68 | SD_DHCP_OPTION_SERVER_IDENTIFIER = 54, | |
69 | SD_DHCP_OPTION_PARAMETER_REQUEST_LIST = 55, | |
70 | SD_DHCP_OPTION_ERROR_MESSAGE = 56, | |
71 | SD_DHCP_OPTION_MAXIMUM_MESSAGE_SIZE = 57, | |
72 | SD_DHCP_OPTION_RENEWAL_T1_TIME = 58, | |
73 | SD_DHCP_OPTION_REBINDING_T2_TIME = 59, | |
74 | SD_DHCP_OPTION_VENDOR_CLASS_IDENTIFIER = 60, | |
75 | SD_DHCP_OPTION_CLIENT_IDENTIFIER = 61, | |
76 | SD_DHCP_OPTION_FQDN = 81, | |
77 | SD_DHCP_OPTION_NEW_POSIX_TIMEZONE = 100, | |
78 | SD_DHCP_OPTION_NEW_TZDB_TIMEZONE = 101, | |
b85bc551 | 79 | SD_DHCP_OPTION_DOMAIN_SEARCH_LIST = 119, |
22805d92 BG |
80 | SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE = 121, |
81 | SD_DHCP_OPTION_PRIVATE_BASE = 224, | |
82 | SD_DHCP_OPTION_PRIVATE_LAST = 254, | |
83 | SD_DHCP_OPTION_END = 255, | |
84 | }; | |
85 | ||
011feef8 PF |
86 | typedef struct sd_dhcp_client sd_dhcp_client; |
87 | ||
4b558378 ZJS |
88 | typedef void (*sd_dhcp_client_callback_t)(sd_dhcp_client *client, int event, void *userdata); |
89 | int sd_dhcp_client_set_callback( | |
90 | sd_dhcp_client *client, | |
91 | sd_dhcp_client_callback_t cb, | |
92 | void *userdata); | |
93 | ||
94 | int sd_dhcp_client_set_request_option( | |
95 | sd_dhcp_client *client, | |
96 | uint8_t option); | |
97 | int sd_dhcp_client_set_request_address( | |
98 | sd_dhcp_client *client, | |
99 | const struct in_addr *last_address); | |
100 | int sd_dhcp_client_set_request_broadcast( | |
101 | sd_dhcp_client *client, | |
102 | int broadcast); | |
2f8e7633 | 103 | int sd_dhcp_client_set_ifindex( |
4b558378 ZJS |
104 | sd_dhcp_client *client, |
105 | int interface_index); | |
106 | int sd_dhcp_client_set_mac( | |
107 | sd_dhcp_client *client, | |
108 | const uint8_t *addr, | |
109 | size_t addr_len, | |
110 | uint16_t arp_type); | |
111 | int sd_dhcp_client_set_client_id( | |
112 | sd_dhcp_client *client, | |
113 | uint8_t type, | |
114 | const uint8_t *data, | |
115 | size_t data_len); | |
116 | int sd_dhcp_client_set_iaid_duid( | |
117 | sd_dhcp_client *client, | |
118 | uint32_t iaid, | |
119 | uint16_t duid_type, | |
f7a92d1a | 120 | const void *duid, |
4b558378 ZJS |
121 | size_t duid_len); |
122 | int sd_dhcp_client_get_client_id( | |
123 | sd_dhcp_client *client, | |
124 | uint8_t *type, | |
125 | const uint8_t **data, | |
126 | size_t *data_len); | |
127 | int sd_dhcp_client_set_mtu( | |
128 | sd_dhcp_client *client, | |
129 | uint32_t mtu); | |
9faed222 SS |
130 | int sd_dhcp_client_set_client_port( |
131 | sd_dhcp_client *client, | |
132 | uint16_t port); | |
4b558378 ZJS |
133 | int sd_dhcp_client_set_hostname( |
134 | sd_dhcp_client *client, | |
135 | const char *hostname); | |
136 | int sd_dhcp_client_set_vendor_class_identifier( | |
137 | sd_dhcp_client *client, | |
138 | const char *vci); | |
139 | int sd_dhcp_client_get_lease( | |
140 | sd_dhcp_client *client, | |
141 | sd_dhcp_lease **ret); | |
a6cc569e | 142 | |
bbdf06d9 | 143 | int sd_dhcp_client_stop(sd_dhcp_client *client); |
46a66b79 | 144 | int sd_dhcp_client_start(sd_dhcp_client *client); |
e5b04c8d PF |
145 | |
146 | sd_dhcp_client *sd_dhcp_client_ref(sd_dhcp_client *client); | |
147 | sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client); | |
148 | ||
b25ef18b TG |
149 | int sd_dhcp_client_new(sd_dhcp_client **ret); |
150 | ||
4b558378 ZJS |
151 | int sd_dhcp_client_attach_event( |
152 | sd_dhcp_client *client, | |
153 | sd_event *event, | |
154 | int64_t priority); | |
b25ef18b TG |
155 | int sd_dhcp_client_detach_event(sd_dhcp_client *client); |
156 | sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client); | |
011feef8 | 157 | |
4afd3348 LP |
158 | _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_client, sd_dhcp_client_unref); |
159 | ||
04c01369 LP |
160 | _SD_END_DECLARATIONS; |
161 | ||
011feef8 | 162 | #endif |