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 "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 insensitive 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
467
471
472/* List of "heuristic" dissectors (which get handed a packet, look at it,
473 and either recognize it as being for their protocol, dissect it, and
474 return true, or don't recognize it and return false) to be called
475 by another dissector.
476
477 This is opaque outside of "packet.c". */
480
481
482typedef struct heur_dtbl_entry {
483 heur_dissector_t dissector;
484 protocol_t *protocol; /* this entry's protocol */
485 char *list_name; /* the list name this entry is in the list of */
486 const char *display_name; /* the string used to present heuristic to user */
487 char *short_name; /* string used for "internal" use to uniquely identify heuristic */
488 bool enabled;
489 bool enabled_by_default;
491
499WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list_with_description(const char *name, const char *ui_name, const int proto);
500
505WS_DLL_PUBLIC const char *heur_dissector_list_get_description(heur_dissector_list_t list);
506
513WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto);
514
516void deregister_heur_dissector_list(const char *name);
517
518typedef void (*DATFunc_heur) (const char *table_name,
519 struct heur_dtbl_entry *entry, void *user_data);
520typedef void (*DATFunc_heur_table) (const char *table_name,
521 struct heur_dissector_list *table, void *user_data);
522
532WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name,
533 DATFunc_heur func, void *user_data);
534
543WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table (DATFunc_heur_table func,
544 void *user_data, GCompareFunc compare_key_func);
545
546/* true if a heur_dissector list of that name exists to be registered into */
547WS_DLL_PUBLIC bool has_heur_dissector_list(const char *name);
548
561WS_DLL_PUBLIC bool dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
562 tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, heur_dtbl_entry_t **hdtbl_entry, void *data);
563
569WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name);
570
576WS_DLL_PUBLIC heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name);
577
588WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector,
589 const char *display_name, const char *internal_name, const int proto, heuristic_enable_e enable);
590
598WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto);
599
601WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto);
602
604WS_DLL_PUBLIC dissector_handle_t register_dissector_with_description(const char *name, const char *description, dissector_t dissector, const int proto);
605
607WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name, dissector_cb_t dissector, const int proto, void *cb_data);
608
610void deregister_dissector(const char *name);
611
613WS_DLL_PUBLIC const char *dissector_handle_get_protocol_long_name(const dissector_handle_t handle);
614
616WS_DLL_PUBLIC const char *dissector_handle_get_protocol_short_name(const dissector_handle_t handle);
617
618/* For backwards source and binary compatibility */
620WS_DLL_PUBLIC const char *dissector_handle_get_short_name(const dissector_handle_t handle);
621
623WS_DLL_PUBLIC const char *dissector_handle_get_description(const dissector_handle_t handle);
624
626WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle);
627
629WS_DLL_PUBLIC GList* get_dissector_names(void);
630
632WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name);
633
635WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto);
636
638WS_DLL_PUBLIC const char *dissector_handle_get_dissector_name(const dissector_handle_t handle);
639
640WS_DLL_PUBLIC const char *dissector_handle_get_pref_suffix(const dissector_handle_t handle);
641
652WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
653 const int proto);
654
666WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
667 const int proto, const char* name);
668
684 const int proto, const char* name, const char* description);
685WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_data(dissector_cb_t dissector,
686 const int proto, void* cb_data);
687
688/* Dump all registered dissectors to the standard output */
689WS_DLL_PUBLIC void dissector_dump_dissectors(void);
690
704WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb,
705 packet_info *pinfo, proto_tree *tree, void *data);
706WS_DLL_PUBLIC int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
707 packet_info *pinfo, proto_tree *tree);
708
709WS_DLL_PUBLIC int call_data_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
710
724WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
725 packet_info *pinfo, proto_tree *tree, void *data);
726
736 packet_info *pinfo, proto_tree *tree, void *data);
737
738/* This is opaque outside of "packet.c". */
741
752WS_DLL_PUBLIC bool register_depend_dissector(const char* parent, const char* dependent);
753
763WS_DLL_PUBLIC bool deregister_depend_dissector(const char* parent, const char* dependent);
764
770WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char* name);
771
772
773/* Do all one-time initialization. */
774extern void dissect_init(void);
775
776extern void dissect_cleanup(void);
777
778/*
779 * Given a tvbuff, and a length from a packet header, adjust the length
780 * of the tvbuff to reflect the specified length.
781 */
782WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const unsigned specified_len);
783
791WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
792
800WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
801
802/*
803 * Allows protocols to register "shutdown" routines, which are called
804 * once, just before program exit
805 */
806WS_DLL_PUBLIC void register_shutdown_routine(void (*func)(void));
807
808/* Initialize all data structures used for dissection. */
809void init_dissection(void);
810
811/* Free data structures allocated for dissection. */
812void cleanup_dissection(void);
813
814/* Allow protocols to register a "cleanup" routine to be
815 * run after the initial sequential run through the packets.
816 * Note that the file can still be open after this; this is not
817 * the final cleanup. */
818WS_DLL_PUBLIC void register_postseq_cleanup_routine(void (*func)(void));
819
820/* Call all the registered "postseq_cleanup" routines. */
821WS_DLL_PUBLIC void postseq_cleanup_all_protocols(void);
822
823/* Allow dissectors to register a "final_registration" routine
824 * that is run like the proto_register_XXX() routine, but the end
825 * end of the epan_init() function; that is, *after* all other
826 * subsystems, liked dfilters, have finished initializing. This is
827 * useful for dissector registration routines which need to compile
828 * display filters. dfilters can't initialize itself until all protocols
829 * have registered themselves. */
830WS_DLL_PUBLIC void
831register_final_registration_routine(void (*func)(void));
832
833/* Call all the registered "final_registration" routines. */
834extern void
835final_registration_all_protocols(void);
836
837/*
838 * Add a new data source to the list of data sources for a frame, given
839 * the tvbuff for the data source and its name.
840 */
841WS_DLL_PUBLIC void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
842 const char *name);
843/* Removes the last-added data source, if it turns out it wasn't needed */
844WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
845
846/*
847 * Return the data source name, tvb.
848 */
849struct data_source;
850WS_DLL_PUBLIC char *get_data_source_name(const struct data_source *src);
851WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb(const struct data_source *src);
852WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb_by_name(packet_info *pinfo, const char *name);
853
854/*
855 * Free up a frame's list of data sources.
856 */
857extern void free_data_sources(packet_info *pinfo);
858
859/* Mark another frame as depended upon by the current frame.
860 *
861 * This information is used to ensure that the depended-upon frame is saved
862 * if the user does a File->Save-As of only the Displayed packets and the
863 * current frame passed the display filter.
864 */
865WS_DLL_PUBLIC void mark_frame_as_depended_upon(frame_data *fd, uint32_t frame_num);
866
867/* Structure passed to the frame dissector */
868typedef struct frame_data_s
869{
870 int file_type_subtype;
872 struct epan_dissect *color_edt;
875
876/* Structure passed to the file dissector */
877typedef struct file_data_s
878{
880 struct epan_dissect *color_edt;
883
884/*
885 * Dissectors should never modify the record data.
886 */
887extern void dissect_record(struct epan_dissect *edt, int file_type_subtype,
888 wtap_rec *rec, const uint8_t *data, frame_data *fd, column_info *cinfo);
889
890/*
891 * Dissectors should never modify the packet data.
892 */
893extern void dissect_file(struct epan_dissect *edt,
894 wtap_rec *rec, const uint8_t *data, frame_data *fd, column_info *cinfo);
895
896/* Structure passed to the ethertype dissector */
897typedef struct ethertype_data_s
898{
899 uint16_t etype;
900 int payload_offset;
901 proto_tree *fh_tree;
902 int trailer_id;
903 int fcs_len;
905
906/*
907 * Dump layer/selector/dissector records in a fashion similar to the
908 * proto_registrar_dump_* routines.
909 */
910WS_DLL_PUBLIC void dissector_dump_decodes(void);
911
912/*
913 * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
914 */
915WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
916
917/*
918 * postdissectors are to be called by packet-frame.c after every other
919 * dissector has been called.
920 */
921
922/*
923 * Register a postdissector; the argument is the dissector handle for it.
924 */
925WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
926
927/*
928 * Specify a set of hfids that the postdissector will need.
929 * The GArray is an array of hfids (type int) and should be NULL to clear the
930 * list. This function will take ownership of the memory.
931 */
932WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle,
933 GArray *wanted_hfids);
934
935/*
936 * Deregister a postdissector. Not for use in (post)dissectors or
937 * applications; only to be used by libwireshark itself.
938 */
939void deregister_postdissector(dissector_handle_t handle);
940
941/*
942 * Return true if we have at least one postdissector, false if not.
943 * Not for use in (post)dissectors or applications; only to be used
944 * by libwireshark itself.
945 */
946extern bool have_postdissector(void);
947
948/*
949 * Call all postdissectors, handing them the supplied arguments.
950 * Not for use in (post)dissectors or applications; only to be used
951 * by libwireshark itself.
952 */
953extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
954
955/*
956 * Return true if at least one postdissector needs at least one hfid,
957 * false otherwise.
958 */
959WS_DLL_PUBLIC bool postdissectors_want_hfids(void);
960
961/*
962 * Prime an epan_dissect_t with all the hfids wanted by postdissectors.
963 */
964WS_DLL_PUBLIC void
965prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt);
966
973WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo);
974
979WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo);
980
983#ifdef __cplusplus
984}
985#endif /* __cplusplus */
986
987#endif /* packet.h */
WS_DLL_PUBLIC void dissector_table_foreach(const char *table_name, DATFunc func, void *user_data)
Definition packet.c:2591
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:3678
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_long_name(const dissector_handle_t handle)
Definition packet.c:3359
void deregister_dissector(const char *name)
Definition packet.c:3662
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(const char *name, const char *string)
Definition packet.c:2013
WS_DLL_PUBLIC heur_dtbl_entry_t * find_heur_dissector_by_unique_short_name(const char *short_name)
Definition packet.c:2933
void dissector_table_foreach_changed(const char *table_name, DATFunc func, void *user_data)
Definition packet.c:2668
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(const char *name, const uint32_t uint_val)
Definition packet.c:1690
WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
Definition packet.c:3434
WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto)
Definition packet.c:3605
void deregister_dissector_table(const char *name)
Definition packet.c:2867
WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
Definition packet.c:2188
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:3625
WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const uint32_t pattern, dissector_handle_t handle)
Definition packet.c:1518
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name)
Definition packet.c:2923
WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table)
Definition packet.c:2471
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:1668
WS_DLL_PUBLIC const char * dissector_handle_get_dissector_name(const dissector_handle_t handle)
Definition packet.c:3447
void deregister_heur_dissector_list(const char *name)
Definition packet.c:3333
WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(dissector_table_t sub_dissectors, void *key)
Definition packet.c:2073
WS_DLL_PUBLIC GList * get_dissector_names(void)
Definition packet.c:3417
WS_DLL_PUBLIC const char * dissector_handle_get_description(const dissector_handle_t handle)
Definition packet.c:3388
WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const uint32_t pattern, dissector_handle_t handle)
Definition packet.c:1405
WS_DLL_PUBLIC bool dissector_table_supports_decode_as(dissector_table_t dissector_table)
Definition packet.c:2483
WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo)
Definition packet.c:4278
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:1678
WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto)
Definition packet.c:3029
WS_DLL_PUBLIC bool register_depend_dissector(const char *parent, const char *dependent)
Definition packet.c:3805
WS_DLL_PUBLIC void register_cleanup_routine(void(*func)(void))
Definition packet.c:329
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector, const int proto)
Definition packet.c:3545
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:1942
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_short_name(const dissector_handle_t handle)
Definition packet.c:3370
WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, range_t *range, dissector_handle_t handle)
Definition packet.c:1428
WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name, DATFunc_heur func, void *user_data)
Definition packet.c:3196
WS_DLL_PUBLIC void dissector_add_uint_range(const char *abbrev, range_t *range, dissector_handle_t handle)
Definition packet.c:1281
WS_DLL_PUBLIC void dissector_table_allow_decode_as(dissector_table_t dissector_table)
Definition packet.c:2477
WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name)
Definition packet.c:3428
WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo)
Definition packet.c:4272
WS_DLL_PUBLIC void dissector_all_tables_foreach_table(DATFunc_table func, void *user_data, GCompareFunc compare_key_func)
Definition packet.c:2723
WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table(DATFunc_heur_table func, void *user_data, GCompareFunc compare_key_func)
Definition packet.c:3252
WS_DLL_PUBLIC GSList * dissector_table_get_dissector_handles(dissector_table_t dissector_table)
Definition packet.c:2429
WS_DLL_PUBLIC void dissector_all_tables_foreach_changed(DATFunc func, void *user_data)
Definition packet.c:2652
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:3522
WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle)
Definition packet.c:3399
WS_DLL_PUBLIC bool dissector_is_uint_changed(dissector_table_t const sub_dissectors, const uint32_t uint_val)
Definition packet.c:1596
WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char *name)
Definition packet.c:3843
WS_DLL_PUBLIC const char * heur_dissector_list_get_description(heur_dissector_list_t list)
Definition packet.c:3344
WS_DLL_PUBLIC void register_dissector_table_alias(dissector_table_t dissector_table, const char *alias_name)
Definition packet.c:2849
WS_DLL_PUBLIC bool deregister_depend_dissector(const char *parent, const char *dependent)
Definition packet.c:3833
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:3692
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:3726
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:2939
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:3615
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector, const int proto, const char *name)
Definition packet.c:3537
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:2459
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto)
Definition packet.c:3327
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:1611
WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func, void *user_data)
Definition packet.c:2610
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:3055
WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const uint32_t pattern)
Definition packet.c:1563
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:2134
WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle)
Definition packet.c:1490
WS_DLL_PUBLIC void dissector_add_uint_range_with_preference(const char *abbrev, const char *range_str, dissector_handle_t handle)
Definition packet.c:1387
WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(dissector_table_t sub_dissectors, const char *string)
Definition packet.c:1998
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:3306
Definition guid-utils.h:23
Definition packet.h:378
Definition packet_info.h:43
Definition proto.h:903
Definition proto.c:382
Definition packet.c:56
Definition packet.c:116
Definition packet.c:787
Definition packet.c:86
Definition packet.c:1135
Definition column-info.h:62
Definition epan_dissect.h:28
Definition range.h:41
Definition packet.h:898
Definition packet.h:878
wtap_block_t pkt_block
Definition packet.h:879
Definition packet.h:869
wtap_block_t pkt_block
Definition packet.h:871
Definition packet.c:161
Definition packet.h:482
Definition tvbuff-int.h:35
Definition wtap_opttypes.c:85
Definition wtap.h:1432