Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 1 | /* options.h */ |
| 2 | #ifndef _OPTIONS_H |
| 3 | #define _OPTIONS_H |
| 4 | |
| 5 | #include "packet.h" |
| 6 | |
Glenn L McGrath | 6b5bd0e | 2002-12-08 22:17:54 +0000 | [diff] [blame] | 7 | #include "config.h" |
| 8 | |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 9 | #define TYPE_MASK 0x0F |
| 10 | |
| 11 | enum { |
| 12 | OPTION_IP=1, |
| 13 | OPTION_IP_PAIR, |
| 14 | OPTION_STRING, |
| 15 | OPTION_BOOLEAN, |
| 16 | OPTION_U8, |
| 17 | OPTION_U16, |
| 18 | OPTION_S16, |
| 19 | OPTION_U32, |
| 20 | OPTION_S32 |
| 21 | }; |
| 22 | |
| 23 | #define OPTION_REQ 0x10 /* have the client request this option */ |
| 24 | #define OPTION_LIST 0x20 /* There can be a list of 1 or more of these */ |
Glenn L McGrath | 6b5bd0e | 2002-12-08 22:17:54 +0000 | [diff] [blame] | 25 | #define OPTION_PREFIX 0x40 /* ip wants a prefix instead of a ip for subnet */ |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 26 | |
| 27 | struct dhcp_option { |
| 28 | char name[10]; |
| 29 | char flags; |
| 30 | unsigned char code; |
| 31 | }; |
| 32 | |
| 33 | extern struct dhcp_option options[]; |
| 34 | extern int option_lengths[]; |
| 35 | |
| 36 | unsigned char *get_option(struct dhcpMessage *packet, int code); |
| 37 | int end_option(unsigned char *optionptr); |
| 38 | int add_option_string(unsigned char *optionptr, unsigned char *string); |
| 39 | int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data); |
| 40 | struct option_set *find_option(struct option_set *opt_list, char code); |
| 41 | void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length); |
| 42 | |
| 43 | #endif |