"Robert P. J. Day" | 63fc1a9 | 2006-07-02 19:47:05 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Mike Frysinger | 7031f62 | 2006-05-08 03:20:50 +0000 | [diff] [blame] | 2 | /* options.h */ |
| 3 | #ifndef _OPTIONS_H |
| 4 | #define _OPTIONS_H |
| 5 | |
| 6 | #include "packet.h" |
| 7 | |
| 8 | #define TYPE_MASK 0x0F |
| 9 | |
| 10 | enum { |
| 11 | OPTION_IP=1, |
| 12 | OPTION_IP_PAIR, |
| 13 | OPTION_STRING, |
| 14 | OPTION_BOOLEAN, |
| 15 | OPTION_U8, |
| 16 | OPTION_U16, |
| 17 | OPTION_S16, |
| 18 | OPTION_U32, |
| 19 | OPTION_S32 |
| 20 | }; |
| 21 | |
| 22 | #define OPTION_REQ 0x10 /* have the client request this option */ |
| 23 | #define OPTION_LIST 0x20 /* There can be a list of 1 or more of these */ |
| 24 | |
| 25 | struct dhcp_option { |
| 26 | char name[10]; |
| 27 | char flags; |
| 28 | uint8_t code; |
| 29 | }; |
| 30 | |
| 31 | extern struct dhcp_option dhcp_options[]; |
| 32 | extern int option_lengths[]; |
| 33 | |
| 34 | uint8_t *get_option(struct dhcpMessage *packet, int code); |
| 35 | int end_option(uint8_t *optionptr); |
| 36 | int add_option_string(uint8_t *optionptr, uint8_t *string); |
| 37 | int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data); |
| 38 | |
| 39 | #endif |