blob: 04e320cf0de7be8a52a20243fe88b73f57fbfe33 [file] [log] [blame]
"Robert P. J. Day"63fc1a92006-07-02 19:47:05 +00001/* vi: set sw=4 ts=4: */
Mike Frysinger7031f622006-05-08 03:20:50 +00002/* dhcpc.h */
Denis Vlasenko223bc972007-11-22 00:58:49 +00003
Mike Frysinger7031f622006-05-08 03:20:50 +00004#ifndef _DHCPC_H
5#define _DHCPC_H
6
Denis Vlasenko98636eb2008-05-09 17:59:34 +00007#if __GNUC_PREREQ(4,1)
8# pragma GCC visibility push(hidden)
9#endif
10
Mike Frysinger7031f622006-05-08 03:20:50 +000011struct client_config_t {
Denis Vlasenko21765fa2008-06-13 20:44:05 +000012 uint8_t arp[6]; /* Our arp address */
Denis Vlasenkoe2d3ded2006-11-27 23:43:28 +000013 /* TODO: combine flag fields into single "unsigned opt" */
14 /* (can be set directly to the result of getopt32) */
Denis Vlasenko2e4c3c42008-04-02 13:04:19 +000015 char no_default_options; /* Do not include default optins in request */
Denis Vlasenkoff7cd6f2008-06-15 09:58:53 +000016 USE_FEATURE_UDHCP_PORT(uint16_t port;)
Denis Vlasenko21765fa2008-06-13 20:44:05 +000017 int ifindex; /* Index number of the interface to use */
18 uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */
Denis Vlasenkoc82b5102007-07-01 17:05:57 +000019 const char *interface; /* The name of the interface to use */
Denis Vlasenkoe2d3ded2006-11-27 23:43:28 +000020 char *pidfile; /* Optionally store the process ID */
Denis Vlasenkoc82b5102007-07-01 17:05:57 +000021 const char *script; /* User script to run at dhcp events */
Denis Vlasenkoe2d3ded2006-11-27 23:43:28 +000022 uint8_t *clientid; /* Optional client id to use */
23 uint8_t *vendorclass; /* Optional vendor class-id to use */
24 uint8_t *hostname; /* Optional hostname to use */
25 uint8_t *fqdn; /* Optional fully qualified domain name to use */
Mike Frysinger7031f622006-05-08 03:20:50 +000026};
27
Denis Vlasenkod55fe3e2008-02-04 13:12:16 +000028/* server_config sits in 1st half of bb_common_bufsiz1 */
Denis Vlasenko21765fa2008-06-13 20:44:05 +000029#define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2]))
Denis Vlasenkod55fe3e2008-02-04 13:12:16 +000030
31#if ENABLE_FEATURE_UDHCP_PORT
32#define CLIENT_PORT (client_config.port)
33#else
34#define CLIENT_PORT 68
35#endif
Mike Frysinger7031f622006-05-08 03:20:50 +000036
37
Denis Vlasenko5a3395b2006-11-18 19:51:32 +000038/*** clientpacket.h ***/
39
Denis Vlasenko42b3dea2007-07-03 15:47:50 +000040uint32_t random_xid(void);
41int send_discover(uint32_t xid, uint32_t requested);
42int send_selecting(uint32_t xid, uint32_t server, uint32_t requested);
Denis Vlasenko223bc972007-11-22 00:58:49 +000043#if ENABLE_FEATURE_UDHCPC_ARPING
Denis Vlasenkoca9635b2008-01-25 19:27:08 +000044int send_decline(uint32_t xid, uint32_t server, uint32_t requested);
Denis Vlasenko223bc972007-11-22 00:58:49 +000045#endif
Denis Vlasenko42b3dea2007-07-03 15:47:50 +000046int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr);
47int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr);
48int send_release(uint32_t server, uint32_t ciaddr);
Denis Vlasenko6de89942008-05-21 07:05:06 +000049
50int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd);
Denis Vlasenko5a3395b2006-11-18 19:51:32 +000051
Denis Vlasenko98636eb2008-05-09 17:59:34 +000052#if __GNUC_PREREQ(4,1)
53# pragma GCC visibility pop
54#endif
Denis Vlasenko5a3395b2006-11-18 19:51:32 +000055
Mike Frysinger7031f622006-05-08 03:20:50 +000056#endif