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 <wiretap/wtap_opttypes.h>
16 #include "proto.h"
17 #include "tvbuff.h"
18 #include "epan.h"
19 #include "value_string.h"
20 #include "frame_data.h"
21 #include "packet_info.h"
22 #include "column-utils.h"
23 #include "guid-utils.h"
24 #include "tfs.h"
25 #include "unit_strings.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30 
31 struct epan_range;
32 
38 #define hi_nibble(b) (((b) & 0xf0) >> 4)
39 #define lo_nibble(b) ((b) & 0x0f)
40 
41 /* Useful when you have an array whose size you can tell at compile-time */
42 #define array_length(x) (sizeof x / sizeof x[0])
43 
44 /* Check whether the "len" bytes of data starting at "offset" is
45  * entirely inside the captured data for this packet. */
46 #define BYTES_ARE_IN_FRAME(offset, captured_len, len) \
47  ((guint)(offset) + (guint)(len) > (guint)(offset) && \
48  (guint)(offset) + (guint)(len) <= (guint)(captured_len))
49 
50 /* 0 is case insenstive for backwards compatibility with tables that
51  * used FALSE or BASE_NONE for case sensitive, which was the default.
52  */
53 #define STRING_CASE_SENSITIVE 0
54 #define STRING_CASE_INSENSITIVE 1
55 
56 extern void packet_init(void);
57 extern void packet_cache_proto_handles(void);
58 extern void packet_cleanup(void);
59 
60 /* Handle for dissectors you call directly or register with "dissector_add_uint()".
61  This handle is opaque outside of "packet.c". */
62 struct dissector_handle;
63 typedef struct dissector_handle *dissector_handle_t;
64 
65 /* Hash table for matching unsigned integers, or strings, and dissectors;
66  this is opaque outside of "packet.c". */
67 struct dissector_table;
68 typedef struct dissector_table *dissector_table_t;
69 
70 /*
71  * Dissector that returns:
72  *
73  * The amount of data in the protocol's PDU, if it was able to
74  * dissect all the data;
75  *
76  * 0, if the tvbuff doesn't contain a PDU for that protocol;
77  *
78  * The negative of the amount of additional data needed, if
79  * we need more data (e.g., from subsequent TCP segments) to
80  * dissect the entire PDU.
81  */
82 typedef int (*dissector_t)(tvbuff_t *, packet_info *, proto_tree *, void *);
83 
84 /* Same as dissector_t with an extra parameter for callback pointer */
85 typedef int (*dissector_cb_t)(tvbuff_t *, packet_info *, proto_tree *, void *, void *);
86 
94 typedef gboolean (*heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
95  proto_tree *tree, void *);
96 
97 typedef enum {
98  HEURISTIC_DISABLE,
99  HEURISTIC_ENABLE
100 } heuristic_enable_e;
101 
102 typedef void (*DATFunc) (const gchar *table_name, ftenum_t selector_type,
103  gpointer key, gpointer value, gpointer user_data);
104 typedef void (*DATFunc_handle) (const gchar *table_name, gpointer value,
105  gpointer user_data);
106 typedef void (*DATFunc_table) (const gchar *table_name, const gchar *ui_name,
107  gpointer user_data);
108 
109 /* Opaque structure - provides type checking but no access to components */
110 typedef struct dtbl_entry dtbl_entry_t;
111 
112 WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry);
113 WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_initial_handle (dtbl_entry_t * entry);
114 
124 void dissector_table_foreach_changed (const char *table_name, DATFunc func,
125  gpointer user_data);
126 
136 WS_DLL_PUBLIC void dissector_table_foreach (const char *table_name, DATFunc func,
137  gpointer user_data);
138 
147 WS_DLL_PUBLIC void dissector_all_tables_foreach_changed (DATFunc func,
148  gpointer user_data);
149 
159 WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func,
160  gpointer user_data);
161 
170 WS_DLL_PUBLIC void dissector_all_tables_foreach_table (DATFunc_table func,
171  gpointer user_data, GCompareFunc compare_key_func);
172 
173 /* a protocol uses the function to register a sub-dissector table
174  *
175  * 'param' is the display base for integer tables, STRING_CASE_SENSITIVE
176  * or STRING_CASE_INSENSITIVE for string tables, and ignored for other
177  * table types.
178  */
179 WS_DLL_PUBLIC dissector_table_t register_dissector_table(const char *name,
180  const char *ui_name, const int proto, const ftenum_t type, const int param);
181 
182 /*
183  * Similar to register_dissector_table, but with a "custom" hash function
184  * to store subdissectors.
185  */
186 WS_DLL_PUBLIC dissector_table_t register_custom_dissector_table(const char *name,
187  const char *ui_name, const int proto, GHashFunc hash_func, GEqualFunc key_equal_func,
188  GDestroyNotify key_destroy_func);
189 
196  const char *alias_name);
197 
199 void deregister_dissector_table(const char *name);
200 
201 /* Find a dissector table by table name. */
202 WS_DLL_PUBLIC dissector_table_t find_dissector_table(const char *name);
203 
204 /* Get the UI name for a sub-dissector table, given its internal name */
205 WS_DLL_PUBLIC const char *get_dissector_table_ui_name(const char *name);
206 
207 /* Get the field type for values of the selector for a dissector table,
208  given the table's internal name */
209 WS_DLL_PUBLIC ftenum_t get_dissector_table_selector_type(const char *name);
210 
211 /* Get the param set for the sub-dissector table,
212  given the table's internal name */
213 WS_DLL_PUBLIC int get_dissector_table_param(const char *name);
214 
215 /* Dump all dissector tables to the standard output (not the entries,
216  just the information about the tables) */
217 WS_DLL_PUBLIC void dissector_dump_dissector_tables(void);
218 
219 /* Add an entry to a uint dissector table. */
220 WS_DLL_PUBLIC void dissector_add_uint(const char *name, const guint32 pattern,
221  dissector_handle_t handle);
222 
223 /* Add an entry to a uint dissector table with "preference" automatically added. */
224 WS_DLL_PUBLIC void dissector_add_uint_with_preference(const char *name, const guint32 pattern,
225  dissector_handle_t handle);
226 
227 /* Add an range of entries to a uint dissector table. */
228 WS_DLL_PUBLIC void dissector_add_uint_range(const char *abbrev, struct epan_range *range,
229  dissector_handle_t handle);
230 
231 /* Add an range of entries to a uint dissector table with "preference" automatically added. */
232 WS_DLL_PUBLIC void dissector_add_uint_range_with_preference(const char *abbrev, const char* range_str,
233  dissector_handle_t handle);
234 
235 /* Delete the entry for a dissector in a uint dissector table
236  with a particular pattern. */
237 WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const guint32 pattern,
238  dissector_handle_t handle);
239 
240 /* Delete an range of entries from a uint dissector table. */
241 WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, struct epan_range *range,
242  dissector_handle_t handle);
243 
244 /* Delete all entries from a dissector table. */
245 WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle);
246 
247 /* Change the entry for a dissector in a uint dissector table
248  with a particular pattern to use a new dissector handle. */
249 WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const guint32 pattern,
250  dissector_handle_t handle);
251 
252 /* Reset an entry in a uint dissector table to its initial value. */
253 WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const guint32 pattern);
254 
255 /* Return TRUE if an entry in a uint dissector table is found and has been
256  * changed (i.e. dissector_change_uint() has been called, such as from
257  * Decode As, prefs registered via dissector_add_uint_[range_]with_preference),
258  * etc.), otherwise return FALSE.
259  */
260 WS_DLL_PUBLIC gboolean dissector_is_uint_changed(dissector_table_t const sub_dissectors, const guint32 uint_val);
261 
262 /* Look for a given value in a given uint dissector table and, if found,
263  call the dissector with the arguments supplied, and return the number
264  of bytes consumed, otherwise return 0. */
265 WS_DLL_PUBLIC int dissector_try_uint(dissector_table_t sub_dissectors,
266  const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
267 
268 /* Look for a given value in a given uint dissector table and, if found,
269  call the dissector with the arguments supplied, and return the number
270  of bytes consumed, otherwise return 0. */
271 WS_DLL_PUBLIC int dissector_try_uint_new(dissector_table_t sub_dissectors,
272  const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
273 
282  dissector_table_t const sub_dissectors, const guint32 uint_val);
283 
292  const char *name, const guint32 uint_val);
293 
294 /* Add an entry to a string dissector table. */
295 WS_DLL_PUBLIC void dissector_add_string(const char *name, const gchar *pattern,
296  dissector_handle_t handle);
297 
298 /* Delete the entry for a dissector in a string dissector table
299  with a particular pattern. */
300 WS_DLL_PUBLIC void dissector_delete_string(const char *name, const gchar *pattern,
301  dissector_handle_t handle);
302 
303 /* Change the entry for a dissector in a string dissector table
304  with a particular pattern to use a new dissector handle. */
305 WS_DLL_PUBLIC void dissector_change_string(const char *name, const gchar *pattern,
306  dissector_handle_t handle);
307 
308 /* Reset an entry in a string sub-dissector table to its initial value. */
309 WS_DLL_PUBLIC void dissector_reset_string(const char *name, const gchar *pattern);
310 
311 /* Return TRUE if an entry in a string dissector table is found and has been
312  * changed (i.e. dissector_change_string() has been called, such as from
313  * Decode As), otherwise return FALSE.
314  */
315 WS_DLL_PUBLIC gboolean dissector_is_string_changed(dissector_table_t const subdissectors, const gchar *string);
316 
317 /* Look for a given string in a given dissector table and, if found, call
318  the dissector with the arguments supplied, and return the number of
319  bytes consumed, otherwise return 0. */
320 WS_DLL_PUBLIC int dissector_try_string(dissector_table_t sub_dissectors,
321  const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
322 
323 /* Look for a given string in a given dissector table and, if found, call
324  the dissector with the arguments supplied, and return the number of
325  bytes consumed, otherwise return 0. */
326 WS_DLL_PUBLIC int dissector_try_string_new(dissector_table_t sub_dissectors,
327  const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name,void *data);
328 
337  dissector_table_t sub_dissectors, const gchar *string);
338 
347  const char *name, const gchar *string);
348 
349 /* Add an entry to a "custom" dissector table. */
350 WS_DLL_PUBLIC void dissector_add_custom_table_handle(const char *name, void *pattern,
351  dissector_handle_t handle);
352 
361  dissector_table_t sub_dissectors, void *key);
362 /* Key for GUID dissector tables. This is based off of DCE/RPC needs
363  so some dissector tables may not need the ver portion of the hash
364  */
365 typedef struct _guid_key {
366  e_guid_t guid;
367  guint16 ver;
368 } guid_key;
369 
370 /* Add an entry to a guid dissector table. */
371 WS_DLL_PUBLIC void dissector_add_guid(const char *name, guid_key* guid_val,
372  dissector_handle_t handle);
373 
374 /* Look for a given value in a given guid dissector table and, if found,
375  call the dissector with the arguments supplied, and return TRUE,
376  otherwise return FALSE. */
377 WS_DLL_PUBLIC int dissector_try_guid(dissector_table_t sub_dissectors,
378  guid_key* guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
379 
380 /* Look for a given value in a given guid dissector table and, if found,
381  call the dissector with the arguments supplied, and return TRUE,
382  otherwise return FALSE. */
383 WS_DLL_PUBLIC int dissector_try_guid_new(dissector_table_t sub_dissectors,
384  guid_key* guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
385 
386 /* Delete a GUID from a dissector table. */
387 WS_DLL_PUBLIC void dissector_delete_guid(const char *name, guid_key* guid_val,
388  dissector_handle_t handle);
389 
398  dissector_table_t const sub_dissectors, guid_key* guid_val);
399 
400 /* Use the currently assigned payload dissector for the dissector table and,
401  if any, call the dissector with the arguments supplied, and return the
402  number of bytes consumed, otherwise return 0. */
403 WS_DLL_PUBLIC int dissector_try_payload(dissector_table_t sub_dissectors,
404  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
405 
406 /* Use the currently assigned payload dissector for the dissector table and,
407  if any, call the dissector with the arguments supplied, and return the
408  number of bytes consumed, otherwise return 0. */
409 WS_DLL_PUBLIC int dissector_try_payload_new(dissector_table_t sub_dissectors,
410  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
411 
412 /* Change the entry for a dissector in a payload (FT_NONE) dissector table
413  with a particular pattern to use a new dissector handle. */
414 WS_DLL_PUBLIC void dissector_change_payload(const char *abbrev, dissector_handle_t handle);
415 
416 /* Reset payload (FT_NONE) dissector table to its initial value. */
417 WS_DLL_PUBLIC void dissector_reset_payload(const char *name);
418 
419 /* Given a payload dissector table (type FT_NONE), return the handle of
420  the dissector that is currently active, i.e. that was selected via
421  Decode As. */
422 WS_DLL_PUBLIC dissector_handle_t dissector_get_payload_handle(
424 
425 /* Add a handle to the list of handles that *could* be used with this
426  table. That list is used by the "Decode As"/"-d" code in the UI. */
427 WS_DLL_PUBLIC void dissector_add_for_decode_as(const char *name,
428  dissector_handle_t handle);
429 
430 /* Same as dissector_add_for_decode_as, but adds preference for dissector table value */
431 WS_DLL_PUBLIC void dissector_add_for_decode_as_with_preference(const char *name,
432  dissector_handle_t handle);
433 
437 
442 
446 
450 
454 
455 /* List of "heuristic" dissectors (which get handed a packet, look at it,
456  and either recognize it as being for their protocol, dissect it, and
457  return TRUE, or don't recognize it and return FALSE) to be called
458  by another dissector.
459 
460  This is opaque outside of "packet.c". */
461 struct heur_dissector_list;
463 
464 
465 typedef struct heur_dtbl_entry {
466  heur_dissector_t dissector;
467  protocol_t *protocol; /* this entry's protocol */
468  gchar *list_name; /* the list name this entry is in the list of */
469  const gchar *display_name; /* the string used to present heuristic to user */
470  gchar *short_name; /* string used for "internal" use to uniquely identify heuristic */
471  gboolean enabled;
472  bool enabled_by_default;
474 
482 WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list_with_description(const char *name, const char *ui_name, const int proto);
483 
488 WS_DLL_PUBLIC const char *heur_dissector_list_get_description(heur_dissector_list_t list);
489 
496 WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto);
497 
499 void deregister_heur_dissector_list(const char *name);
500 
501 typedef void (*DATFunc_heur) (const gchar *table_name,
502  struct heur_dtbl_entry *entry, gpointer user_data);
503 typedef void (*DATFunc_heur_table) (const char *table_name,
504  struct heur_dissector_list *table, gpointer user_data);
505 
515 WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name,
516  DATFunc_heur func, gpointer user_data);
517 
526 WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table (DATFunc_heur_table func,
527  gpointer user_data, GCompareFunc compare_key_func);
528 
529 /* true if a heur_dissector list of that name exists to be registered into */
530 WS_DLL_PUBLIC gboolean has_heur_dissector_list(const gchar *name);
531 
544 WS_DLL_PUBLIC gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
545  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, heur_dtbl_entry_t **hdtbl_entry, void *data);
546 
552 WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name);
553 
559 WS_DLL_PUBLIC heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name);
560 
571 WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector,
572  const char *display_name, const char *internal_name, const int proto, heuristic_enable_e enable);
573 
581 WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto);
582 
584 WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto);
585 
587 WS_DLL_PUBLIC dissector_handle_t register_dissector_with_description(const char *name, const char *description, dissector_t dissector, const int proto);
588 
590 WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name, dissector_cb_t dissector, const int proto, void *cb_data);
591 
593 void deregister_dissector(const char *name);
594 
596 WS_DLL_PUBLIC const char *dissector_handle_get_protocol_long_name(const dissector_handle_t handle);
597 
599 WS_DLL_PUBLIC const char *dissector_handle_get_protocol_short_name(const dissector_handle_t handle);
600 
601 /* For backwards source and binary compatibility */
603 WS_DLL_PUBLIC const char *dissector_handle_get_short_name(const dissector_handle_t handle);
604 
606 WS_DLL_PUBLIC const char *dissector_handle_get_description(const dissector_handle_t handle);
607 
609 WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle);
610 
612 WS_DLL_PUBLIC GList* get_dissector_names(void);
613 
615 WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name);
616 
618 WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto);
619 
621 WS_DLL_PUBLIC const char *dissector_handle_get_dissector_name(const dissector_handle_t handle);
622 
624 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
625  const int proto);
626 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
627  const int proto, const char* name);
628 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name_and_description(dissector_t dissector,
629  const int proto, const char* name, const char* description);
630 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_data(dissector_cb_t dissector,
631  const int proto, void* cb_data);
632 
633 /* Dump all registered dissectors to the standard output */
634 WS_DLL_PUBLIC void dissector_dump_dissectors(void);
635 
649 WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb,
650  packet_info *pinfo, proto_tree *tree, void *data);
651 WS_DLL_PUBLIC int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
652  packet_info *pinfo, proto_tree *tree);
653 
654 WS_DLL_PUBLIC int call_data_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
655 
669 WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
670  packet_info *pinfo, proto_tree *tree, void *data);
671 
681  packet_info *pinfo, proto_tree *tree, void *data);
682 
683 /* This is opaque outside of "packet.c". */
684 struct depend_dissector_list;
686 
697 WS_DLL_PUBLIC gboolean register_depend_dissector(const char* parent, const char* dependent);
698 
708 WS_DLL_PUBLIC gboolean deregister_depend_dissector(const char* parent, const char* dependent);
709 
715 WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char* name);
716 
717 
718 /* Do all one-time initialization. */
719 extern void dissect_init(void);
720 
721 extern void dissect_cleanup(void);
722 
723 /*
724  * Given a tvbuff, and a length from a packet header, adjust the length
725  * of the tvbuff to reflect the specified length.
726  */
727 WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const guint specified_len);
728 
736 WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
737 
745 WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
746 
747 /*
748  * Allows protocols to register "shutdown" routines, which are called
749  * once, just before program exit
750  */
751 WS_DLL_PUBLIC void register_shutdown_routine(void (*func)(void));
752 
753 /* Initialize all data structures used for dissection. */
754 void init_dissection(void);
755 
756 /* Free data structures allocated for dissection. */
757 void cleanup_dissection(void);
758 
759 /* Allow protocols to register a "cleanup" routine to be
760  * run after the initial sequential run through the packets.
761  * Note that the file can still be open after this; this is not
762  * the final cleanup. */
763 WS_DLL_PUBLIC void register_postseq_cleanup_routine(void (*func)(void));
764 
765 /* Call all the registered "postseq_cleanup" routines. */
766 WS_DLL_PUBLIC void postseq_cleanup_all_protocols(void);
767 
768 /* Allow dissectors to register a "final_registration" routine
769  * that is run like the proto_register_XXX() routine, but the end
770  * end of the epan_init() function; that is, *after* all other
771  * subsystems, liked dfilters, have finished initializing. This is
772  * useful for dissector registration routines which need to compile
773  * display filters. dfilters can't initialize itself until all protocols
774  * have registered themselves. */
775 WS_DLL_PUBLIC void
776 register_final_registration_routine(void (*func)(void));
777 
778 /* Call all the registered "final_registration" routines. */
779 extern void
780 final_registration_all_protocols(void);
781 
782 /*
783  * Add a new data source to the list of data sources for a frame, given
784  * the tvbuff for the data source and its name.
785  */
786 WS_DLL_PUBLIC void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
787  const char *name);
788 /* Removes the last-added data source, if it turns out it wasn't needed */
789 WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
790 
791 /*
792  * Return the data source name, tvb.
793  */
794 struct data_source;
795 WS_DLL_PUBLIC char *get_data_source_name(const struct data_source *src);
796 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb(const struct data_source *src);
797 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb_by_name(packet_info *pinfo, const char *name);
798 
799 /*
800  * Free up a frame's list of data sources.
801  */
802 extern void free_data_sources(packet_info *pinfo);
803 
804 /* Mark another frame as depended upon by the current frame.
805  *
806  * This information is used to ensure that the depended-upon frame is saved
807  * if the user does a File->Save-As of only the Displayed packets and the
808  * current frame passed the display filter.
809  */
810 WS_DLL_PUBLIC void mark_frame_as_depended_upon(frame_data *fd, guint32 frame_num);
811 
812 /* Structure passed to the frame dissector */
813 typedef struct frame_data_s
814 {
815  int file_type_subtype;
817  struct epan_dissect *color_edt;
819 } frame_data_t;
820 
821 /* Structure passed to the file dissector */
822 typedef struct file_data_s
823 {
825  struct epan_dissect *color_edt;
827 } file_data_t;
828 
829 /*
830  * Dissectors should never modify the record data.
831  */
832 extern void dissect_record(struct epan_dissect *edt, int file_type_subtype,
833  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
834 
835 /*
836  * Dissectors should never modify the packet data.
837  */
838 extern void dissect_file(struct epan_dissect *edt,
839  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
840 
841 /* Structure passed to the ethertype dissector */
842 typedef struct ethertype_data_s
843 {
844  guint16 etype;
845  int payload_offset;
846  proto_tree *fh_tree;
847  int trailer_id;
848  int fcs_len;
850 
851 /*
852  * Dump layer/selector/dissector records in a fashion similar to the
853  * proto_registrar_dump_* routines.
854  */
855 WS_DLL_PUBLIC void dissector_dump_decodes(void);
856 
857 /*
858  * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
859  */
860 WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
861 
862 /*
863  * postdissectors are to be called by packet-frame.c after every other
864  * dissector has been called.
865  */
866 
867 /*
868  * Register a postdissector; the argument is the dissector handle for it.
869  */
870 WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
871 
872 /*
873  * Specify a set of hfids that the postdissector will need.
874  * The GArray is an array of hfids (type int) and should be NULL to clear the
875  * list. This function will take ownership of the memory.
876  */
877 WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle,
878  GArray *wanted_hfids);
879 
880 /*
881  * Deregister a postdissector. Not for use in (post)dissectors or
882  * applications; only to be used by libwireshark itself.
883  */
884 void deregister_postdissector(dissector_handle_t handle);
885 
886 /*
887  * Return TRUE if we have at least one postdissector, FALSE if not.
888  * Not for use in (post)dissectors or applications; only to be used
889  * by libwireshark itself.
890  */
891 extern gboolean have_postdissector(void);
892 
893 /*
894  * Call all postdissectors, handing them the supplied arguments.
895  * Not for use in (post)dissectors or applications; only to be used
896  * by libwireshark itself.
897  */
898 extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
899 
900 /*
901  * Return TRUE if at least one postdissector needs at least one hfid,
902  * FALSE otherwise.
903  */
904 WS_DLL_PUBLIC gboolean postdissectors_want_hfids(void);
905 
906 /*
907  * Prime an epan_dissect_t with all the hfids wanted by postdissectors.
908  */
909 WS_DLL_PUBLIC void
910 prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt);
911 
918 WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo);
919 
924 WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo);
925 
928 #ifdef __cplusplus
929 }
930 #endif /* __cplusplus */
931 
932 #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:3550
void deregister_dissector(const char *name)
Definition: packet.c:3534
void dissector_table_foreach_changed(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2593
WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(dissector_table_t sub_dissectors, const gchar *string)
Definition: packet.c:1969
WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
Definition: packet.c:3356
WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto)
Definition: packet.c:3477
void deregister_dissector_table(const char *name)
Definition: packet.c:2792
WS_DLL_PUBLIC gboolean deregister_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3705
WS_DLL_PUBLIC const char * dissector_handle_get_dissector_name(const dissector_handle_t handle)
Definition: packet.c:3369
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(const char *name, const guint32 uint_val)
Definition: packet.c:1654
WS_DLL_PUBLIC dissector_handle_t dissector_get_uint_handle(dissector_table_t const sub_dissectors, const guint32 uint_val)
Definition: packet.c:1642
WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
Definition: packet.c:2165
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:3497
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name)
Definition: packet.c:2848
WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table)
Definition: packet.c:2398
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_long_name(const dissector_handle_t handle)
Definition: packet.c:3284
WS_DLL_PUBLIC void dissector_table_foreach(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2516
void deregister_heur_dissector_list(const char *name)
Definition: packet.c:3258
WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(dissector_table_t sub_dissectors, void *key)
Definition: packet.c:2044
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(const char *name, const gchar *string)
Definition: packet.c:1984
WS_DLL_PUBLIC void decrement_dissection_depth(packet_info *pinfo)
Definition: packet.c:4063
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:2954
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:3409
WS_DLL_PUBLIC void dissector_all_tables_foreach_table(DATFunc_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:2648
WS_DLL_PUBLIC gboolean dissector_table_supports_decode_as(dissector_table_t dissector_table)
Definition: packet.c:2410
WS_DLL_PUBLIC void dissector_table_allow_decode_as(dissector_table_t dissector_table)
Definition: packet.c:2404
WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name)
Definition: packet.c:3350
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:2980
WS_DLL_PUBLIC void dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data)
Definition: packet.c:2577
WS_DLL_PUBLIC gboolean register_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3677
WS_DLL_PUBLIC const char * heur_dissector_list_get_description(heur_dissector_list_t list)
Definition: packet.c:3269
WS_DLL_PUBLIC const char * dissector_handle_get_description(const dissector_handle_t handle)
Definition: packet.c:3313
WS_DLL_PUBLIC void increment_dissection_depth(packet_info *pinfo)
Definition: packet.c:4057
gboolean(* heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *)
Definition: packet.h:94
WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle)
Definition: packet.c:3321
WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char *name)
Definition: packet.c:3715
WS_DLL_PUBLIC void register_dissector_table_alias(dissector_table_t dissector_table, const char *alias_name)
Definition: packet.c:2774
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:3564
WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func, gpointer user_data)
Definition: packet.c:2535
WS_DLL_PUBLIC GList * get_dissector_names(void)
Definition: packet.c:3339
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:3598
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:2864
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:3487
WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table(DATFunc_heur_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:3177
WS_DLL_PUBLIC GSList * dissector_table_get_dissector_handles(dissector_table_t dissector_table)
Definition: packet.c:2356
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_short_name(const dissector_handle_t handle)
Definition: packet.c:3295
WS_DLL_PUBLIC dissector_handle_t dissector_table_get_dissector_handle(dissector_table_t dissector_table, const gchar *description)
Definition: packet.c:2386
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto)
Definition: packet.c:3252
WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name, DATFunc_heur func, gpointer user_data)
Definition: packet.c:3121
WS_DLL_PUBLIC heur_dtbl_entry_t * find_heur_dissector_by_unique_short_name(const char *short_name)
Definition: packet.c:2858
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:3231
Definition: guid-utils.h:22
Definition: packet.h:365
Definition: packet_info.h:44
Definition: proto.h:904
Definition: proto.c:371
Definition: packet.c:56
Definition: packet.c:115
Definition: packet.c:763
Definition: packet.c:86
Definition: packet.c:1104
Definition: column-info.h:63
Definition: epan_dissect.h:28
Definition: range.h:42
Definition: packet.h:843
Definition: packet.h:823
wtap_block_t pkt_block
Definition: packet.h:824
Definition: packet.h:814
wtap_block_t pkt_block
Definition: packet.h:816
Definition: packet.c:160
Definition: packet.h:465
Definition: tvbuff-int.h:35
Definition: wtap_opttypes.c:85
Definition: wtap.h:1395