TODO SMB2 NegotiateContext....
[metze/wireshark/wip.git] / epan / addr_and_mask.h
1 /* addr_and_mask.h
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
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11
12 #ifndef __ADDR_AND_MASK_H__
13 #define __ADDR_AND_MASK_H__
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif /* __cplusplus */
18
19 /*
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
22  * is 0.
23  */
24
25 #define PREFIX_LEN_OK           0
26 #define PREFIX_LEN_TOO_LONG     1
27 #define PREFIX_LEN_ZERO         2
28
29 extern int tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset,
30     guint8 *addr, guint32 prefix_len);
31
32 extern int tvb_get_ipv6_addr_with_prefix_len(tvbuff_t *tvb, int offset,
33     ws_in6_addr *addr, guint32 prefix_len);
34
35 guint32 ip_get_subnet_mask(const guint32 mask_length);
36
37 #ifdef __cplusplus
38 }
39 #endif /* __cplusplus */
40
41 #endif /* __ADDR_AND_MASK_H__  */