~ubuntu-branches/ubuntu/trusty/ipv6toolkit/trusty

« back to all changes in this revision

Viewing changes to tools/rd6.h

  • Committer: Package Import Robot
  • Author(s): Octavio Alvarez
  • Date: 2013-08-24 18:37:54 UTC
  • Revision ID: package-import@ubuntu.com-20130824183754-zulpzbg53eotkwyp
Tags: upstream-1.4
ImportĀ upstreamĀ versionĀ 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Header file for the rd6 tool
 
3
 *
 
4
 */
 
5
 
 
6
#define LUI             long unsigned int
 
7
 
 
8
#define ETH_ALEN        6               /* Octets in one ethernet addr   */
 
9
#define ETH_HLEN        14              /* Total octets in header.       */
 
10
#define ETH_DATA_LEN    1500            /* Max. octets in payload        */
 
11
#define ETHERTYPE_IPV6  0x86dd          /* IP protocol version 6 */
 
12
#define ETHER_ADDR_LEN  ETH_ALEN        /* size of ethernet addr */
 
13
#define ETHER_HDR_LEN   ETH_HLEN        /* total octets in header */
 
14
 
 
15
#define ETHER_ADDR_PLEN 18              /* Includes termination byte */
 
16
 
 
17
#define ETHER_ALLNODES_LINK_ADDR        "33:33:00:00:00:01"
 
18
#define ETHER_ALLROUTERS_LINK_ADDR      "33:33:00:00:00:02"
 
19
 
 
20
#define MIN_IPV6_HLEN           40
 
21
#define MIN_TCP_HLEN            20
 
22
#define MIN_UDP_HLEN            20
 
23
#define MIN_ICMP6_HLEN          8
 
24
#define SLLA_OPT_LEN            1
 
25
#define TLLA_OPT_LEN            1
 
26
#define MAX_TLLA_OPTION         256
 
27
#define IFACE_LENGTH    255
 
28
#define ALL_NODES_MULTICAST_ADDR        "FF02::1"
 
29
#define ALL_ROUTERS_MULTICAST_ADDR      "FF02::2"
 
30
#define SOLICITED_NODE_MULTICAST_PREFIX "FF02:0:0:0:0:1:FF00::"
 
31
 
 
32
 
 
33
/* Support for IPv6 extension headers */
 
34
#define FRAG_HDR_SIZE           8
 
35
#define MAX_IPV6_PAYLOAD        65535
 
36
#define MAX_DST_OPT_HDR         256
 
37
#define MAX_DST_OPT_U_HDR       MAX_DST_OPT_HDR
 
38
#define MAX_HBH_OPT_HDR         MAX_DST_OPT_HDR
 
39
 
 
40
 
 
41
/* Filter Constants */
 
42
#define MAX_BLOCK_SRC                   50
 
43
#define MAX_BLOCK_DST                   50
 
44
#define MAX_BLOCK_TARGET                50
 
45
#define MAX_BLOCK_LINK_SRC              50
 
46
#define MAX_BLOCK_LINK_DST              50
 
47
 
 
48
#define MAX_ACCEPT_SRC                  50
 
49
#define MAX_ACCEPT_DST                  50
 
50
#define MAX_ACCEPT_TARGET               50
 
51
#define MAX_ACCEPT_LINK_SRC             50
 
52
#define MAX_ACCEPT_LINK_DST             50
 
53
 
 
54
#define ACCEPTED                        1
 
55
#define BLOCKED                         0
 
56
 
 
57
/* Constants used with the libpcap functions */
 
58
#define PCAP_ICMPV6_NA_FILTER "icmp6 and ip6[7]==255 and ip6[40]==136 and ip6[41]==0"
 
59
#define PCAP_ICMPV6_RA_FILTER "icmp6 and ip6[7]==255 and ip6[40]==134 and ip6[41]==0"
 
60
#define PCAP_IPV6_FILTER "ip6"
 
61
 
 
62
struct ether_addr{
 
63
  u_int8_t a[ETHER_ADDR_LEN];
 
64
} __attribute__ ((__packed__));
 
65
 
 
66
struct  nd_opt_slla{
 
67
    u_int8_t    type;
 
68
    u_int8_t    length;
 
69
    u_int8_t    address[6];
 
70
} __attribute__ ((__packed__));
 
71
 
 
72
struct  nd_opt_tlla{
 
73
    u_int8_t    type;
 
74
    u_int8_t    length;
 
75
    u_int8_t    address[6];
 
76
} __attribute__ ((__packed__));
 
77
 
 
78
struct ipv6pseudohdr{
 
79
    struct in6_addr srcaddr;
 
80
    struct in6_addr dstaddr;
 
81
    u_int32_t   len;
 
82
    u_int8_t zero[3];
 
83
    u_int8_t    nh;
 
84
} __attribute__ ((__packed__));
 
85
 
 
86
/* 10Mb/s ethernet header */
 
87
struct ether_header
 
88
{
 
89
  struct ether_addr dst;        /* destination eth addr */
 
90
  struct ether_addr src;        /* source ether addr    */
 
91
  u_int16_t ether_type;         /* packet type ID field */
 
92
} __attribute__ ((__packed__));
 
93
 
 
94
 
 
95
#if defined (__FreeBSD__) || defined(__NetBSD__) || defined (__OpenBSD__) || defined(__APPLE__)
 
96
    #ifndef s6_addr16
 
97
            #define s6_addr16   __u6_addr.__u6_addr16
 
98
    #endif
 
99
 
 
100
    #ifndef s6_addr8
 
101
            #define s6_addr8    __u6_addr.__u6_addr8
 
102
    #endif
 
103
 
 
104
    #ifndef s6_addr32
 
105
            #define s6_addr32   __u6_addr.__u6_addr32
 
106
    #endif
 
107
#endif
 
108
 
 
109
 
 
110
/* This causes Linux to use the BSD definition of the TCP and UDP header fields */
 
111
#ifndef __FAVOR_BSD
 
112
        #define __FAVOR_BSD
 
113
#endif
 
114