Statistics
| Branch: | Revision:

iof-bird-daemon / lib / ip.h @ 25697773

History | View | Annotate | Download (804 Bytes)

1
/*
2
 *        BIRD Internet Routing Daemon -- The Internet Protocol
3
 *
4
 *        (c) 1998 Martin Mares <mj@ucw.cz>
5
 *
6
 *        Can be freely distributed and used under the terms of the GNU GPL.
7
 */
8

    
9
#ifndef _BIRD_IP_H_
10
#define _BIRD_IP_H_
11

    
12
#ifndef IPV6
13
#include "ipv4.h"
14
#else
15
#include "ipv6.h"
16
#endif
17

    
18
/*
19
 *        ip_classify() returns either a negative number for invalid addresses
20
 *        or scope OR'ed together with address type.
21
 */
22

    
23
#define IADDR_INVALID                -1
24
#define IADDR_SCOPE_MASK               0xfff
25
#define IADDR_HOST                0x1000
26
#define IADDR_BROADCAST                0x2000
27
#define IADDR_MULTICAST                0x4000
28

    
29
/*
30
 *        Address scope
31
 */
32

    
33
#define SCOPE_HOST 0
34
#define SCOPE_LINK 1
35
#define SCOPE_SITE 2
36
#define SCOPE_UNIVERSE 3
37

    
38
/*
39
 *        Is it a valid network prefix?
40
 */
41

    
42
#define ip_is_prefix(a,l) (!ipa_nonzero(ipa_and(a, ipa_not(ipa_mkmask(l)))))
43

    
44
#endif