diff options
author | Bjørn Mork <bjorn@mork.no> | 2011-11-09 16:07:33 +0100 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2011-11-09 16:20:37 +0100 |
commit | 5c72289e845695a7513f214f3d26c3f2ce78d0d8 (patch) | |
tree | e7d9c9be8e9864f4ba66186054e990ab1777ecc9 /dhcpv6.h | |
parent | 00ec9ddb987bc36fa4295dddd26ed54470673c98 (diff) |
Working relay both ways - Still need a lot of cleanup!
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Diffstat (limited to 'dhcpv6.h')
-rw-r--r-- | dhcpv6.h | 34 |
1 files changed, 18 insertions, 16 deletions
@@ -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 */ |