blob: dccaa2af92426356a29d5b712603420881716336 [file] [log] [blame]
Russ Dill61fb4892002-10-14 21:41:28 +00001/* options.h */
2#ifndef _OPTIONS_H
3#define _OPTIONS_H
4
5#include "packet.h"
6
Glenn L McGrath6b5bd0e2002-12-08 22:17:54 +00007#include "config.h"
8
Russ Dill61fb4892002-10-14 21:41:28 +00009#define TYPE_MASK 0x0F
10
11enum {
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 McGrath6b5bd0e2002-12-08 22:17:54 +000025#define OPTION_PREFIX 0x40 /* ip wants a prefix instead of a ip for subnet */
Russ Dill61fb4892002-10-14 21:41:28 +000026
27struct dhcp_option {
28 char name[10];
29 char flags;
30 unsigned char code;
31};
32
33extern struct dhcp_option options[];
34extern int option_lengths[];
35
36unsigned char *get_option(struct dhcpMessage *packet, int code);
37int end_option(unsigned char *optionptr);
38int add_option_string(unsigned char *optionptr, unsigned char *string);
39int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data);
40struct option_set *find_option(struct option_set *opt_list, char code);
41void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length);
42
43#endif