Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-ipos.c
blobdb76e3e95e59f482cec1349e4c96c1d3ad3090bd
1 /* packet-ipos.c
2 * Routines for IPOS dissection
3 * Copyright 2015, Chuan He <chuan.he@ericsson.com>
4 * Anders Broman <anders.broman@ericsson.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 * This is a dissector for Ericsson IPOS Linux kernel packets' header
15 * exchanged between kernel and linecard. All fields are in network byte order.
16 * This header follow the Linux cooked-mode capture(SLL) and will call REDBACK
17 * dissector.
19 * IPOS is the network operating system running on a few Ericsson platforms
20 * including SSR 8000 routers, Router 6000 series, and SP routers.
22 * Product details for Ericsson's IP Metro and Backhaul routers using IPOS:
23 * http://www.ericsson.com/ourportfolio/products/ip-metro-and-backhaul
26 #include "config.h"
27 #include <epan/packet.h>
28 #include <epan/expert.h>
30 void proto_reg_handoff_ipos(void);
31 void proto_register_ipos(void);
33 static dissector_handle_t ipos_handle;
34 static dissector_handle_t redback_handle;
36 static int proto_ipos;
37 static int hf_ipos_protocol;
38 static int hf_ipos_priority;
39 static int hf_ipos_ppe;
40 static int hf_ipos_slot;
41 static int ett_ipos;
43 /* static expert_field ei_ipos_protocol; */
45 #define LINUX_SLL_P_IPOS_NETIPC 0x0030 /* IPOS IPC frames to/from AF_IPC module */
46 #define LINUX_SLL_P_IPOS_RBN 0x0031 /* IPOS IP frames to/from CTX module */
47 #define LINUX_SLL_P_IPOS_NETLINK 0x0032 /* IPOS data frames to/from AF_RBN_NETLINK module */
48 #define LINUX_SLL_P_IPOS_XCRP 0x0033 /* IPOS data frames to/from XCRP driver */
49 #define LINUX_SLL_P_IPOS_ISIS 0x0034 /* IPOS data frames to/from ISIS module */
50 #define LINUX_SLL_P_IPOS_PAKIO 0x0035 /* IPOS data frames to/from AF_RBN_PAKIO module */
52 static const value_string prototypenames[] = {
53 { 0, "L2 Protocol" },
54 { 1, "L3 Protocol" },
55 { 2, "Control (IPC) message" },
56 { 3, "ISIS packet" },
57 { 4, "PAKIO packet" },
58 { 0, NULL }
61 static const value_string ppetypenames[] = {
62 { 4, "Output PPA" },
63 { 6, "Input PPA" },
64 { 10, "SPPA" },
65 { 0, NULL }
68 /**
69 * Dissect a buffer containing IPOS kernel packet bit string.
71 * @param tvb The buffer to dissect.
72 * @param pinfo Packet Info.
73 * @param tree The protocol tree.
74 **/
75 static int
76 dissect_ipos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
78 proto_item *ti = NULL;
79 proto_tree *ipos_tree = NULL;
80 tvbuff_t *next_tvb;
81 int offset = 0;
83 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPOS");
84 col_clear(pinfo->cinfo, COL_INFO);
86 ti = proto_tree_add_item(tree, proto_ipos, tvb, 0, -1, ENC_NA);
87 ipos_tree = proto_item_add_subtree(ti, ett_ipos);
88 proto_tree_add_item(ipos_tree, hf_ipos_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
89 proto_tree_add_item(ipos_tree, hf_ipos_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
90 offset += 1;
91 proto_tree_add_item(ipos_tree, hf_ipos_ppe, tvb, offset, 1, ENC_BIG_ENDIAN);
92 offset += 1;
93 proto_tree_add_item(ipos_tree, hf_ipos_slot, tvb, offset, 2, ENC_BIG_ENDIAN);
94 offset += 2;
96 if (redback_handle) {
97 next_tvb = tvb_new_subset_remaining(tvb, offset);
98 call_dissector(redback_handle, next_tvb, pinfo, tree);
101 return tvb_reported_length(tvb);
104 void
105 proto_register_ipos(void)
107 static hf_register_info hf[] = {
108 { &hf_ipos_protocol,
109 { "Protocol", "ipos.proto", FT_UINT8, BASE_DEC, VALS(prototypenames), 0xF0,
110 NULL, HFILL }},
112 { &hf_ipos_priority,
113 { "Priority", "ipos.priority", FT_UINT8, BASE_DEC, NULL, 0x0F,
114 NULL, HFILL }},
116 { &hf_ipos_ppe,
117 { "Packet Processing Engine", "ipos.ppe", FT_UINT8, BASE_HEX, VALS(ppetypenames), 0x0,
118 NULL, HFILL }},
120 { &hf_ipos_slot,
121 { "Destination (source) Slot", "ipos.slot", FT_UINT16, BASE_DEC, NULL, 0x0,
122 NULL, HFILL }}
125 static int *ett[] = {
126 &ett_ipos
129 #if 0
130 static ei_register_info ei[] = {
131 { &ei_ipos_protocol,
132 { "ipos.protocol.unknown", PI_PROTOCOL, PI_WARN,
133 "Unknown Protocol Data", EXPFILL }}
136 expert_module_t* expert_ipos;
137 #endif
139 proto_ipos = proto_register_protocol("IPOS Kernel Packet Protocol", "IPOS", "ipos");
140 proto_register_field_array(proto_ipos, hf, array_length(hf));
141 proto_register_subtree_array(ett, array_length(ett));
142 #if 0
143 expert_ipos = expert_register_protocol(proto_ipos);
144 expert_register_field_array(expert_ipos, ei, array_length(ei));
145 #endif
146 ipos_handle = register_dissector("ipos", dissect_ipos, proto_ipos);
149 void
150 proto_reg_handoff_ipos(void)
152 redback_handle = find_dissector_add_dependency("redback", proto_ipos);
154 /*dissector_add_uint("wtap_encap", WTAP_ENCAP_IPOS, ipos_handle); */
155 dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_NETIPC, ipos_handle);
156 dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_RBN, ipos_handle);
157 dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_NETLINK, ipos_handle);
158 dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_XCRP, ipos_handle);
159 dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_ISIS, ipos_handle);
160 dissector_add_uint("sll.ltype", LINUX_SLL_P_IPOS_PAKIO, ipos_handle);
162 dissector_add_for_decode_as("ethertype", ipos_handle);
166 * Editor modelines - https://www.wireshark.org/tools/modelines.html
168 * Local variables:
169 * c-basic-offset: 4
170 * tab-width: 8
171 * indent-tabs-mode: nil
172 * End:
174 * vi: set shiftwidth=4 tabstop=8 expandtab:
175 * :indentSize=4:tabSize=8:noTabs=true: