1 |
/* vi: set sw=4 ts=4: */ |
/* vi: set sw=4 ts=4: */ |
2 |
/* dhcpc.h */ |
/* dhcpc.h */ |
3 |
|
|
4 |
#ifndef _DHCPC_H |
#ifndef _DHCPC_H |
5 |
#define _DHCPC_H |
#define _DHCPC_H |
6 |
|
|
7 |
#define INIT_SELECTING 0 |
#if __GNUC_PREREQ(4,1) |
8 |
#define REQUESTING 1 |
# pragma GCC visibility push(hidden) |
9 |
#define BOUND 2 |
#endif |
|
#define RENEWING 3 |
|
|
#define REBINDING 4 |
|
|
#define INIT_REBOOT 5 |
|
|
#define RENEW_REQUESTED 6 |
|
|
#define RELEASED 7 |
|
10 |
|
|
11 |
struct client_config_t { |
struct client_config_t { |
12 |
|
uint8_t arp[6]; /* Our arp address */ |
13 |
/* TODO: combine flag fields into single "unsigned opt" */ |
/* TODO: combine flag fields into single "unsigned opt" */ |
14 |
/* (can be set directly to the result of getopt32) */ |
/* (can be set directly to the result of getopt32) */ |
15 |
char foreground; /* Do not fork */ |
char no_default_options; /* Do not include default optins in request */ |
16 |
char quit_after_lease; /* Quit after obtaining lease */ |
USE_FEATURE_UDHCP_PORT(uint16_t port;) |
17 |
char release_on_quit; /* perform release on quit */ |
int ifindex; /* Index number of the interface to use */ |
18 |
char abort_if_no_lease; /* Abort if no lease */ |
uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */ |
19 |
char background_if_no_lease; /* Fork to background if no lease */ |
const char *interface; /* The name of the interface to use */ |
|
char *interface; /* The name of the interface to use */ |
|
20 |
char *pidfile; /* Optionally store the process ID */ |
char *pidfile; /* Optionally store the process ID */ |
21 |
char *script; /* User script to run at dhcp events */ |
const char *script; /* User script to run at dhcp events */ |
22 |
uint8_t *clientid; /* Optional client id to use */ |
uint8_t *clientid; /* Optional client id to use */ |
23 |
uint8_t *vendorclass; /* Optional vendor class-id to use */ |
uint8_t *vendorclass; /* Optional vendor class-id to use */ |
24 |
uint8_t *hostname; /* Optional hostname to use */ |
uint8_t *hostname; /* Optional hostname to use */ |
25 |
uint8_t *fqdn; /* Optional fully qualified domain name to use */ |
uint8_t *fqdn; /* Optional fully qualified domain name to use */ |
|
int ifindex; /* Index number of the interface to use */ |
|
|
int retries; /* Max number of request packets */ |
|
|
int timeout; /* Number of seconds to try to get a lease */ |
|
|
uint8_t arp[6]; /* Our arp address */ |
|
26 |
}; |
}; |
27 |
|
|
28 |
extern struct client_config_t client_config; |
/* server_config sits in 1st half of bb_common_bufsiz1 */ |
29 |
|
#define client_config (*(struct client_config_t*)(&bb_common_bufsiz1[COMMON_BUFSIZE / 2])) |
30 |
|
|
31 |
|
#if ENABLE_FEATURE_UDHCP_PORT |
32 |
|
#define CLIENT_PORT (client_config.port) |
33 |
|
#else |
34 |
|
#define CLIENT_PORT 68 |
35 |
|
#endif |
36 |
|
|
37 |
|
|
38 |
/*** clientpacket.h ***/ |
/*** clientpacket.h ***/ |
39 |
|
|
40 |
unsigned long random_xid(void); |
uint32_t random_xid(void) FAST_FUNC; |
41 |
int send_discover(unsigned long xid, unsigned long requested); |
int send_discover(uint32_t xid, uint32_t requested) FAST_FUNC; |
42 |
int send_selecting(unsigned long xid, unsigned long server, unsigned long requested); |
int send_select(uint32_t xid, uint32_t server, uint32_t requested) FAST_FUNC; |
43 |
int send_renew(unsigned long xid, unsigned long server, unsigned long ciaddr); |
#if ENABLE_FEATURE_UDHCPC_ARPING |
44 |
int send_renew(unsigned long xid, unsigned long server, unsigned long ciaddr); |
int send_decline(uint32_t xid, uint32_t server, uint32_t requested) FAST_FUNC; |
45 |
int send_release(unsigned long server, unsigned long ciaddr); |
#endif |
46 |
int get_raw_packet(struct dhcpMessage *payload, int fd); |
int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) FAST_FUNC; |
47 |
|
int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr) FAST_FUNC; |
48 |
|
int send_release(uint32_t server, uint32_t ciaddr) FAST_FUNC; |
49 |
|
|
50 |
|
int udhcp_recv_raw_packet(struct dhcpMessage *payload, int fd) FAST_FUNC; |
51 |
|
|
52 |
|
#if __GNUC_PREREQ(4,1) |
53 |
|
# pragma GCC visibility pop |
54 |
|
#endif |
55 |
|
|
56 |
#endif |
#endif |