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 gboolean 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 gboolean 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 gboolean has_heur_dissector_list(const gchar *name);
529 
542 WS_DLL_PUBLIC gboolean 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 
622 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
623  const int proto);
624 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
625  const int proto, const char* name);
626 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name_and_description(dissector_t dissector,
627  const int proto, const char* name, const char* description);
628 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_data(dissector_cb_t dissector,
629  const int proto, void* cb_data);
630 
631 /* Dump all registered dissectors to the standard output */
632 WS_DLL_PUBLIC void dissector_dump_dissectors(void);
633 
647 WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb,
648  packet_info *pinfo, proto_tree *tree, void *data);
649 WS_DLL_PUBLIC int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
650  packet_info *pinfo, proto_tree *tree);
651 
652 WS_DLL_PUBLIC int call_data_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
653 
667 WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
668  packet_info *pinfo, proto_tree *tree, void *data);
669 
679  packet_info *pinfo, proto_tree *tree, void *data);
680 
681 /* This is opaque outside of "packet.c". */
682 struct depend_dissector_list;
684 
695 WS_DLL_PUBLIC gboolean register_depend_dissector(const char* parent, const char* dependent);
696 
706 WS_DLL_PUBLIC gboolean deregister_depend_dissector(const char* parent, const char* dependent);
707 
713 WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char* name);
714 
715 
716 /* Do all one-time initialization. */
717 extern void dissect_init(void);
718 
719 extern void dissect_cleanup(void);
720 
721 /*
722  * Given a tvbuff, and a length from a packet header, adjust the length
723  * of the tvbuff to reflect the specified length.
724  */
725 WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const guint specified_len);
726 
734 WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
735 
743 WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
744 
745 /*
746  * Allows protocols to register "shutdown" routines, which are called
747  * once, just before program exit
748  */
749 WS_DLL_PUBLIC void register_shutdown_routine(void (*func)(void));
750 
751 /* Initialize all data structures used for dissection. */
752 void init_dissection(void);
753 
754 /* Free data structures allocated for dissection. */
755 void cleanup_dissection(void);
756 
757 /* Allow protocols to register a "cleanup" routine to be
758  * run after the initial sequential run through the packets.
759  * Note that the file can still be open after this; this is not
760  * the final cleanup. */
761 WS_DLL_PUBLIC void register_postseq_cleanup_routine(void (*func)(void));
762 
763 /* Call all the registered "postseq_cleanup" routines. */
764 WS_DLL_PUBLIC void postseq_cleanup_all_protocols(void);
765 
766 /* Allow dissectors to register a "final_registration" routine
767  * that is run like the proto_register_XXX() routine, but the end
768  * end of the epan_init() function; that is, *after* all other
769  * subsystems, liked dfilters, have finished initializing. This is
770  * useful for dissector registration routines which need to compile
771  * display filters. dfilters can't initialize itself until all protocols
772  * have registered themselves. */
773 WS_DLL_PUBLIC void
774 register_final_registration_routine(void (*func)(void));
775 
776 /* Call all the registered "final_registration" routines. */
777 extern void
778 final_registration_all_protocols(void);
779 
780 /*
781  * Add a new data source to the list of data sources for a frame, given
782  * the tvbuff for the data source and its name.
783  */
784 WS_DLL_PUBLIC void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
785  const char *name);
786 /* Removes the last-added data source, if it turns out it wasn't needed */
787 WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
788 
789 /*
790  * Return the data source name, tvb.
791  */
792 struct data_source;
793 WS_DLL_PUBLIC char *get_data_source_name(const struct data_source *src);
794 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb(const struct data_source *src);
795 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb_by_name(packet_info *pinfo, const char *name);
796 
797 /*
798  * Free up a frame's list of data sources.
799  */
800 extern void free_data_sources(packet_info *pinfo);
801 
802 /* Mark another frame as depended upon by the current frame.
803  *
804  * This information is used to ensure that the depended-upon frame is saved
805  * if the user does a File->Save-As of only the Displayed packets and the
806  * current frame passed the display filter.
807  */
808 WS_DLL_PUBLIC void mark_frame_as_depended_upon(frame_data *fd, guint32 frame_num);
809 
810 /* Structure passed to the frame dissector */
811 typedef struct frame_data_s
812 {
813  int file_type_subtype;
815  struct epan_dissect *color_edt;
817 } frame_data_t;
818 
819 /* Structure passed to the file dissector */
820 typedef struct file_data_s
821 {
823  struct epan_dissect *color_edt;
825 } file_data_t;
826 
827 /*
828  * Dissectors should never modify the record data.
829  */
830 extern void dissect_record(struct epan_dissect *edt, int file_type_subtype,
831  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
832 
833 /*
834  * Dissectors should never modify the packet data.
835  */
836 extern void dissect_file(struct epan_dissect *edt,
837  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
838 
839 /* Structure passed to the ethertype dissector */
840 typedef struct ethertype_data_s
841 {
842  guint16 etype;
843  int payload_offset;
844  proto_tree *fh_tree;
845  int trailer_id;
846  int fcs_len;
848 
849 /*
850  * Dump layer/selector/dissector records in a fashion similar to the
851  * proto_registrar_dump_* routines.
852  */
853 WS_DLL_PUBLIC void dissector_dump_decodes(void);
854 
855 /*
856  * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
857  */
858 WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
859 
860 /*
861  * postdissectors are to be called by packet-frame.c after every other
862  * dissector has been called.
863  */
864 
865 /*
866  * Register a postdissector; the argument is the dissector handle for it.
867  */
868 WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
869 
870 /*
871  * Specify a set of hfids that the postdissector will need.
872  * The GArray is an array of hfids (type int) and should be NULL to clear the
873  * list. This function will take ownership of the memory.
874  */
875 WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle,
876  GArray *wanted_hfids);
877 
878 /*
879  * Deregister a postdissector. Not for use in (post)dissectors or
880  * applications; only to be used by libwireshark itself.
881  */
882 void deregister_postdissector(dissector_handle_t handle);
883 
884 /*
885  * Return TRUE if we have at least one postdissector, FALSE if not.
886  * Not for use in (post)dissectors or applications; only to be used
887  * by libwireshark itself.
888  */
889 extern gboolean have_postdissector(void);
890 
891 /*
892  * Call all postdissectors, handing them the supplied arguments.
893  * Not for use in (post)dissectors or applications; only to be used
894  * by libwireshark itself.
895  */
896 extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
897 
898 /*
899  * Return TRUE if at least one postdissector needs at least one hfid,
900  * FALSE otherwise.
901  */
902 WS_DLL_PUBLIC gboolean postdissectors_want_hfids(void);
903 
904 /*
905  * Prime an epan_dissect_t with all the hfids wanted by postdissectors.
906  */
907 WS_DLL_PUBLIC void
908 prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt);
909 
916 WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo);
917 
922 WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo);
923 
926 #ifdef __cplusplus
927 }
928 #endif /* __cplusplus */
929 
930 #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:3571
void deregister_dissector(const char *name)
Definition: packet.c:3555
void dissector_table_foreach_changed(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2599
WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(dissector_table_t sub_dissectors, const gchar *string)
Definition: packet.c:1975
WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
Definition: packet.c:3362
WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto)
Definition: packet.c:3498
void deregister_dissector_table(const char *name)
Definition: packet.c:2798
WS_DLL_PUBLIC gboolean deregister_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3726
WS_DLL_PUBLIC const char * dissector_handle_get_dissector_name(const dissector_handle_t handle)
Definition: packet.c:3375
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(const char *name, const guint32 uint_val)
Definition: packet.c:1660
WS_DLL_PUBLIC dissector_handle_t dissector_get_uint_handle(dissector_table_t const sub_dissectors, const guint32 uint_val)
Definition: packet.c:1648
WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
Definition: packet.c:2171
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:3518
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name)
Definition: packet.c:2854
WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table)
Definition: packet.c:2404
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_long_name(const dissector_handle_t handle)
Definition: packet.c:3290
WS_DLL_PUBLIC void dissector_table_foreach(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2522
void deregister_heur_dissector_list(const char *name)
Definition: packet.c:3264
WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(dissector_table_t sub_dissectors, void *key)
Definition: packet.c:2050
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(const char *name, const gchar *string)
Definition: packet.c:1990
WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo)
Definition: packet.c:4084
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:2960
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:3434
WS_DLL_PUBLIC void dissector_all_tables_foreach_table(DATFunc_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:2654
WS_DLL_PUBLIC gboolean dissector_table_supports_decode_as(dissector_table_t dissector_table)
Definition: packet.c:2416
WS_DLL_PUBLIC void dissector_table_allow_decode_as(dissector_table_t dissector_table)
Definition: packet.c:2410
WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name)
Definition: packet.c:3356
WS_DLL_PUBLIC gboolean 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:2986
WS_DLL_PUBLIC void dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data)
Definition: packet.c:2583
WS_DLL_PUBLIC gboolean register_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3698
WS_DLL_PUBLIC const char * heur_dissector_list_get_description(heur_dissector_list_t list)
Definition: packet.c:3275
WS_DLL_PUBLIC const char * dissector_handle_get_description(const dissector_handle_t handle)
Definition: packet.c:3319
WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo)
Definition: packet.c:4078
WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle)
Definition: packet.c:3327
WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char *name)
Definition: packet.c:3736
WS_DLL_PUBLIC void register_dissector_table_alias(dissector_table_t dissector_table, const char *alias_name)
Definition: packet.c:2780
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:3585
WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func, gpointer user_data)
Definition: packet.c:2541
WS_DLL_PUBLIC GList * get_dissector_names(void)
Definition: packet.c:3345
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:3619
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:2870
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:3508
WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table(DATFunc_heur_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:3183
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:2362
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_short_name(const dissector_handle_t handle)
Definition: packet.c:3301
WS_DLL_PUBLIC dissector_handle_t dissector_table_get_dissector_handle(dissector_table_t dissector_table, const gchar *description)
Definition: packet.c:2392
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto)
Definition: packet.c:3258
WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name, DATFunc_heur func, gpointer user_data)
Definition: packet.c:3127
WS_DLL_PUBLIC heur_dtbl_entry_t * find_heur_dissector_by_unique_short_name(const char *short_name)
Definition: packet.c:2864
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:3237
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:1110
Definition: column-info.h:63
Definition: epan_dissect.h:28
Definition: range.h:42
Definition: packet.h:841
Definition: packet.h:821
wtap_block_t pkt_block
Definition: packet.h:822
Definition: packet.h:812
wtap_block_t pkt_block
Definition: packet.h:814
Definition: packet.c:160
Definition: packet.h:463
Definition: tvbuff-int.h:35
Definition: wtap_opttypes.c:85
Definition: wtap.h:1431