Wireshark  4.3.0
The Wireshark network protocol analyzer
packet.h
Go to the documentation of this file.
1 
11 #ifndef __PACKET_H__
12 #define __PACKET_H__
13 #include <wireshark.h>
14 
15 #include <wsutil/array.h>
16 #include <wiretap/wtap_opttypes.h>
17 #include "proto.h"
18 #include "tvbuff.h"
19 #include "epan.h"
20 #include "value_string.h"
21 #include "frame_data.h"
22 #include "packet_info.h"
23 #include "column-utils.h"
24 #include "guid-utils.h"
25 #include "tfs.h"
26 #include "unit_strings.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 
32 struct epan_range;
33 
39 #define hi_nibble(b) (((b) & 0xf0) >> 4)
40 #define lo_nibble(b) ((b) & 0x0f)
41 
42 /* Check whether the "len" bytes of data starting at "offset" is
43  * entirely inside the captured data for this packet. */
44 #define BYTES_ARE_IN_FRAME(offset, captured_len, len) \
45  ((guint)(offset) + (guint)(len) > (guint)(offset) && \
46  (guint)(offset) + (guint)(len) <= (guint)(captured_len))
47 
48 /* 0 is case insensitive for backwards compatibility with tables that
49  * used FALSE or BASE_NONE for case sensitive, which was the default.
50  */
51 #define STRING_CASE_SENSITIVE 0
52 #define STRING_CASE_INSENSITIVE 1
53 
54 extern void packet_init(void);
55 extern void packet_cache_proto_handles(void);
56 extern void packet_cleanup(void);
57 
58 /* Handle for dissectors you call directly or register with "dissector_add_uint()".
59  This handle is opaque outside of "packet.c". */
60 struct dissector_handle;
61 typedef struct dissector_handle *dissector_handle_t;
62 
63 /* Hash table for matching unsigned integers, or strings, and dissectors;
64  this is opaque outside of "packet.c". */
65 struct dissector_table;
66 typedef struct dissector_table *dissector_table_t;
67 
68 /*
69  * Dissector that returns:
70  *
71  * The amount of data in the protocol's PDU, if it was able to
72  * dissect all the data;
73  *
74  * 0, if the tvbuff doesn't contain a PDU for that protocol;
75  *
76  * The negative of the amount of additional data needed, if
77  * we need more data (e.g., from subsequent TCP segments) to
78  * dissect the entire PDU.
79  */
80 typedef int (*dissector_t)(tvbuff_t *, packet_info *, proto_tree *, void *);
81 
82 /* Same as dissector_t with an extra parameter for callback pointer */
83 typedef int (*dissector_cb_t)(tvbuff_t *, packet_info *, proto_tree *, void *, void *);
84 
92 typedef bool (*heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
93  proto_tree *tree, void *);
94 
95 typedef enum {
96  HEURISTIC_DISABLE,
97  HEURISTIC_ENABLE
98 } heuristic_enable_e;
99 
100 typedef void (*DATFunc) (const gchar *table_name, ftenum_t selector_type,
101  gpointer key, gpointer value, gpointer user_data);
102 typedef void (*DATFunc_handle) (const gchar *table_name, gpointer value,
103  gpointer user_data);
104 typedef void (*DATFunc_table) (const gchar *table_name, const gchar *ui_name,
105  gpointer user_data);
106 
107 /* Opaque structure - provides type checking but no access to components */
108 typedef struct dtbl_entry dtbl_entry_t;
109 
110 WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry);
111 WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_initial_handle (dtbl_entry_t * entry);
112 
122 void dissector_table_foreach_changed (const char *table_name, DATFunc func,
123  gpointer user_data);
124 
134 WS_DLL_PUBLIC void dissector_table_foreach (const char *table_name, DATFunc func,
135  gpointer user_data);
136 
145 WS_DLL_PUBLIC void dissector_all_tables_foreach_changed (DATFunc func,
146  gpointer user_data);
147 
157 WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func,
158  gpointer user_data);
159 
168 WS_DLL_PUBLIC void dissector_all_tables_foreach_table (DATFunc_table func,
169  gpointer user_data, GCompareFunc compare_key_func);
170 
171 /* a protocol uses the function to register a sub-dissector table
172  *
173  * 'param' is the display base for integer tables, STRING_CASE_SENSITIVE
174  * or STRING_CASE_INSENSITIVE for string tables, and ignored for other
175  * table types.
176  */
177 WS_DLL_PUBLIC dissector_table_t register_dissector_table(const char *name,
178  const char *ui_name, const int proto, const ftenum_t type, const int param);
179 
180 /*
181  * Similar to register_dissector_table, but with a "custom" hash function
182  * to store subdissectors.
183  */
184 WS_DLL_PUBLIC dissector_table_t register_custom_dissector_table(const char *name,
185  const char *ui_name, const int proto, GHashFunc hash_func, GEqualFunc key_equal_func,
186  GDestroyNotify key_destroy_func);
187 
194  const char *alias_name);
195 
197 void deregister_dissector_table(const char *name);
198 
199 /* Find a dissector table by table name. */
200 WS_DLL_PUBLIC dissector_table_t find_dissector_table(const char *name);
201 
202 /* Get the UI name for a sub-dissector table, given its internal name */
203 WS_DLL_PUBLIC const char *get_dissector_table_ui_name(const char *name);
204 
205 /* Get the field type for values of the selector for a dissector table,
206  given the table's internal name */
207 WS_DLL_PUBLIC ftenum_t get_dissector_table_selector_type(const char *name);
208 
209 /* Get the param set for the sub-dissector table,
210  given the table's internal name */
211 WS_DLL_PUBLIC int get_dissector_table_param(const char *name);
212 
213 /* Dump all dissector tables to the standard output (not the entries,
214  just the information about the tables) */
215 WS_DLL_PUBLIC void dissector_dump_dissector_tables(void);
216 
217 /* Add an entry to a uint dissector table. */
218 WS_DLL_PUBLIC void dissector_add_uint(const char *name, const guint32 pattern,
219  dissector_handle_t handle);
220 
221 /* Add an entry to a uint dissector table with "preference" automatically added. */
222 WS_DLL_PUBLIC void dissector_add_uint_with_preference(const char *name, const guint32 pattern,
223  dissector_handle_t handle);
224 
225 /* Add an range of entries to a uint dissector table. */
226 WS_DLL_PUBLIC void dissector_add_uint_range(const char *abbrev, struct epan_range *range,
227  dissector_handle_t handle);
228 
229 /* Add an range of entries to a uint dissector table with "preference" automatically added. */
230 WS_DLL_PUBLIC void dissector_add_uint_range_with_preference(const char *abbrev, const char* range_str,
231  dissector_handle_t handle);
232 
233 /* Delete the entry for a dissector in a uint dissector table
234  with a particular pattern. */
235 WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const guint32 pattern,
236  dissector_handle_t handle);
237 
238 /* Delete an range of entries from a uint dissector table. */
239 WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, struct epan_range *range,
240  dissector_handle_t handle);
241 
242 /* Delete all entries from a dissector table. */
243 WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle);
244 
245 /* Change the entry for a dissector in a uint dissector table
246  with a particular pattern to use a new dissector handle. */
247 WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const guint32 pattern,
248  dissector_handle_t handle);
249 
250 /* Reset an entry in a uint dissector table to its initial value. */
251 WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const guint32 pattern);
252 
253 /* Return TRUE if an entry in a uint dissector table is found and has been
254  * changed (i.e. dissector_change_uint() has been called, such as from
255  * Decode As, prefs registered via dissector_add_uint_[range_]with_preference),
256  * etc.), otherwise return FALSE.
257  */
258 WS_DLL_PUBLIC bool dissector_is_uint_changed(dissector_table_t const sub_dissectors, const guint32 uint_val);
259 
260 /* Look for a given value in a given uint dissector table and, if found,
261  call the dissector with the arguments supplied, and return the number
262  of bytes consumed, otherwise return 0. */
263 WS_DLL_PUBLIC int dissector_try_uint(dissector_table_t sub_dissectors,
264  const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
265 
266 /* Look for a given value in a given uint dissector table and, if found,
267  call the dissector with the arguments supplied, and return the number
268  of bytes consumed, otherwise return 0. */
269 WS_DLL_PUBLIC int dissector_try_uint_new(dissector_table_t sub_dissectors,
270  const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
271 
280  dissector_table_t const sub_dissectors, const guint32 uint_val);
281 
290  const char *name, const guint32 uint_val);
291 
292 /* Add an entry to a string dissector table. */
293 WS_DLL_PUBLIC void dissector_add_string(const char *name, const gchar *pattern,
294  dissector_handle_t handle);
295 
296 /* Delete the entry for a dissector in a string dissector table
297  with a particular pattern. */
298 WS_DLL_PUBLIC void dissector_delete_string(const char *name, const gchar *pattern,
299  dissector_handle_t handle);
300 
301 /* Change the entry for a dissector in a string dissector table
302  with a particular pattern to use a new dissector handle. */
303 WS_DLL_PUBLIC void dissector_change_string(const char *name, const gchar *pattern,
304  dissector_handle_t handle);
305 
306 /* Reset an entry in a string sub-dissector table to its initial value. */
307 WS_DLL_PUBLIC void dissector_reset_string(const char *name, const gchar *pattern);
308 
309 /* Return TRUE if an entry in a string dissector table is found and has been
310  * changed (i.e. dissector_change_string() has been called, such as from
311  * Decode As), otherwise return FALSE.
312  */
313 WS_DLL_PUBLIC bool dissector_is_string_changed(dissector_table_t const subdissectors, const gchar *string);
314 
315 /* Look for a given string in a given dissector table and, if found, call
316  the dissector with the arguments supplied, and return the number of
317  bytes consumed, otherwise return 0. */
318 WS_DLL_PUBLIC int dissector_try_string(dissector_table_t sub_dissectors,
319  const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
320 
321 /* Look for a given string in a given dissector table and, if found, call
322  the dissector with the arguments supplied, and return the number of
323  bytes consumed, otherwise return 0. */
324 WS_DLL_PUBLIC int dissector_try_string_new(dissector_table_t sub_dissectors,
325  const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name,void *data);
326 
335  dissector_table_t sub_dissectors, const gchar *string);
336 
345  const char *name, const gchar *string);
346 
347 /* Add an entry to a "custom" dissector table. */
348 WS_DLL_PUBLIC void dissector_add_custom_table_handle(const char *name, void *pattern,
349  dissector_handle_t handle);
350 
359  dissector_table_t sub_dissectors, void *key);
360 /* Key for GUID dissector tables. This is based off of DCE/RPC needs
361  so some dissector tables may not need the ver portion of the hash
362  */
363 typedef struct _guid_key {
364  e_guid_t guid;
365  guint16 ver;
366 } guid_key;
367 
368 /* Add an entry to a guid dissector table. */
369 WS_DLL_PUBLIC void dissector_add_guid(const char *name, guid_key* guid_val,
370  dissector_handle_t handle);
371 
372 /* Look for a given value in a given guid dissector table and, if found,
373  call the dissector with the arguments supplied, and return TRUE,
374  otherwise return FALSE. */
375 WS_DLL_PUBLIC int dissector_try_guid(dissector_table_t sub_dissectors,
376  guid_key* guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
377 
378 /* Look for a given value in a given guid dissector table and, if found,
379  call the dissector with the arguments supplied, and return TRUE,
380  otherwise return FALSE. */
381 WS_DLL_PUBLIC int dissector_try_guid_new(dissector_table_t sub_dissectors,
382  guid_key* guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
383 
384 /* Delete a GUID from a dissector table. */
385 WS_DLL_PUBLIC void dissector_delete_guid(const char *name, guid_key* guid_val,
386  dissector_handle_t handle);
387 
396  dissector_table_t const sub_dissectors, guid_key* guid_val);
397 
398 /* Use the currently assigned payload dissector for the dissector table and,
399  if any, call the dissector with the arguments supplied, and return the
400  number of bytes consumed, otherwise return 0. */
401 WS_DLL_PUBLIC int dissector_try_payload(dissector_table_t sub_dissectors,
402  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
403 
404 /* Use the currently assigned payload dissector for the dissector table and,
405  if any, call the dissector with the arguments supplied, and return the
406  number of bytes consumed, otherwise return 0. */
407 WS_DLL_PUBLIC int dissector_try_payload_new(dissector_table_t sub_dissectors,
408  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
409 
410 /* Change the entry for a dissector in a payload (FT_NONE) dissector table
411  with a particular pattern to use a new dissector handle. */
412 WS_DLL_PUBLIC void dissector_change_payload(const char *abbrev, dissector_handle_t handle);
413 
414 /* Reset payload (FT_NONE) dissector table to its initial value. */
415 WS_DLL_PUBLIC void dissector_reset_payload(const char *name);
416 
417 /* Given a payload dissector table (type FT_NONE), return the handle of
418  the dissector that is currently active, i.e. that was selected via
419  Decode As. */
420 WS_DLL_PUBLIC dissector_handle_t dissector_get_payload_handle(
422 
423 /* Add a handle to the list of handles that *could* be used with this
424  table. That list is used by the "Decode As"/"-d" code in the UI. */
425 WS_DLL_PUBLIC void dissector_add_for_decode_as(const char *name,
426  dissector_handle_t handle);
427 
428 /* Same as dissector_add_for_decode_as, but adds preference for dissector table value */
429 WS_DLL_PUBLIC void dissector_add_for_decode_as_with_preference(const char *name,
430  dissector_handle_t handle);
431 
435 
440 
444 
448 
452 
453 /* List of "heuristic" dissectors (which get handed a packet, look at it,
454  and either recognize it as being for their protocol, dissect it, and
455  return TRUE, or don't recognize it and return FALSE) to be called
456  by another dissector.
457 
458  This is opaque outside of "packet.c". */
459 struct heur_dissector_list;
461 
462 
463 typedef struct heur_dtbl_entry {
464  heur_dissector_t dissector;
465  protocol_t *protocol; /* this entry's protocol */
466  gchar *list_name; /* the list name this entry is in the list of */
467  const gchar *display_name; /* the string used to present heuristic to user */
468  gchar *short_name; /* string used for "internal" use to uniquely identify heuristic */
469  gboolean enabled;
470  bool enabled_by_default;
472 
480 WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list_with_description(const char *name, const char *ui_name, const int proto);
481 
486 WS_DLL_PUBLIC const char *heur_dissector_list_get_description(heur_dissector_list_t list);
487 
494 WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto);
495 
497 void deregister_heur_dissector_list(const char *name);
498 
499 typedef void (*DATFunc_heur) (const gchar *table_name,
500  struct heur_dtbl_entry *entry, gpointer user_data);
501 typedef void (*DATFunc_heur_table) (const char *table_name,
502  struct heur_dissector_list *table, gpointer user_data);
503 
513 WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name,
514  DATFunc_heur func, gpointer user_data);
515 
524 WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table (DATFunc_heur_table func,
525  gpointer user_data, GCompareFunc compare_key_func);
526 
527 /* true if a heur_dissector list of that name exists to be registered into */
528 WS_DLL_PUBLIC bool has_heur_dissector_list(const gchar *name);
529 
542 WS_DLL_PUBLIC bool dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
543  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, heur_dtbl_entry_t **hdtbl_entry, void *data);
544 
550 WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name);
551 
557 WS_DLL_PUBLIC heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name);
558 
569 WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector,
570  const char *display_name, const char *internal_name, const int proto, heuristic_enable_e enable);
571 
579 WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto);
580 
582 WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto);
583 
585 WS_DLL_PUBLIC dissector_handle_t register_dissector_with_description(const char *name, const char *description, dissector_t dissector, const int proto);
586 
588 WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name, dissector_cb_t dissector, const int proto, void *cb_data);
589 
591 void deregister_dissector(const char *name);
592 
594 WS_DLL_PUBLIC const char *dissector_handle_get_protocol_long_name(const dissector_handle_t handle);
595 
597 WS_DLL_PUBLIC const char *dissector_handle_get_protocol_short_name(const dissector_handle_t handle);
598 
599 /* For backwards source and binary compatibility */
601 WS_DLL_PUBLIC const char *dissector_handle_get_short_name(const dissector_handle_t handle);
602 
604 WS_DLL_PUBLIC const char *dissector_handle_get_description(const dissector_handle_t handle);
605 
607 WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle);
608 
610 WS_DLL_PUBLIC GList* get_dissector_names(void);
611 
613 WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name);
614 
616 WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto);
617 
619 WS_DLL_PUBLIC const char *dissector_handle_get_dissector_name(const dissector_handle_t handle);
620 
621 WS_DLL_PUBLIC const char *dissector_handle_get_pref_suffix(const dissector_handle_t handle);
622 
633 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
634  const int proto);
635 
647 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
648  const int proto, const char* name);
649 
665  const int proto, const char* name, const char* description);
666 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_data(dissector_cb_t dissector,
667  const int proto, void* cb_data);
668 
669 /* Dump all registered dissectors to the standard output */
670 WS_DLL_PUBLIC void dissector_dump_dissectors(void);
671 
685 WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb,
686  packet_info *pinfo, proto_tree *tree, void *data);
687 WS_DLL_PUBLIC int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
688  packet_info *pinfo, proto_tree *tree);
689 
690 WS_DLL_PUBLIC int call_data_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
691 
705 WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
706  packet_info *pinfo, proto_tree *tree, void *data);
707 
717  packet_info *pinfo, proto_tree *tree, void *data);
718 
719 /* This is opaque outside of "packet.c". */
720 struct depend_dissector_list;
722 
733 WS_DLL_PUBLIC bool register_depend_dissector(const char* parent, const char* dependent);
734 
744 WS_DLL_PUBLIC bool deregister_depend_dissector(const char* parent, const char* dependent);
745 
751 WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char* name);
752 
753 
754 /* Do all one-time initialization. */
755 extern void dissect_init(void);
756 
757 extern void dissect_cleanup(void);
758 
759 /*
760  * Given a tvbuff, and a length from a packet header, adjust the length
761  * of the tvbuff to reflect the specified length.
762  */
763 WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const guint specified_len);
764 
772 WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
773 
781 WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
782 
783 /*
784  * Allows protocols to register "shutdown" routines, which are called
785  * once, just before program exit
786  */
787 WS_DLL_PUBLIC void register_shutdown_routine(void (*func)(void));
788 
789 /* Initialize all data structures used for dissection. */
790 void init_dissection(void);
791 
792 /* Free data structures allocated for dissection. */
793 void cleanup_dissection(void);
794 
795 /* Allow protocols to register a "cleanup" routine to be
796  * run after the initial sequential run through the packets.
797  * Note that the file can still be open after this; this is not
798  * the final cleanup. */
799 WS_DLL_PUBLIC void register_postseq_cleanup_routine(void (*func)(void));
800 
801 /* Call all the registered "postseq_cleanup" routines. */
802 WS_DLL_PUBLIC void postseq_cleanup_all_protocols(void);
803 
804 /* Allow dissectors to register a "final_registration" routine
805  * that is run like the proto_register_XXX() routine, but the end
806  * end of the epan_init() function; that is, *after* all other
807  * subsystems, liked dfilters, have finished initializing. This is
808  * useful for dissector registration routines which need to compile
809  * display filters. dfilters can't initialize itself until all protocols
810  * have registered themselves. */
811 WS_DLL_PUBLIC void
812 register_final_registration_routine(void (*func)(void));
813 
814 /* Call all the registered "final_registration" routines. */
815 extern void
816 final_registration_all_protocols(void);
817 
818 /*
819  * Add a new data source to the list of data sources for a frame, given
820  * the tvbuff for the data source and its name.
821  */
822 WS_DLL_PUBLIC void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
823  const char *name);
824 /* Removes the last-added data source, if it turns out it wasn't needed */
825 WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
826 
827 /*
828  * Return the data source name, tvb.
829  */
830 struct data_source;
831 WS_DLL_PUBLIC char *get_data_source_name(const struct data_source *src);
832 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb(const struct data_source *src);
833 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb_by_name(packet_info *pinfo, const char *name);
834 
835 /*
836  * Free up a frame's list of data sources.
837  */
838 extern void free_data_sources(packet_info *pinfo);
839 
840 /* Mark another frame as depended upon by the current frame.
841  *
842  * This information is used to ensure that the depended-upon frame is saved
843  * if the user does a File->Save-As of only the Displayed packets and the
844  * current frame passed the display filter.
845  */
846 WS_DLL_PUBLIC void mark_frame_as_depended_upon(frame_data *fd, guint32 frame_num);
847 
848 /* Structure passed to the frame dissector */
849 typedef struct frame_data_s
850 {
851  int file_type_subtype;
853  struct epan_dissect *color_edt;
855 } frame_data_t;
856 
857 /* Structure passed to the file dissector */
858 typedef struct file_data_s
859 {
861  struct epan_dissect *color_edt;
863 } file_data_t;
864 
865 /*
866  * Dissectors should never modify the record data.
867  */
868 extern void dissect_record(struct epan_dissect *edt, int file_type_subtype,
869  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
870 
871 /*
872  * Dissectors should never modify the packet data.
873  */
874 extern void dissect_file(struct epan_dissect *edt,
875  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
876 
877 /* Structure passed to the ethertype dissector */
878 typedef struct ethertype_data_s
879 {
880  guint16 etype;
881  int payload_offset;
882  proto_tree *fh_tree;
883  int trailer_id;
884  int fcs_len;
886 
887 /*
888  * Dump layer/selector/dissector records in a fashion similar to the
889  * proto_registrar_dump_* routines.
890  */
891 WS_DLL_PUBLIC void dissector_dump_decodes(void);
892 
893 /*
894  * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
895  */
896 WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
897 
898 /*
899  * postdissectors are to be called by packet-frame.c after every other
900  * dissector has been called.
901  */
902 
903 /*
904  * Register a postdissector; the argument is the dissector handle for it.
905  */
906 WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
907 
908 /*
909  * Specify a set of hfids that the postdissector will need.
910  * The GArray is an array of hfids (type int) and should be NULL to clear the
911  * list. This function will take ownership of the memory.
912  */
913 WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle,
914  GArray *wanted_hfids);
915 
916 /*
917  * Deregister a postdissector. Not for use in (post)dissectors or
918  * applications; only to be used by libwireshark itself.
919  */
920 void deregister_postdissector(dissector_handle_t handle);
921 
922 /*
923  * Return TRUE if we have at least one postdissector, FALSE if not.
924  * Not for use in (post)dissectors or applications; only to be used
925  * by libwireshark itself.
926  */
927 extern bool have_postdissector(void);
928 
929 /*
930  * Call all postdissectors, handing them the supplied arguments.
931  * Not for use in (post)dissectors or applications; only to be used
932  * by libwireshark itself.
933  */
934 extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
935 
936 /*
937  * Return TRUE if at least one postdissector needs at least one hfid,
938  * FALSE otherwise.
939  */
940 WS_DLL_PUBLIC bool postdissectors_want_hfids(void);
941 
942 /*
943  * Prime an epan_dissect_t with all the hfids wanted by postdissectors.
944  */
945 WS_DLL_PUBLIC void
946 prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt);
947 
954 WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo);
955 
960 WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo);
961 
964 #ifdef __cplusplus
965 }
966 #endif /* __cplusplus */
967 
968 #endif /* packet.h */
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:3652
void deregister_dissector(const char *name)
Definition: packet.c:3636
void dissector_table_foreach_changed(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2642
WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(dissector_table_t sub_dissectors, const gchar *string)
Definition: packet.c:1981
WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
Definition: packet.c:3408
WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto)
Definition: packet.c:3579
void deregister_dissector_table(const char *name)
Definition: packet.c:2841
WS_DLL_PUBLIC const char * dissector_handle_get_dissector_name(const dissector_handle_t handle)
Definition: packet.c:3421
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(const char *name, const guint32 uint_val)
Definition: packet.c:1666
WS_DLL_PUBLIC dissector_handle_t dissector_get_uint_handle(dissector_table_t const sub_dissectors, const guint32 uint_val)
Definition: packet.c:1654
WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
Definition: packet.c:2177
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:3599
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name)
Definition: packet.c:2897
WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table)
Definition: packet.c:2447
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_long_name(const dissector_handle_t handle)
Definition: packet.c:3333
WS_DLL_PUBLIC void dissector_table_foreach(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2565
void deregister_heur_dissector_list(const char *name)
Definition: packet.c:3307
WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(dissector_table_t sub_dissectors, void *key)
Definition: packet.c:2056
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(const char *name, const gchar *string)
Definition: packet.c:1996
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:4165
WS_DLL_PUBLIC void register_init_routine(void(*func)(void))
Definition: packet.c:321
WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto)
Definition: packet.c:3003
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:327
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector, const int proto)
Definition: packet.c:3519
WS_DLL_PUBLIC void dissector_all_tables_foreach_table(DATFunc_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:2697
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:3402
WS_DLL_PUBLIC void dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data)
Definition: packet.c:2626
WS_DLL_PUBLIC const char * heur_dissector_list_get_description(heur_dissector_list_t list)
Definition: packet.c:3318
WS_DLL_PUBLIC const char * dissector_handle_get_description(const dissector_handle_t handle)
Definition: packet.c:3362
WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo)
Definition: packet.c:4159
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:3496
WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle)
Definition: packet.c:3373
WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char *name)
Definition: packet.c:3817
WS_DLL_PUBLIC void register_dissector_table_alias(dissector_table_t dissector_table, const char *alias_name)
Definition: packet.c:2823
WS_DLL_PUBLIC bool deregister_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3807
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:3666
WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func, gpointer user_data)
Definition: packet.c:2584
WS_DLL_PUBLIC GList * get_dissector_names(void)
Definition: packet.c:3391
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:3700
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:2913
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:3589
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector, const int proto, const char *name)
Definition: packet.c:3511
WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table(DATFunc_heur_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:3226
bool(* heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *)
Definition: packet.h:92
WS_DLL_PUBLIC GSList * dissector_table_get_dissector_handles(dissector_table_t dissector_table)
Definition: packet.c:2405
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_short_name(const dissector_handle_t handle)
Definition: packet.c:3344
WS_DLL_PUBLIC dissector_handle_t dissector_table_get_dissector_handle(dissector_table_t dissector_table, const gchar *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:3301
WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name, DATFunc_heur func, gpointer user_data)
Definition: packet.c:3170
WS_DLL_PUBLIC heur_dtbl_entry_t * find_heur_dissector_by_unique_short_name(const char *short_name)
Definition: packet.c:2907
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:3029
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:3280
Definition: guid-utils.h:22
Definition: packet.h:363
Definition: packet_info.h:44
Definition: proto.h:904
Definition: proto.c:372
Definition: packet.c:56
Definition: packet.c:115
Definition: packet.c:763
Definition: packet.c:86
Definition: packet.c:1111
Definition: column-info.h:63
Definition: epan_dissect.h:28
Definition: range.h:42
Definition: packet.h:879
Definition: packet.h:859
wtap_block_t pkt_block
Definition: packet.h:860
Definition: packet.h:850
wtap_block_t pkt_block
Definition: packet.h:852
Definition: packet.c:160
Definition: packet.h:463
Definition: tvbuff-int.h:35
Definition: wtap_opttypes.c:85
Definition: wtap.h:1431