Revision f4a60a9b lib/net.h

View differences:

lib/net.h
21 21
#define NET_ROA6	6
22 22
#define NET_MAX		7
23 23

  
24
#define NB_IP4		(1 << NET_IP4)
25
#define NB_IP6		(1 << NET_IP6)
26
#define NB_VPN4		(1 << NET_VPN4)
27
#define NB_VPN6		(1 << NET_VPN6)
28

  
29
#define NB_IP		(NB_IP4 | NB_IP6)
30
#define NB_ANY		0xffffffff
31

  
32

  
24 33
typedef struct net_addr {
25 34
  u8 type;
26 35
  u8 pxlen;
......
88 97
} net_addr_union;
89 98

  
90 99

  
100
extern const char * const net_label[];
91 101
extern const u16 net_addr_length[];
92 102
extern const u8  net_max_prefix_length[];
93 103
extern const u16 net_max_text_length[];
......
149 159
    net_fill_ip6(a, ipa_to_ip6(prefix), IP6_MAX_PREFIX_LENGTH);
150 160
}
151 161

  
162

  
163
static inline int net_val_match(u8 type, u32 mask)
164
{ return !!((1 << type) & mask); }
165

  
166
static inline int net_type_match(const net_addr *a, u32 mask)
167
{ return net_val_match(a->type, mask); }
168

  
152 169
static inline int net_is_ip(const net_addr *a)
153 170
{ return (a->type == NET_IP4) || (a->type == NET_IP6); }
154 171

  

Also available in: Unified diff