www.usr.com/support/gpl/USR9113_release1.0.tar.gz
[bcm963xx.git] / userapps / opensource / udhcp / options.h
1 /* options.h */
2 #ifndef _OPTIONS_H
3 #define _OPTIONS_H
4
5 #include "packet.h"
6
7 #define TYPE_MASK       0x0F
8
9 enum {
10         OPTION_IP=1,
11         OPTION_IP_PAIR,
12         OPTION_STRING,
13         OPTION_BOOLEAN,
14         OPTION_U8,
15         OPTION_U16,
16         OPTION_S16,
17         OPTION_U32,
18         OPTION_S32
19 };
20
21 #define OPTION_LIST     0x80
22
23 struct dhcp_option {
24         char name[10];
25         char flags;
26         char code;
27 };
28
29 extern struct dhcp_option options[];
30 extern int option_lengths[];
31
32 unsigned char *get_option(struct dhcpMessage *packet, int code);
33 int end_option(unsigned char *optionptr);
34 int add_option_string(unsigned char *optionptr, unsigned char *string);
35 int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data);
36 struct option_set *find_option(struct option_set *opt_list, char code);
37 void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length);
38
39 // brcm
40 extern char session_path[];
41
42 // brcm
43 int createVIoption(int type, char *VIinfo);
44 int saveVIoption(char *option, u_int32_t ipAddr);
45
46 #define _PATH_RESOLV     "/var/fyi/sys/dns"
47 #define _PATH_GW         "/var/fyi/sys/gateway"
48 #define _PATH_SYS_DIR    "/var/fyi/sys"
49
50 #define _PATH_WAN_DIR   "/proc/var/fyi/wan"
51 #define _PATH_MSG       "daemonstatus"
52 #define _PATH_IP        "ipaddress"
53 #define _PATH_MASK      "subnetmask"
54 #define _PATH_PID       "pid"
55
56 /* option header: 2 bytes + subcode headers (6) + option data (64*2+6);
57    these are TR111 option data.    Option can be longer.  */
58 #define VENDOR_BRCM_ENTERPRISE_NUMBER     4413
59 #define VENDOR_ENTERPRISE_LEN             4    /* 4 bytes */
60 #define VENDOR_IDENTIFYING_INFO_LEN       142
61 #define VENDOR_IDENTIFYING_OPTION_CODE    125
62 #define VENDOR_OPTION_CODE_OFFSET         0
63 #define VENDOR_OPTION_LEN_OFFSET          1
64 #define VENDOR_OPTION_ENTERPRISE_OFFSET   2
65 #define VENDOR_OPTION_DATA_OFFSET         6
66 #define VENDOR_SUBCODE_AND_LEN_BYTES      2
67 #define VENDOR_DEVICE_OUI_SUBCODE            1
68 #define VENDOR_DEVICE_SERIAL_NUMBER_SUBCODE  2
69 #define VENDOR_DEVICE_PRODUCT_CLASS_SUBCODE  3
70 #define VENDOR_GATEWAY_OUI_SUBCODE           4
71 #define VENDOR_GATEWAY_SERIAL_NUMBER_SUBCODE 5
72 #define VENDOR_GATEWAY_PRODUCT_CLASS_SUBCODE 6
73 #define VENDOR_IDENTIFYING_FOR_GATEWAY       1
74 #define VENDOR_IDENTIFYING_FOR_DEVICE        2
75 #define VENDOR_GATEWAY_OUI_MAX_LEN           6
76 #define VENDOR_GATEWAY_SERIAL_NUMBER_MAX_LEN 64 
77 #define VENDOR_GATEWAY_PRODUCT_CLASS_MAX_LEN 64
78
79 #endif