Wireshark 4.7.2
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
inet_cidr.h
Go to the documentation of this file.
1
15
16#ifndef __IPV4_H__
17#define __IPV4_H__
18
19#include <wireshark.h>
20#include <wsutil/inet_addr.h>
21
25typedef struct {
26 uint32_t addr;
27 uint32_t nmask;
29
33typedef struct {
35 uint32_t prefix;
37
38/*
39 ********** IPv4 *********
40 */
41
51WS_DLL_PUBLIC
52uint32_t ws_ipv4_get_subnet_mask(const uint32_t mask_length);
53
63WS_DLL_PUBLIC
64void ws_ipv4_addr_and_mask_init(ipv4_addr_and_mask *dst, ws_in4_addr src_addr, unsigned src_bits);
65
75WS_DLL_PUBLIC
77
78/*
79 ********** IPv6 *********
80 */
81
93WS_DLL_PUBLIC
94bool
96
97#endif
struct e_in6_addr ws_in6_addr
Represents a 128-bit IPv6 address.
uint32_t ws_in4_addr
Represents a 32-bit IPv4 address in network byte order.
Definition inet_addr.h:22
WS_DLL_PUBLIC void ws_ipv4_addr_and_mask_init(ipv4_addr_and_mask *dst, ws_in4_addr src_addr, unsigned src_bits)
Initializes an IPv4 address-and-mask structure.
Definition inet_cidr.c:49
WS_DLL_PUBLIC bool ws_ipv4_addr_and_mask_contains(const ipv4_addr_and_mask *ipv4, const ws_in4_addr *addr)
Checks whether an IPv4 address is contained within a subnet.
Definition inet_cidr.c:56
WS_DLL_PUBLIC bool ws_ipv6_addr_and_prefix_contains(const ipv6_addr_and_prefix *ipv6, const ws_in6_addr *addr)
Checks whether an IPv6 address is contained within a subnet.
Definition inet_cidr.c:103
WS_DLL_PUBLIC uint32_t ws_ipv4_get_subnet_mask(const uint32_t mask_length)
Returns the IPv4 subnet mask of the specified length.
Definition inet_cidr.c:14
Holds an IPv4 address paired with its subnet mask, both in host byte order.
Definition inet_cidr.h:25
uint32_t nmask
Definition inet_cidr.h:27
uint32_t addr
Definition inet_cidr.h:26
Holds an IPv6 address paired with its prefix length.
Definition inet_cidr.h:33
uint32_t prefix
Definition inet_cidr.h:35
ws_in6_addr addr
Definition inet_cidr.h:34