diff options
Diffstat (limited to 'networking/udhcp/options.h')
-rw-r--r-- | networking/udhcp/options.h | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/networking/udhcp/options.h b/networking/udhcp/options.h index 75087fa35..b7c9d8f8d 100644 --- a/networking/udhcp/options.h +++ b/networking/udhcp/options.h | |||
@@ -32,45 +32,55 @@ enum { | |||
32 | /* Do not modify below here unless you know what you are doing!! */ | 32 | /* Do not modify below here unless you know what you are doing!! */ |
33 | /*****************************************************************/ | 33 | /*****************************************************************/ |
34 | 34 | ||
35 | /* DHCP protocol -- see RFC 2131 */ | 35 | /* DHCP protocol. See RFC 2131 */ |
36 | #define DHCP_MAGIC 0x63825363 | 36 | #define DHCP_MAGIC 0x63825363 |
37 | 37 | ||
38 | /* DHCP option codes (partial list) */ | 38 | /* DHCP option codes (partial list). See RFC 2132. |
39 | * Commented out options are handled by common option machinery, | ||
40 | * uncommented ones have spacial cases (grep for them to see). | ||
41 | */ | ||
39 | #define DHCP_PADDING 0x00 | 42 | #define DHCP_PADDING 0x00 |
40 | #define DHCP_SUBNET 0x01 | 43 | #define DHCP_SUBNET 0x01 |
41 | #define DHCP_TIME_OFFSET 0x02 | 44 | //#define DHCP_TIME_OFFSET 0x02 /* (localtime - UTC_time) in seconds. signed */ |
42 | #define DHCP_ROUTER 0x03 | 45 | //#define DHCP_ROUTER 0x03 |
43 | #define DHCP_TIME_SERVER 0x04 | 46 | //#define DHCP_TIME_SERVER 0x04 /* RFC 868 time server (32-bit, 0 = 1.1.1900) */ |
44 | //#define DHCP_NAME_SERVER 0x05 /* _really_ ancient kind of NS */ | 47 | //#define DHCP_NAME_SERVER 0x05 /* IEN 116 _really_ ancient kind of NS */ |
45 | #define DHCP_DNS_SERVER 0x06 | 48 | //#define DHCP_DNS_SERVER 0x06 |
46 | #define DHCP_LOG_SERVER 0x07 | 49 | //#define DHCP_LOG_SERVER 0x07 /* port 704 UDP log (not syslog) |
47 | //#define DHCP_COOKIE_SERVER 0x08 /* "quote of the day" server */ | 50 | //#define DHCP_COOKIE_SERVER 0x08 /* "quote of the day" server */ |
48 | #define DHCP_LPR_SERVER 0x09 | 51 | //#define DHCP_LPR_SERVER 0x09 |
49 | #define DHCP_HOST_NAME 0x0c /* either client informs server or server gives name to client */ | 52 | #define DHCP_HOST_NAME 0x0c /* either client informs server or server gives name to client */ |
50 | #define DHCP_BOOT_SIZE 0x0d | 53 | //#define DHCP_BOOT_SIZE 0x0d |
51 | #define DHCP_DOMAIN_NAME 0x0f /* server gives domain suffix */ | 54 | //#define DHCP_DOMAIN_NAME 0x0f /* server gives domain suffix */ |
52 | #define DHCP_SWAP_SERVER 0x10 | 55 | //#define DHCP_SWAP_SERVER 0x10 |
53 | #define DHCP_ROOT_PATH 0x11 | 56 | //#define DHCP_ROOT_PATH 0x11 |
54 | #define DHCP_IP_TTL 0x17 | 57 | //#define DHCP_IP_TTL 0x17 |
55 | #define DHCP_MTU 0x1a | 58 | //#define DHCP_MTU 0x1a |
56 | #define DHCP_BROADCAST 0x1c | 59 | //#define DHCP_BROADCAST 0x1c |
57 | #define DHCP_NTP_SERVER 0x2a | 60 | //#define DHCP_NIS_DOMAIN 0x28 |
58 | #define DHCP_WINS_SERVER 0x2c | 61 | //#define DHCP_NIS_SERVER 0x29 |
62 | //#define DHCP_NTP_SERVER 0x2a | ||
63 | //#define DHCP_WINS_SERVER 0x2c | ||
59 | #define DHCP_REQUESTED_IP 0x32 /* sent by client if specific IP is wanted */ | 64 | #define DHCP_REQUESTED_IP 0x32 /* sent by client if specific IP is wanted */ |
60 | #define DHCP_LEASE_TIME 0x33 | 65 | #define DHCP_LEASE_TIME 0x33 |
61 | #define DHCP_OPTION_OVERLOAD 0x34 | 66 | #define DHCP_OPTION_OVERLOAD 0x34 |
62 | #define DHCP_MESSAGE_TYPE 0x35 | 67 | #define DHCP_MESSAGE_TYPE 0x35 |
63 | #define DHCP_SERVER_ID 0x36 /* by default server's IP */ | 68 | #define DHCP_SERVER_ID 0x36 /* by default server's IP */ |
64 | #define DHCP_PARAM_REQ 0x37 /* list of options client wants */ | 69 | #define DHCP_PARAM_REQ 0x37 /* list of options client wants */ |
65 | #define DHCP_MESSAGE 0x38 /* error message when sending NAK etc */ | 70 | //#define DHCP_ERR_MESSAGE 0x38 /* error message when sending NAK etc */ |
66 | #define DHCP_MAX_SIZE 0x39 | 71 | #define DHCP_MAX_SIZE 0x39 |
67 | //#define DHCP_T1 0x3a | ||
68 | //#define DHCP_T2 0x3b | ||
69 | #define DHCP_VENDOR 0x3c /* client's vendor (a string) */ | 72 | #define DHCP_VENDOR 0x3c /* client's vendor (a string) */ |
70 | #define DHCP_CLIENT_ID 0x3d /* by default client's MAC addr, but may be arbitrarily long */ | 73 | #define DHCP_CLIENT_ID 0x3d /* by default client's MAC addr, but may be arbitrarily long */ |
74 | //#define DHCP_TFTP_SERVER_NAME 0x42 /* same as 'sname' field */ | ||
75 | //#define DHCP_BOOT_FILE 0x43 /* same as 'file' field */ | ||
76 | //#define DHCP_USER_CLASS 0x4d /* RFC 3004. set of LASCII strings. "I am a printer" etc */ | ||
71 | #define DHCP_FQDN 0x51 /* client asks to update DNS to map its FQDN to its new IP */ | 77 | #define DHCP_FQDN 0x51 /* client asks to update DNS to map its FQDN to its new IP */ |
72 | #define DHCP_STATIC_ROUTES 0x79 | 78 | //#define DHCP_DOMAIN_SEARCH 0x77 /* RFC 3397. set of ASCIZ string, DNS-style compressed */ |
73 | #define DHCP_END 0xFF | 79 | //#define DHCP_STATIC_ROUTES 0x79 /* RFC 3442. (mask,ip,router) tuples */ |
80 | //#define DHCP_WPAD 0xfc /* MSIE's Web Proxy Autodiscovery Protocol */ | ||
81 | #define DHCP_END 0xff | ||
82 | |||
83 | |||
74 | /* Offsets in option byte sequence */ | 84 | /* Offsets in option byte sequence */ |
75 | #define OPT_CODE 0 | 85 | #define OPT_CODE 0 |
76 | #define OPT_LEN 1 | 86 | #define OPT_LEN 1 |
@@ -106,8 +116,8 @@ extern const uint8_t dhcp_option_lengths[]; | |||
106 | 116 | ||
107 | uint8_t *get_option(struct dhcp_packet *packet, int code) FAST_FUNC; | 117 | uint8_t *get_option(struct dhcp_packet *packet, int code) FAST_FUNC; |
108 | int end_option(uint8_t *optionptr) FAST_FUNC; | 118 | int end_option(uint8_t *optionptr) FAST_FUNC; |
109 | int add_option_string(uint8_t *optionptr, uint8_t *string) FAST_FUNC; | 119 | void add_option_string(uint8_t *optionptr, uint8_t *string) FAST_FUNC; |
110 | int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data) FAST_FUNC; | 120 | void add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data) FAST_FUNC; |
111 | #if ENABLE_FEATURE_UDHCP_RFC3397 | 121 | #if ENABLE_FEATURE_UDHCP_RFC3397 |
112 | char *dname_dec(const uint8_t *cstr, int clen, const char *pre) FAST_FUNC; | 122 | char *dname_dec(const uint8_t *cstr, int clen, const char *pre) FAST_FUNC; |
113 | uint8_t *dname_enc(const uint8_t *cstr, int clen, const char *src, int *retlen) FAST_FUNC; | 123 | uint8_t *dname_enc(const uint8_t *cstr, int clen, const char *src, int *retlen) FAST_FUNC; |