Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
packet.h
1 /* packet.h
2  * Definitions for packet disassembly structures and routines
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef __PACKET_H__
12 #define __PACKET_H__
13 
14 #include "proto.h"
15 #include "tvbuff.h"
16 #include "epan.h"
17 #include "value_string.h"
18 #include "frame_data.h"
19 #include "packet_info.h"
20 #include "column-utils.h"
21 #include "guid-utils.h"
22 #include "tfs.h"
23 #include "unit_strings.h"
24 #include "ws_symbol_export.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29 
30 struct epan_range;
31 
37 #define hi_nibble(b) (((b) & 0xf0) >> 4)
38 #define lo_nibble(b) ((b) & 0x0f)
39 
40 /* Useful when you have an array whose size you can tell at compile-time */
41 #define array_length(x) (sizeof x / sizeof x[0])
42 
43 /* Check whether the "len" bytes of data starting at "offset" is
44  * entirely inside the captured data for this packet. */
45 #define BYTES_ARE_IN_FRAME(offset, captured_len, len) \
46  ((guint)(offset) + (guint)(len) > (guint)(offset) && \
47  (guint)(offset) + (guint)(len) <= (guint)(captured_len))
48 
49 extern void packet_init(void);
50 extern void packet_cache_proto_handles(void);
51 extern void packet_cleanup(void);
52 
53 /* Handle for dissectors you call directly or register with "dissector_add_uint()".
54  This handle is opaque outside of "packet.c". */
55 struct dissector_handle;
56 typedef struct dissector_handle *dissector_handle_t;
57 
58 /* Hash table for matching unsigned integers, or strings, and dissectors;
59  this is opaque outside of "packet.c". */
60 struct dissector_table;
61 typedef struct dissector_table *dissector_table_t;
62 
63 /*
64  * Dissector that returns:
65  *
66  * The amount of data in the protocol's PDU, if it was able to
67  * dissect all the data;
68  *
69  * 0, if the tvbuff doesn't contain a PDU for that protocol;
70  *
71  * The negative of the amount of additional data needed, if
72  * we need more data (e.g., from subsequent TCP segments) to
73  * dissect the entire PDU.
74  */
75 typedef int (*dissector_t)(tvbuff_t *, packet_info *, proto_tree *, void *);
76 
77 /* Same as dissector_t with an extra parameter for callback pointer */
78 typedef int (*dissector_cb_t)(tvbuff_t *, packet_info *, proto_tree *, void *, void *);
79 
87 typedef gboolean (*heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
88  proto_tree *tree, void *);
89 
90 typedef enum {
91  HEURISTIC_DISABLE,
92  HEURISTIC_ENABLE
93 } heuristic_enable_e;
94 
95 typedef void (*DATFunc) (const gchar *table_name, ftenum_t selector_type,
96  gpointer key, gpointer value, gpointer user_data);
97 typedef void (*DATFunc_handle) (const gchar *table_name, gpointer value,
98  gpointer user_data);
99 typedef void (*DATFunc_table) (const gchar *table_name, const gchar *ui_name,
100  gpointer user_data);
101 
102 /* Opaque structure - provides type checking but no access to components */
103 typedef struct dtbl_entry dtbl_entry_t;
104 
105 WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_handle (dtbl_entry_t *dtbl_entry);
106 WS_DLL_PUBLIC dissector_handle_t dtbl_entry_get_initial_handle (dtbl_entry_t * entry);
107 
117 void dissector_table_foreach_changed (const char *table_name, DATFunc func,
118  gpointer user_data);
119 
129 WS_DLL_PUBLIC void dissector_table_foreach (const char *table_name, DATFunc func,
130  gpointer user_data);
131 
140 WS_DLL_PUBLIC void dissector_all_tables_foreach_changed (DATFunc func,
141  gpointer user_data);
142 
152 WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func,
153  gpointer user_data);
154 
163 WS_DLL_PUBLIC void dissector_all_tables_foreach_table (DATFunc_table func,
164  gpointer user_data, GCompareFunc compare_key_func);
165 
166 /* a protocol uses the function to register a sub-dissector table
167  *
168  * 'param' is the display base for integer tables, and TRUE/FALSE for
169  * string tables (true indicating case-insensitive, false indicating
170  * case-sensitive)
171  */
172 WS_DLL_PUBLIC dissector_table_t register_dissector_table(const char *name,
173  const char *ui_name, const int proto, const ftenum_t type, const int param);
174 
175 /*
176  * Similar to register_dissector_table, but with a "custom" hash function
177  * to store subdissectors.
178  */
179 WS_DLL_PUBLIC dissector_table_t register_custom_dissector_table(const char *name,
180  const char *ui_name, const int proto, GHashFunc hash_func, GEqualFunc key_equal_func);
181 
183 void deregister_dissector_table(const char *name);
184 
185 /* Find a dissector table by table name. */
186 WS_DLL_PUBLIC dissector_table_t find_dissector_table(const char *name);
187 
188 /* Get the UI name for a sub-dissector table, given its internal name */
189 WS_DLL_PUBLIC const char *get_dissector_table_ui_name(const char *name);
190 
191 /* Get the field type for values of the selector for a dissector table,
192  given the table's internal name */
193 WS_DLL_PUBLIC ftenum_t get_dissector_table_selector_type(const char *name);
194 
195 /* Get the param set for the sub-dissector table,
196  given the table's internal name */
197 WS_DLL_PUBLIC int get_dissector_table_param(const char *name);
198 
199 /* Dump all dissector tables to the standard output (not the entries,
200  just the information about the tables) */
201 WS_DLL_PUBLIC void dissector_dump_dissector_tables(void);
202 
203 /* Add an entry to a uint dissector table. */
204 WS_DLL_PUBLIC void dissector_add_uint(const char *name, const guint32 pattern,
205  dissector_handle_t handle);
206 
207 /* Add an entry to a uint dissector table with "preference" automatically added. */
208 WS_DLL_PUBLIC void dissector_add_uint_with_preference(const char *name, const guint32 pattern,
209  dissector_handle_t handle);
210 
211 /* Add an range of entries to a uint dissector table. */
212 WS_DLL_PUBLIC void dissector_add_uint_range(const char *abbrev, struct epan_range *range,
213  dissector_handle_t handle);
214 
215 /* Add an range of entries to a uint dissector table with "preference" automatically added. */
216 WS_DLL_PUBLIC void dissector_add_uint_range_with_preference(const char *abbrev, const char* range_str,
217  dissector_handle_t handle);
218 
219 /* Delete the entry for a dissector in a uint dissector table
220  with a particular pattern. */
221 WS_DLL_PUBLIC void dissector_delete_uint(const char *name, const guint32 pattern,
222  dissector_handle_t handle);
223 
224 /* Delete an range of entries from a uint dissector table. */
225 WS_DLL_PUBLIC void dissector_delete_uint_range(const char *abbrev, struct epan_range *range,
226  dissector_handle_t handle);
227 
228 /* Delete all entries from a dissector table. */
229 WS_DLL_PUBLIC void dissector_delete_all(const char *name, dissector_handle_t handle);
230 
231 /* Change the entry for a dissector in a uint dissector table
232  with a particular pattern to use a new dissector handle. */
233 WS_DLL_PUBLIC void dissector_change_uint(const char *abbrev, const guint32 pattern,
234  dissector_handle_t handle);
235 
236 /* Reset an entry in a uint dissector table to its initial value. */
237 WS_DLL_PUBLIC void dissector_reset_uint(const char *name, const guint32 pattern);
238 
239 /* Look for a given value in a given uint dissector table and, if found,
240  call the dissector with the arguments supplied, and return the number
241  of bytes consumed, otherwise return 0. */
242 WS_DLL_PUBLIC int dissector_try_uint(dissector_table_t sub_dissectors,
243  const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
244 
245 /* Look for a given value in a given uint dissector table and, if found,
246  call the dissector with the arguments supplied, and return the number
247  of bytes consumed, otherwise return 0. */
248 WS_DLL_PUBLIC int dissector_try_uint_new(dissector_table_t sub_dissectors,
249  const guint32 uint_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
250 
258 WS_DLL_PUBLIC dissector_handle_t dissector_get_uint_handle(
259  dissector_table_t const sub_dissectors, const guint32 uint_val);
260 
268 WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(
269  const char *name, const guint32 uint_val);
270 
271 /* Add an entry to a string dissector table. */
272 WS_DLL_PUBLIC void dissector_add_string(const char *name, const gchar *pattern,
273  dissector_handle_t handle);
274 
275 /* Delete the entry for a dissector in a string dissector table
276  with a particular pattern. */
277 WS_DLL_PUBLIC void dissector_delete_string(const char *name, const gchar *pattern,
278  dissector_handle_t handle);
279 
280 /* Change the entry for a dissector in a string dissector table
281  with a particular pattern to use a new dissector handle. */
282 WS_DLL_PUBLIC void dissector_change_string(const char *name, const gchar *pattern,
283  dissector_handle_t handle);
284 
285 /* Reset an entry in a string sub-dissector table to its initial value. */
286 WS_DLL_PUBLIC void dissector_reset_string(const char *name, const gchar *pattern);
287 
288 /* Look for a given string in a given dissector table and, if found, call
289  the dissector with the arguments supplied, and return the number of
290  bytes consumed, otherwise return 0. */
291 WS_DLL_PUBLIC int dissector_try_string(dissector_table_t sub_dissectors,
292  const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
293 
294 /* Look for a given string in a given dissector table and, if found, call
295  the dissector with the arguments supplied, and return the number of
296  bytes consumed, otherwise return 0. */
297 WS_DLL_PUBLIC int dissector_try_string_new(dissector_table_t sub_dissectors,
298  const gchar *string, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name,void *data);
299 
307 WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(
308  dissector_table_t sub_dissectors, const gchar *string);
309 
317 WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(
318  const char *name, const gchar *string);
319 
320 /* Add an entry to a "custom" dissector table. */
321 WS_DLL_PUBLIC void dissector_add_custom_table_handle(const char *name, void *pattern,
322  dissector_handle_t handle);
323 
331 WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(
332  dissector_table_t sub_dissectors, void *key);
333 /* Key for GUID dissector tables. This is based off of DCE/RPC needs
334  so some dissector tables may not need the ver portion of the hash
335  */
336 typedef struct _guid_key {
337  e_guid_t guid;
338  guint16 ver;
339 } guid_key;
340 
341 /* Add an entry to a guid dissector table. */
342 WS_DLL_PUBLIC void dissector_add_guid(const char *name, guid_key* guid_val,
343  dissector_handle_t handle);
344 
345 /* Look for a given value in a given guid dissector table and, if found,
346  call the dissector with the arguments supplied, and return TRUE,
347  otherwise return FALSE. */
348 WS_DLL_PUBLIC int dissector_try_guid(dissector_table_t sub_dissectors,
349  guid_key* guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
350 
351 /* Look for a given value in a given guid dissector table and, if found,
352  call the dissector with the arguments supplied, and return TRUE,
353  otherwise return FALSE. */
354 WS_DLL_PUBLIC int dissector_try_guid_new(dissector_table_t sub_dissectors,
355  guid_key* guid_val, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
356 
364 WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(
365  dissector_table_t const sub_dissectors, guid_key* guid_val);
366 
367 /* Use the currently assigned payload dissector for the dissector table and,
368  if any, call the dissector with the arguments supplied, and return the
369  number of bytes consumed, otherwise return 0. */
370 WS_DLL_PUBLIC int dissector_try_payload(dissector_table_t sub_dissectors,
371  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
372 
373 /* Use the currently assigned payload dissector for the dissector table and,
374  if any, call the dissector with the arguments supplied, and return the
375  number of bytes consumed, otherwise return 0. */
376 WS_DLL_PUBLIC int dissector_try_payload_new(dissector_table_t sub_dissectors,
377  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, const gboolean add_proto_name, void *data);
378 
379 /* Change the entry for a dissector in a payload (FT_NONE) dissector table
380  with a particular pattern to use a new dissector handle. */
381 WS_DLL_PUBLIC void dissector_change_payload(const char *abbrev, dissector_handle_t handle);
382 
383 /* Reset payload (FT_NONE) dissector table to its initial value. */
384 WS_DLL_PUBLIC void dissector_reset_payload(const char *name);
385 
386 /* Add a handle to the list of handles that *could* be used with this
387  table. That list is used by the "Decode As"/"-d" code in the UI. */
388 WS_DLL_PUBLIC void dissector_add_for_decode_as(const char *name,
389  dissector_handle_t handle);
390 
391 /* Same as dissector_add_for_decode_as, but adds preference for dissector table value */
392 WS_DLL_PUBLIC void dissector_add_for_decode_as_with_preference(const char *name,
393  dissector_handle_t handle);
394 
397 WS_DLL_PUBLIC GSList *dissector_table_get_dissector_handles(dissector_table_t dissector_table);
398 
401 WS_DLL_PUBLIC dissector_handle_t dissector_table_get_dissector_handle(dissector_table_t dissector_table, const gchar* short_name);
402 
405 WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table);
406 
409 WS_DLL_PUBLIC void dissector_table_allow_decode_as(dissector_table_t dissector_table);
410 
411 /* List of "heuristic" dissectors (which get handed a packet, look at it,
412  and either recognize it as being for their protocol, dissect it, and
413  return TRUE, or don't recognize it and return FALSE) to be called
414  by another dissector.
415 
416  This is opaque outside of "packet.c". */
417 struct heur_dissector_list;
419 
420 
421 typedef struct heur_dtbl_entry {
422  heur_dissector_t dissector;
423  protocol_t *protocol; /* this entry's protocol */
424  gchar *list_name; /* the list name this entry is in the list of */
425  const gchar *display_name; /* the string used to present heuristic to user */
426  gchar *short_name; /* string used for "internal" use to uniquely identify heuristic */
427  gboolean enabled;
429 
435 WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto);
436 
437 typedef void (*DATFunc_heur) (const gchar *table_name,
438  struct heur_dtbl_entry *entry, gpointer user_data);
439 typedef void (*DATFunc_heur_table) (const char *table_name,
440  struct heur_dissector_list *table, gpointer user_data);
441 
451 WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name,
452  DATFunc_heur func, gpointer user_data);
453 
462 WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table (DATFunc_heur_table func,
463  gpointer user_data, GCompareFunc compare_key_func);
464 
465 /* true if a heur_dissector list of that anme exists to be registered into */
466 WS_DLL_PUBLIC gboolean has_heur_dissector_list(const gchar *name);
467 
480 WS_DLL_PUBLIC gboolean dissector_try_heuristic(heur_dissector_list_t sub_dissectors,
481  tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, heur_dtbl_entry_t **hdtbl_entry, void *data);
482 
488 WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name);
489 
495 WS_DLL_PUBLIC heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name);
496 
507 WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector,
508  const char *display_name, const char *short_name, const int proto, heuristic_enable_e enable);
509 
517 WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto);
518 
520 WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto);
521 
523 WS_DLL_PUBLIC dissector_handle_t register_dissector_with_data(const char *name, dissector_cb_t dissector, const int proto, void *cb_data);
524 
526 void deregister_dissector(const char *name);
527 
529 extern const char *dissector_handle_get_long_name(const dissector_handle_t handle);
530 
532 WS_DLL_PUBLIC const char *dissector_handle_get_short_name(const dissector_handle_t handle);
533 
535 WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle);
536 
538 WS_DLL_PUBLIC GList* get_dissector_names(void);
539 
541 WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name);
542 
544 WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto);
545 
547 WS_DLL_PUBLIC const char *dissector_handle_get_dissector_name(const dissector_handle_t handle);
548 
550 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
551  const int proto);
552 WS_DLL_PUBLIC dissector_handle_t create_dissector_handle_with_name(dissector_t dissector,
553  const int proto, const char* name);
554 
568 WS_DLL_PUBLIC int call_dissector_with_data(dissector_handle_t handle, tvbuff_t *tvb,
569  packet_info *pinfo, proto_tree *tree, void *data);
570 WS_DLL_PUBLIC int call_dissector(dissector_handle_t handle, tvbuff_t *tvb,
571  packet_info *pinfo, proto_tree *tree);
572 
573 WS_DLL_PUBLIC int call_data_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
574 
588 WS_DLL_PUBLIC int call_dissector_only(dissector_handle_t handle, tvbuff_t *tvb,
589  packet_info *pinfo, proto_tree *tree, void *data);
590 
599 WS_DLL_PUBLIC void call_heur_dissector_direct(heur_dtbl_entry_t *heur_dtbl_entry, tvbuff_t *tvb,
600  packet_info *pinfo, proto_tree *tree, void *data);
601 
602 /* This is opaque outside of "packet.c". */
603 struct depend_dissector_list;
605 
616 WS_DLL_PUBLIC gboolean register_depend_dissector(const char* parent, const char* dependent);
617 
627 WS_DLL_PUBLIC gboolean deregister_depend_dissector(const char* parent, const char* dependent);
628 
634 WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char* name);
635 
636 
637 /* Do all one-time initialization. */
638 extern void dissect_init(void);
639 
640 extern void dissect_cleanup(void);
641 
642 /*
643  * Given a tvbuff, and a length from a packet header, adjust the length
644  * of the tvbuff to reflect the specified length.
645  */
646 WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const guint specified_len);
647 
655 WS_DLL_PUBLIC void register_init_routine(void (*func)(void));
656 
664 WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void));
665 
666 /*
667  * Register a shutdown routine to call once just before program exit
668  */
669 WS_DLL_PUBLIC void register_shutdown_routine(void (*func)(void));
670 
671 /* Initialize all data structures used for dissection. */
672 void init_dissection(void);
673 
674 /* Free data structures allocated for dissection. */
675 void cleanup_dissection(void);
676 
677 /* Allow protocols to register a "cleanup" routine to be
678  * run after the initial sequential run through the packets.
679  * Note that the file can still be open after this; this is not
680  * the final cleanup. */
681 WS_DLL_PUBLIC void register_postseq_cleanup_routine(void (*func)(void));
682 
683 /* Call all the registered "postseq_cleanup" routines. */
684 WS_DLL_PUBLIC void postseq_cleanup_all_protocols(void);
685 
686 /* Allow dissectors to register a "final_registration" routine
687  * that is run like the proto_register_XXX() routine, but the end
688  * end of the epan_init() function; that is, *after* all other
689  * subsystems, liked dfilters, have finished initializing. This is
690  * useful for dissector registration routines which need to compile
691  * display filters. dfilters can't initialize itself until all protocols
692  * have registereed themselvs. */
693 WS_DLL_PUBLIC void
694 register_final_registration_routine(void (*func)(void));
695 
696 /* Call all the registered "final_registration" routines. */
697 extern void
698 final_registration_all_protocols(void);
699 
700 /*
701  * Add a new data source to the list of data sources for a frame, given
702  * the tvbuff for the data source and its name.
703  */
704 WS_DLL_PUBLIC void add_new_data_source(packet_info *pinfo, tvbuff_t *tvb,
705  const char *name);
706 /* Removes the last-added data source, if it turns out it wasn't needed */
707 WS_DLL_PUBLIC void remove_last_data_source(packet_info *pinfo);
708 
709 /*
710  * Return the data source name, tvb.
711  */
712 struct data_source;
713 WS_DLL_PUBLIC char *get_data_source_name(const struct data_source *src);
714 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb(const struct data_source *src);
715 WS_DLL_PUBLIC tvbuff_t *get_data_source_tvb_by_name(packet_info *pinfo, const char *name);
716 
717 /*
718  * Free up a frame's list of data sources.
719  */
720 extern void free_data_sources(packet_info *pinfo);
721 
722 /* Mark another frame as depended upon by the current frame.
723  *
724  * This information is used to ensure that the dependend-upon frame is saved
725  * if the user does a File->Save-As of only the Displayed packets and the
726  * current frame passed the display filter.
727  */
728 WS_DLL_PUBLIC void mark_frame_as_depended_upon(packet_info *pinfo, guint32 frame_num);
729 
730 /* Structure passed to the frame dissector */
731 typedef struct frame_data_s
732 {
733  int file_type_subtype;
734  const gchar *pkt_comment;
735  struct epan_dissect *color_edt;
737 } frame_data_t;
738 
739 /* Structure passed to the file dissector */
740 typedef struct file_data_s
741 {
742  const gchar *pkt_comment;
743  struct epan_dissect *color_edt;
745 } file_data_t;
746 
747 /*
748  * Dissectors should never modify the record data.
749  */
750 extern void dissect_record(struct epan_dissect *edt, int file_type_subtype,
751  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
752 
753 /*
754  * Dissectors should never modify the packet data.
755  */
756 extern void dissect_file(struct epan_dissect *edt,
757  wtap_rec *rec, tvbuff_t *tvb, frame_data *fd, column_info *cinfo);
758 
759 /* Structure passed to the ethertype dissector */
760 typedef struct ethertype_data_s
761 {
762  guint16 etype;
763  int offset_after_ethertype;
764  proto_tree *fh_tree;
765  int etype_id;
766  int trailer_id;
767  int fcs_len;
769 
770 /*
771  * Dump layer/selector/dissector records in a fashion similar to the
772  * proto_registrar_dump_* routines.
773  */
774 WS_DLL_PUBLIC void dissector_dump_decodes(void);
775 
776 /*
777  * For each heuristic dissector table, dump list of dissectors (filter_names) for that table
778  */
779 WS_DLL_PUBLIC void dissector_dump_heur_decodes(void);
780 
781 /*
782  * postdissectors are to be called by packet-frame.c after every other
783  * dissector has been called.
784  */
785 
786 /*
787  * Register a postdissector; the argument is the dissector handle for it.
788  */
789 WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle);
790 
791 /*
792  * Specify a set of hfids that the postdissector will need.
793  * The GArray is an array of hfids (type int) and should be NULL to clear the
794  * list. This function will take ownership of the memory.
795  */
796 WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle,
797  GArray *wanted_hfids);
798 
799 /*
800  * Deregister a postdissector. Not for use in (post)dissectors or
801  * applications; only to be used by libwireshark itself.
802  */
803 void deregister_postdissector(dissector_handle_t handle);
804 
805 /*
806  * Return TRUE if we have at least one postdissector, FALSE if not.
807  * Not for use in (post)dissectors or applications; only to be used
808  * by libwireshark itself.
809  */
810 extern gboolean have_postdissector(void);
811 
812 /*
813  * Call all postdissectors, handing them the supplied arguments.
814  * Not for use in (post)dissectors or applications; only to be used
815  * by libwireshark itself.
816  */
817 extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
818 
819 /*
820  * Return TRUE if at least one postdissector needs at least one hfid,
821  * FALSE otherwise.
822  */
823 WS_DLL_PUBLIC gboolean postdissectors_want_hfids(void);
824 
825 /*
826  * Prime an epan_dissect_t with all the hfids wanted by postdissectors.
827  */
828 WS_DLL_PUBLIC void
829 prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt);
830 
833 #ifdef __cplusplus
834 }
835 #endif /* __cplusplus */
836 
837 #endif /* packet.h */
WS_DLL_PUBLIC gboolean deregister_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3236
WS_DLL_PUBLIC GSList * dissector_table_get_dissector_handles(dissector_table_t dissector_table)
Definition: packet.c:2058
WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name, const int proto)
Definition: packet.c:2859
WS_DLL_PUBLIC gboolean register_depend_dissector(const char *parent, const char *dependent)
Definition: packet.c:3208
WS_DLL_PUBLIC const char * dissector_handle_get_short_name(const dissector_handle_t handle)
Definition: packet.c:2899
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_uint_handle(const char *name, const guint32 uint_val)
Definition: packet.c:1401
void dissector_table_foreach_changed(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2290
WS_DLL_PUBLIC const char * dissector_handle_get_dissector_name(const dissector_handle_t handle)
Definition: packet.c:2960
Definition: range.h:42
WS_DLL_PUBLIC void dissector_all_tables_foreach_table(DATFunc_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:2345
WS_DLL_PUBLIC dissector_handle_t dissector_table_get_dissector_handle(dissector_table_t dissector_table, const gchar *short_name)
Definition: packet.c:2088
Definition: packet.h:421
Definition: packet.h:740
Definition: packet_info.h:44
WS_DLL_PUBLIC void dissector_table_foreach(const char *table_name, DATFunc func, gpointer user_data)
Definition: packet.c:2213
void deregister_dissector_table(const char *name)
Definition: packet.c:2469
WS_DLL_PUBLIC dissector_handle_t dissector_get_uint_handle(dissector_table_t const sub_dissectors, const guint32 uint_val)
Definition: packet.c:1389
WS_DLL_PUBLIC void dissector_table_allow_decode_as(dissector_table_t dissector_table)
Definition: packet.c:2106
Definition: column-info.h:51
WS_DLL_PUBLIC dissector_handle_t dissector_get_default_string_handle(const char *name, const gchar *string)
Definition: packet.c:1704
WS_DLL_PUBLIC dissector_handle_t find_dissector_add_dependency(const char *name, const int parent_proto)
Definition: packet.c:2947
Definition: packet.h:731
WS_DLL_PUBLIC void dissector_table_foreach_handle(const char *table_name, DATFunc_handle func, gpointer user_data)
Definition: packet.c:2232
Definition: tvbuff-int.h:35
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:2634
Definition: packet.c:53
Definition: packet.c:659
WS_DLL_PUBLIC ftenum_t dissector_table_get_type(dissector_table_t dissector_table)
Definition: packet.c:2100
WS_DLL_PUBLIC void register_cleanup_routine(void(*func)(void))
Definition: packet.c:287
WS_DLL_PUBLIC void heur_dissector_delete(const char *name, heur_dissector_t dissector, const int proto)
Definition: packet.c:2608
WS_DLL_PUBLIC heur_dtbl_entry_t * find_heur_dissector_by_unique_short_name(const char *short_name)
Definition: packet.c:2516
Definition: guid-utils.h:21
Definition: packet.h:336
WS_DLL_PUBLIC void heur_dissector_add(const char *name, heur_dissector_t dissector, const char *display_name, const char *short_name, const int proto, heuristic_enable_e enable)
Definition: packet.c:2522
WS_DLL_PUBLIC int dissector_handle_get_protocol_index(const dissector_handle_t handle)
Definition: packet.c:2916
gboolean(* heur_dissector_t)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *)
Definition: packet.h:87
WS_DLL_PUBLIC dissector_handle_t dissector_get_custom_table_handle(dissector_table_t sub_dissectors, void *key)
Definition: packet.c:1757
WS_DLL_PUBLIC void register_init_routine(void(*func)(void))
Definition: packet.c:281
Definition: frame_data.h:53
void deregister_dissector(const char *name)
Definition: packet.c:3067
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector, const int proto)
Definition: packet.c:2984
Definition: packet.c:149
WS_DLL_PUBLIC void dissector_all_heur_tables_foreach_table(DATFunc_heur_table func, gpointer user_data, GCompareFunc compare_key_func)
Definition: packet.c:2808
Definition: packet.h:760
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:3030
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:3084
WS_DLL_PUBLIC dissector_handle_t find_dissector(const char *name)
Definition: packet.c:2941
WS_DLL_PUBLIC void dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data)
Definition: packet.c:2274
WS_DLL_PUBLIC void heur_dissector_table_foreach(const char *table_name, DATFunc_heur func, gpointer user_data)
Definition: packet.c:2753
WS_DLL_PUBLIC heur_dissector_list_t find_heur_dissector_list(const char *name)
Definition: packet.c:2506
WS_DLL_PUBLIC dissector_handle_t register_dissector(const char *name, dissector_t dissector, const int proto)
Definition: packet.c:3020
WS_DLL_PUBLIC depend_dissector_list_t find_depend_dissector_list(const char *name)
Definition: packet.c:3246
const char * dissector_handle_get_long_name(const dissector_handle_t handle)
Definition: packet.c:2888
Definition: packet.c:83
Definition: epan_dissect.h:28
WS_DLL_PUBLIC dissector_handle_t dissector_get_guid_handle(dissector_table_t const sub_dissectors, guid_key *guid_val)
Definition: packet.c:1878
Definition: packet.c:906
const gchar * pkt_comment
Definition: packet.h:734
Definition: proto.h:759
WS_DLL_PUBLIC dissector_handle_t dissector_get_string_handle(dissector_table_t sub_dissectors, const gchar *string)
Definition: packet.c:1689
Definition: wtap.h:1274
WS_DLL_PUBLIC GList * get_dissector_names(void)
Definition: packet.c:2934
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:3132
Definition: proto.c:312
const gchar * pkt_comment
Definition: packet.h:742
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:3098
Definition: packet.c:104