summaryrefslogtreecommitdiff
path: root/dhcpv6.h
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6.h')
-rw-r--r--dhcpv6.h34
1 files changed, 18 insertions, 16 deletions
diff --git a/dhcpv6.h b/dhcpv6.h
index 1596034..79d9a40 100644
--- a/dhcpv6.h
+++ b/dhcpv6.h
@@ -1,3 +1,12 @@
+
+/* these structures are word aligned */
+#pragma pack(push)
+#pragma pack(2)
+struct vlan_tag {
+ u_int16_t tpid;
+ u_int16_t tci;
+};
+
struct dhcpv6_msg { /* [RFC3315] ch 6 */
u_int8_t msg_type; /* Message type */
u_int8_t xid[3]; /* transaction-id */
@@ -19,24 +28,17 @@ struct dhcpv6_option { /* [RFC3315] generic option */
char data[]; /* any */
};
-struct dhcpv6_interface_id { /* [RFC3315] ch 22.18 */
- u_int16_t code; /* option-code (18) */
- u_int16_t len; /* option-len */
- char id[]; /* interface-id */
-};
+#pragma pack(pop)
-struct dhcpv6_remote_id { /* [RFC4649] */
- u_int16_t code; /* option-code (37) */
- u_int16_t len; /* option-len */
- u_int32_t enterprise; /* enterprise-number */
- char id[]; /* remote-id */
-};
+static struct dhcpv6_option *nextopt(const struct dhcpv6_option *opt) {
+ return (struct dhcpv6_option *)((char *)opt + sizeof(struct dhcpv6_option) + ntohs(opt->len));
+}
-struct dhcpv6_subscriber_id { /* [RFC4580] */
- u_int16_t code; /* option-code (38) */
- u_int16_t len; /* option-len */
- char id[]; /* subscriber-id */
-};
+
+#define NEXTOPT(x) \
+ x = ((struct dhcpv6_option *)x)->len ? \
+ (struct dhcpv6_option *)((char *)x + (ntohs(((struct dhcpv6_option *)x)->len) + sizeof(struct dhcpv6_option))) : \
+ NULL
/* all the following are ref http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */