Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / proto_data.h
blob28200339cb6c05a509106bf576f86c26388f1265
1 /* proto_data.h
2 * Definitions for protocol-specific data
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #ifndef __PROTO_DATA_H__
12 #define __PROTO_DATA_H__
14 #include "ws_symbol_export.h"
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 /** @file
21 * Dissected packet data and metadata.
24 /** @defgroup packetinfo Packet Data and Metadata
26 * @{
29 /* Allocator should be either pinfo->pool or wmem_file_scope() */
31 /**
32 * Add data associated with a protocol.
34 * This can be used to persist file-scoped data between packets or share
35 * packet-scoped data between dissectors without having to use global
36 * variables.
38 * Each call adds a new entry to the protocol data list.
40 * @param scope The memory scope, either pinfo->pool or wmem_file_scope().
41 * @param pinfo This dissection's packet info.
42 * @param proto The protocol ID.
43 * @param key A unique key for the data.
44 * @param proto_data The data to add.
46 WS_DLL_PUBLIC void p_add_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, uint32_t key, void *proto_data);
48 /**
49 * Set data associated with a protocol.
51 * This can be used to persist file-scoped data between packets or share
52 * packet-scoped data between dissectors without having to use global
53 * variables.
55 * If the protocol data list contains a matching entry it will be updated,
56 * otherwise a new entry will be created.
58 * @param scope The memory scope, either pinfo->pool or wmem_file_scope().
59 * @param pinfo This dissection's packet info.
60 * @param proto The protocol ID.
61 * @param key A unique key for the data.
62 * @param proto_data The data to add.
64 WS_DLL_PUBLIC void p_set_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, uint32_t key, void *proto_data);
66 /**
67 * Fetch data associated with a protocol.
69 * @param scope The memory scope, typically pinfo->pool or wmem_file_scope().
70 * @param pinfo This dissection's packet info.
71 * @param proto The protocol ID.
72 * @param key A unique key for the data.
73 * @return The data set using p_set_proto_data or most recently added
74 * using p_add_proto_data if the scope, protocol ID, and key match,
75 * otherwise NULL.
77 WS_DLL_PUBLIC void *p_get_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, uint32_t key);
79 /**
80 * Remove data associated with a protocol.
82 * @param scope The memory scope, typically pinfo->pool or wmem_file_scope().
83 * @param pinfo This dissection's packet info.
84 * @param proto The protocol ID.
85 * @param key A unique key for the data.
87 WS_DLL_PUBLIC void p_remove_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, uint32_t key);
89 char *p_get_proto_name_and_key(wmem_allocator_t *scope, struct _packet_info* pinfo, unsigned pfd_index);
91 /**
92 * Initialize or update a per-protocol and per-packet check for recursion, nesting, cycling, etc.
94 * @param pinfo Packet info for this packet.
95 * @param proto The current protocol.
96 * @param depth The depth to set.
98 WS_DLL_PUBLIC void p_set_proto_depth(struct _packet_info* pinfo, int proto, unsigned depth);
101 * Fetch the current per-protocol and per-packet recursion, nesting, or cycling depth.
102 * @param pinfo Packet info for this packet.
103 * @param proto The current protocol.
104 * @return The current depth.
106 WS_DLL_PUBLIC unsigned p_get_proto_depth(struct _packet_info* pinfo, int proto);
108 /** @} */
110 #ifdef __cplusplus
112 #endif /* __cplusplus */
114 #endif /* __PROTO_DATA__ */
117 * Editor modelines - https://www.wireshark.org/tools/modelines.html
119 * Local variables:
120 * c-basic-offset: 2
121 * tab-width: 8
122 * indent-tabs-mode: nil
123 * End:
125 * vi: set shiftwidth=2 tabstop=8 expandtab:
126 * :indentSize=2:tabSize=8:noTabs=true: