Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-clip.c
blobf09350710a3970565961ab64e87dbbd2a5f469d1
1 /* packet-clip.c
2 * Routines for clip packet disassembly
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
7 * This file created by Thierry Andry <Thierry.Andry@advalvas.be>
8 * from nearly-the-same packet-raw.c created by Mike Hall <mlh@io.com>
9 * Copyright 1999
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include "config.h"
16 #include <epan/packet.h>
17 #include <epan/expert.h>
18 #include <wiretap/wtap.h>
20 #include "packet-ip.h"
22 void proto_register_clip(void);
23 void proto_reg_handoff_clip(void);
25 static int proto_clip;
27 static int ett_clip;
29 static expert_field ei_no_link_info;
31 static dissector_handle_t clip_handle;
32 static dissector_handle_t ip_handle;
34 static int
35 dissect_clip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
37 proto_item *fh_item;
39 /* load the top pane info. This should be overwritten by
40 the next protocol in the stack */
41 col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "N/A");
42 col_set_str(pinfo->cinfo, COL_RES_DL_DST, "N/A");
43 col_set_str(pinfo->cinfo, COL_PROTOCOL, "CLIP");
44 col_set_str(pinfo->cinfo, COL_INFO, "Classical IP frame");
46 /* populate a tree in the second pane with the status of the link
47 layer (ie none)
49 XXX - the Linux Classical IP code supports both LLC Encapsulation,
50 which puts an LLC header and possibly a SNAP header in front of
51 the network-layer header, and VC Based Multiplexing, which puts
52 no headers in front of the network-layer header.
54 The ATM on Linux code includes a patch to "tcpdump"
55 that compares the first few bytes of the packet with the
56 LLC header that Classical IP frames may have and, if there's
57 a SNAP LLC header at the beginning of the packet, it gets
58 the packet type from that header and uses that, otherwise
59 it treats the packet as being raw IP with no link-level
60 header, in order to handle both of those.
62 This code, however, won't handle LLC Encapsulation. We've
63 not yet seen a capture taken on a machine using LLC Encapsulation,
64 however. If we see one, we can modify the code.
66 A future version of libpcap, however, will probably use DLT_LINUX_SLL
67 for both of those cases, to avoid the headache of having to
68 generate capture-filter code to handle both of those cases. */
69 fh_item = proto_tree_add_item(tree, proto_clip, tvb, 0, 0, ENC_NA);
70 expert_add_info(pinfo, fh_item, &ei_no_link_info);
72 call_dissector(ip_handle, tvb, pinfo, tree);
73 return tvb_captured_length(tvb);
76 void
77 proto_register_clip(void)
79 static int *ett[] = {
80 &ett_clip,
83 static ei_register_info ei[] = {
84 { &ei_no_link_info, { "clip.no_link_info", PI_PROTOCOL, PI_NOTE, "No link information available", EXPFILL }},
87 expert_module_t* expert_clip;
89 proto_clip = proto_register_protocol("Classical IP frame", "CLIP", "clip");
91 proto_register_subtree_array(ett, array_length(ett));
92 expert_clip = expert_register_protocol(proto_clip);
93 expert_register_field_array(expert_clip, ei, array_length(ei));
95 clip_handle = register_dissector("clip", dissect_clip, proto_clip);
98 void
99 proto_reg_handoff_clip(void)
103 * Get a handle for the IP dissector.
105 ip_handle = find_dissector_add_dependency("ip", proto_clip);
107 /* XXX - no protocol, can't be disabled */
108 dissector_add_uint("wtap_encap", WTAP_ENCAP_LINUX_ATM_CLIP, clip_handle);
112 * Editor modelines - https://www.wireshark.org/tools/modelines.html
114 * Local Variables:
115 * c-basic-offset: 2
116 * tab-width: 8
117 * indent-tabs-mode: nil
118 * End:
120 * ex: set shiftwidth=2 tabstop=8 expandtab:
121 * :indentSize=2:tabSize=8:noTabs=true: