Frame: Fixup whitespace.
[metze/wireshark/wip.git] / epan / dissectors / packet-frame.c
1 /* packet-frame.c
2  *
3  * Top-most dissector. Decides dissector based on Wiretap Encapsulation Type.
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 2000 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11
12 #include "config.h"
13
14 #ifdef _MSC_VER
15 #include <windows.h>
16 #endif
17
18 #include <epan/packet.h>
19 #include <epan/capture_dissectors.h>
20 #include <epan/epan.h>
21 #include <epan/exceptions.h>
22 #include <epan/show_exception.h>
23 #include <epan/timestamp.h>
24 #include <epan/prefs.h>
25 #include <epan/to_str.h>
26 #include <epan/sequence_analysis.h>
27 #include <wiretap/wtap.h>
28 #include <epan/tap.h>
29 #include <epan/expert.h>
30 #include <wsutil/wsgcrypt.h>
31 #include <wsutil/str_util.h>
32 #include <epan/proto_data.h>
33 #include <wmem/wmem.h>
34
35 #include "packet-frame.h"
36 #include "packet-icmp.h"
37 #include "log.h"
38
39 #include <epan/column-info.h>
40 #include <epan/color_filters.h>
41
42 void proto_register_frame(void);
43 void proto_reg_handoff_frame(void);
44
45 static int proto_frame = -1;
46 static int proto_pkt_comment = -1;
47 static int proto_syscall = -1;
48
49 static int hf_frame_arrival_time = -1;
50 static int hf_frame_shift_offset = -1;
51 static int hf_frame_arrival_time_epoch = -1;
52 static int hf_frame_time_delta = -1;
53 static int hf_frame_time_delta_displayed = -1;
54 static int hf_frame_time_relative = -1;
55 static int hf_frame_time_reference = -1;
56 static int hf_frame_number = -1;
57 static int hf_frame_len = -1;
58 static int hf_frame_capture_len = -1;
59 static int hf_frame_p2p_dir = -1;
60 static int hf_frame_file_off = -1;
61 static int hf_frame_md5_hash = -1;
62 static int hf_frame_marked = -1;
63 static int hf_frame_ignored = -1;
64 static int hf_link_number = -1;
65 static int hf_frame_protocols = -1;
66 static int hf_frame_color_filter_name = -1;
67 static int hf_frame_color_filter_text = -1;
68 static int hf_frame_interface_id = -1;
69 static int hf_frame_interface_name = -1;
70 static int hf_frame_interface_description = -1;
71 static int hf_frame_pack_flags = -1;
72 static int hf_frame_pack_direction = -1;
73 static int hf_frame_pack_reception_type = -1;
74 static int hf_frame_pack_fcs_length = -1;
75 static int hf_frame_pack_reserved = -1;
76 static int hf_frame_pack_crc_error = -1;
77 static int hf_frame_pack_wrong_packet_too_long_error = -1;
78 static int hf_frame_pack_wrong_packet_too_short_error = -1;
79 static int hf_frame_pack_wrong_inter_frame_gap_error = -1;
80 static int hf_frame_pack_unaligned_frame_error = -1;
81 static int hf_frame_pack_start_frame_delimiter_error = -1;
82 static int hf_frame_pack_preamble_error = -1;
83 static int hf_frame_pack_symbol_error = -1;
84 static int hf_frame_wtap_encap = -1;
85 static int hf_comments_text = -1;
86
87 static gint ett_frame = -1;
88 static gint ett_ifname = -1;
89 static gint ett_flags = -1;
90 static gint ett_comments = -1;
91
92 static expert_field ei_comments_text = EI_INIT;
93 static expert_field ei_arrive_time_out_of_range = EI_INIT;
94 static expert_field ei_incomplete = EI_INIT;
95
96 static int frame_tap = -1;
97
98 static dissector_handle_t docsis_handle;
99 static dissector_handle_t sysdig_handle;
100
101 /* Preferences */
102 static gboolean show_file_off       = FALSE;
103 static gboolean force_docsis_encap  = FALSE;
104 static gboolean generate_md5_hash   = FALSE;
105 static gboolean generate_epoch_time = TRUE;
106 static gboolean generate_bits_field = TRUE;
107 static gboolean disable_packet_size_limited_in_summary = FALSE;
108
109 static const value_string p2p_dirs[] = {
110         { P2P_DIR_UNKNOWN, "Unknown" },
111         { P2P_DIR_SENT,    "Sent" },
112         { P2P_DIR_RECV,    "Received" },
113         { 0, NULL }
114 };
115
116 #define PACKET_WORD_DIRECTION_MASK                        0x00000003
117 #define PACKET_WORD_RECEPTION_TYPE_MASK                   0x0000001C
118 #define PACKET_WORD_FCS_LENGTH_MASK                       0x000001E0
119 #define PACKET_WORD_RESERVED_MASK                         0x0000FE00
120 #define PACKET_WORD_CRC_ERR_MASK                          0x01000000
121 #define PACKET_WORD_PACKET_TOO_LONG_ERR_MASK              0x02000000
122 #define PACKET_WORD_PACKET_TOO_SHORT_ERR_MASK             0x04000000
123 #define PACKET_WORD_WRONG_INTER_FRAME_GAP_ERR_MASK        0x08000000
124 #define PACKET_WORD_UNALIGNED_FRAME_ERR_MASK              0x10000000
125 #define PACKET_WORD_START_FRAME_DELIMITER_ERR_MASK        0x20000000
126 #define PACKET_WORD_PREAMBLE_ERR_MASK                     0x40000000
127 #define PACKET_WORD_SYMBOL_ERR_MASK                       0x80000000
128
129 static const value_string packet_word_directions[] = {
130         { 0x00, "Not available" },
131         { 0x01, "Inbound" },
132         { 0x02, "Outbound" },
133         { 0x03, "Undefined" },
134         { 0, NULL }
135 };
136
137 static const value_string packet_word_reception_types[] = {
138         { 0x00, "Not specified" },
139         { 0x01, "Unicast" },
140         { 0x02, "Multicast" },
141         { 0x03, "Broadcast" },
142         { 0x04, "Promiscuous" },
143         { 0x05, "Undefined" },
144         { 0x06, "Undefined" },
145         { 0x07, "Undefined" },
146         { 0, NULL }
147 };
148
149 static dissector_table_t wtap_encap_dissector_table;
150 static dissector_table_t wtap_fts_rec_dissector_table;
151
152 /****************************************************************************/
153 /* whenever a frame packet is seen by the tap listener */
154 /* Add a new frame into the graph */
155 static gboolean
156 frame_seq_analysis_packet( void *ptr, packet_info *pinfo, epan_dissect_t *edt _U_, const void *dummy _U_)
157 {
158         seq_analysis_info_t *sainfo = (seq_analysis_info_t *) ptr;
159         seq_analysis_item_t *sai = sequence_analysis_create_sai_with_addresses(pinfo, sainfo);
160
161         if (!sai)
162                 return FALSE;
163
164         sai->frame_number = pinfo->num;
165
166         sequence_analysis_use_color_filter(pinfo, sai);
167
168         sai->port_src=pinfo->srcport;
169         sai->port_dst=pinfo->destport;
170
171         sequence_analysis_use_col_info_as_label_comment(pinfo, sai);
172
173         sai->line_style = 1;
174         sai->conv_num = 0;
175         sai->display = TRUE;
176
177         g_queue_push_tail(sainfo->items, sai);
178
179         return TRUE;
180 }
181
182 /*
183  * Routine used to register frame end routine.  The routine should only
184  * be registered when the dissector is used in the frame, not in the
185  * proto_register_XXX function.
186  */
187 void
188 register_frame_end_routine(packet_info *pinfo, void (*func)(void))
189 {
190         pinfo->frame_end_routines = g_slist_append(pinfo->frame_end_routines, (gpointer)func);
191 }
192
193 typedef void (*void_func_t)(void);
194
195 static void
196 call_frame_end_routine(gpointer routine)
197 {
198         void_func_t func = (void_func_t)routine;
199         (*func)();
200 }
201
202 static int
203 dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
204 {
205         proto_item  *volatile ti = NULL, *comment_item;
206         guint        cap_len = 0, frame_len = 0;
207         proto_tree  *volatile tree;
208         proto_tree  *comments_tree;
209         proto_tree  *volatile fh_tree = NULL;
210         proto_item  *item;
211         const gchar *cap_plurality, *frame_plurality;
212         frame_data_t *fr_data = (frame_data_t*)data;
213         const color_filter_t *color_filter;
214
215         tree=parent_tree;
216
217         DISSECTOR_ASSERT(fr_data);
218
219         switch (pinfo->rec->rec_type) {
220
221         case REC_TYPE_PACKET:
222                 pinfo->current_proto = "Frame";
223                 if (pinfo->rec->presence_flags & WTAP_HAS_PACK_FLAGS) {
224                         if (pinfo->rec->rec_header.packet_header.pack_flags & 0x00000001)
225                                 pinfo->p2p_dir = P2P_DIR_RECV;
226                         if (pinfo->rec->rec_header.packet_header.pack_flags & 0x00000002)
227                                 pinfo->p2p_dir = P2P_DIR_SENT;
228                 }
229
230                 /*
231                  * If the pseudo-header *and* the packet record both
232                  * have direction information, the pseudo-header
233                  * overrides the packet record.
234                  */
235                 if (pinfo->pseudo_header != NULL) {
236                         switch (pinfo->rec->rec_header.packet_header.pkt_encap) {
237
238                         case WTAP_ENCAP_WFLEET_HDLC:
239                         case WTAP_ENCAP_CHDLC_WITH_PHDR:
240                         case WTAP_ENCAP_PPP_WITH_PHDR:
241                         case WTAP_ENCAP_SDLC:
242                         case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
243                                 pinfo->p2p_dir = pinfo->pseudo_header->p2p.sent ?
244                                     P2P_DIR_SENT : P2P_DIR_RECV;
245                                 break;
246
247                         case WTAP_ENCAP_BLUETOOTH_HCI:
248                                 pinfo->p2p_dir = pinfo->pseudo_header->bthci.sent;
249                                 break;
250
251                         case WTAP_ENCAP_LAPB:
252                         case WTAP_ENCAP_FRELAY_WITH_PHDR:
253                                 pinfo->p2p_dir =
254                                     (pinfo->pseudo_header->dte_dce.flags & FROM_DCE) ?
255                                     P2P_DIR_RECV : P2P_DIR_SENT;
256                                 break;
257
258                         case WTAP_ENCAP_ISDN:
259                         case WTAP_ENCAP_V5_EF:
260                         case WTAP_ENCAP_DPNSS:
261                         case WTAP_ENCAP_BACNET_MS_TP_WITH_PHDR:
262                                 pinfo->p2p_dir = pinfo->pseudo_header->isdn.uton ?
263                                     P2P_DIR_SENT : P2P_DIR_RECV;
264                                 break;
265
266                         case WTAP_ENCAP_LINUX_LAPD:
267                                 pinfo->p2p_dir = (pinfo->pseudo_header->lapd.pkttype == 3 ||
268                                         pinfo->pseudo_header->lapd.pkttype == 4) ?
269                                         P2P_DIR_SENT : P2P_DIR_RECV;
270                                 break;
271
272                         case WTAP_ENCAP_MTP2_WITH_PHDR:
273                                 pinfo->p2p_dir = pinfo->pseudo_header->mtp2.sent ?
274                                     P2P_DIR_SENT : P2P_DIR_RECV;
275                                 pinfo->link_number  = pinfo->pseudo_header->mtp2.link_number;
276                                 break;
277
278                         case WTAP_ENCAP_GSM_UM:
279                                 pinfo->p2p_dir = pinfo->pseudo_header->gsm_um.uplink ?
280                                     P2P_DIR_SENT : P2P_DIR_RECV;
281                                 break;
282                         }
283                 }
284                 break;
285
286         case REC_TYPE_FT_SPECIFIC_EVENT:
287                 pinfo->current_proto = "Event";
288                 break;
289
290         case REC_TYPE_FT_SPECIFIC_REPORT:
291                 pinfo->current_proto = "Report";
292                 break;
293
294         case REC_TYPE_SYSCALL:
295                 pinfo->current_proto = "System Call";
296                 break;
297
298         default:
299                 g_assert_not_reached();
300                 break;
301         }
302
303         if (fr_data->pkt_comment) {
304                 item = proto_tree_add_item(tree, proto_pkt_comment, tvb, 0, 0, ENC_NA);
305                 comments_tree = proto_item_add_subtree(item, ett_comments);
306                 comment_item = proto_tree_add_string_format(comments_tree, hf_comments_text, tvb, 0, 0,
307                                                                            fr_data->pkt_comment, "%s",
308                                                                            fr_data->pkt_comment);
309                 expert_add_info_format(pinfo, comment_item, &ei_comments_text,
310                                                                "%s",  fr_data->pkt_comment);
311
312
313         }
314
315         /* if FRAME is not referenced from any filters we don't need to worry about
316            generating any tree items.  */
317         if (!proto_field_is_referenced(tree, proto_frame)) {
318                 tree=NULL;
319                 if (pinfo->presence_flags & PINFO_HAS_TS) {
320                         if (pinfo->abs_ts.nsecs < 0 || pinfo->abs_ts.nsecs >= 1000000000)
321                                 expert_add_info(pinfo, NULL, &ei_arrive_time_out_of_range);
322                 }
323         } else {
324                 /* Put in frame header information. */
325                 cap_len = tvb_captured_length(tvb);
326                 frame_len = tvb_reported_length(tvb);
327
328                 cap_plurality = plurality(cap_len, "", "s");
329                 frame_plurality = plurality(frame_len, "", "s");
330
331                 switch (pinfo->rec->rec_type) {
332                 case REC_TYPE_PACKET:
333                         ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, tvb_captured_length(tvb),
334                             "Frame %u: %u byte%s on wire",
335                             pinfo->num, frame_len, frame_plurality);
336                         if (generate_bits_field)
337                                 proto_item_append_text(ti, " (%u bits)", frame_len * 8);
338                         proto_item_append_text(ti, ", %u byte%s captured",
339                             cap_len, cap_plurality);
340                         if (generate_bits_field) {
341                                 proto_item_append_text(ti, " (%u bits)",
342                                     cap_len * 8);
343                         }
344                         if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID) {
345                                 proto_item_append_text(ti, " on interface %u",
346                                     pinfo->rec->rec_header.packet_header.interface_id);
347                         }
348                         if (pinfo->rec->presence_flags & WTAP_HAS_PACK_FLAGS) {
349                                 if (pinfo->rec->rec_header.packet_header.pack_flags & 0x00000001)
350                                         proto_item_append_text(ti, " (inbound)");
351                                 if (pinfo->rec->rec_header.packet_header.pack_flags & 0x00000002)
352                                         proto_item_append_text(ti, " (outbound)");
353                         }
354                         break;
355
356                 case REC_TYPE_FT_SPECIFIC_EVENT:
357                         ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, tvb_captured_length(tvb),
358                             "Event %u: %u byte%s on wire",
359                             pinfo->num, frame_len, frame_plurality);
360                         if (generate_bits_field)
361                                 proto_item_append_text(ti, " (%u bits)", frame_len * 8);
362                         proto_item_append_text(ti, ", %u byte%s captured",
363                         cap_len, cap_plurality);
364                         if (generate_bits_field) {
365                                 proto_item_append_text(ti, " (%u bits)",
366                                 cap_len * 8);
367                         }
368                         break;
369
370                 case REC_TYPE_FT_SPECIFIC_REPORT:
371                         ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, tvb_captured_length(tvb),
372                             "Report %u: %u byte%s on wire",
373                             pinfo->num, frame_len, frame_plurality);
374                         if (generate_bits_field)
375                                 proto_item_append_text(ti, " (%u bits)", frame_len * 8);
376                         proto_item_append_text(ti, ", %u byte%s captured",
377                         cap_len, cap_plurality);
378                         if (generate_bits_field) {
379                                 proto_item_append_text(ti, " (%u bits)",
380                                 cap_len * 8);
381                         }
382                         break;
383
384                 case REC_TYPE_SYSCALL:
385                         /*
386                          * This gives us a top-of-tree "syscall" protocol
387                          * with "frame" fields underneath. Should we create
388                          * corresponding syscall.time, .time_epoch, etc
389                          * fields and use them instead or would frame.*
390                          * be preferred?
391                          */
392                         ti = proto_tree_add_protocol_format(tree, proto_syscall, tvb, 0, tvb_captured_length(tvb),
393                             "System Call %u: %u byte%s",
394                             pinfo->num, frame_len, frame_plurality);
395                         break;
396                 }
397
398                 fh_tree = proto_item_add_subtree(ti, ett_frame);
399
400                 if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID &&
401                    (proto_field_is_referenced(tree, hf_frame_interface_id) || proto_field_is_referenced(tree, hf_frame_interface_name) || proto_field_is_referenced(tree, hf_frame_interface_description))) {
402                         const char *interface_name = epan_get_interface_name(pinfo->epan, pinfo->rec->rec_header.packet_header.interface_id);
403                         const char *interface_description = epan_get_interface_description(pinfo->epan, pinfo->rec->rec_header.packet_header.interface_id);
404                         proto_tree *if_tree;
405                         proto_item *if_item;
406
407                         if (interface_name) {
408                                 if_item = proto_tree_add_uint_format_value(fh_tree, hf_frame_interface_id, tvb, 0, 0,
409                                                                            pinfo->rec->rec_header.packet_header.interface_id, "%u (%s)",
410                                                                            pinfo->rec->rec_header.packet_header.interface_id, interface_name);
411                                 if_tree = proto_item_add_subtree(if_item, ett_ifname);
412                                 proto_tree_add_string(if_tree, hf_frame_interface_name, tvb, 0, 0, interface_name);
413                         } else {
414                                 if_item = proto_tree_add_uint(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->rec->rec_header.packet_header.interface_id);
415                         }
416
417                         if (interface_description) {
418                                 if_tree = proto_item_add_subtree(if_item, ett_ifname);
419                                 proto_tree_add_string(if_tree, hf_frame_interface_description, tvb, 0, 0, interface_description);
420                         }
421                 }
422
423                 if (pinfo->rec->presence_flags & WTAP_HAS_PACK_FLAGS) {
424                         proto_tree *flags_tree;
425                         proto_item *flags_item;
426                         static const int * flags[] = {
427                                 &hf_frame_pack_direction,
428                                 &hf_frame_pack_reception_type,
429                                 &hf_frame_pack_fcs_length,
430                                 &hf_frame_pack_reserved,
431                                 &hf_frame_pack_crc_error,
432                                 &hf_frame_pack_wrong_packet_too_long_error,
433                                 &hf_frame_pack_wrong_packet_too_short_error,
434                                 &hf_frame_pack_wrong_inter_frame_gap_error,
435                                 &hf_frame_pack_unaligned_frame_error,
436                                 &hf_frame_pack_start_frame_delimiter_error,
437                                 &hf_frame_pack_preamble_error,
438                                 &hf_frame_pack_symbol_error,
439                                 NULL
440                         };
441
442                         flags_item = proto_tree_add_uint(fh_tree, hf_frame_pack_flags, tvb, 0, 0, pinfo->rec->rec_header.packet_header.pack_flags);
443                         flags_tree = proto_item_add_subtree(flags_item, ett_flags);
444                         proto_tree_add_bitmask_list_value(flags_tree, tvb, 0, 0, flags, pinfo->rec->rec_header.packet_header.pack_flags);
445                 }
446
447                 if (pinfo->rec->rec_type == REC_TYPE_PACKET)
448                         proto_tree_add_int(fh_tree, hf_frame_wtap_encap, tvb, 0, 0, pinfo->rec->rec_header.packet_header.pkt_encap);
449
450                 if (pinfo->presence_flags & PINFO_HAS_TS) {
451                         proto_tree_add_time(fh_tree, hf_frame_arrival_time, tvb,
452                                             0, 0, &(pinfo->abs_ts));
453                         if (pinfo->abs_ts.nsecs < 0 || pinfo->abs_ts.nsecs >= 1000000000) {
454                                 expert_add_info_format(pinfo, ti, &ei_arrive_time_out_of_range,
455                                                                   "Arrival Time: Fractional second %09ld is invalid,"
456                                                                   " the valid range is 0-1000000000",
457                                                                   (long) pinfo->abs_ts.nsecs);
458                         }
459                         item = proto_tree_add_time(fh_tree, hf_frame_shift_offset, tvb,
460                                             0, 0, &(pinfo->fd->shift_offset));
461                         PROTO_ITEM_SET_GENERATED(item);
462
463                         if (generate_epoch_time) {
464                                 proto_tree_add_time(fh_tree, hf_frame_arrival_time_epoch, tvb,
465                                                     0, 0, &(pinfo->abs_ts));
466                         }
467
468                         if (proto_field_is_referenced(tree, hf_frame_time_delta)) {
469                                 nstime_t     del_cap_ts;
470
471                                 frame_delta_abs_time(pinfo->epan, pinfo->fd, pinfo->num - 1, &del_cap_ts);
472
473                                 item = proto_tree_add_time(fh_tree, hf_frame_time_delta, tvb,
474                                                            0, 0, &(del_cap_ts));
475                                 PROTO_ITEM_SET_GENERATED(item);
476                         }
477
478                         if (proto_field_is_referenced(tree, hf_frame_time_delta_displayed)) {
479                                 nstime_t del_dis_ts;
480
481                                 frame_delta_abs_time(pinfo->epan, pinfo->fd, pinfo->fd->prev_dis_num, &del_dis_ts);
482
483                                 item = proto_tree_add_time(fh_tree, hf_frame_time_delta_displayed, tvb,
484                                                            0, 0, &(del_dis_ts));
485                                 PROTO_ITEM_SET_GENERATED(item);
486                         }
487
488                         item = proto_tree_add_time(fh_tree, hf_frame_time_relative, tvb,
489                                                    0, 0, &(pinfo->rel_ts));
490                         PROTO_ITEM_SET_GENERATED(item);
491
492                         if (pinfo->fd->flags.ref_time) {
493                                 ti = proto_tree_add_item(fh_tree, hf_frame_time_reference, tvb, 0, 0, ENC_NA);
494                                 PROTO_ITEM_SET_GENERATED(ti);
495                         }
496                 }
497
498                 proto_tree_add_uint(fh_tree, hf_frame_number, tvb,
499                                     0, 0, pinfo->num);
500
501                 proto_tree_add_uint_format(fh_tree, hf_frame_len, tvb,
502                                            0, 0, frame_len, "Frame Length: %u byte%s (%u bits)",
503                                            frame_len, frame_plurality, frame_len * 8);
504
505                 proto_tree_add_uint_format(fh_tree, hf_frame_capture_len, tvb,
506                                            0, 0, cap_len, "Capture Length: %u byte%s (%u bits)",
507                                            cap_len, cap_plurality, cap_len * 8);
508
509                 if (generate_md5_hash) {
510                         const guint8 *cp;
511                         guint8        digest[HASH_MD5_LENGTH];
512                         const gchar  *digest_string;
513
514                         cp = tvb_get_ptr(tvb, 0, cap_len);
515
516                         gcry_md_hash_buffer(GCRY_MD_MD5, digest, cp, cap_len);
517                         digest_string = bytestring_to_str(wmem_packet_scope(), digest, HASH_MD5_LENGTH, '\0');
518                         ti = proto_tree_add_string(fh_tree, hf_frame_md5_hash, tvb, 0, 0, digest_string);
519                         PROTO_ITEM_SET_GENERATED(ti);
520                 }
521
522                 ti = proto_tree_add_boolean(fh_tree, hf_frame_marked, tvb, 0, 0,pinfo->fd->flags.marked);
523                 PROTO_ITEM_SET_GENERATED(ti);
524
525                 ti = proto_tree_add_boolean(fh_tree, hf_frame_ignored, tvb, 0, 0,pinfo->fd->flags.ignored);
526                 PROTO_ITEM_SET_GENERATED(ti);
527
528                 if (pinfo->rec->rec_type == REC_TYPE_PACKET) {
529                         /* Check for existences of P2P pseudo header */
530                         if (pinfo->p2p_dir != P2P_DIR_UNKNOWN) {
531                                 proto_tree_add_int(fh_tree, hf_frame_p2p_dir, tvb,
532                                                    0, 0, pinfo->p2p_dir);
533                         }
534
535                         /* Check for existences of MTP2 link number */
536                         if ((pinfo->pseudo_header != NULL) &&
537                             (pinfo->rec->rec_header.packet_header.pkt_encap == WTAP_ENCAP_MTP2_WITH_PHDR)) {
538                                 proto_tree_add_uint(fh_tree, hf_link_number, tvb,
539                                                     0, 0, pinfo->link_number);
540                         }
541                 }
542
543                 if (show_file_off) {
544                         proto_tree_add_int64_format_value(fh_tree, hf_frame_file_off, tvb,
545                                                     0, 0, pinfo->fd->file_off,
546                                                     "%" G_GINT64_MODIFIER "d (0x%" G_GINT64_MODIFIER "x)",
547                                                     pinfo->fd->file_off, pinfo->fd->file_off);
548                 }
549         }
550
551         if (pinfo->fd->flags.ignored) {
552                 /* Ignored package, stop handling here */
553                 col_set_str(pinfo->cinfo, COL_INFO, "<Ignored>");
554                 proto_tree_add_boolean_format(tree, hf_frame_ignored, tvb, 0, 0, TRUE, "This frame is marked as ignored");
555                 return tvb_captured_length(tvb);
556         }
557
558         /* Portable Exception Handling to trap Wireshark specific exceptions like BoundsError exceptions */
559         TRY {
560 #ifdef _MSC_VER
561                 /* Win32: Visual-C Structured Exception Handling (SEH) to trap hardware exceptions
562                    like memory access violations.
563                    (a running debugger will be called before the except part below) */
564                 /* Note: A Windows "exceptional exception" may leave the kazlib's (Portable Exception Handling)
565                    stack in an inconsistent state thus causing a crash at some point in the
566                    handling of the exception.
567                    See: https://www.wireshark.org/lists/wireshark-dev/200704/msg00243.html
568                 */
569                 __try {
570 #endif
571                         switch (pinfo->rec->rec_type) {
572
573                         case REC_TYPE_PACKET:
574                                 if ((force_docsis_encap) && (docsis_handle)) {
575                                         call_dissector_with_data(docsis_handle,
576                                             tvb, pinfo, parent_tree,
577                                             (void *)pinfo->pseudo_header);
578                                 } else {
579                                         if (!dissector_try_uint_new(wtap_encap_dissector_table,
580                                             pinfo->rec->rec_header.packet_header.pkt_encap, tvb, pinfo,
581                                             parent_tree, TRUE,
582                                             (void *)pinfo->pseudo_header)) {
583                                                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
584                                                 col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP_ENCAP = %d",
585                                                              pinfo->rec->rec_header.packet_header.pkt_encap);
586                                                 call_data_dissector(tvb, pinfo, parent_tree);
587                                         }
588                                 }
589                                 break;
590
591                         case REC_TYPE_FT_SPECIFIC_EVENT:
592                         case REC_TYPE_FT_SPECIFIC_REPORT:
593                                 {
594                                         int file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_UNKNOWN;
595
596                                         file_type_subtype = fr_data->file_type_subtype;
597
598                                         if (!dissector_try_uint(wtap_fts_rec_dissector_table, file_type_subtype,
599                                             tvb, pinfo, parent_tree)) {
600                                                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
601                                                 col_add_fstr(pinfo->cinfo, COL_INFO, "WTAP FT ST = %d",
602                                                              file_type_subtype);
603                                                 call_data_dissector(tvb, pinfo, parent_tree);
604                                         }
605                                 }
606                                 break;
607
608                         case REC_TYPE_SYSCALL:
609                                 /* Sysdig is the only type we currently handle. */
610                                 if (sysdig_handle) {
611                                         call_dissector_with_data(sysdig_handle,
612                                             tvb, pinfo, parent_tree,
613                                             (void *)pinfo->pseudo_header);
614                                 }
615                                 break;
616                         }
617 #ifdef _MSC_VER
618                 } __except(EXCEPTION_EXECUTE_HANDLER /* handle all exceptions */) {
619                         switch (GetExceptionCode()) {
620                         case(STATUS_ACCESS_VIOLATION):
621                                 show_exception(tvb, pinfo, parent_tree, DissectorError,
622                                                "STATUS_ACCESS_VIOLATION: dissector accessed an invalid memory address");
623                                 break;
624                         case(STATUS_INTEGER_DIVIDE_BY_ZERO):
625                                 show_exception(tvb, pinfo, parent_tree, DissectorError,
626                                                "STATUS_INTEGER_DIVIDE_BY_ZERO: dissector tried an integer division by zero");
627                                 break;
628                         case(STATUS_STACK_OVERFLOW):
629                                 show_exception(tvb, pinfo, parent_tree, DissectorError,
630                                                "STATUS_STACK_OVERFLOW: dissector overflowed the stack (e.g. endless loop)");
631                                 /* XXX - this will have probably corrupted the stack,
632                                    which makes problems later in the exception code */
633                                 break;
634                                 /* XXX - add other hardware exception codes as required */
635                         default:
636                                 show_exception(tvb, pinfo, parent_tree, DissectorError,
637                                                g_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode()));
638                         }
639                 }
640 #endif
641         }
642         CATCH_BOUNDS_AND_DISSECTOR_ERRORS {
643                 show_exception(tvb, pinfo, parent_tree, EXCEPT_CODE, GET_MESSAGE);
644         }
645         ENDTRY;
646
647         if (proto_field_is_referenced(tree, hf_frame_protocols)) {
648                 wmem_strbuf_t *val = wmem_strbuf_sized_new(wmem_packet_scope(), 128, 0);
649                 wmem_list_frame_t *frame;
650                 /* skip the first entry, it's always the "frame" protocol */
651                 frame = wmem_list_frame_next(wmem_list_head(pinfo->layers));
652                 if (frame) {
653                         wmem_strbuf_append(val, proto_get_protocol_filter_name(GPOINTER_TO_UINT(wmem_list_frame_data(frame))));
654                         frame = wmem_list_frame_next(frame);
655                 }
656                 while (frame) {
657                         wmem_strbuf_append_c(val, ':');
658                         wmem_strbuf_append(val, proto_get_protocol_filter_name(GPOINTER_TO_UINT(wmem_list_frame_data(frame))));
659                         frame = wmem_list_frame_next(frame);
660                 }
661                 ti = proto_tree_add_string(fh_tree, hf_frame_protocols, tvb, 0, 0, wmem_strbuf_get_str(val));
662                 PROTO_ITEM_SET_GENERATED(ti);
663         }
664
665         /*  Call postdissectors if we have any (while trying to avoid another
666          *  TRY/CATCH)
667          */
668         if (have_postdissector()) {
669                 TRY {
670 #ifdef _MSC_VER
671                         /* Win32: Visual-C Structured Exception Handling (SEH)
672                            to trap hardware exceptions like memory access violations */
673                         /* (a running debugger will be called before the except part below) */
674                         /* Note: A Windows "exceptional exception" may leave the kazlib's (Portable Exception Handling)
675                            stack in an inconsistent state thus causing a crash at some point in the
676                            handling of the exception.
677                            See: https://www.wireshark.org/lists/wireshark-dev/200704/msg00243.html
678                         */
679                         __try {
680 #endif
681                                 call_all_postdissectors(tvb, pinfo, parent_tree);
682 #ifdef _MSC_VER
683                         } __except(EXCEPTION_EXECUTE_HANDLER /* handle all exceptions */) {
684                                 switch (GetExceptionCode()) {
685                                 case(STATUS_ACCESS_VIOLATION):
686                                         show_exception(tvb, pinfo, parent_tree, DissectorError,
687                                                        "STATUS_ACCESS_VIOLATION: dissector accessed an invalid memory address");
688                                         break;
689                                 case(STATUS_INTEGER_DIVIDE_BY_ZERO):
690                                         show_exception(tvb, pinfo, parent_tree, DissectorError,
691                                                        "STATUS_INTEGER_DIVIDE_BY_ZERO: dissector tried an integer division by zero");
692                                         break;
693                                 case(STATUS_STACK_OVERFLOW):
694                                         show_exception(tvb, pinfo, parent_tree, DissectorError,
695                                                        "STATUS_STACK_OVERFLOW: dissector overflowed the stack (e.g. endless loop)");
696                                         /* XXX - this will have probably corrupted the stack,
697                                            which makes problems later in the exception code */
698                                         break;
699                                         /* XXX - add other hardware exception codes as required */
700                                 default:
701                                         show_exception(tvb, pinfo, parent_tree, DissectorError,
702                                                        g_strdup_printf("dissector caused an unknown exception: 0x%x", GetExceptionCode()));
703                                 }
704                         }
705 #endif
706                 }
707                 CATCH_BOUNDS_AND_DISSECTOR_ERRORS {
708                         show_exception(tvb, pinfo, parent_tree, EXCEPT_CODE, GET_MESSAGE);
709                 }
710                 ENDTRY;
711         }
712
713         /* Attempt to (re-)calculate color filters (if any). */
714         if (pinfo->fd->flags.need_colorize) {
715                 color_filter = color_filters_colorize_packet(fr_data->color_edt);
716                 pinfo->fd->color_filter = color_filter;
717                 pinfo->fd->flags.need_colorize = 0;
718         } else {
719                 color_filter = pinfo->fd->color_filter;
720         }
721         if (color_filter) {
722                 item = proto_tree_add_string(fh_tree, hf_frame_color_filter_name, tvb,
723                                              0, 0, color_filter->filter_name);
724                 PROTO_ITEM_SET_GENERATED(item);
725                 item = proto_tree_add_string(fh_tree, hf_frame_color_filter_text, tvb,
726                                              0, 0, color_filter->filter_text);
727                 PROTO_ITEM_SET_GENERATED(item);
728         }
729
730         tap_queue_packet(frame_tap, pinfo, NULL);
731
732
733         if (pinfo->frame_end_routines) {
734                 g_slist_free_full(pinfo->frame_end_routines, &call_frame_end_routine);
735                 pinfo->frame_end_routines = NULL;
736         }
737
738         if (prefs.enable_incomplete_dissectors_check && tree && tree->tree_data->visible) {
739                 gchar* decoded;
740                 guint length;
741                 guint i;
742                 guint byte;
743                 guint bit;
744
745                 length = tvb_captured_length(tvb);
746                 decoded = proto_find_undecoded_data(tree, length);
747
748                 for (i = 0; i < length; i++) {
749                         byte = i / 8;
750                         bit = i % 8;
751                         if (!(decoded[byte] & (1 << bit))) {
752                                 field_info* fi = proto_find_field_from_offset(tree, i, tvb);
753                                 if (fi && fi->hfinfo->id != proto_frame) {
754                                         if (prefs.incomplete_dissectors_check_debug)
755                                                 g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_WARNING,
756                                                         "Dissector %s incomplete in frame %u: undecoded byte number %u "
757                                                         "(0x%.4X+%u)",
758                                                         (fi ? fi->hfinfo->abbrev : "[unknown]"),
759                                                         pinfo->num, i, i - i % 16, i % 16);
760                                         proto_tree_add_expert_format(tree, pinfo, &ei_incomplete, tvb, i, 1, "Undecoded byte number: %u (0x%.4X+%u)", i, i - i % 16, i % 16);
761                                 }
762                         }
763                 }
764         }
765
766         return tvb_captured_length(tvb);
767 }
768
769 void
770 proto_register_frame(void)
771 {
772         static hf_register_info hf[] = {
773                 { &hf_frame_arrival_time,
774                   { "Arrival Time", "frame.time",
775                     FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
776                     "Absolute time when this frame was captured", HFILL }},
777
778                 { &hf_frame_shift_offset,
779                   { "Time shift for this packet", "frame.offset_shift",
780                     FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
781                     "Time shift applied to this packet", HFILL }},
782
783                 { &hf_frame_arrival_time_epoch,
784                   { "Epoch Time", "frame.time_epoch",
785                     FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
786                     "Epoch time when this frame was captured", HFILL }},
787
788                 { &hf_frame_time_delta,
789                   { "Time delta from previous captured frame", "frame.time_delta",
790                     FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
791                     NULL, HFILL }},
792
793                 { &hf_frame_time_delta_displayed,
794                   { "Time delta from previous displayed frame", "frame.time_delta_displayed",
795                     FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
796                     NULL, HFILL }},
797
798                 { &hf_frame_time_relative,
799                   { "Time since reference or first frame", "frame.time_relative",
800                     FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
801                     "Time relative to time reference or first frame", HFILL }},
802
803                 { &hf_frame_time_reference,
804                   { "This is a Time Reference frame", "frame.ref_time",
805                     FT_NONE, BASE_NONE, NULL, 0x0,
806                     "This frame is a Time Reference frame", HFILL }},
807
808                 { &hf_frame_number,
809                   { "Frame Number", "frame.number",
810                     FT_UINT32, BASE_DEC, NULL, 0x0,
811                     NULL, HFILL }},
812
813                 { &hf_frame_len,
814                   { "Frame length on the wire", "frame.len",
815                     FT_UINT32, BASE_DEC, NULL, 0x0,
816                     NULL, HFILL }},
817
818                 { &hf_frame_capture_len,
819                   { "Frame length stored into the capture file", "frame.cap_len",
820                     FT_UINT32, BASE_DEC, NULL, 0x0,
821                     NULL, HFILL }},
822
823                 { &hf_frame_md5_hash,
824                   { "Frame MD5 Hash", "frame.md5_hash",
825                     FT_STRING, BASE_NONE, NULL, 0x0,
826                     NULL, HFILL }},
827
828                 { &hf_frame_p2p_dir,
829                   { "Point-to-Point Direction", "frame.p2p_dir",
830                     FT_INT8, BASE_DEC, VALS(p2p_dirs), 0x0,
831                     NULL, HFILL }},
832
833                 { &hf_link_number,
834                   { "Link Number", "frame.link_nr",
835                     FT_UINT16, BASE_DEC, NULL, 0x0,
836                     NULL, HFILL }},
837
838                 { &hf_frame_file_off,
839                   { "File Offset", "frame.file_off",
840                     FT_INT64, BASE_DEC, NULL, 0x0,
841                     NULL, HFILL }},
842
843                 { &hf_frame_marked,
844                   { "Frame is marked", "frame.marked",
845                     FT_BOOLEAN, BASE_NONE, NULL, 0x0,
846                     "Frame is marked in the GUI", HFILL }},
847
848                 { &hf_frame_ignored,
849                   { "Frame is ignored", "frame.ignored",
850                     FT_BOOLEAN, BASE_NONE, NULL, 0x0,
851                     "Frame is ignored by the dissectors", HFILL }},
852
853                 { &hf_frame_protocols,
854                   { "Protocols in frame", "frame.protocols",
855                     FT_STRING, BASE_NONE, NULL, 0x0,
856                     "Protocols carried by this frame", HFILL }},
857
858                 { &hf_frame_color_filter_name,
859                   { "Coloring Rule Name", "frame.coloring_rule.name",
860                     FT_STRING, BASE_NONE, NULL, 0x0,
861                     "The frame matched the coloring rule with this name", HFILL }},
862
863                 { &hf_frame_color_filter_text,
864                   { "Coloring Rule String", "frame.coloring_rule.string",
865                     FT_STRING, BASE_NONE, NULL, 0x0,
866                     "The frame matched this coloring rule string", HFILL }},
867
868                 { &hf_frame_interface_id,
869                   { "Interface id", "frame.interface_id",
870                     FT_UINT32, BASE_DEC, NULL, 0x0,
871                     NULL, HFILL }},
872
873                 { &hf_frame_interface_name,
874                   { "Interface name", "frame.interface_name",
875                     FT_STRING, BASE_NONE, NULL, 0x0,
876                     "The friendly name for this interface", HFILL }},
877
878                 { &hf_frame_interface_description,
879                   { "Interface description", "frame.interface_description",
880                     FT_STRING, BASE_NONE, NULL, 0x0,
881                     "The descriptionfor this interface", HFILL }},
882
883                 { &hf_frame_pack_flags,
884                   { "Packet flags", "frame.packet_flags",
885                     FT_UINT32, BASE_HEX, NULL, 0x0,
886                     NULL, HFILL }},
887
888                 { &hf_frame_pack_direction,
889                   { "Direction", "frame.packet_flags_direction",
890                     FT_UINT32, BASE_HEX, VALS(packet_word_directions), PACKET_WORD_DIRECTION_MASK,
891                     NULL, HFILL }},
892
893                 { &hf_frame_pack_reception_type,
894                   { "Reception type", "frame.packet_flags_reception_type",
895                     FT_UINT32, BASE_DEC, VALS(packet_word_reception_types), PACKET_WORD_RECEPTION_TYPE_MASK,
896                     NULL, HFILL }},
897
898                 { &hf_frame_pack_fcs_length,
899                   { "FCS length", "frame.packet_flags_fcs_length",
900                     FT_UINT32, BASE_DEC, NULL, PACKET_WORD_FCS_LENGTH_MASK,
901                     NULL, HFILL }},
902
903                 { &hf_frame_pack_reserved,
904                   { "Reserved", "frame.packet_flags_reserved",
905                     FT_UINT32, BASE_DEC, NULL, PACKET_WORD_RESERVED_MASK,
906                     NULL, HFILL }},
907
908                 { &hf_frame_pack_crc_error,
909                   { "CRC error", "frame.packet_flags_crc_error",
910                     FT_BOOLEAN, 32, TFS(&tfs_set_notset), PACKET_WORD_CRC_ERR_MASK,
911                     NULL, HFILL }},
912
913                 { &hf_frame_pack_wrong_packet_too_long_error,
914                   { "Packet too long error", "frame.packet_flags_packet_too_error",
915                     FT_BOOLEAN, 32, TFS(&tfs_set_notset), PACKET_WORD_PACKET_TOO_LONG_ERR_MASK,
916                     NULL, HFILL }},
917
918                 { &hf_frame_pack_wrong_packet_too_short_error,
919                   { "Packet too short error", "frame.packet_flags_packet_too_short_error",
920                     FT_BOOLEAN, 32, TFS(&tfs_set_notset), PACKET_WORD_PACKET_TOO_SHORT_ERR_MASK,
921                     NULL, HFILL }},
922
923                 { &hf_frame_pack_wrong_inter_frame_gap_error,
924                   { "Wrong interframe gap error", "frame.packet_flags_wrong_inter_frame_gap_error",
925                     FT_BOOLEAN, 32, TFS(&tfs_set_notset), PACKET_WORD_WRONG_INTER_FRAME_GAP_ERR_MASK,
926                     NULL, HFILL }},
927
928                 { &hf_frame_pack_unaligned_frame_error,
929                   { "Unaligned frame error", "frame.packet_flags_unaligned_frame_error",
930                     FT_BOOLEAN, 32, TFS(&tfs_set_notset), PACKET_WORD_UNALIGNED_FRAME_ERR_MASK,
931                     NULL, HFILL }},
932
933                 { &hf_frame_pack_start_frame_delimiter_error,
934                   { "Start frame delimiter error", "frame.packet_flags_start_frame_delimiter_error",
935                     FT_BOOLEAN, 32, TFS(&tfs_set_notset), PACKET_WORD_START_FRAME_DELIMITER_ERR_MASK,
936                     NULL, HFILL }},
937
938                 { &hf_frame_pack_preamble_error,
939                   { "Preamble error", "frame.packet_flags_preamble_error",
940                     FT_BOOLEAN, 32, TFS(&tfs_set_notset), PACKET_WORD_PREAMBLE_ERR_MASK,
941                     NULL, HFILL }},
942
943                 { &hf_frame_pack_symbol_error,
944                   { "Symbol error", "frame.packet_flags_symbol_error",
945                     FT_BOOLEAN, 32, TFS(&tfs_set_notset), PACKET_WORD_SYMBOL_ERR_MASK,
946                     NULL, HFILL }},
947
948                 { &hf_comments_text,
949                   { "Comment", "frame.comment",
950                     FT_STRING, BASE_NONE, NULL, 0x0,
951                     NULL, HFILL }},
952         };
953
954         static hf_register_info hf_encap =
955                 { &hf_frame_wtap_encap,
956                   { "Encapsulation type", "frame.encap_type",
957                     FT_INT16, BASE_DEC, NULL, 0x0,
958                     NULL, HFILL }};
959
960         static gint *ett[] = {
961                 &ett_frame,
962                 &ett_ifname,
963                 &ett_flags,
964                 &ett_comments
965         };
966
967         static ei_register_info ei[] = {
968                 { &ei_comments_text, { "frame.comment.expert", PI_COMMENTS_GROUP, PI_COMMENT, "Formatted comment", EXPFILL }},
969                 { &ei_arrive_time_out_of_range, { "frame.time_invalid", PI_SEQUENCE, PI_NOTE, "Arrival Time: Fractional second out of range (0-1000000000)", EXPFILL }},
970                 { &ei_incomplete, { "frame.incomplete", PI_UNDECODED, PI_NOTE, "Incomplete dissector", EXPFILL }}
971         };
972
973         module_t *frame_module;
974         expert_module_t* expert_frame;
975
976         if (hf_encap.hfinfo.strings == NULL) {
977                 int encap_count = wtap_get_num_encap_types();
978                 value_string *arr;
979                 int i;
980
981                 hf_encap.hfinfo.strings = arr = wmem_alloc_array(wmem_epan_scope(), value_string, encap_count+1);
982
983                 for (i = 0; i < encap_count; i++) {
984                         arr[i].value = i;
985                         arr[i].strptr = wtap_encap_string(i);
986                 }
987                 arr[encap_count].value = 0;
988                 arr[encap_count].strptr = NULL;
989         }
990
991         proto_frame = proto_register_protocol("Frame", "Frame", "frame");
992         proto_pkt_comment = proto_register_protocol_in_name_only("Packet comments", "Pkt_Comment", "pkt_comment", proto_frame, FT_PROTOCOL);
993         proto_syscall = proto_register_protocol("System Call", "Syscall", "syscall");
994
995         proto_register_field_array(proto_frame, hf, array_length(hf));
996         proto_register_field_array(proto_frame, &hf_encap, 1);
997         proto_register_subtree_array(ett, array_length(ett));
998         expert_frame = expert_register_protocol(proto_frame);
999         expert_register_field_array(expert_frame, ei, array_length(ei));
1000         register_dissector("frame",dissect_frame,proto_frame);
1001
1002         wtap_encap_dissector_table = register_dissector_table("wtap_encap",
1003             "Wiretap encapsulation type", proto_frame, FT_UINT32, BASE_DEC);
1004         wtap_fts_rec_dissector_table = register_dissector_table("wtap_fts_rec",
1005             "Wiretap file type for file-type-specific records", proto_frame, FT_UINT32, BASE_DEC);
1006         register_capture_dissector_table("wtap_encap", "Wiretap encapsulation type");
1007
1008         /* You can't disable dissection of "Frame", as that would be
1009            tantamount to not doing any dissection whatsoever. */
1010         proto_set_cant_toggle(proto_frame);
1011
1012         register_seq_analysis("any", "All Flows", proto_frame, NULL, TL_REQUIRES_COLUMNS, frame_seq_analysis_packet);
1013
1014         /* Our preferences */
1015         frame_module = prefs_register_protocol(proto_frame, NULL);
1016         prefs_register_bool_preference(frame_module, "show_file_off",
1017             "Show File Offset", "Show offset of frame in capture file", &show_file_off);
1018         prefs_register_bool_preference(frame_module, "force_docsis_encap",
1019             "Treat all frames as DOCSIS frames", "Treat all frames as DOCSIS Frames", &force_docsis_encap);
1020         prefs_register_bool_preference(frame_module, "generate_md5_hash",
1021             "Generate an MD5 hash of each frame",
1022             "Whether or not MD5 hashes should be generated for each frame, useful for finding duplicate frames.",
1023             &generate_md5_hash);
1024         prefs_register_bool_preference(frame_module, "generate_epoch_time",
1025             "Generate an epoch time entry for each frame",
1026             "Whether or not an Epoch time entry should be generated for each frame.",
1027             &generate_epoch_time);
1028         prefs_register_bool_preference(frame_module, "generate_bits_field",
1029             "Show the number of bits in the frame",
1030             "Whether or not the number of bits in the frame should be shown.",
1031             &generate_bits_field);
1032         prefs_register_bool_preference(frame_module, "disable_packet_size_limited_in_summary",
1033             "Disable 'packet size limited during capture' message in summary",
1034             "Whether or not 'packet size limited during capture' message in shown in Info column.",
1035             &disable_packet_size_limited_in_summary);
1036
1037         frame_tap=register_tap("frame");
1038 }
1039
1040 void
1041 proto_reg_handoff_frame(void)
1042 {
1043         docsis_handle = find_dissector_add_dependency("docsis", proto_frame);
1044         sysdig_handle = find_dissector_add_dependency("sysdig", proto_frame);
1045 }
1046
1047 /*
1048  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
1049  *
1050  * Local variables:
1051  * c-basic-offset: 8
1052  * tab-width: 8
1053  * indent-tabs-mode: t
1054  * End:
1055  *
1056  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1057  * :indentSize=8:tabSize=8:noTabs=false:
1058  */