*: mass renaming of USE_XXXX to IF_XXXX
[platform/upstream/busybox.git] / networking / udhcp / dhcpc.h
1 /* vi: set sw=4 ts=4: */
2 /* dhcpc.h */
3 #ifndef UDHCP_DHCPC_H
4 #define UDHCP_DHCPC_H 1
5
6 PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
7
8 struct client_config_t {
9         uint8_t arp[6];                 /* Our arp address */
10         /* TODO: combine flag fields into single "unsigned opt" */
11         /* (can be set directly to the result of getopt32) */
12         char no_default_options;        /* Do not include default optins in request */
13         IF_FEATURE_UDHCP_PORT(uint16_t port;)
14         int ifindex;                    /* Index number of the interface to use */
15         uint8_t opt_mask[256 / 8];      /* Bitmask of options to send (-O option) */
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         uint8_t *clientid;              /* Optional client id to use */
20         uint8_t *vendorclass;           /* Optional vendor class-id to use */
21         uint8_t *hostname;              /* Optional hostname to use */
22         uint8_t *fqdn;                  /* Optional fully qualified domain name to use */
23 };
24
25 /* server_config sits in 1st half of bb_common_bufsiz1 */
26 #define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2]))
27
28 #if ENABLE_FEATURE_UDHCP_PORT
29 #define CLIENT_PORT (client_config.port)
30 #else
31 #define CLIENT_PORT 68
32 #endif
33
34
35 /*** clientpacket.h ***/
36
37 uint32_t random_xid(void) FAST_FUNC;
38 int send_discover(uint32_t xid, uint32_t requested) FAST_FUNC;
39 int send_select(uint32_t xid, uint32_t server, uint32_t requested) FAST_FUNC;
40 #if ENABLE_FEATURE_UDHCPC_ARPING
41 int send_decline(uint32_t xid, uint32_t server, uint32_t requested) FAST_FUNC;
42 #endif
43 int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) FAST_FUNC;
44 int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) FAST_FUNC;
45 int send_release(uint32_t server, uint32_t ciaddr) FAST_FUNC;
46
47 int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd) FAST_FUNC;
48
49 POP_SAVED_FUNCTION_VISIBILITY
50
51 #endif