2618b12b5c59518b18797cc96e3e6fc7c5ad17e3
[oweals/busybox.git] / networking / udhcp / dhcpc.h
1 /* vi: set sw=4 ts=4: */
2 /*
3  * Licensed under GPLv2, see file LICENSE in this source tree.
4  */
5 #ifndef UDHCP_DHCPC_H
6 #define UDHCP_DHCPC_H 1
7
8 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
9
10 struct client_config_t {
11         uint8_t client_mac[6];          /* Our mac address */
12         IF_FEATURE_UDHCP_PORT(uint16_t port;)
13         int ifindex;                    /* Index number of the interface to use */
14         uint8_t opt_mask[256 / 8];      /* Bitmask of options to send (-O option) */
15 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TODO: DHCPv6 has 16-bit option numbers
16         const char *interface;          /* The name of the interface to use */
17         char *pidfile;                  /* Optionally store the process ID */
18         const char *script;             /* User script to run at dhcp events */
19         struct option_set *options;     /* list of DHCP options to send to server */
20         uint8_t *clientid;              /* Optional client id to use */
21         uint8_t *vendorclass;           /* Optional vendor class-id to use */
22         uint8_t *hostname;              /* Optional hostname to use */
23         uint8_t *fqdn;                  /* Optional fully qualified domain name to use */
24
25         uint16_t first_secs;
26         uint16_t last_secs;
27
28         int sockfd;
29         smallint listen_mode;
30         smallint state;
31 } FIX_ALIASING;
32
33 /* server_config sits in 1st half of bb_common_bufsiz1 */
34 #define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2]))
35
36 #if ENABLE_FEATURE_UDHCP_PORT
37 #define CLIENT_PORT  (client_config.port)
38 #define CLIENT_PORT6 (client_config.port)
39 #else
40 #define CLIENT_PORT  68
41 #define CLIENT_PORT6 546
42 #endif
43
44 POP_SAVED_FUNCTION_VISIBILITY
45
46 #endif