blob: 11f013fd476fc47e0d4eceeb06479ed457b980ff [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/* options.h */
3#ifndef _OPTIONS_H
4#define _OPTIONS_H
5
Mike Frysinger7031f622006-05-08 03:20:50 +00006#define TYPE_MASK 0x0F
7
8enum {
9 OPTION_IP=1,
10 OPTION_IP_PAIR,
11 OPTION_STRING,
Denis Vlasenko50664732007-02-27 21:15:08 +000012#if ENABLE_FEATURE_RFC3397
13 OPTION_STR1035, /* RFC1035 compressed domain name list */
14#endif
Mike Frysinger7031f622006-05-08 03:20:50 +000015 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 */
25
26struct dhcp_option {
Denis Vlasenkoe175ff22006-09-26 17:41:00 +000027 char name[12];
Mike Frysinger7031f622006-05-08 03:20:50 +000028 char flags;
29 uint8_t code;
30};
31
Denis Vlasenkoc90c3f32006-11-23 12:57:49 +000032extern const struct dhcp_option dhcp_options[];
33extern const unsigned char option_lengths[];
Mike Frysinger7031f622006-05-08 03:20:50 +000034
35uint8_t *get_option(struct dhcpMessage *packet, int code);
36int end_option(uint8_t *optionptr);
37int add_option_string(uint8_t *optionptr, uint8_t *string);
38int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data);
Denis Vlasenko50664732007-02-27 21:15:08 +000039#if ENABLE_FEATURE_RFC3397
40char *dname_dec(const uint8_t *cstr, int clen, const char *pre);
41uint8_t *dname_enc(const uint8_t *cstr, int clen, const char *src, int *retlen);
42#endif
Mike Frysinger7031f622006-05-08 03:20:50 +000043
44#endif