TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / wsutil / inet_cidr.h
blob352b01de389a8ce99e344bd85eb08867ade7f256
1 /** @file
2 * Definitions of IPv4 address-and-mask structure, which is what an
3 * FT_IPV4 value is (even if there's no mask in a packet, those
4 * values can be compared against an address+mask in a filter
5 * expression).
7 * Gilbert Ramirez <gram@alumni.rice.edu>
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * SPDX-License-Identifier: GPL-2.0-or-later
16 #ifndef __IPV4_H__
17 #define __IPV4_H__
19 #include <wireshark.h>
20 #include <wsutil/inet_addr.h>
22 typedef struct {
23 uint32_t addr; /* stored in host order */
24 uint32_t nmask; /* stored in host order */
25 } ipv4_addr_and_mask;
27 typedef struct {
28 ws_in6_addr addr;
29 uint32_t prefix;
30 } ipv6_addr_and_prefix;
33 ********** IPv4 *********
36 /**
37 * Returns the IPv4 subnet mask of the specified length
39 * @param mask_length the number of bits in the subnet mask (max of 32)
40 * @return the subnet mask of the specified length
42 WS_DLL_PUBLIC
43 uint32_t
44 ws_ipv4_get_subnet_mask(const uint32_t mask_length);
46 WS_DLL_PUBLIC
47 void
48 ws_ipv4_addr_and_mask_init(ipv4_addr_and_mask *dst, ws_in4_addr src_addr, int src_bits);
50 WS_DLL_PUBLIC
51 bool
52 ws_ipv4_addr_and_mask_contains(const ipv4_addr_and_mask *ipv4, const ws_in4_addr *addr);
55 ********** IPv6 *********
58 WS_DLL_PUBLIC
59 bool
60 ws_ipv6_addr_and_prefix_contains(const ipv6_addr_and_prefix *ipv6, const ws_in6_addr *addr);
62 #endif