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

« back to all changes in this revision

Viewing changes to tools/addr6.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
#define MAX_LINE_SIZE                   250
 
3
#define MAX_TYPE_SIZE                   25
 
4
#define MAX_LIST_ENTRIES                65535
 
5
#define MAX_HOST_ENTRIES                4000000
 
6
 
 
7
#define IPV6_UNSPEC                             1
 
8
#define IPV6_MULTICAST                  2
 
9
#define IPV6_UNICAST                    4
 
10
 
 
11
#define UCAST_V4MAPPED                  1
 
12
#define UCAST_V4COMPAT                  2
 
13
#define UCAST_LINKLOCAL                 4
 
14
#define UCAST_SITELOCAL                 8
 
15
#define UCAST_UNIQUELOCAL               16
 
16
#define UCAST_6TO4                              32
 
17
#define UCAST_TEREDO                    64
 
18
#define UCAST_GLOBAL                    128
 
19
#define UCAST_LOOPBACK                  256
 
20
 
 
21
#define MCAST_PERMANENT                 512
 
22
#define MCAST_NONPERMANENT              1024
 
23
#define MCAST_INVALID                   2048
 
24
#define MCAST_UNICASTBASED              4096
 
25
#define MCAST_EMBEDRP                   8192
 
26
#define MCAST_UNKNOWN                   16384
 
27
 
 
28
#define SCOPE_RESERVED                  1
 
29
#define SCOPE_INTERFACE                 2
 
30
#define SCOPE_LINK                              4
 
31
#define SCOPE_ADMIN                             8
 
32
#define SCOPE_SITE                              16
 
33
#define SCOPE_ORGANIZATION              32
 
34
#define SCOPE_GLOBAL                    64
 
35
#define SCOPE_UNASSIGNED                128
 
36
#define SCOPE_UNSPECIFIED               256
 
37
 
 
38
#define IID_MACDERIVED                  1
 
39
#define IID_ISATAP                              2
 
40
#define IID_EMBEDDEDIPV4                4
 
41
#define IID_EMBEDDEDPORT                8
 
42
#define IID_EMBEDDEDPORTREV             16
 
43
#define IID_LOWBYTE                             32
 
44
#define IID_EMBEDDEDIPV4_64             64
 
45
#define IID_PATTERN_BYTES               128
 
46
#define IID_RANDOM                              256
 
47
#define IID_TEREDO_RFC4380              512
 
48
#define IID_TEREDO_RFC5991              1024
 
49
#define IID_TEREDO_UNKNOWN              2048
 
50
#define IID_UNSPECIFIED                 4096
 
51
 
 
52
 
 
53
/* Filter Constants */
 
54
#define MAX_BLOCK                       50
 
55
#define MAX_ACCEPT                      50
 
56
 
 
57
 
 
58
struct  decode6{
 
59
        struct in6_addr ip6;
 
60
        unsigned int    type;
 
61
        unsigned int    subtype;
 
62
        unsigned int    scope;
 
63
        unsigned int    iidtype;
 
64
        unsigned int    iidsubtype;
 
65
};
 
66
 
 
67
 
 
68
struct host_entry{
 
69
        struct in6_addr         ip6;
 
70
        struct host_entry       *next;
 
71
        struct host_entry       *prev;
 
72
};
 
73
 
 
74
struct host_list{
 
75
        struct host_entry       **host;                 /* Double-linked list of host entries */
 
76
        unsigned int            nhosts;                 /* Current number of host entries */
 
77
        unsigned int            maxhosts;               /* Maximum number of host entries */
 
78
        u_int16_t                       key_l;                  /* Low-order word of the hash key */
 
79
        u_int16_t                       key_h;                  /* High-order word of the hash key */
 
80
};
 
