diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-07-29 21:35:03 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-07-30 13:14:43 +0000 |
commit | e3d78be0b47537b61fd431e15e7c4ec2b4b4a5b6 (patch) | |
tree | dadd8cfe132127b2a23cddf65565193247792e73 /wsutil | |
parent | 9e747b9c388df04b49d2794a59285d88a583ffc0 (diff) |
Move IPv6 inet definitions to wsutil/inet_ipv6.h
Change-Id: I880adf7fc1e131639f318cdecf7d8e59262d89fb
Reviewed-on: https://code.wireshark.org/review/16784
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/inet_ipv6.h | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/wsutil/inet_ipv6.h b/wsutil/inet_ipv6.h index 72cac4d302..dc7183c08e 100644 --- a/wsutil/inet_ipv6.h +++ b/wsutil/inet_ipv6.h @@ -22,10 +22,73 @@ #ifndef __INET_IPV6_H__ #define __INET_IPV6_H__ +#include <glib.h> + +#define IPv6_ADDR_SIZE 16 + +#define IPv6_HDR_SIZE 40 +#define IPv6_FRAGMENT_HDR_SIZE 8 + struct e_in6_addr { - guint8 bytes[16]; /**< 128 bit IP6 address */ + guint8 bytes[16]; /* 128 bit IPv6 address */ +}; + +/* + * Definition for internet protocol version 6. + * RFC 2460 + */ +struct ws_ip6_hdr { + guint32 ip6h_vc_flow; /* version, class, flow */ + guint16 ip6h_plen; /* payload length */ + guint8 ip6h_nxt; /* next header */ + guint8 ip6h_hlim; /* hop limit */ + struct e_in6_addr ip6h_src; /* source address */ + struct e_in6_addr ip6h_dst; /* destination address */ +}; + +/* + * Extension Headers + */ + +struct ip6_ext { + guchar ip6e_nxt; + guchar ip6e_len; +}; + +/* Routing header */ +struct ip6_rthdr { + guint8 ip6r_nxt; /* next header */ + guint8 ip6r_len; /* length in units of 8 octets */ + guint8 ip6r_type; /* routing type */ + guint8 ip6r_segleft; /* segments left */ + /* followed by routing type specific data */ +}; + +/* Type 0 Routing header */ +struct ip6_rthdr0 { + guint8 ip6r0_nxt; /* next header */ + guint8 ip6r0_len; /* length in units of 8 octets */ + guint8 ip6r0_type; /* always zero */ + guint8 ip6r0_segleft; /* segments left */ + guint8 ip6r0_reserved; /* reserved field */ + guint8 ip6r0_slmap[3]; /* strict/loose bit map */ + /* followed by up to 127 addresses */ + struct e_in6_addr ip6r0_addr[1]; }; +/* Fragment header */ +struct ip6_frag { + guint8 ip6f_nxt; /* next header */ + guint8 ip6f_reserved; /* reserved field */ + guint16 ip6f_offlg; /* offset, reserved, and flag */ + guint32 ip6f_ident; /* identification */ +}; + +#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */ +#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */ +#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ + + /** * Unicast Scope * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373). |