Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
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 "tvbuff.h"
18#include "epan.h"
19#include "frame_data.h"
20#include "packet_info.h"
21#include "column-utils.h"
22#include "guid-utils.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif /* __cplusplus */
27
28struct epan_range;
29
35#define hi_nibble(b) (((b) & 0xf0) >> 4)
36#define lo_nibble(b) ((b) & 0x0f)
37
38/* Check whether the "len" bytes of data starting at "offset" is
39 * entirely inside the captured data for this packet. */
40#define BYTES_ARE_IN_FRAME(offset, captured_len, len) \
41 ((unsigned)(offset) + (unsigned)(len) > (unsigned)(offset) && \
42 (unsigned)(offset) + (unsigned)(len) <= (unsigned)(captured_len))
43
44/* 0 is case insensitive for backwards compatibility with tables that
45 * used false or BASE_NONE for case sensitive, which was the default.
46 */
47#define STRING_CASE_SENSITIVE 0
48#define STRING_CASE_INSENSITIVE 1
49
50extern void packet_init(void);
51extern void packet_cache_proto_handles(void);
52extern void packet_all_tables_sort_handles(void);
53extern void packet_cleanup(void);
54
55/* Handle for dissectors you call directly or register with "dissector_add_uint()".
56 This handle is opaque outside of "packet.c". */
57struct dissector_handle;
59
60/* Hash table for matching unsigned integers, or strings, and dissectors;
61 this is opaque outside of "packet.c". */
62struct dissector_table;
64
65/*
66 * Dissector that returns:
67 *
68 * The amount of data in the protocol's PDU, if it was able to
69 * dissect all the data;
70 *
71 * 0, if the tvbuff doesn't contain a PDU for that protocol;
72 *
73 * The negative of the amount of additional data needed, if
74 * we need more data (e.g., from subsequent TCP segments) to
75 * dissect the entire PDU.
76 */
77typedef int (*dissector_t)(tvbuff_t *, packet_info *, proto_tree *, void *);
78
79/* Same as dissector_t with an extra parameter for callback pointer */
80typedef int (*dissector_cb_t)(tvbuff_t *, packet_info *, proto_tree *, void *, void *);
81
89typedef bool (*heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
90 proto_tree *tree, void *);
91
92typedef enum {
93 HEURISTIC_DISABLE,
94 HEURISTIC_ENABLE
95} heuristic_enable_e;
96
97typedef void (*DATFunc) (const char *table_name, ftenum_t selector_type,
98 void *key, void *value, void *user_data);
99typedef void (*DATFunc_handle) (const char *table_name, void *value,
100 void *user_data);
101typedef void (*DATFunc_table) (const char *table_name, const char *ui_name,
102 void *user_data);
103
104/* Opaque structure - provides type checking but no access to components */
105typedef struct dtbl_entry dtbl_entry_t;
106
107WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry);
108WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_initial_handle (dtbl_entry_t * entry);
109
119void dissector_table_foreach_changed (const char *table_name, DATFunc func,
120 void *user_data);
121
131WS_DLL_PUBLIC void dissector_table_foreach (const char *table_name, DATFunc func,
132 void *user_data);
133
142WS_DLL_PUBLIC void dissector_all_tables_foreach_changed (DATFunc func,
143 void *user_data);
144
154WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func,
155 void *user_data);
156
165WS_DLL_PUBLIC void dissector_all_tables_foreach_table (DATFunc_table func,
166 void *user_data, GCompareFunc compare_key_func);
167
168/* a protocol uses the function to register a sub-dissector table
169 *
170 * 'param' is the display base for integer tables, STRING_CASE_SENSITIVE
171 * or STRING_CASE_INSENSITIVE for string tables, and ignored for other
172 * table types.
173 */
174WS_DLL_PUBLIC dissector_table_t register_dissector_table(const char *name,
175 const char *ui_name, const int proto, const ftenum_t type, const int param);
176
177/*
178 * Similar to register_dissector_table, but with a "custom" hash function
179 * to store subdissectors.
180 */
181WS_DLL_PUBLIC dissector_table_t register_custom_dissector_table(const char *name,
182 const char *ui_name, const int proto, GHashFunc hash_func, GEqualFunc key_equal_func,
183 GDestroyNotify key_destroy_func);
184
191 const char *alias_name);
192
194void deregister_dissector_table(const char *name);
195
196/* Find a dissector table by table name. */
197WS_DLL_PUBLIC dissector_table_t find_dissector_table(const char *name);
198
199/* Get the UI name for a sub-dissector table, given its internal name */
200WS_DLL_PUBLIC const char *get_dissector_table_ui_name(const char *name);
201
202/* Get the field type for values of the selector for a dissector table,
203 given the table's internal name */
204WS_DLL_PUBLIC ftenum_t get_dissector_table_selector_type(const char *name);
205
206/* Get the param set for the sub-dissector table,
207 given the table's internal name */
208WS_DLL_PUBLIC int get_dissector_table_param(const char *name);
209
210/* Dump all dissector tables to the standard output (not the entries,
211 just the information about the tables) */
212WS_DLL_PUBLIC void dissector_dump_dissector_tables(void);
213
214/* Add an entry to a uint dissector table. */
215WS_DLL_PUBLIC void dissector_add_uint(const char *name, const uint32_t pattern,
216 dissector_handle_t handle);
217
218/* Add an entry to a uint dissector table with "preference" automatically added. */
219WS_DLL_PUBLIC void dissector_add_uint_with_preference(const char *name, const uint32_t pattern,
220 dissector_handle_t handle);
221
223WS_DLL_PUBLIC void dissector_add_uint_range(const char *abbrev, struct epan_range *range,
224 dissector_handle_t handle);
225
227WS_DLL_PUBLIC void dissector_add_uint_range_with_preference(const char *abbrev, const char* range_str,
228 dissector_handle_t handle);
229
232WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const uint32_t pattern,
233 dissector_handle_t handle);
234
236WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, struct epan_range *range,
237 dissector_handle_t handle);
238
240WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle);
241
244WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const uint32_t pattern,
245 dissector_handle_t handle);
246
248WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const uint32_t pattern);
249
255WS_DLL_PUBLIC bool dissector_is_uint_changed(dissector_table_t const sub_dissectors, const uint32_t uint_val);
256
260WS_DLL_PUBLIC int dissector_try_uint(dissector_table_t sub_dissectors,
261 const uint32_t uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
262
267WS_DLL_PUBLIC int dissector_try_uint_with_data(dissector_table_t sub_dissectors,
268 const uint32_t uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data);
269
270WS_DEPRECATED_X("Use dissector_try_uint_with_data instead")
271static inline int dissector_try_uint_new(dissector_table_t sub_dissectors,
272 const uint32_t uint_val, tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, const bool add_proto_name, void* data) \
273{ return dissector_try_uint_with_data(sub_dissectors, uint_val, tvb, pinfo, tree, add_proto_name, data); }
274
283 dissector_table_t const sub_dissectors, const uint32_t uint_val);
284
293 const char *name, const uint32_t uint_val);
294
295/* Add an entry to a string dissector table. */
296WS_DLL_PUBLIC void dissector_add_string(const char *name, const char *pattern,
297 dissector_handle_t handle);
298
299/* Delete the entry for a dissector in a string dissector table
300 with a particular pattern. */
301WS_DLL_PUBLIC void dissector_delete_string(const char *name, const char *pattern,
302 dissector_handle_t handle);
303
304/* Change the entry for a dissector in a string dissector table
305 with a particular pattern to use a new dissector handle. */
306WS_DLL_PUBLIC void dissector_change_string(const char *name, const char *pattern,
307 dissector_handle_t handle);
308
309/* Reset an entry in a string sub-dissector table to its initial value. */
310WS_DLL_PUBLIC void dissector_reset_string(const char *name, const char *pattern);
311
312/* Return true if an entry in a string dissector table is found and has been
313 * changed (i.e. dissector_change_string() has been called, such as from
314 * Decode As), otherwise return false.
315 */
316WS_DLL_PUBLIC bool dissector_is_string_changed(dissector_table_t const subdissectors, const char *string);
317
318
322WS_DLL_PUBLIC int dissector_try_string_with_data(dissector_table_t sub_dissectors,
323 const char* string, tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, const bool add_proto_name, void* data);
324
325/* Look for a given string in a given dissector table and, if found, call
326 the dissector with the arguments supplied, and return the number of
327 bytes consumed, otherwise return 0. */
328WS_DEPRECATED_X("Use dissector_try_string_with_data instead")
329static inline int
330dissector_try_string(dissector_table_t sub_dissectors, const char* string,\
331 tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data) \
332 { return dissector_try_string_with_data(sub_dissectors, string, tvb, pinfo, tree, true, data); }
333
334WS_DEPRECATED_X("Use dissector_try_string_with_data instead")
335static inline int
336dissector_try_string_new(dissector_table_t sub_dissectors, const char* string, \
337 tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, const bool add_proto_name, void* data) \
338{ return dissector_try_string_with_data(sub_dissectors, string, tvb, pinfo, tree, add_proto_name, data); }
339
340
349 dissector_table_t sub_dissectors, const char *string);
350
359 const char *name, const char *string);
360
361/* Add an entry to a "custom" dissector table. */
362WS_DLL_PUBLIC void dissector_add_custom_table_handle(const char *name, void *pattern,
363 dissector_handle_t handle);
364
373 dissector_table_t sub_dissectors, void *key);
374/* Key for GUID dissector tables. This is based off of DCE/RPC needs
375 so some dissector tables may not need the ver portion of the hash
376 */
377typedef struct _guid_key {
378 e_guid_t guid;
379 uint16_t ver;
380} guid_key;
381
382/* Add an entry to a guid dissector table. */
383WS_DLL_PUBLIC void dissector_add_guid(const char *name, guid_key* guid_val,
384 dissector_handle_t handle);
385
389WS_DLL_PUBLIC int dissector_try_guid_with_data(dissector_table_t sub_dissectors,
390 guid_key* guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data);
391
392/* Delete a GUID from a dissector table. */
393WS_DLL_PUBLIC void dissector_delete_guid(const char *name, guid_key* guid_val,
394 dissector_handle_t handle);
395
404 dissector_table_t const sub_dissectors, guid_key* guid_val);
405
406/* Use the currently assigned payload dissector for the dissector table and,
407 if any, call the dissector with the arguments supplied, and return the
408 number of bytes consumed, otherwise return 0. */
409WS_DLL_PUBLIC int dissector_try_payload_with_data(dissector_table_t sub_dissectors,
410 tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const bool add_proto_name, void *data);
411
412WS_DEPRECATED_X("Use dissector_try_payload_with_data instead")
413static inline int dissector_try_payload_new(dissector_table_t sub_dissectors,
414 tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, const bool add_proto_name, void* data){ \
415 return dissector_try_payload_with_data(sub_dissectors, tvb, pinfo, tree, add_proto_name, data); \
416}
417
418/* Use the currently assigned payload dissector for the dissector table and,
419 if any, call the dissector with the arguments supplied, and return the
420 number of bytes consumed, otherwise return 0. */
421WS_DEPRECATED_X("Use dissector_try_payload_with_data instead")
422static inline int dissector_try_payload(dissector_table_t sub_dissectors,
423 tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
424 \
425 return dissector_try_payload_with_data(sub_dissectors, tvb, pinfo, tree, true, NULL); \
426}
427
428/* Change the entry for a dissector in a payload (FT_NONE) dissector table
429 with a particular pattern to use a new dissector handle. */
430WS_DLL_PUBLIC void dissector_change_payload(const char *abbrev, dissector_handle_t handle);
431
432/* Reset payload (FT_NONE) dissector table to its initial value. */
433WS_DLL_PUBLIC void dissector_reset_payload(const char *name);
434
435/* Given a payload dissector table (type FT_NONE), return the handle of
436 the dissector that is currently active, i.e. that was selected via
437 Decode As. */
438WS_DLL_PUBLIC dissector_handle_t dissector_get_payload_handle(
440
441/* Add a handle to the list of handles that *could* be used with this
442 table. That list is used by the "Decode As"/"-d" code in the UI. */
443WS_DLL_PUBLIC void dissector_add_for_decode_as(const char *name,
444 dissector_handle_t handle);
445
446/* Same as dissector_add_for_decode_as, but adds preference for dissector table value */
447WS_DLL_PUBLIC void dissector_add_for_decode_as_with_preference(const char *name,
448 dissector_handle_t handle);
449
453
458
462
466
470
471/* List of "heuristic" dissectors (which get handed a packet, look at it,
472 and either recognize it as being for their protocol, dissect it, and
473 return true, or don't recognize it and return false) to be called
474 by another dissector.
475
476 This is opaque outside of "packet.c". */
479
480
481typedef struct heur_dtbl_entry {
482 heur_dissector_t dissector;
483 protocol_t *protocol; /* this entry's protocol */
484 char *list_name; /* the list name this entry is in the list of */
485 const char *display_name; /* the string used to present heuristic to user */
486 char *short_name; /* string used for "internal" use to uniquely identify heuristic */
487 bool enabled;
488 bool enabled_by_default;
490
498WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list_with_description(const char *name, const char *ui_name, const int proto);
499
504WS_DLL_PUBLIC const char *heur_dissector_list_get_description(heur_dissector_list_t list);
505
512WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto);
513
515void deregister_heur_dissector_list(const char *name);
516
517typedef void (*DATFunc_heur) (const char *table_name,
518 struct heur_dtbl_entry *entry, void *user_data);
519typedef void (*DATFunc_heur_table) (const char *table_name,
520 struct heur_dissector_list *table, void *user_data);
521
531WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name,
532 DATFunc_heur func, void *user_data);
533
542WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table (DATFunc_heur_table func,
543 void *user_data, GCompareFunc compare_key_func);
544
545/* true if a heur_dissector list of that name exists to be registered into */
546WS_DLL_PUBLIC bool has_heur_dissector_list(const char *name);
547
560WS_DLL_PUBLIC bool dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
561 tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, heur_dtbl_entry_t **hdtbl_entry, void *data);
562
568WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name);
569
575WS_DLL_PUBLIC heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name);
576
587WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector,
588 const char *display_name, const char *internal_name, const int proto, heuristic_enable_e enable);
589
597WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto);
598
600WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto);
601
603WS_DLL_PUBLIC dissector_handle_t register_dissector_with_description(const char *name, const char *description, dissector_t dissector, const int proto);
604
606WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name, dissector_cb_t dissector, const int proto, void *cb_data);
607
609void deregister_dissector(const char *name);
610
612WS_DLL_PUBLIC const char *dissector_handle_get_protocol_long_name(const dissector_handle_t handle);
613
615WS_DLL_PUBLIC const char *dissector_handle_get_protocol_short_name(const dissector_handle_t handle);
616
617/* For backwards source and binary compatibility */
619WS_DLL_PUBLIC const char *dissector_handle_get_short_name(const dissector_handle_t handle);
620
622WS_DLL_PUBLIC const char *dissector_handle_get_description(const dissector_handle_t handle);
623
625WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle);
626
628WS_DLL_PUBLIC GList* get_dissector_names(void);
629
631WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name);
632
634WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto);
635
637WS_DLL_PUBLIC const char *dissector_handle_get_dissector_name(const dissector_handle_t handle);
638
639WS_DLL_PUBLIC const char *dissector_handle_get_pref_suffix(const dissector_handle_t handle);
640
651WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
652 const int proto);
653
665WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
666 const int proto, const char* name);
667
683 const int proto, const char* name, const char* description);
684WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_data(dissector_cb_t dissector,
685 const int proto, void* cb_data);
686
687/* Dump all registered dissectors to the standard output */
688WS_DLL_PUBLIC void dissector_dump_dissectors(void);
689
703WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb,
704 packet_info *pinfo, proto_tree *tree, void *data);
705WS_DLL_PUBLIC int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
706 packet_info *pinfo, proto_tree *tree);
707
708WS_DLL_PUBLIC int call_data_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
709
723WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
724 packet_info *pinfo, proto_tree *tree, void *data);
725
735 packet_info *pinfo, proto_tree *tree, void *data);
736
737/* This is opaque outside of "packet.c". */
740
751WS_DLL_PUBLIC bool register_depend_dissector(const char* parent, const char* dependent);
752
762WS_DLL_PUBLIC bool deregister_depend_dissector(const char* parent, const char* dependent);
763
769WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char* name);
770
771
772/* Do all one-time initialization. */
773extern void dissect_init(void);
774
775extern void dissect_cleanup(void);
776
777/*
778 * Given a tvbuff, and a length from a packet header, adjust the length
779 * of the tvbuff to reflect the specified length.
780 */
781WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const unsigned specified_len);
782
790WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
791
799WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
800
801/*
802 * Allows protocols to register "shutdown" routines, which are called
803 * once, just before program exit
804 */
805WS_DLL_PUBLIC void register_shutdown_routine(void (*func)(void));
806
807/* Initialize all data structures used for dissection. */
808void init_dissection(void);
809
810/* Free data structures allocated for dissection. */
811void cleanup_dissection(void);
812
813/* Allow protocols to register a "cleanup" routine to be
814 * run after the initial sequential run through the packets.
815 * Note that the file can still be open after this; this is not
816 * the final cleanup. */
817WS_DLL_PUBLIC void register_postseq_cleanup_routine(void (*func)(void));
818
819/* Call all the registered "postseq_cleanup" routines. */
820WS_DLL_PUBLIC void postseq_cleanup_all_protocols(void);
821
822/* Allow dissectors to register a "final_registration" routine
823 * that is run like the proto_register_XXX() routine, but the end
824 * end of the epan_init() function; that is, *after* all other
825 * subsystems, liked dfilters, have finished initializing. This is
826 * useful for dissector registration routines which need to compile
827 * display filters. dfilters can't initialize itself until all protocols
828 * have registered themselves. */
829WS_DLL_PUBLIC void
830register_final_registration_routine(void (*func)(void));
831
832/* Call all the registered "final_registration" routines. */
833extern void
834final_registration_all_protocols(void);
835
836/*
837 * Add a new data source to the list of data sources for a frame, given
838 * the tvbuff for the data source and its name.
839 */
840WS_DLL_PUBLIC void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
841 const char *name);
842/* Removes the last-added data source, if it turns out it wasn't needed */
843WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
844
845/*
846 * Return the data source name, tvb.
847 */
848struct data_source;
849WS_DLL_PUBLIC char *get_data_source_name(const struct data_source *src);
850WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb(const struct data_source *src);
851WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb_by_name(packet_info *pinfo, const char *name);
852
853/*
854 * Free up a frame's list of data sources.
855 */
856extern void free_data_sources(packet_info *pinfo);
857
858/* Mark another frame as depended upon by the current frame.
859 *
860 * This information is used to ensure that the depended-upon frame is saved
861 * if the user does a File->Save-As of only the Displayed packets and the
862 * current frame passed the display filter.
863 */
864WS_DLL_PUBLIC void mark_frame_as_depended_upon(frame_data *fd, uint32_t frame_num);
865
866/* Structure passed to the frame dissector */
867typedef struct frame_data_s
868{
869 int file_type_subtype;
871 struct epan_dissect *color_edt;
874
875/* Structure passed to the file dissector */
876typedef struct file_data_s
877{
879 struct epan_dissect *color_edt;
882
883/*
884 * Dissectors should never modify the record data.
885 */
886extern void dissect_record(struct epan_dissect *edt, int file_type_subtype,
887 wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
888
889/*
890 * Dissectors should never modify the packet data.
891 */
892extern void dissect_file(struct epan_dissect *edt,
893 wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
894
895/* Structure passed to the ethertype dissector */
896typedef struct ethertype_data_s
897{
898 uint16_t etype;
899 int payload_offset;
900 proto_tree *fh_tree;
901 int trailer_id;
902 int fcs_len;
904
905/*
906 * Dump layer/selector/dissector records in a fashion similar to the
907 * proto_registrar_dump_* routines.
908 */
909WS_DLL_PUBLIC void dissector_dump_decodes(void);
910
911/*
912 * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
913 */
914WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
915
916/*
917 * postdissectors are to be called by packet-frame.c after every other
918 * dissector has been called.
919 */
920
921/*
922 * Register a postdissector; the argument is the dissector handle for it.
923 */
924WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
925
926/*
927 * Specify a set of hfids that the postdissector will need.
928 * The GArray is an array of hfids (type int) and should be NULL to clear the
929 * list. This function will take ownership of the memory.
930 */
931WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle,
932 GArray *wanted_hfids);
933
934/*
935 * Deregister a postdissector. Not for use in (post)dissectors or
936 * applications; only to be used by libwireshark itself.
937 */
938void deregister_postdissector(dissector_handle_t handle);
939
940/*
941 * Return true if we have at least one postdissector, false if not.
942 * Not for use in (post)dissectors or applications; only to be used
943 * by libwireshark itself.
944 */
945extern bool have_postdissector(void);
946
947/*
948 * Call all postdissectors, handing them the supplied arguments.
949 * Not for use in (post)dissectors or applications; only to be used
950 * by libwireshark itself.
951 */
952extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
953
954/*
955 * Return true if at least one postdissector needs at least one hfid,
956 * false otherwise.
957 */
958WS_DLL_PUBLIC bool postdissectors_want_hfids(void);
959
960/*
961 * Prime an epan_dissect_t with all the hfids wanted by postdissectors.
962 */
963WS_DLL_PUBLIC void
964prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt);
965
972WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo);
973
978WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo);
979
982#ifdef __cplusplus
983}
984#endif /* __cplusplus */
985
986#endif /* packet.h */
WS_DLL_PUBLIC void dissector_table_foreach(const char *table_name, DATFunc func, void *user_data)
Definition packet.c:2567
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:3654
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_long_name(const dissector_handle_t handle)
Definition packet.c:3335
void deregister_dissector(const char *name)
Definition packet.c:3638
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(const char *name, const char *string)
Definition packet.c:1989
WS_DLL_PUBLIC heur_dtbl_entry_t * find_heur_dissector_by_unique_short_name(const char *short_name)
Definition packet.c:2909
void dissector_table_foreach_changed(const char *table_name, DATFunc func, void *user_data)
Definition packet.c:2644
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(const char *name, const uint32_t uint_val)
Definition packet.c:1666
WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
Definition packet.c:3410
WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto)
Definition packet.c:3581
void deregister_dissector_table(const char *name)
Definition packet.c:2843
WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
Definition packet.c:2164
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:3601
WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const uint32_t pattern, dissector_handle_t handle)
Definition packet.c:1494
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name)
Definition packet.c:2899
WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table)
Definition packet.c:2447
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:1644
WS_DLL_PUBLIC const char * dissector_handle_get_dissector_name(const dissector_handle_t handle)
Definition packet.c:3423
void deregister_heur_dissector_list(const char *name)
Definition packet.c:3309
WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(dissector_table_t sub_dissectors, void *key)
Definition packet.c:2049
WS_DLL_PUBLIC GList * get_dissector_names(void)
Definition packet.c:3393
WS_DLL_PUBLIC const char * dissector_handle_get_description(const dissector_handle_t handle)
Definition packet.c:3364
WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const uint32_t pattern, dissector_handle_t handle)
Definition packet.c:1381
WS_DLL_PUBLIC bool dissector_table_supports_decode_as(dissector_table_t dissector_table)
Definition packet.c:2459
WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo)
Definition packet.c:4254
WS_DLL_PUBLIC void register_init_routine(void(*func)(void))
Definition packet.c:323
WS_DLL_PUBLIC dissector_handle_t dissector_get_uint_handle(dissector_table_t const sub_dissectors, const uint32_t uint_val)
Definition packet.c:1654
WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto)
Definition packet.c:3005
WS_DLL_PUBLIC bool register_depend_dissector(const char *parent, const char *dependent)
Definition packet.c:3781
WS_DLL_PUBLIC void register_cleanup_routine(void(*func)(void))
Definition packet.c:329
WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, struct epan_range *range, dissector_handle_t handle)
Definition packet.c:1404
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector, const int proto)
Definition packet.c:3521
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:1918
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_short_name(const dissector_handle_t handle)
Definition packet.c:3346
WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name, DATFunc_heur func, void *user_data)
Definition packet.c:3172
WS_DLL_PUBLIC void dissector_table_allow_decode_as(dissector_table_t dissector_table)
Definition packet.c:2453
WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name)
Definition packet.c:3404
WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo)
Definition packet.c:4248
WS_DLL_PUBLIC void dissector_all_tables_foreach_table(DATFunc_table func, void *user_data, GCompareFunc compare_key_func)
Definition packet.c:2699
WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table(DATFunc_heur_table func, void *user_data, GCompareFunc compare_key_func)
Definition packet.c:3228
WS_DLL_PUBLIC GSList * dissector_table_get_dissector_handles(dissector_table_t dissector_table)
Definition packet.c:2405
WS_DLL_PUBLIC void dissector_all_tables_foreach_changed(DATFunc func, void *user_data)
Definition packet.c:2628
WS_DLL_PUBLIC void dissector_add_uint_range(const char *abbrev, struct epan_range *range, dissector_handle_t handle)
Definition packet.c:1257
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:3498
WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle)
Definition packet.c:3375
WS_DLL_PUBLIC bool dissector_is_uint_changed(dissector_table_t const sub_dissectors, const uint32_t uint_val)
Definition packet.c:1572
WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char *name)
Definition packet.c:3819
WS_DLL_PUBLIC const char * heur_dissector_list_get_description(heur_dissector_list_t list)
Definition packet.c:3320
WS_DLL_PUBLIC void register_dissector_table_alias(dissector_table_t dissector_table, const char *alias_name)
Definition packet.c:2825
WS_DLL_PUBLIC bool deregister_depend_dissector(const char *parent, const char *dependent)
Definition packet.c:3809
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:3668
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:3702
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:2915
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:3591
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector, const int proto, const char *name)
Definition packet.c:3513
bool(* heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *)
Definition packet.h:89
WS_DLL_PUBLIC dissector_handle_t dissector_table_get_dissector_handle(dissector_table_t dissector_table, const char *description)
Definition packet.c:2435
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto)
Definition packet.c:3303
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:1587
WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func, void *user_data)
Definition packet.c:2586
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:3031
WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const uint32_t pattern)
Definition packet.c:1539
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:2110
WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle)
Definition packet.c:1466
WS_DLL_PUBLIC void dissector_add_uint_range_with_preference(const char *abbrev, const char *range_str, dissector_handle_t handle)
Definition packet.c:1363
WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(dissector_table_t sub_dissectors, const char *string)
Definition packet.c:1974
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:3282
Definition guid-utils.h:23
Definition packet.h:377
Definition packet_info.h:43
Definition proto.h:903
Definition proto.c:380
Definition packet.c:56
Definition packet.c:116
Definition packet.c:763
Definition packet.c:86
Definition packet.c:1111
Definition column-info.h:62
Definition epan_dissect.h:28
Definition range.h:41
Definition packet.h:897
Definition packet.h:877
wtap_block_t pkt_block
Definition packet.h:878
Definition packet.h:868
wtap_block_t pkt_block
Definition packet.h:870
Definition packet.c:161
Definition packet.h:481
Definition tvbuff-int.h:35
Definition wtap_opttypes.c:85
Definition wtap.h:1432