Wireshark 4.5.0
The Wireshark network protocol analyzer
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
packet.h
Go to the documentation of this file.
1
11#ifndef __PACKET_H__
12#define __PACKET_H__
13
14#include <wsutil/array.h>
16#include "proto.h"
17#include "range.h"
18#include "tvbuff.h"
19#include "epan.h"
20#include "frame_data.h"
21#include "packet_info.h"
22#include "column-utils.h"
23#include "guid-utils.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif /* __cplusplus */
28
29
30
36#define hi_nibble(b) (((b) & 0xf0) >> 4)
37#define lo_nibble(b) ((b) & 0x0f)
38
39/* Check whether the "len" bytes of data starting at "offset" is
40 * entirely inside the captured data for this packet. */
41#define BYTES_ARE_IN_FRAME(offset, captured_len, len) \
42 ((unsigned)(offset) + (unsigned)(len) > (unsigned)(offset) && \
43 (unsigned)(offset) + (unsigned)(len) <= (unsigned)(captured_len))
44
45/* 0 is case sensitive for backwards compatibility with tables that
46 * used false or BASE_NONE for case sensitive, which was the default.
47 */
48#define STRING_CASE_SENSITIVE 0
49#define STRING_CASE_INSENSITIVE 1
50
51extern void packet_init(void);
52extern void packet_cache_proto_handles(void);
53extern void packet_all_tables_sort_handles(void);
54extern void packet_cleanup(void);
55
56/* Handle for dissectors you call directly or register with "dissector_add_uint()".
57 This handle is opaque outside of "packet.c". */
58struct dissector_handle;
60
61/* Hash table for matching unsigned integers, or strings, and dissectors;
62 this is opaque outside of "packet.c". */
63struct dissector_table;
65
66/*
67 * Dissector that returns:
68 *
69 * The amount of data in the protocol's PDU, if it was able to
70 * dissect all the data;
71 *
72 * 0, if the tvbuff doesn't contain a PDU for that protocol;
73 *
74 * The negative of the amount of additional data needed, if
75 * we need more data (e.g., from subsequent TCP segments) to
76 * dissect the entire PDU.
77 */
78typedef int (*dissector_t)(tvbuff_t *, packet_info *, proto_tree *, void *);
79
80/* Same as dissector_t with an extra parameter for callback pointer */
81typedef int (*dissector_cb_t)(tvbuff_t *, packet_info *, proto_tree *, void *, void *);
82
90typedef bool (*heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
91 proto_tree *tree, void *);
92
93typedef enum {
94 HEURISTIC_DISABLE,
95 HEURISTIC_ENABLE
96} heuristic_enable_e;
97
98typedef void (*DATFunc) (const char *table_name, ftenum_t selector_type,
99 void *key, void *value, void *user_data);
100typedef void (*DATFunc_handle) (const char *table_name, void *value,
101 void *user_data);
102typedef void (*DATFunc_table) (const char *table_name, const char *ui_name,
103 void *user_data);
104
105/* Opaque structure - provides type checking but no access to components */
106typedef struct dtbl_entry dtbl_entry_t;
107
108WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry);
109WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_initial_handle (dtbl_entry_t * entry);
110
120void dissector_table_foreach_changed (const char *table_name, DATFunc func,
121 void *user_data);
122
132WS_DLL_PUBLIC void dissector_table_foreach (const char *table_name, DATFunc func,
133 void *user_data);
134
143WS_DLL_PUBLIC void dissector_all_tables_foreach_changed (DATFunc func,
144 void *user_data);
145
155WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func,
156 void *user_data);
157
166WS_DLL_PUBLIC void dissector_all_tables_foreach_table (DATFunc_table func,
167 void *user_data, GCompareFunc compare_key_func);
168
169/* a protocol uses the function to register a sub-dissector table
170 *
171 * 'param' is the display base for integer tables, STRING_CASE_SENSITIVE
172 * or STRING_CASE_INSENSITIVE for string tables, and ignored for other
173 * table types.
174 */
175WS_DLL_PUBLIC dissector_table_t register_dissector_table(const char *name,
176 const char *ui_name, const int proto, const ftenum_t type, const int param);
177
178/*
179 * Similar to register_dissector_table, but with a "custom" hash function
180 * to store subdissectors.
181 */
182WS_DLL_PUBLIC dissector_table_t register_custom_dissector_table(const char *name,
183 const char *ui_name, const int proto, GHashFunc hash_func, GEqualFunc key_equal_func,
184 GDestroyNotify key_destroy_func);
185
192 const char *alias_name);
193
195void deregister_dissector_table(const char *name);
196
197/* Find a dissector table by table name. */
198WS_DLL_PUBLIC dissector_table_t find_dissector_table(const char *name);
199
200/* Get the UI name for a sub-dissector table, given its internal name */
201WS_DLL_PUBLIC const char *get_dissector_table_ui_name(const char *name);
202
203/* Get the field type for values of the selector for a dissector table,
204 given the table's internal name */
205WS_DLL_PUBLIC ftenum_t get_dissector_table_selector_type(const char *name);
206
207/* Get the param set for the sub-dissector table,
208 given the table's internal name */
209WS_DLL_PUBLIC int get_dissector_table_param(const char *name);
210
211/* Dump all dissector tables to the standard output (not the entries,
212 just the information about the tables) */
213WS_DLL_PUBLIC void dissector_dump_dissector_tables(void);
214
215/* Add an entry to a uint dissector table. */
216WS_DLL_PUBLIC void dissector_add_uint(const char *name, const uint32_t pattern,
217 dissector_handle_t handle);
218
219/* Add an entry to a uint dissector table with "preference" automatically added. */
220WS_DLL_PUBLIC void dissector_add_uint_with_preference(const char *name, const uint32_t pattern,
221 dissector_handle_t handle);
222
224WS_DLL_PUBLIC void dissector_add_uint_range(const char *abbrev, range_t *range,
225 dissector_handle_t handle);
226
228WS_DLL_PUBLIC void dissector_add_uint_range_with_preference(const char *abbrev, const char* range_str,
229 dissector_handle_t handle);
230
233WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const uint32_t pattern,
234 dissector_handle_t handle);
235
237WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, range_t *range,
238 dissector_handle_t handle);
239
241WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle);
242
245WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const uint32_t pattern,
246 dissector_handle_t handle);
247
249WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const uint32_t pattern);
250
256WS_DLL_PUBLIC bool dissector_is_uint_changed(dissector_table_t const sub_dissectors, const uint32_t uint_val);
257
261WS_DLL_PUBLIC int dissector_try_uint(dissector_table_t sub_dissectors,
262 const uint32_t uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
263
268WS_DLL_PUBLIC int dissector_try_uint_with_data(dissector_table_t sub_dissectors,
269 const uint32_t uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data);
270
271WS_DEPRECATED_X("Use dissector_try_uint_with_data instead")
272static inline int dissector_try_uint_new(dissector_table_t sub_dissectors,
273 const uint32_t uint_val, tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, const bool add_proto_name, void* data) \
274{ return dissector_try_uint_with_data(sub_dissectors, uint_val, tvb, pinfo, tree, add_proto_name, data); }
275
284 dissector_table_t const sub_dissectors, const uint32_t uint_val);
285
294 const char *name, const uint32_t uint_val);
295
296/* Add an entry to a string dissector table. */
297WS_DLL_PUBLIC void dissector_add_string(const char *name, const char *pattern,
298 dissector_handle_t handle);
299
300/* Delete the entry for a dissector in a string dissector table
301 with a particular pattern. */
302WS_DLL_PUBLIC void dissector_delete_string(const char *name, const char *pattern,
303 dissector_handle_t handle);
304
305/* Change the entry for a dissector in a string dissector table
306 with a particular pattern to use a new dissector handle. */
307WS_DLL_PUBLIC void dissector_change_string(const char *name, const char *pattern,
308 dissector_handle_t handle);
309
310/* Reset an entry in a string sub-dissector table to its initial value. */
311WS_DLL_PUBLIC void dissector_reset_string(const char *name, const char *pattern);
312
313/* Return true if an entry in a string dissector table is found and has been
314 * changed (i.e. dissector_change_string() has been called, such as from
315 * Decode As), otherwise return false.
316 */
317WS_DLL_PUBLIC bool dissector_is_string_changed(dissector_table_t const subdissectors, const char *string);
318
319
323WS_DLL_PUBLIC int dissector_try_string_with_data(dissector_table_t sub_dissectors,
324 const char* string, tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, const bool add_proto_name, void* data);
325
326/* Look for a given string in a given dissector table and, if found, call
327 the dissector with the arguments supplied, and return the number of
328 bytes consumed, otherwise return 0. */
329WS_DEPRECATED_X("Use dissector_try_string_with_data instead")
330static inline int
331dissector_try_string(dissector_table_t sub_dissectors, const char* string,\
332 tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data) \
333 { return dissector_try_string_with_data(sub_dissectors, string, tvb, pinfo, tree, true, data); }
334
335WS_DEPRECATED_X("Use dissector_try_string_with_data instead")
336static inline int
337dissector_try_string_new(dissector_table_t sub_dissectors, const char* string, \
338 tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, const bool add_proto_name, void* data) \
339{ return dissector_try_string_with_data(sub_dissectors, string, tvb, pinfo, tree, add_proto_name, data); }
340
341
350 dissector_table_t sub_dissectors, const char *string);
351
360 const char *name, const char *string);
361
362/* Add an entry to a "custom" dissector table. */
363WS_DLL_PUBLIC void dissector_add_custom_table_handle(const char *name, void *pattern,
364 dissector_handle_t handle);
365
374 dissector_table_t sub_dissectors, void *key);
375/* Key for GUID dissector tables. This is based off of DCE/RPC needs
376 so some dissector tables may not need the ver portion of the hash
377 */
378typedef struct _guid_key {
379 e_guid_t guid;
380 uint16_t ver;
381} guid_key;
382
383/* Add an entry to a guid dissector table. */
384WS_DLL_PUBLIC void dissector_add_guid(const char *name, guid_key* guid_val,
385 dissector_handle_t handle);
386
390WS_DLL_PUBLIC int dissector_try_guid_with_data(dissector_table_t sub_dissectors,
391 guid_key* guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data);
392
393/* Delete a GUID from a dissector table. */
394WS_DLL_PUBLIC void dissector_delete_guid(const char *name, guid_key* guid_val,
395 dissector_handle_t handle);
396
405 dissector_table_t const sub_dissectors, guid_key* guid_val);
406
407/* Use the currently assigned payload dissector for the dissector table and,
408 if any, call the dissector with the arguments supplied, and return the
409 number of bytes consumed, otherwise return 0. */
410WS_DLL_PUBLIC int dissector_try_payload_with_data(dissector_table_t sub_dissectors,
411 tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data);
412
413WS_DEPRECATED_X("Use dissector_try_payload_with_data instead")
414static inline int dissector_try_payload_new(dissector_table_t sub_dissectors,
415 tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, const bool add_proto_name, void* data){ \
416 return dissector_try_payload_with_data(sub_dissectors, tvb, pinfo, tree, add_proto_name, data); \
417}
418
419/* Use the currently assigned payload dissector for the dissector table and,
420 if any, call the dissector with the arguments supplied, and return the
421 number of bytes consumed, otherwise return 0. */
422WS_DEPRECATED_X("Use dissector_try_payload_with_data instead")
423static inline int dissector_try_payload(dissector_table_t sub_dissectors,
424 tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
425 \
426 return dissector_try_payload_with_data(sub_dissectors, tvb, pinfo, tree, true, NULL); \
427}
428
429/* Change the entry for a dissector in a payload (FT_NONE) dissector table
430 with a particular pattern to use a new dissector handle. */
431WS_DLL_PUBLIC void dissector_change_payload(const char *abbrev, dissector_handle_t handle);
432
433/* Reset payload (FT_NONE) dissector table to its initial value. */
434WS_DLL_PUBLIC void dissector_reset_payload(const char *name);
435
436/* Given a payload dissector table (type FT_NONE), return the handle of
437 the dissector that is currently active, i.e. that was selected via
438 Decode As. */
439WS_DLL_PUBLIC dissector_handle_t dissector_get_payload_handle(
441
442/* Add a handle to the list of handles that *could* be used with this
443 table. That list is used by the "Decode As"/"-d" code in the UI. */
444WS_DLL_PUBLIC void dissector_add_for_decode_as(const char *name,
445 dissector_handle_t handle);
446
447/* Same as dissector_add_for_decode_as, but adds preference for dissector table value */
448WS_DLL_PUBLIC void dissector_add_for_decode_as_with_preference(const char *name,
449 dissector_handle_t handle);
450
454
459
463
470
474
475/* List of "heuristic" dissectors (which get handed a packet, look at it,
476 and either recognize it as being for their protocol, dissect it, and
477 return true, or don't recognize it and return false) to be called
478 by another dissector.
479
480 This is opaque outside of "packet.c". */
483
484
485typedef struct heur_dtbl_entry {
486 heur_dissector_t dissector;
487 protocol_t *protocol; /* this entry's protocol */
488 char *list_name; /* the list name this entry is in the list of */
489 const char *display_name; /* the string used to present heuristic to user */
490 char *short_name; /* string used for "internal" use to uniquely identify heuristic */
491 bool enabled;
492 bool enabled_by_default;
494
502WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list_with_description(const char *name, const char *ui_name, const int proto);
503
508WS_DLL_PUBLIC const char *heur_dissector_list_get_description(heur_dissector_list_t list);
509
516WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto);
517
519void deregister_heur_dissector_list(const char *name);
520
521typedef void (*DATFunc_heur) (const char *table_name,
522 struct heur_dtbl_entry *entry, void *user_data);
523typedef void (*DATFunc_heur_table) (const char *table_name,
524 struct heur_dissector_list *table, void *user_data);
525
535WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name,
536 DATFunc_heur func, void *user_data);
537
546WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table (DATFunc_heur_table func,
547 void *user_data, GCompareFunc compare_key_func);
548
549/* true if a heur_dissector list of that name exists to be registered into */
550WS_DLL_PUBLIC bool has_heur_dissector_list(const char *name);
551
564WS_DLL_PUBLIC bool dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
565 tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, heur_dtbl_entry_t **hdtbl_entry, void *data);
566
572WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name);
573
579WS_DLL_PUBLIC heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name);
580
591WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector,
592 const char *display_name, const char *internal_name, const int proto, heuristic_enable_e enable);
593
601WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto);
602
604WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto);
605
607WS_DLL_PUBLIC dissector_handle_t register_dissector_with_description(const char *name, const char *description, dissector_t dissector, const int proto);
608
610WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name, dissector_cb_t dissector, const int proto, void *cb_data);
611
613void deregister_dissector(const char *name);
614
616WS_DLL_PUBLIC const char *dissector_handle_get_protocol_long_name(const dissector_handle_t handle);
617
619WS_DLL_PUBLIC const char *dissector_handle_get_protocol_short_name(const dissector_handle_t handle);
620
621/* For backwards source and binary compatibility */
623WS_DLL_PUBLIC const char *dissector_handle_get_short_name(const dissector_handle_t handle);
624
626WS_DLL_PUBLIC const char *dissector_handle_get_description(const dissector_handle_t handle);
627
629WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle);
630
632WS_DLL_PUBLIC GList* get_dissector_names(void);
633
635WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name);
636
638WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto);
639
641WS_DLL_PUBLIC const char *dissector_handle_get_dissector_name(const dissector_handle_t handle);
642
643WS_DLL_PUBLIC const char *dissector_handle_get_pref_suffix(const dissector_handle_t handle);
644
655WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
656 const int proto);
657
669WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
670 const int proto, const char* name);
671
687 const int proto, const char* name, const char* description);
688WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_data(dissector_cb_t dissector,
689 const int proto, void* cb_data);
690
691/* Dump all registered dissectors to the standard output */
692WS_DLL_PUBLIC void dissector_dump_dissectors(void);
693
707WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb,
708 packet_info *pinfo, proto_tree *tree, void *data);
709WS_DLL_PUBLIC int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
710 packet_info *pinfo, proto_tree *tree);
711
712WS_DLL_PUBLIC int call_data_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
713
727WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
728 packet_info *pinfo, proto_tree *tree, void *data);
729
739 packet_info *pinfo, proto_tree *tree, void *data);
740
741/* This is opaque outside of "packet.c". */
744
755WS_DLL_PUBLIC bool register_depend_dissector(const char* parent, const char* dependent);
756
766WS_DLL_PUBLIC bool deregister_depend_dissector(const char* parent, const char* dependent);
767
773WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char* name);
774
775/*
776 * Given a tvbuff, and a length from a packet header, adjust the length
777 * of the tvbuff to reflect the specified length.
778 */
779WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const unsigned specified_len);
780
788WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
789
797WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
798
799/*
800 * Allows protocols to register "shutdown" routines, which are called
801 * once, just before program exit
802 */
803WS_DLL_PUBLIC void register_shutdown_routine(void (*func)(void));
804
805/* Initialize all data structures used for dissection. */
806void init_dissection(void);
807
808/* Free data structures allocated for dissection. */
809void cleanup_dissection(void);
810
811/* Allow protocols to register a "cleanup" routine to be
812 * run after the initial sequential run through the packets.
813 * Note that the file can still be open after this; this is not
814 * the final cleanup. */
815WS_DLL_PUBLIC void register_postseq_cleanup_routine(void (*func)(void));
816
817/* Call all the registered "postseq_cleanup" routines. */
818WS_DLL_PUBLIC void postseq_cleanup_all_protocols(void);
819
820/* Allow dissectors to register a "final_registration" routine
821 * that is run like the proto_register_XXX() routine, but the end
822 * end of the epan_init() function; that is, *after* all other
823 * subsystems, liked dfilters, have finished initializing. This is
824 * useful for dissector registration routines which need to compile
825 * display filters. dfilters can't initialize itself until all protocols
826 * have registered themselves. */
827WS_DLL_PUBLIC void
828register_final_registration_routine(void (*func)(void));
829
830/* Call all the registered "final_registration" routines. */
831extern void
832final_registration_all_protocols(void);
833
834// XXX Should we move frame_data.encoding here?
835typedef enum {
836 DS_MEDIA_TYPE_APPLICATION_OCTET_STREAM,
837 DS_MEDIA_TYPE_APPLICATION_JSON,
838} data_source_media_type_e;
839
840struct data_source;
841
851WS_DLL_PUBLIC struct data_source* add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
852 const char *name);
853
860WS_DLL_PUBLIC void set_data_source_name(packet_info *pinfo, struct data_source *src, const char *name);
861
868WS_DLL_PUBLIC void set_data_source_media_type(struct data_source *src, data_source_media_type_e media_type);
869
870/* Removes the last-added data source, if it turns out it wasn't needed */
871WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
872
873/*
874 * Return the data source description.
875 */
876WS_DLL_PUBLIC char *get_data_source_description(const struct data_source *src);
877
878/*
879 * Return the tvb for the data source.
880 */
881WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb(const struct data_source *src);
882
889WS_DLL_PUBLIC struct data_source *get_data_source_by_name(const packet_info *pinfo, const char *name);
890
897WS_DLL_PUBLIC struct data_source *get_data_source_by_tvb(const packet_info *pinfo, const tvbuff_t *tvb);
898
904WS_DLL_PUBLIC data_source_media_type_e get_data_source_media_type(const struct data_source *src);
905
906/*
907 * Free up a frame's list of data sources.
908 */
909extern void free_data_sources(packet_info *pinfo);
910
911/* Mark another frame as depended upon by the current frame.
912 *
913 * This information is used to ensure that the depended-upon frame is saved
914 * if the user does a File->Save-As of only the Displayed packets and the
915 * current frame passed the display filter.
916 */
917WS_DLL_PUBLIC void mark_frame_as_depended_upon(frame_data *fd, uint32_t frame_num);
918
919/* Structure passed to the frame dissector */
920typedef struct frame_data_s
921{
922 int file_type_subtype;
923 /*
924 * This might be the block from the packet's wtap_rec or it might
925 * be a modified copy of that, as, for example, the comments
926 * might have been edited but not yet saved to the file.
927 */
929 struct epan_dissect *color_edt;
932
933/* Structure passed to the file dissector */
934typedef struct file_data_s
935{
937 struct epan_dissect *color_edt;
940
941/*
942 * Dissectors should never modify the record data.
943 */
944extern void dissect_record(struct epan_dissect *edt, int file_type_subtype,
945 wtap_rec *rec, frame_data *fd, column_info *cinfo);
946
947/*
948 * Dissectors should never modify the file data.
949 */
950extern void dissect_file(struct epan_dissect *edt,
951 wtap_rec *rec, frame_data *fd, column_info *cinfo);
952
953/* Structure passed to the ethertype dissector */
954typedef struct ethertype_data_s
955{
956 uint16_t etype;
957 int payload_offset;
958 proto_tree *fh_tree;
959 int trailer_id;
960 int fcs_len;
962
963/*
964 * Dump layer/selector/dissector records in a fashion similar to the
965 * proto_registrar_dump_* routines.
966 */
967WS_DLL_PUBLIC void dissector_dump_decodes(void);
968
969/*
970 * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
971 */
972WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
973
974/*
975 * postdissectors are to be called by packet-frame.c after every other
976 * dissector has been called.
977 */
978
979/*
980 * Register a postdissector; the argument is the dissector handle for it.
981 */
982WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
983
984/*
985 * Specify a set of hfids that the postdissector will need on the first pass.
986 * This ensures that the fields will not be faked, and can be retrieved with
987 * proto_get_finfo_ptr_array.
988 *
989 * @note There is no way to guarantee that fields added by other postdissectors
990 * will be available. (Issue #19804) This is for postdissectors that examine
991 * fields added by other dissectors on the first linear pass, and then store
992 * their own results in persistent memory for retrieval and adding in later
993 * passes. Postdissectors that need field values on later passes should call
994 * something else, like epan_set_always_visible() (which slows dissection.)
995 *
996 * @param handle The dissector handle used to register the postdissector.
997 * @param wanted_hfids An array of hfids (type int), which should be NULL to
998 * clear the list. This function will take ownership of the array.
999 */
1000WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle,
1001 GArray *wanted_hfids);
1002
1003/*
1004 * Deregister a postdissector. Not for use in (post)dissectors or
1005 * applications; only to be used by libwireshark itself.
1006 */
1007void deregister_postdissector(dissector_handle_t handle);
1008
1009/*
1010 * Return true if we have at least one postdissector, false if not.
1011 * Not for use in (post)dissectors or applications; only to be used
1012 * by libwireshark itself.
1013 */
1014extern bool have_postdissector(void);
1015
1016/*
1017 * Call all postdissectors, handing them the supplied arguments.
1018 * Not for use in (post)dissectors or applications; only to be used
1019 * by libwireshark itself.
1020 */
1021extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
1022
1023/*
1024 * Return true if at least one postdissector needs at least one hfid,
1025 * false otherwise.
1026 */
1027WS_DLL_PUBLIC bool postdissectors_want_hfids(void);
1028
1029/*
1030 * Prime an epan_dissect_t with all the hfids wanted by postdissectors
1031 * on the first pass. Not for use in (post)dissectors or applications;
1032 * only to be used by libwireshark itself, which will call this automatically
1033 * when dissecting a frame that has not been visited yet.
1034 */
1035extern void
1036prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt);
1037
1044WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo);
1045
1050WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo);
1051
1054#ifdef __cplusplus
1055}
1056#endif /* __cplusplus */
1057
1058#endif /* packet.h */
WS_DLL_PUBLIC void dissector_table_foreach(const char *table_name, DATFunc func, void *user_data)
Definition packet.c:2588
WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
Definition packet.c:3659
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_long_name(const dissector_handle_t handle)
Definition packet.c:3351
void deregister_dissector(const char *name)
Definition packet.c:3643
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(const char *name, const char *string)
Definition packet.c:2091
WS_DLL_PUBLIC heur_dtbl_entry_t * find_heur_dissector_by_unique_short_name(const char *short_name)
Definition packet.c:2928
void dissector_table_foreach_changed(const char *table_name, DATFunc func, void *user_data)
Definition packet.c:2665
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(const char *name, const uint32_t uint_val)
Definition packet.c:1785
WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
Definition packet.c:3426
WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto)
Definition packet.c:3597
void deregister_dissector_table(const char *name)
Definition packet.c:2862
WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
Definition packet.c:2230
WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name, dissector_cb_t dissector, const int proto, void *cb_data)
Definition packet.c:3617
WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const uint32_t pattern, dissector_handle_t handle)
Definition packet.c:1613
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name)
Definition packet.c:2918
WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table)
Definition packet.c:2465
WS_DLL_PUBLIC int dissector_try_uint(dissector_table_t sub_dissectors, const uint32_t uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
Definition packet.c:1763
WS_DLL_PUBLIC const char * dissector_handle_get_dissector_name(const dissector_handle_t handle)
Definition packet.c:3439
void deregister_heur_dissector_list(const char *name)
Definition packet.c:3325
WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(dissector_table_t sub_dissectors, void *key)
Definition packet.c:2134
WS_DLL_PUBLIC GList * get_dissector_names(void)
Definition packet.c:3409
WS_DLL_PUBLIC const char * dissector_handle_get_description(const dissector_handle_t handle)
Definition packet.c:3380
WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const uint32_t pattern, dissector_handle_t handle)
Definition packet.c:1496
WS_DLL_PUBLIC bool dissector_table_supports_decode_as(dissector_table_t dissector_table)
Definition packet.c:2480
WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo)
Definition packet.c:4270
WS_DLL_PUBLIC void register_init_routine(void(*func)(void))
Definition packet.c:352
WS_DLL_PUBLIC dissector_handle_t dissector_get_uint_handle(dissector_table_t const sub_dissectors, const uint32_t uint_val)
Definition packet.c:1773
WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto)
Definition packet.c:3020
WS_DLL_PUBLIC void set_data_source_name(packet_info *pinfo, struct data_source *src, const char *name)
Definition packet.c:452
WS_DLL_PUBLIC bool register_depend_dissector(const char *parent, const char *dependent)
Definition packet.c:3779
WS_DLL_PUBLIC void register_cleanup_routine(void(*func)(void))
Definition packet.c:358
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector, const int proto)
Definition packet.c:3537
WS_DLL_PUBLIC int dissector_try_string_with_data(dissector_table_t sub_dissectors, const char *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data)
Definition packet.c:2020
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_short_name(const dissector_handle_t handle)
Definition packet.c:3362
WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, range_t *range, dissector_handle_t handle)
Definition packet.c:1519
WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name, DATFunc_heur func, void *user_data)
Definition packet.c:3190
WS_DLL_PUBLIC void dissector_add_uint_range(const char *abbrev, range_t *range, dissector_handle_t handle)
Definition packet.c:1339
WS_DLL_PUBLIC void dissector_table_allow_decode_as(dissector_table_t dissector_table)
Definition packet.c:2471
WS_DLL_PUBLIC struct data_source * get_data_source_by_name(const packet_info *pinfo, const char *name)
Definition packet.c:497
WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name)
Definition packet.c:3420
WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo)
Definition packet.c:4264
WS_DLL_PUBLIC void dissector_all_tables_foreach_table(DATFunc_table func, void *user_data, GCompareFunc compare_key_func)
Definition packet.c:2720
WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table(DATFunc_heur_table func, void *user_data, GCompareFunc compare_key_func)
Definition packet.c:3246
WS_DLL_PUBLIC GSList * dissector_table_get_dissector_handles(dissector_table_t dissector_table)
Definition packet.c:2418
WS_DLL_PUBLIC void dissector_all_tables_foreach_changed(DATFunc func, void *user_data)
Definition packet.c:2649
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name_and_description(dissector_t dissector, const int proto, const char *name, const char *description)
Definition packet.c:3514
WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle)
Definition packet.c:3391
WS_DLL_PUBLIC bool dissector_is_uint_changed(dissector_table_t const sub_dissectors, const uint32_t uint_val)
Definition packet.c:1691
WS_DLL_PUBLIC void set_data_source_media_type(struct data_source *src, data_source_media_type_e media_type)
Definition packet.c:459
WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char *name)
Definition packet.c:3812
WS_DLL_PUBLIC const char * heur_dissector_list_get_description(heur_dissector_list_t list)
Definition packet.c:3336
WS_DLL_PUBLIC void register_dissector_table_alias(dissector_table_t dissector_table, const char *alias_name)
Definition packet.c:2844
WS_DLL_PUBLIC bool deregister_depend_dissector(const char *parent, const char *dependent)
Definition packet.c:3802
WS_DLL_PUBLIC struct data_source * add_new_data_source(packet_info *pinfo, tvbuff_t *tvb, const char *name)
Definition packet.c:437
WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
Definition packet.c:3673
WS_DLL_PUBLIC void call_heur_dissector_direct(heur_dtbl_entry_t *heur_dtbl_entry, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
Definition packet.c:3706
WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector, const char *display_name, const char *internal_name, const int proto, heuristic_enable_e enable)
Definition packet.c:2934
WS_DLL_PUBLIC dissector_handle_t register_dissector_with_description(const char *name, const char *description, dissector_t dissector, const int proto)
Definition packet.c:3607
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector, const int proto, const char *name)
Definition packet.c:3529
WS_DLL_PUBLIC struct data_source * get_data_source_by_tvb(const packet_info *pinfo, const tvbuff_t *tvb)
Definition packet.c:515
bool(* heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *)
Definition packet.h:90
WS_DLL_PUBLIC dissector_handle_t dissector_table_get_dissector_handle(dissector_table_t dissector_table, const char *description)
Definition packet.c:2448
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto)
Definition packet.c:3319
WS_DLL_PUBLIC int dissector_try_uint_with_data(dissector_table_t sub_dissectors, const uint32_t uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data)
Definition packet.c:1706
WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func, void *user_data)
Definition packet.c:2607
WS_DLL_PUBLIC bool dissector_try_heuristic(heur_dissector_list_t sub_dissectors, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, heur_dtbl_entry_t **hdtbl_entry, void *data)
Definition packet.c:3046
WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const uint32_t pattern)
Definition packet.c:1658
WS_DLL_PUBLIC int dissector_try_guid_with_data(dissector_table_t sub_dissectors, guid_key *guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data)
Definition packet.c:2176
WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle)
Definition packet.c:1581
WS_DLL_PUBLIC void dissector_add_uint_range_with_preference(const char *abbrev, const char *range_str, dissector_handle_t handle)
Definition packet.c:1478
WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(dissector_table_t sub_dissectors, const char *string)
Definition packet.c:2076
WS_DLL_PUBLIC data_source_media_type_e get_data_source_media_type(const struct data_source *src)
Definition packet.c:530
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list_with_description(const char *name, const char *ui_name, const int proto)
Definition packet.c:3300
Definition guid-utils.h:23
Definition packet.h:378
Definition packet_info.h:43
Definition proto.h:907
Definition proto.c:381
Definition packet.c:56
Definition packet.c:131
Definition packet.c:837
Definition packet.c:97
Definition packet.c:1182
Definition column-info.h:62
Definition epan_dissect.h:28
Definition range.h:41
Definition packet.h:955
Definition packet.h:935
wtap_block_t pkt_block
Definition packet.h:936
Definition packet.h:921
wtap_block_t pkt_block
Definition packet.h:928
Definition packet.c:188
Definition packet.h:485
Definition tvbuff-int.h:35
Definition wtap_opttypes.h:229
Definition wtap.h:1425