| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
capture_dissectors.h
Go to the documentation of this file.
1/* capture_dissectors.h
2 * Routines for handling capture dissectors
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10#pragma once
11#include "ws_symbol_export.h"
12#include <wiretap/wtap.h>
13
14#ifdef __cplusplus
15 extern "C" {
16#endif /* __cplusplus */
17
20
22 typedef struct {
23 GHashTable* counts_hash; /* packet counters keyed by proto */
24 uint64_t other; /* Packets not counted in the hash total */
25 uint64_t total; /* Cache of total packets */
26} packet_counts;
27
31 typedef struct _capture_packet_info {
32 GHashTable *counts;
33} capture_packet_info_t;
34
35 typedef struct capture_dissector_handle* capture_dissector_handle_t;
36
38 typedef bool (*capture_dissector_t)(const uint8_t *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header);
39
44WS_DLL_PUBLIC void register_capture_dissector_table(const char *name, const char *ui_name);
45
51WS_DLL_PUBLIC capture_dissector_handle_t create_capture_dissector_handle(capture_dissector_t dissector, const int proto);
52
57WS_DLL_PUBLIC capture_dissector_handle_t find_capture_dissector(const char *name);
58
65WS_DLL_PUBLIC capture_dissector_handle_t register_capture_dissector(const char *name, capture_dissector_t dissector, int proto);
66
72WS_DLL_PUBLIC void capture_dissector_add_uint(const char *name, const uint32_t pattern, capture_dissector_handle_t handle);
73
86WS_DLL_PUBLIC bool try_capture_dissector(const char* name, const uint32_t pattern, const uint8_t *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header);
87
98WS_DLL_PUBLIC bool call_capture_dissector(capture_dissector_handle_t handle, const uint8_t *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header);
99
106WS_DLL_PUBLIC uint64_t capture_dissector_get_count(packet_counts* counts, const int proto);
107
113WS_DLL_PUBLIC void capture_dissector_increment_count(capture_packet_info_t *cpinfo, const int proto);
114
118 extern void capture_dissector_init(void);
119
123 extern void capture_dissector_cleanup(void);
124
125#ifdef __cplusplus
126}
127#endif /* __cplusplus */
register_capture_dissector
WS_DLL_PUBLIC capture_dissector_handle_t register_capture_dissector(const char *name, capture_dissector_t dissector, int proto)
Register a new capture dissector.
Definition capture_dissectors.c:106
call_capture_dissector
WS_DLL_PUBLIC bool call_capture_dissector(capture_dissector_handle_t handle, const uint8_t *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
Call a capture dissector through a handle. If handle is value return true, otherwise return false.
Definition capture_dissectors.c:157
try_capture_dissector
WS_DLL_PUBLIC bool try_capture_dissector(const char *name, const uint32_t pattern, const uint8_t *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
Look for a given value in a given uint capture dissector table and, if found, call the dissector with...
Definition capture_dissectors.c:138
capture_dissector_increment_count
WS_DLL_PUBLIC void capture_dissector_increment_count(capture_packet_info_t *cpinfo, const int proto)
Increment packet capture count by 1 for a particular protocol.
Definition capture_dissectors.c:173
find_capture_dissector
WS_DLL_PUBLIC capture_dissector_handle_t find_capture_dissector(const char *name)
Find a dissector by name.
Definition capture_dissectors.c:101
capture_dissector_get_count
WS_DLL_PUBLIC uint64_t capture_dissector_get_count(packet_counts *counts, const int proto)
Get current capture packet count for a particular protocol.
Definition capture_dissectors.c:164
capture_dissector_add_uint
WS_DLL_PUBLIC void capture_dissector_add_uint(const char *name, const uint32_t pattern, capture_dissector_handle_t handle)
Add an entry to a uint capture dissector table.
Definition capture_dissectors.c:118
capture_dissector_init
void capture_dissector_init(void)
Initialize capture dissectors.
Definition capture_dissectors.c:54
create_capture_dissector_handle
WS_DLL_PUBLIC capture_dissector_handle_t create_capture_dissector_handle(capture_dissector_t dissector, const int proto)
Create an anonymous handle for a capture dissector.
Definition capture_dissectors.c:96
capture_dissector_t
bool(* capture_dissector_t)(const uint8_t *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
Definition capture_dissectors.h:38
capture_dissector_cleanup
void capture_dissector_cleanup(void)
Cleanup capture dissectors.
Definition capture_dissectors.c:60
capture_packet_info_t
struct _capture_packet_info capture_packet_info_t
Accumulates per-protocol packet counts during a live capture session.
register_capture_dissector_table
WS_DLL_PUBLIC void register_capture_dissector_table(const char *name, const char *ui_name)
Register a capture sub-dissector table.
Definition capture_dissectors.c:66
_capture_packet_info
Accumulates per-protocol packet counts during a live capture session.
Definition capture_dissectors.h:31
_capture_packet_info::counts
GHashTable * counts
Definition capture_dissectors.h:32
capture_dissector_handle
Definition capture_dissectors.c:30
packet_counts
Definition capture_dissectors.h:22
wtap_pseudo_header
Top-level union of all Wiretap pseudo-headers.
Definition wtap.h:1355
wtap.h