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 
394  dissector_table_t const sub_dissectors, guid_key* guid_val);
395 
396 /* Use the currently assigned payload dissector for the dissector table and,
397  if any, call the dissector with the arguments supplied, and return the
398  number of bytes consumed, otherwise return 0. */
399 WS_DLL_PUBLIC int dissector_try_payload(dissector_table_t sub_dissectors,
400  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
401 
402 /* Use the currently assigned payload dissector for the dissector table and,
403  if any, call the dissector with the arguments supplied, and return the
404  number of bytes consumed, otherwise return 0. */
405 WS_DLL_PUBLIC int dissector_try_payload_new(dissector_table_t sub_dissectors,
406  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
407 
408 /* Change the entry for a dissector in a payload (FT_NONE) dissector table
409  with a particular pattern to use a new dissector handle. */
410 WS_DLL_PUBLIC void dissector_change_payload(const char *abbrev, dissector_handle_t handle);
411 
412 /* Reset payload (FT_NONE) dissector table to its initial value. */
413 WS_DLL_PUBLIC void dissector_reset_payload(const char *name);
414 
415 /* Given a payload dissector table (type FT_NONE), return the handle of
416  the dissector that is currently active, i.e. that was selected via
417  Decode As. */
418 WS_DLL_PUBLIC dissector_handle_t dissector_get_payload_handle(
420 
421 /* Add a handle to the list of handles that *could* be used with this
422  table. That list is used by the "Decode As"/"-d" code in the UI. */
423 WS_DLL_PUBLIC void dissector_add_for_decode_as(const char *name,
424  dissector_handle_t handle);
425 
426 /* Same as dissector_add_for_decode_as, but adds preference for dissector table value */
427 WS_DLL_PUBLIC void dissector_add_for_decode_as_with_preference(const char *name,
428  dissector_handle_t handle);
429 
433 
438 
442 
446 
450 
451 /* List of "heuristic" dissectors (which get handed a packet, look at it,
452  and either recognize it as being for their protocol, dissect it, and
453  return TRUE, or don't recognize it and return FALSE) to be called
454  by another dissector.
455 
456  This is opaque outside of "packet.c". */
457 struct heur_dissector_list;
459 
460 
461 typedef struct heur_dtbl_entry {
462  heur_dissector_t dissector;
463  protocol_t *protocol; /* this entry's protocol */
464  gchar *list_name; /* the list name this entry is in the list of */
465  const gchar *display_name; /* the string used to present heuristic to user */
466  gchar *short_name; /* string used for "internal" use to uniquely identify heuristic */
467  gboolean enabled;
469 
476 WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto);
477 
478 typedef void (*DATFunc_heur) (const gchar *table_name,
479  struct heur_dtbl_entry *entry, gpointer user_data);
480 typedef void (*DATFunc_heur_table) (const char *table_name,
481  struct heur_dissector_list *table, gpointer user_data);
482 
492 WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name,
493  DATFunc_heur func, gpointer user_data);
494 
503 WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table (DATFunc_heur_table func,
504  gpointer user_data, GCompareFunc compare_key_func);
505 
506 /* true if a heur_dissector list of that name exists to be registered into */
507 WS_DLL_PUBLIC gboolean has_heur_dissector_list(const gchar *name);
508 
521 WS_DLL_PUBLIC gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
522  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, heur_dtbl_entry_t **hdtbl_entry, void *data);
523 
529 WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name);
530 
536 WS_DLL_PUBLIC heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name);
537 
548 WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector,
549  const char *display_name, const char *internal_name, const int proto, heuristic_enable_e enable);
550 
558 WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto);
559 
561 WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto);
562 
564 WS_DLL_PUBLIC dissector_handle_t register_dissector_with_description(const char *name, const char *description, dissector_t dissector, const int proto);
565 
567 WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name, dissector_cb_t dissector, const int proto, void *cb_data);
568 
570 void deregister_dissector(const char *name);
571 
573 WS_DLL_PUBLIC const char *dissector_handle_get_protocol_long_name(const dissector_handle_t handle);
574 
576 WS_DLL_PUBLIC const char *dissector_handle_get_protocol_short_name(const dissector_handle_t handle);
577 
578 /* For backwards source and binary compatibility */
580 WS_DLL_PUBLIC const char *dissector_handle_get_short_name(const dissector_handle_t handle);
581 
583 WS_DLL_PUBLIC const char *dissector_handle_get_description(const dissector_handle_t handle);
584 
586 WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle);
587 
589 WS_DLL_PUBLIC GList* get_dissector_names(void);
590 
592 WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name);
593 
595 WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto);
596 
598 WS_DLL_PUBLIC const char *dissector_handle_get_dissector_name(const dissector_handle_t handle);
599 
601 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
602  const int proto);
603 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
604  const int proto, const char* name);
605 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name_and_description(dissector_t dissector,
606  const int proto, const char* name, const char* description);
607 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_data(dissector_cb_t dissector,
608  const int proto, void* cb_data);
609 
610 /* Dump all registered dissectors to the standard output */
611 WS_DLL_PUBLIC void dissector_dump_dissectors(void);
612 
626 WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb,
627  packet_info *pinfo, proto_tree *tree, void *data);
628 WS_DLL_PUBLIC int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
629  packet_info *pinfo, proto_tree *tree);
630 
631 WS_DLL_PUBLIC int call_data_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
632 
646 WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
647  packet_info *pinfo, proto_tree *tree, void *data);
648 
658  packet_info *pinfo, proto_tree *tree, void *data);
659 
660 /* This is opaque outside of "packet.c". */
661 struct depend_dissector_list;
663 
674 WS_DLL_PUBLIC gboolean register_depend_dissector(const char* parent, const char* dependent);
675 
685 WS_DLL_PUBLIC gboolean deregister_depend_dissector(const char* parent, const char* dependent);
686 
692 WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char* name);
693 
694 
695 /* Do all one-time initialization. */
696 extern void dissect_init(void);
697 
698 extern void dissect_cleanup(void);
699 
700 /*
701  * Given a tvbuff, and a length from a packet header, adjust the length
702  * of the tvbuff to reflect the specified length.
703  */
704 WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const guint specified_len);
705 
713 WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
714 
722 WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
723 
724 /*
725  * Allows protocols to register "shutdown" routines, which are called
726  * once, just before program exit
727  */
728 WS_DLL_PUBLIC void register_shutdown_routine(void (*func)(void));
729 
730 /* Initialize all data structures used for dissection. */
731 void init_dissection(void);
732 
733 /* Free data structures allocated for dissection. */
734 void cleanup_dissection(void);
735 
736 /* Allow protocols to register a "cleanup" routine to be
737  * run after the initial sequential run through the packets.
738  * Note that the file can still be open after this; this is not
739  * the final cleanup. */
740 WS_DLL_PUBLIC void register_postseq_cleanup_routine(void (*func)(void));
741 
742 /* Call all the registered "postseq_cleanup" routines. */
743 WS_DLL_PUBLIC void postseq_cleanup_all_protocols(void);
744 
745 /* Allow dissectors to register a "final_registration" routine
746  * that is run like the proto_register_XXX() routine, but the end
747  * end of the epan_init() function; that is, *after* all other
748  * subsystems, liked dfilters, have finished initializing. This is
749  * useful for dissector registration routines which need to compile
750  * display filters. dfilters can't initialize itself until all protocols
751  * have registered themselves. */
752 WS_DLL_PUBLIC void
753 register_final_registration_routine(void (*func)(void));
754 
755 /* Call all the registered "final_registration" routines. */
756 extern void
757 final_registration_all_protocols(void);
758 
759 /*
760  * Add a new data source to the list of data sources for a frame, given
761  * the tvbuff for the data source and its name.
762  */
763 WS_DLL_PUBLIC void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
764  const char *name);
765 /* Removes the last-added data source, if it turns out it wasn't needed */
766 WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
767 
768 /*
769  * Return the data source name, tvb.
770  */
771 struct data_source;
772 WS_DLL_PUBLIC char *get_data_source_name(const struct data_source *src);
773 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb(const struct data_source *src);
774 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb_by_name(packet_info *pinfo, const char *name);
775 
776 /*
777  * Free up a frame's list of data sources.
778  */
779 extern void free_data_sources(packet_info *pinfo);
780 
781 /* Mark another frame as depended upon by the current frame.
782  *
783  * This information is used to ensure that the depended-upon frame is saved
784  * if the user does a File->Save-As of only the Displayed packets and the
785  * current frame passed the display filter.
786  */
787 WS_DLL_PUBLIC void mark_frame_as_depended_upon(frame_data *fd, guint32 frame_num);
788 
789 /* Structure passed to the frame dissector */
790 typedef struct frame_data_s
791 {
792  int file_type_subtype;
794  struct epan_dissect *color_edt;
796 } frame_data_t;
797 
798 /* Structure passed to the file dissector */
799 typedef struct file_data_s
800 {
802  struct epan_dissect *color_edt;
804 } file_data_t;
805 
806 /*
807  * Dissectors should never modify the record data.
808  */
809 extern void dissect_record(struct epan_dissect *edt, int file_type_subtype,
810  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
811 
812 /*
813  * Dissectors should never modify the packet data.
814  */
815 extern void dissect_file(struct epan_dissect *edt,
816  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
817 
818 /* Structure passed to the ethertype dissector */
819 typedef struct ethertype_data_s
820 {
821  guint16 etype;
822  int payload_offset;
823  proto_tree *fh_tree;
824  int trailer_id;
825  int fcs_len;
827 
828 /*
829  * Dump layer/selector/dissector records in a fashion similar to the
830  * proto_registrar_dump_* routines.
831  */
832 WS_DLL_PUBLIC void dissector_dump_decodes(void);
833 
834 /*
835  * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
836  */
837 WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
838 
839 /*
840  * postdissectors are to be called by packet-frame.c after every other
841  * dissector has been called.
842  */
843 
844 /*
845  * Register a postdissector; the argument is the dissector handle for it.
846  */
847 WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
848 
849 /*
850  * Specify a set of hfids that the postdissector will need.
851  * The GArray is an array of hfids (type int) and should be NULL to clear the
852  * list. This function will take ownership of the memory.
853  */
854 WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle,
855  GArray *wanted_hfids);
856 
857 /*
858  * Deregister a postdissector. Not for use in (post)dissectors or
859  * applications; only to be used by libwireshark itself.
860  */
861 void deregister_postdissector(dissector_handle_t handle);
862 
863 /*
864  * Return TRUE if we have at least one postdissector, FALSE if not.
865  * Not for use in (post)dissectors or applications; only to be used
866  * by libwireshark itself.
867  */
868 extern gboolean have_postdissector(void);
869 
870 /*
871  * Call all postdissectors, handing them the supplied arguments.
872  * Not for use in (post)dissectors or applications; only to be used
873  * by libwireshark itself.
874  */
875 extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
876 
877 /*
878  * Return TRUE if at least one postdissector needs at least one hfid,
879  * FALSE otherwise.
880  */
881 WS_DLL_PUBLIC gboolean postdissectors_want_hfids(void);
882 
883 /*
884  * Prime an epan_dissect_t with all the hfids wanted by postdissectors.
885  */
886 WS_DLL_PUBLIC void
887 prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt);
888 
891 #ifdef __cplusplus
892 }
893 #endif /* __cplusplus */
894 
895 #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:3447
void deregister_dissector(const char *name)
Definition: packet.c:3430
void dissector_table_foreach_changed(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2523
WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(dissector_table_t sub_dissectors, const gchar *string)
Definition: packet.c:1899
WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
Definition: packet.c:3252
WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto)
Definition: packet.c:3373
void deregister_dissector_table(const char *name)
Definition: packet.c:2722
WS_DLL_PUBLIC gboolean deregister_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3597
WS_DLL_PUBLIC const char * dissector_handle_get_dissector_name(const dissector_handle_t handle)
Definition: packet.c:3265
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(const char *name, const guint32 uint_val)
Definition: packet.c:1593
WS_DLL_PUBLIC dissector_handle_t dissector_get_uint_handle(dissector_table_t const sub_dissectors, const guint32 uint_val)
Definition: packet.c:1581
WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
Definition: packet.c:2095
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:3393
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name)
Definition: packet.c:2778
WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table)
Definition: packet.c:2328
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_long_name(const dissector_handle_t handle)
Definition: packet.c:3184
WS_DLL_PUBLIC void dissector_table_foreach(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2446
WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(dissector_table_t sub_dissectors, void *key)
Definition: packet.c:1974
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(const char *name, const gchar *string)
Definition: packet.c:1914
WS_DLL_PUBLIC void register_init_routine(void(*func)(void))
Definition: packet.c:320
WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto)
Definition: packet.c:2883
WS_DLL_PUBLIC void register_cleanup_routine(void(*func)(void))
Definition: packet.c:326
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector, const int proto)
Definition: packet.c:3305
WS_DLL_PUBLIC void dissector_all_tables_foreach_table(DATFunc_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:2578
WS_DLL_PUBLIC gboolean dissector_table_supports_decode_as(dissector_table_t dissector_table)
Definition: packet.c:2340
WS_DLL_PUBLIC void dissector_table_allow_decode_as(dissector_table_t dissector_table)
Definition: packet.c:2334
WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name)
Definition: packet.c:3246
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:2909
WS_DLL_PUBLIC void dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data)
Definition: packet.c:2507
WS_DLL_PUBLIC gboolean register_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3569
WS_DLL_PUBLIC const char * dissector_handle_get_description(const dissector_handle_t handle)
Definition: packet.c:3213
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:3221
WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char *name)
Definition: packet.c:3607
WS_DLL_PUBLIC void register_dissector_table_alias(dissector_table_t dissector_table, const char *alias_name)
Definition: packet.c:2704
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:3461
WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func, gpointer user_data)
Definition: packet.c:2465
WS_DLL_PUBLIC GList * get_dissector_names(void)
Definition: packet.c:3239
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:3495
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:2794
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:3383
WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table(DATFunc_heur_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:3101
WS_DLL_PUBLIC GSList * dissector_table_get_dissector_handles(dissector_table_t dissector_table)
Definition: packet.c:2286
WS_DLL_PUBLIC const char * dissector_handle_get_protocol_short_name(const dissector_handle_t handle)
Definition: packet.c:3195
WS_DLL_PUBLIC dissector_handle_t dissector_table_get_dissector_handle(dissector_table_t dissector_table, const gchar *description)
Definition: packet.c:2316
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto)
Definition: packet.c:3155
WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name, DATFunc_heur func, gpointer user_data)
Definition: packet.c:3046
WS_DLL_PUBLIC heur_dtbl_entry_t * find_heur_dissector_by_unique_short_name(const char *short_name)
Definition: packet.c:2788
Definition: guid-utils.h:22
Definition: packet.h:365
Definition: packet_info.h:44
Definition: proto.h:897
Definition: proto.c:361
Definition: packet.c:56
Definition: packet.c:115
Definition: packet.c:762
Definition: packet.c:86
Definition: packet.c:1082
Definition: column-info.h:54
Definition: epan_dissect.h:28
Definition: range.h:42
Definition: packet.h:820
Definition: packet.h:800
wtap_block_t pkt_block
Definition: packet.h:801
Definition: packet.h:791
wtap_block_t pkt_block
Definition: packet.h:793
Definition: packet.c:160
Definition: packet.h:461
Definition: tvbuff-int.h:35
Definition: wtap_opttypes.c:86
Definition: wtap.h:1394