81
 
 
82
 
 
83
struct stats6{
 
84
        unsigned int    total;
 
85
        unsigned int    ipv6unspecified;
 
86
        unsigned int    ipv6multicast;
 
87
        unsigned int    ipv6unicast;
 
88
 
 
89
        unsigned int    ucastloopback;
 
90
        unsigned int    ucastv4mapped;
 
91
        unsigned int    ucastv4compat;
 
92
        unsigned int    ucastlinklocal;
 
93
        unsigned int    ucastsitelocal;
 
94
        unsigned int    ucastuniquelocal;
 
95
        unsigned int    ucast6to4;
 
96
        unsigned int    ucastteredo;
 
97
        unsigned int    ucastglobal;
 
98
 
 
99
        unsigned int    mcastpermanent;
 
100
        unsigned int    mcastnonpermanent;
 
101
        unsigned int    mcastinvalid;
 
102
        unsigned int    mcastunicastbased;
 
103
        unsigned int    mcastembedrp;
 
104
        unsigned int    mcastunknown;
 
105
 
 
106
        unsigned int    iidmacderived;
 
107
        unsigned int    iidisatap;
 
108
        unsigned int    iidmbeddedipv4;
 
109
        unsigned int    iidembeddedport;
 
110
        unsigned int    iidembeddedportrev;
 
111
        unsigned int    iidlowbyte;
 
112
        unsigned int    iidembeddedipv4_64;
 
113
        unsigned int    iidpatternbytes;
 
114
        unsigned int    iidrandom;
 
115
 
 
116
        unsigned int    mscopereserved;
 
117
        unsigned int    mscopeinterface;
 
118
        unsigned int    mnscopelink;
 
119
        unsigned int    mscopeadmin;
 
120
        unsigned int    mscopesite;
 
121
        unsigned int    mscopeorganization;
 
122
        unsigned int    mscopeglobal;
 
123
        unsigned int    mscopeunassigned;
 
124
        unsigned int    mscopeunspecified;
 
125
};
 
126
 
 
127
#ifndef IN6_IS_ADDR_UNIQUELOCAL
 
128
        #define IN6_IS_ADDR_UNIQUELOCAL(a) \
 
129
                ((((uint32_t *) (a))[0] & htonl (0xfe000000))                 \
 
130
                 == htonl (0xfc000000))
 
131
#endif
 
132
 
 
133
#ifndef IN6_IS_ADDR_6TO4
 
134
        #define IN6_IS_ADDR_6TO4(a) \
 
135
                ((((uint32_t *) (a))[0] & htonl (0xffff0000))                 \
 
136
                 == htonl (0x20020000))
 
137
#endif
 
138
 
 
139
#ifndef IN6_IS_ADDR_TEREDO
 
140
        #define IN6_IS_ADDR_TEREDO(a) \
 
141
                (((uint32_t *) (a))[0] == htonl (0x20020000))
 
142
#endif
 
143
 
 
144
#ifndef IN6_IS_ADDR_TEREDO_LEGACY
 
145
        #define IN6_IS_ADDR_TEREDO_LEGACY(a) \
 
146
                (((uint32_t *) (a))[0] == htonl (0x3ffe831f))
 
147
#endif
 
148
 
 
149
#if defined (__FreeBSD__) || defined(__NetBSD__) || defined (__OpenBSD__) || defined(__APPLE__)
 
150
    #ifndef s6_addr16
 
151
            #define s6_addr16   __u6_addr.__u6_addr16
 
152
    #endif
 
153
 
 
154
    #ifndef s6_addr
 
155
            #define s6_addr             __u6_addr.__u6_addr8
 
156
    #endif
 
157
 
 
158
    #ifndef s6_addr8
 
159
            #define s6_addr8    __u6_addr.__u6_addr8
 
160
    #endif
 
161
 
 
162
    #ifndef s6_addr32
 
163
            #define s6_addr32   __u6_addr.__u6_addr32
 
164
    #endif
 
165
#elif defined __linux__
 
166
    #ifndef s6_addr16
 
167
            #define s6_addr16   __in6_u.__u6_addr16
 
168
    #endif
 
169
 
 
170
        #ifndef s6_addr32
 
171
                #define s6_addr32       __in6_u.__u6_addr32
 
172
        #endif
 
173
#endif
 
174
 
 
175
 
 
176
/* This causes Linux to use the BSD definition of the TCP and UDP header fields */
 
177
#ifndef __FAVOR_BSD
 
178
        #define __FAVOR_BSD
 
179
#endif