summaryrefslogtreecommitdiff
path: root/networking/udhcp/common.h
diff options
context:
space:
mode:
authorMartin Lewis <martin.lewis.x84@gmail.com>2020-06-23 15:25:08 -0500
committerDenys Vlasenko <vda.linux@googlemail.com>2020-06-29 14:57:02 +0200
commitacdc8eed89399a9fa5e7478ee40b928c65e3ab4e (patch)
tree406e5c338b8d22c895cb16bdee9151202efe0ead /networking/udhcp/common.h
parentfc2ce04a38ebfb03f9aeff205979786839cd5a7c (diff)
downloadbusybox-w32-acdc8eed89399a9fa5e7478ee40b928c65e3ab4e.tar.gz
busybox-w32-acdc8eed89399a9fa5e7478ee40b928c65e3ab4e.tar.bz2
busybox-w32-acdc8eed89399a9fa5e7478ee40b928c65e3ab4e.zip
udhcp: add option scanner
Added an option scanner to udhcp to enable iteration over packet options. Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/common.h')
-rw-r--r--networking/udhcp/common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index 6214db06a..81c1dcbdc 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -107,6 +107,12 @@ enum {
107 OPTION_LIST = 0x20, 107 OPTION_LIST = 0x20,
108}; 108};
109 109
110struct dhcp_scan_state {
111 int overload;
112 int rem;
113 uint8_t *optionptr;
114};
115
110/* DHCP option codes (partial list). See RFC 2132 and 116/* DHCP option codes (partial list). See RFC 2132 and
111 * http://www.iana.org/assignments/bootp-dhcp-parameters/ 117 * http://www.iana.org/assignments/bootp-dhcp-parameters/
112 * Commented out options are handled by common option machinery, 118 * Commented out options are handled by common option machinery,
@@ -206,6 +212,8 @@ extern const uint8_t dhcp_option_lengths[] ALIGN1;
206 212
207unsigned FAST_FUNC udhcp_option_idx(const char *name, const char *option_strings); 213unsigned FAST_FUNC udhcp_option_idx(const char *name, const char *option_strings);
208 214
215void init_scan_state(struct dhcp_packet *packet, struct dhcp_scan_state *scan_state) FAST_FUNC;
216uint8_t *udhcp_scan_options(struct dhcp_packet *packet, struct dhcp_scan_state *scan_state) FAST_FUNC;
209uint8_t *udhcp_get_option(struct dhcp_packet *packet, int code) FAST_FUNC; 217uint8_t *udhcp_get_option(struct dhcp_packet *packet, int code) FAST_FUNC;
210/* Same as above + ensures that option length is 4 bytes 218/* Same as above + ensures that option length is 4 bytes
211 * (returns NULL if size is different) 219 * (returns NULL if size is different)