#ifndef _NETINET_IP6_H
#define _NETINET_IP6_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <netinet/in.h>
struct ip6_hdr {
union {
struct ip6_hdrctl {
uint32_t ip6_un1_flow;
uint16_t ip6_un1_plen;
uint8_t ip6_un1_nxt;
uint8_t ip6_un1_hlim;
} ip6_un1;
uint8_t ip6_un2_vfc;
} ip6_ctlun;
struct in6_addr ip6_src;
struct in6_addr ip6_dst;
};
typedef struct ip6_hdr ip6_t;
#define ip6_vfc ip6_ctlun.ip6_un2_vfc
#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
#define ip6_vcf ip6_flow
#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
struct ip6_hbh {
uint8_t ip6h_nxt;
uint8_t ip6h_len;
};
typedef struct ip6_hbh ip6_hbh_t;
struct ip6_dest {
uint8_t ip6d_nxt;
uint8_t ip6d_len;
};
typedef struct ip6_dest ip6_dest_t;
struct ip6_rthdr {
uint8_t ip6r_nxt;
uint8_t ip6r_len;
uint8_t ip6r_type;
uint8_t ip6r_segleft;
};
typedef struct ip6_rthdr ip6_rthdr_t;
struct ip6_rthdr0 {
uint8_t ip6r0_nxt;
uint8_t ip6r0_len;
uint8_t ip6r0_type;
uint8_t ip6r0_segleft;
uint32_t ip6r0_reserved;
};
typedef struct ip6_rthdr0 ip6_rthdr0_t;
struct ip6_frag {
uint8_t ip6f_nxt;
uint8_t ip6f_reserved;
uint16_t ip6f_offlg;
uint32_t ip6f_ident;
};
typedef struct ip6_frag ip6_frag_t;
#ifdef _BIG_ENDIAN
#define IP6F_OFF_MASK 0xfff8
#define IP6F_RESERVED_MASK 0x0006
#define IP6F_MORE_FRAG 0x0001
#else
#define IP6F_OFF_MASK 0xf8ff
#define IP6F_RESERVED_MASK 0x0600
#define IP6F_MORE_FRAG 0x0100
#endif
struct ip6_opt {
uint8_t ip6o_type;
uint8_t ip6o_len;
};
#define IP6OPT_TYPE(o) ((o) & 0xc0)
#define IP6OPT_TYPE_SKIP 0x00
#define IP6OPT_TYPE_DISCARD 0x40
#define IP6OPT_TYPE_FORCEICMP 0x80
#define IP6OPT_TYPE_ICMP 0xc0
#define IP6OPT_MUTABLE 0x20
#define IP6OPT_PAD1 0x00
#define IP6OPT_PADN 0x01
#define IP6OPT_JUMBO 0xc2
#define IP6OPT_NSAP_ADDR 0xc3
#define IP6OPT_TUNNEL_LIMIT 0x04
#define IP6OPT_ROUTER_ALERT 0x05
#define IP6OPT_BINDING_UPDATE 0xc6
#define IP6OPT_BINDING_ACK 0x07
#define IP6OPT_BINDING_REQ 0x08
#define IP6OPT_HOME_ADDRESS 0xc9
#define IP6OPT_EID 0x8a
#define IP6OPT_LS 0x0a
#define IP6_MAX_OPT_LENGTH 255
struct ip6_opt_jumbo {
uint8_t ip6oj_type;
uint8_t ip6oj_len;
uint8_t ip6oj_jumbo_len[4];
};
#define IP6OPT_JUMBO_LEN 6
struct ip6_opt_nsap {
uint8_t ip6on_type;
uint8_t ip6on_len;
uint8_t ip6on_src_nsap_len;
uint8_t ip6on_dst_nsap_len;
};
struct ip6_opt_tunnel {
uint8_t ip6ot_type;
uint8_t ip6ot_len;
uint8_t ip6ot_encap_limit;
};
struct ip6_opt_router {
uint8_t ip6or_type;
uint8_t ip6or_len;
uint8_t ip6or_value[2];
};
#ifdef _BIG_ENDIAN
#define IP6_ALERT_MLD 0x0000
#define IP6_ALERT_RSVP 0x0001
#define IP6_ALERT_AN 0x0002
#else
#define IP6_ALERT_MLD 0x0000
#define IP6_ALERT_RSVP 0x0100
#define IP6_ALERT_AN 0x0200
#endif
struct ip6_opt_binding_update {
uint8_t ip6ou_type;
uint8_t ip6ou_len;
uint8_t ip6ou_flags;
uint8_t ip6ou_prefixlen;
uint8_t ip6ou_seqno[2];
uint8_t ip6ou_lifetime[4];
uint8_t ip6ou_coa[16];
};
#define IP6_BUF_ACK 0x80
#define IP6_BUF_HOME 0x40
#define IP6_BUF_COA 0x20
#define IP6_BUF_ROUTER 0x10
struct ip6_opt_binding_ack {
uint8_t ip6oa_type;
uint8_t ip6oa_len;
uint8_t ip6oa_status;
uint8_t ip6oa_seqno[2];
uint8_t ip6oa_lifetime[4];
uint8_t ip6oa_refresh[4];
};
struct ip6_opt_binding_request {
uint8_t ip6or_type;
uint8_t ip6or_len;
};
struct ip6_opt_home_address {
uint8_t ip6oh_type;
uint8_t ip6oh_len;
uint8_t ip6oh_addr[16];
};
struct ip6_opt_labeled_security {
uint8_t ip6ol_type;
uint8_t ip6ol_len;
uint8_t ip6ol_doi[4];
};
#define IP6LS_DOI_V4 0
#define IP6LS_TT_LEVEL 1
#define IP6LS_TT_VECTOR 2
#define IP6LS_TT_ENUM 3
#define IP6LS_TT_RANGES 4
#define IP6LS_TT_V4 5
#define IP6LS_TT_DEST 6
#ifdef __cplusplus
}
#endif
#endif