Remove building with NOCRYPTO option
[minix3.git] / external / bsd / dhcpcd / dist / if-options.h
blobaa618f4a2fb3cffae2cdfc11457d10175bb858e4
1 /* $NetBSD: if-options.h,v 1.14 2015/09/04 12:25:01 roy Exp $ */
3 /*
4 * dhcpcd - DHCP client daemon
5 * Copyright (c) 2006-2015 Roy Marples <roy@marples.name>
6 * All rights reserved
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
30 #ifndef IF_OPTIONS_H
31 #define IF_OPTIONS_H
33 #include <sys/param.h>
34 #include <sys/socket.h>
35 #include <net/if.h>
36 #include <netinet/in.h>
38 #include <getopt.h>
39 #include <limits.h>
40 #include <stdint.h>
42 #include "auth.h"
44 /* Don't set any optional arguments here so we retain POSIX
45 * compatibility with getopt */
46 #define IF_OPTS "46bc:de:f:gh:i:j:kl:m:no:pqr:s:t:u:v:wxy:z:" \
47 "ABC:DEF:GHI:JKLMO:Q:S:TUVW:X:Z:"
49 #define DEFAULT_TIMEOUT 30
50 #define DEFAULT_REBOOT 5
52 #ifndef HOSTNAME_MAX_LEN
53 #define HOSTNAME_MAX_LEN 250 /* 255 - 3 (FQDN) - 2 (DNS enc) */
54 #endif
55 #define VENDORCLASSID_MAX_LEN 255
56 #define CLIENTID_MAX_LEN 48
57 #define USERCLASS_MAX_LEN 255
58 #define VENDOR_MAX_LEN 255
60 #define DHCPCD_ARP (1ULL << 0)
61 #define DHCPCD_RELEASE (1ULL << 1)
62 #define DHCPCD_DOMAIN (1ULL << 2)
63 #define DHCPCD_GATEWAY (1ULL << 3)
64 #define DHCPCD_STATIC (1ULL << 4)
65 #define DHCPCD_DEBUG (1ULL << 5)
66 #define DHCPCD_LASTLEASE (1ULL << 7)
67 #define DHCPCD_INFORM (1ULL << 8)
68 #define DHCPCD_REQUEST (1ULL << 9)
69 #define DHCPCD_IPV4LL (1ULL << 10)
70 #define DHCPCD_DUID (1ULL << 11)
71 #define DHCPCD_PERSISTENT (1ULL << 12)
72 #define DHCPCD_DAEMONISE (1ULL << 14)
73 #define DHCPCD_DAEMONISED (1ULL << 15)
74 #define DHCPCD_TEST (1ULL << 16)
75 #define DHCPCD_MASTER (1ULL << 17)
76 #define DHCPCD_HOSTNAME (1ULL << 18)
77 #define DHCPCD_CLIENTID (1ULL << 19)
78 #define DHCPCD_LINK (1ULL << 20)
79 #define DHCPCD_QUIET (1ULL << 21)
80 #define DHCPCD_BACKGROUND (1ULL << 22)
81 #define DHCPCD_VENDORRAW (1ULL << 23)
82 #define DHCPCD_NOWAITIP (1ULL << 24) /* To force daemonise */
83 #define DHCPCD_WAITIP (1ULL << 25)
84 #define DHCPCD_SLAACPRIVATE (1ULL << 26)
85 #define DHCPCD_CSR_WARNED (1ULL << 27)
86 #define DHCPCD_XID_HWADDR (1ULL << 28)
87 #define DHCPCD_BROADCAST (1ULL << 29)
88 #define DHCPCD_DUMPLEASE (1ULL << 30)
89 #define DHCPCD_IPV6RS (1ULL << 31)
90 #define DHCPCD_IPV6RA_REQRDNSS (1ULL << 32)
91 #define DHCPCD_IPV6RA_OWN (1ULL << 33)
92 #define DHCPCD_IPV6RA_OWN_DEFAULT (1ULL << 34)
93 #define DHCPCD_IPV4 (1ULL << 35)
94 #define DHCPCD_FORKED (1ULL << 36)
95 #define DHCPCD_IPV6 (1ULL << 37)
96 #define DHCPCD_STARTED (1ULL << 38)
97 #define DHCPCD_NOALIAS (1ULL << 39)
98 #define DHCPCD_IA_FORCED (1ULL << 40)
99 #define DHCPCD_STOPPING (1ULL << 41)
100 #define DHCPCD_DEPARTED (1ULL << 42)
101 #define DHCPCD_HOSTNAME_SHORT (1ULL << 43)
102 #define DHCPCD_EXITING (1ULL << 44)
103 #define DHCPCD_WAITIP4 (1ULL << 45)
104 #define DHCPCD_WAITIP6 (1ULL << 46)
105 #define DHCPCD_DEV (1ULL << 47)
106 #define DHCPCD_IAID (1ULL << 48)
107 #define DHCPCD_DHCP (1ULL << 49)
108 #define DHCPCD_DHCP6 (1ULL << 50)
109 #define DHCPCD_IF_UP (1ULL << 51)
110 // unassigned (1ULL << 52)
111 // unassinged (1ULL << 53)
112 #define DHCPCD_IPV6RA_AUTOCONF (1ULL << 54)
113 #define DHCPCD_ROUTER_HOST_ROUTE_WARNED (1ULL << 55)
114 #define DHCPCD_IPV6RA_ACCEPT_NOPUBLIC (1ULL << 56)
115 #define DHCPCD_BOOTP (1ULL << 57)
116 #define DHCPCD_INITIAL_DELAY (1ULL << 58)
118 #define DHCPCD_NODROP (DHCPCD_EXITING | DHCPCD_PERSISTENT)
120 #define DHCPCD_WAITOPTS (DHCPCD_WAITIP | DHCPCD_WAITIP4 | DHCPCD_WAITIP6)
122 #define DHCPCD_WARNINGS (DHCPCD_CSR_WARNED | \
123 DHCPCD_ROUTER_HOST_ROUTE_WARNED)
125 extern const struct option cf_options[];
127 struct if_sla {
128 char ifname[IF_NAMESIZE];
129 uint32_t sla;
130 uint8_t prefix_len;
131 int8_t sla_set;
134 struct if_ia {
135 uint8_t iaid[4];
136 #ifdef INET6
137 uint16_t ia_type;
138 uint8_t iaid_set;
139 struct in6_addr addr;
140 uint8_t prefix_len;
141 uint32_t sla_max;
142 size_t sla_len;
143 struct if_sla *sla;
144 #endif
147 struct vivco {
148 size_t len;
149 uint8_t *data;
152 struct if_options {
153 time_t mtime;
154 uint8_t iaid[4];
155 int metric;
156 uint8_t requestmask[256 / NBBY];
157 uint8_t requiremask[256 / NBBY];
158 uint8_t nomask[256 / NBBY];
159 uint8_t rejectmask[256 / NBBY];
160 uint8_t dstmask[256 / NBBY];
161 uint8_t requestmasknd[(UINT16_MAX + 1) / NBBY];
162 uint8_t requiremasknd[(UINT16_MAX + 1) / NBBY];
163 uint8_t nomasknd[(UINT16_MAX + 1) / NBBY];
164 uint8_t rejectmasknd[(UINT16_MAX + 1) / NBBY];
165 uint8_t requestmask6[(UINT16_MAX + 1) / NBBY];
166 uint8_t requiremask6[(UINT16_MAX + 1) / NBBY];
167 uint8_t nomask6[(UINT16_MAX + 1) / NBBY];
168 uint8_t rejectmask6[(UINT16_MAX + 1) / NBBY];
169 uint32_t leasetime;
170 time_t timeout;
171 time_t reboot;
172 unsigned long long options;
174 struct in_addr req_addr;
175 struct in_addr req_mask;
176 struct rt_head *routes;
177 unsigned int mtu;
178 char **config;
180 char **environ;
181 char *script;
183 char hostname[HOSTNAME_MAX_LEN + 1]; /* We don't store the length */
184 uint8_t fqdn;
185 uint8_t vendorclassid[VENDORCLASSID_MAX_LEN + 2];
186 uint8_t clientid[CLIENTID_MAX_LEN + 2];
187 uint8_t userclass[USERCLASS_MAX_LEN + 2];
188 uint8_t vendor[VENDOR_MAX_LEN + 2];
190 size_t blacklist_len;
191 in_addr_t *blacklist;
192 size_t whitelist_len;
193 in_addr_t *whitelist;
194 size_t arping_len;
195 in_addr_t *arping;
196 char *fallback;
198 struct if_ia *ia;
199 size_t ia_len;
201 struct dhcp_opt *dhcp_override;
202 size_t dhcp_override_len;
203 struct dhcp_opt *nd_override;
204 size_t nd_override_len;
205 struct dhcp_opt *dhcp6_override;
206 size_t dhcp6_override_len;
207 uint32_t vivco_en;
208 struct vivco *vivco;
209 size_t vivco_len;
210 struct dhcp_opt *vivso_override;
211 size_t vivso_override_len;
213 struct auth auth;
216 struct if_options *read_config(struct dhcpcd_ctx *,
217 const char *, const char *, const char *);
218 int add_options(struct dhcpcd_ctx *, const char *,
219 struct if_options *, int, char **);
220 void free_dhcp_opt_embenc(struct dhcp_opt *);
221 void free_options(struct if_options *);
223 #endif