2 * Declarations of routines to fetch IPv4 and IPv6 addresses from a tvbuff
3 * and then mask out bits other than those covered by a prefix length
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __ADDR_AND_MASK_H__
13 #define __ADDR_AND_MASK_H__
17 #endif /* __cplusplus */
20 * These routines return PREFIX_LEN_OK on success, PREFIX_LEN_TOO_LONG if
21 * the prefix length is too long, and PREFIX_LEN_ZERO if the prefix length
25 #define PREFIX_LEN_OK 0
26 #define PREFIX_LEN_TOO_LONG 1
27 #define PREFIX_LEN_ZERO 2
29 extern int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset,
30 guint8 *addr, guint32 prefix_len);
32 extern int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, int offset,
33 ws_in6_addr *addr, guint32 prefix_len);
35 guint32 ip_get_subnet_mask(const guint32 mask_length);
39 #endif /* __cplusplus */
41 #endif /* __ADDR_AND_MASK_H__ */