Wireshark  4.3.0
The Wireshark network protocol analyzer
inet_ipv4.h
Go to the documentation of this file.
1 
10 #ifndef __INET_IPV4_H__
11 #define __INET_IPV4_H__
12 
13 #include <inttypes.h>
14 #include <glib.h>
15 
16 typedef uint32_t ws_in4_addr; /* 32 bit IPv4 address, in network byte order */
17 
18 /*
19  * We define these in *network byte order*, unlike the C library. Therefore
20  * it uses a different prefix than INADDR_* to make the distinction more obvious.
21  */
22 #define WS_IN4_LOOPBACK ((ws_in4_addr)GUINT32_TO_BE(0x7f000001))
23 
29 #define in4_addr_is_local_network_control_block(addr) \
30  ((addr & 0xffffff00) == 0xe0000000)
31 
36 #define in4_addr_is_multicast(addr) \
37  ((addr & 0xf0000000) == 0xe0000000)
38 
45 #define in4_addr_is_private(addr) \
46  (((addr & 0xff000000) == 0x0a000000) || \
47  ((addr & 0xfff00000) == 0xac100000) || \
48  ((addr & 0xffff0000) == 0xc0a80000))
49 
54 #define in4_addr_is_link_local(addr) \
55  ((addr & 0xffff0000) == 0xa9fe0000)
56 
57 #endif