2016-01-25 01:10:20 +00:00
|
|
|
/* proto_data.h
|
|
|
|
* Definitions for protocol-specific data
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-08 16:59:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2016-01-25 01:10:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PROTO_DATA_H__
|
|
|
|
#define __PROTO_DATA_H__
|
|
|
|
|
2021-03-16 09:36:10 +00:00
|
|
|
#include "ws_symbol_export.h"
|
|
|
|
|
2016-01-25 01:10:20 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2020-04-14 23:04:09 +00:00
|
|
|
/** @file
|
|
|
|
* Dissected packet data and metadata.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @defgroup packetinfo Packet Data and Metadata
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2016-09-16 20:15:57 +00:00
|
|
|
/* Allocator should be either pinfo->pool or wmem_file_scope() */
|
2021-12-29 02:52:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add data associated with a protocol.
|
|
|
|
*
|
|
|
|
* This can be used to persist file-scoped data between packets or share
|
|
|
|
* packet-scoped data between dissectors without having to use global
|
|
|
|
* variables.
|
|
|
|
*
|
|
|
|
* Each call adds a new entry to the protocol data list.
|
|
|
|
*
|
|
|
|
* @param scope The memory scope, either pinfo->pool or wmem_file_scope().
|
|
|
|
* @param pinfo This dissection's packet info.
|
|
|
|
* @param proto The protocol ID.
|
|
|
|
* @param key A unique key for the data.
|
|
|
|
* @param proto_data The data to add.
|
|
|
|
*/
|
2016-01-25 01:10:20 +00:00
|
|
|
WS_DLL_PUBLIC void p_add_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key, void *proto_data);
|
2021-12-29 02:52:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set data associated with a protocol.
|
|
|
|
*
|
|
|
|
* This can be used to persist file-scoped data between packets or share
|
|
|
|
* packet-scoped data between dissectors without having to use global
|
|
|
|
* variables.
|
|
|
|
*
|
|
|
|
* If the protocol data list contains a matching entry it will be updated,
|
|
|
|
* otherwise a new entry will be created.
|
|
|
|
*
|
|
|
|
* @param scope The memory scope, either pinfo->pool or wmem_file_scope().
|
|
|
|
* @param pinfo This dissection's packet info.
|
|
|
|
* @param proto The protocol ID.
|
|
|
|
* @param key A unique key for the data.
|
|
|
|
* @param proto_data The data to add.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void p_set_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key, void *proto_data);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch data associated with a protocol.
|
|
|
|
*
|
|
|
|
* @param scope The memory scope, typically pinfo->pool or wmem_file_scope().
|
|
|
|
* @param pinfo This dissection's packet info.
|
|
|
|
* @param proto The protocol ID.
|
|
|
|
* @param key A unique key for the data.
|
|
|
|
* @return The data set using p_set_proto_data or most recently added
|
|
|
|
* using p_add_proto_data if the scope, protocol ID, and key match,
|
|
|
|
* otherwise NULL.
|
|
|
|
*/
|
2016-01-25 01:10:20 +00:00
|
|
|
WS_DLL_PUBLIC void *p_get_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key);
|
2021-12-29 02:52:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove data associated with a protocol.
|
|
|
|
*
|
|
|
|
* @param scope The memory scope, typically pinfo->pool or wmem_file_scope().
|
|
|
|
* @param pinfo This dissection's packet info.
|
|
|
|
* @param proto The protocol ID.
|
|
|
|
* @param key A unique key for the data.
|
|
|
|
*/
|
2016-01-25 01:10:20 +00:00
|
|
|
WS_DLL_PUBLIC void p_remove_proto_data(wmem_allocator_t *scope, struct _packet_info* pinfo, int proto, guint32 key);
|
2021-12-29 02:52:30 +00:00
|
|
|
|
2016-01-25 01:10:20 +00:00
|
|
|
gchar *p_get_proto_name_and_key(wmem_allocator_t *scope, struct _packet_info* pinfo, guint pfd_index);
|
|
|
|
|
2020-04-14 23:04:09 +00:00
|
|
|
/**
|
|
|
|
* Initialize or update a per-protocol and per-packet check for recursion, nesting, cycling, etc.
|
|
|
|
*
|
|
|
|
* @param pinfo Packet info for this packet.
|
|
|
|
* @param proto The current protocol.
|
|
|
|
* @param depth The depth to set.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void p_set_proto_depth(struct _packet_info* pinfo, int proto, unsigned depth);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch the current per-protocol and per-packet recursion, nesting, or cycling depth.
|
|
|
|
* @param pinfo Packet info for this packet.
|
|
|
|
* @param proto The current protocol.
|
|
|
|
* @return The current depth.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC unsigned p_get_proto_depth(struct _packet_info* pinfo, int proto);
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
2016-01-25 01:10:20 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* __PROTO_DATA__ */
|
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2016-01-25 01:10:20 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 2
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=2 tabstop=8 expandtab:
|
|
|
|
* :indentSize=2:tabSize=8:noTabs=true:
|
|
|
|
*/
|