/src/wireshark/epan/dissectors/packet-itdm.c
Line | Count | Source |
1 | | /* packet-itdm.c |
2 | | * Routines for I-TDM (Internal TDM) dissection |
3 | | * Compliant to PICMG SFP.0 and SFP.1 March 24, 2005 |
4 | | * |
5 | | * Copyright 2008, Dan Gora <dg [AT] adax.com> |
6 | | * |
7 | | * Wireshark - Network traffic analyzer |
8 | | * By Gerald Combs <gerald@wireshark.org> |
9 | | * Copyright 1998 Gerald Combs |
10 | | * |
11 | | * SPDX-License-Identifier: GPL-2.0-or-later |
12 | | */ |
13 | | |
14 | | #include "config.h" |
15 | | |
16 | | #include <epan/packet.h> |
17 | | #include <epan/prefs.h> |
18 | | #include <epan/tfs.h> |
19 | | #include <wsutil/array.h> |
20 | | |
21 | | void proto_register_itdm(void); |
22 | | void proto_reg_handoff_itdm(void); |
23 | | |
24 | | /* Initialize the protocol and registered fields */ |
25 | | static int proto_itdm; |
26 | | static int hf_itdm_timestamp; |
27 | | static int hf_itdm_seqnum; |
28 | | static int hf_itdm_sop_eop; |
29 | | static int hf_itdm_last_pack; |
30 | | static int hf_itdm_pktlen; |
31 | | static int hf_itdm_chksum; |
32 | | static int hf_itdm_uid; |
33 | | static int hf_itdm_ack; |
34 | | static int hf_itdm_act; |
35 | | static int hf_itdm_chcmd; |
36 | | static int hf_itdm_chid; |
37 | | static int hf_itdm_chloc1; |
38 | | static int hf_itdm_chloc2; |
39 | | static int hf_itdm_pktrate; |
40 | | static int hf_itdm_cxnsize; |
41 | | |
42 | | /* I-TDM control protocol fields */ |
43 | | static int hf_itdm_ctl_transid; |
44 | | static int hf_itdm_ctl_command; |
45 | | static int hf_itdm_ctl_flowid; |
46 | | static int hf_itdm_ctl_dm; |
47 | | static int hf_itdm_ctl_emts; |
48 | | static int hf_itdm_ctl_pktrate; |
49 | | static int hf_itdm_ctl_ptid; |
50 | | static int hf_itdm_ctl_cksum; |
51 | | |
52 | | |
53 | | /* Initialize the subtree pointers */ |
54 | | static int ett_itdm; |
55 | | static int ett_itdm_ctl; |
56 | | |
57 | | static dissector_handle_t itdm_handle; |
58 | | |
59 | | /* ZZZZ some magic number.. */ |
60 | | static unsigned gbl_ItdmMPLSLabel = 0x99887; |
61 | | static unsigned gbl_ItdmCTLFlowNo; |
62 | | |
63 | | /* I-TDM 125usec mode commands for data flows */ |
64 | 0 | #define ITDM_CMD_NEW_CHAN 1 |
65 | 0 | #define ITDM_CMD_CLOSE_CHAN 2 |
66 | 0 | #define ITDM_CMD_RELOC_CHAN 3 |
67 | 0 | #define ITDM_CMD_CYCLIC_REAF 4 |
68 | 0 | #define ITDM_CMD_PACKET_RATE 5 |
69 | | |
70 | 0 | #define ITDM_FLOWID_OFFSET 7 |
71 | 0 | #define ITDM_CHCMD_OFFSET 10 |
72 | 0 | #define ITDM_CHANID_OFFSET 11 |
73 | 0 | #define ITDM_CHLOC1_OFFSET 14 |
74 | 0 | #define ITDM_CHLOC2_OFFSET 16 |
75 | | |
76 | | /* I-TDM commands for I-TDM control flows */ |
77 | 0 | #define ITDM_CTL_TRANSID_OFFSET 10 |
78 | 0 | #define ITDM_CTL_CMD_OFFSET 14 |
79 | 0 | #define ITDM_CTL_FLOWID_OFFSET 15 |
80 | | #define ITDM_CTL_ITDM_MODE_OFFSET 18 |
81 | | #define ITDM_CTL_EMTS_OFFSET 20 |
82 | | #define ITDM_CTL_PKTRATE_OFFSET 22 |
83 | 0 | #define ITDM_CTL_PAIRED_TRANSID_OFFSET 26 |
84 | | #define ITDM_CTL_CRC_OFFSET 30 |
85 | | |
86 | 0 | #define ITDM_CTL_CMD_AFI_REQ 1 |
87 | | |
88 | | static const value_string sop_eop_vals[] = { |
89 | | { 0x0, "Middle of Packet" }, |
90 | | { 0x1, "End of Packet" }, |
91 | | { 0x2, "Start of Packet" }, |
92 | | { 0x3, "Complete Packet" }, |
93 | | { 0, NULL } |
94 | | }; |
95 | | |
96 | | static const true_false_string ack_tfs = { |
97 | | "Acknowledging a command from remote node", |
98 | | "Normal Command" |
99 | | }; |
100 | | |
101 | | static const value_string chcmd_vals[] = { |
102 | | { 0x0, "Reserved" }, |
103 | | { 0x1, "New Channel ID" }, |
104 | | { 0x2, "Close Channel ID" }, |
105 | | { 0x3, "Relocate Channel ID" }, |
106 | | { 0x4, "Cyclic Reaffirmation" }, |
107 | | { 0x5, "Packet Rate Integrity Check" }, |
108 | | { 0x6, "Reserved" }, |
109 | | { 0x7, "Reserved" }, |
110 | | { 0x8, "Reserved" }, |
111 | | { 0x9, "Reserved" }, |
112 | | { 0xa, "Reserved" }, |
113 | | { 0xb, "Reserved" }, |
114 | | { 0xc, "Reserved" }, |
115 | | { 0xd, "Reserved" }, |
116 | | { 0xe, "Reserved" }, |
117 | | { 0xf, "Reserved" }, |
118 | | { 0, NULL } |
119 | | }; |
120 | | |
121 | | static const value_string itdm_ctl_command_vals[] = { |
122 | | { 0x0, "Not Used" }, |
123 | | { 0x1, "AFI_REQ: Alloc Flow ID Req" }, |
124 | | { 0x2, "AFI_RSP: Alloc Flow ID Rsp - Req Accepted." }, |
125 | | { 0x3, "DFI_REQ: Dealloc Flow ID Req" }, |
126 | | { 0x4, "DFI_RSP: Dealloc Flow ID Rsp - Req Accepted." }, |
127 | | |
128 | | { 0x10, "AFI_RSP: Reject: Data Mode Field value Not Supported." }, |
129 | | { 0x11, "AFI_RSP: Reject: Explicit Multi-timeslot value Not Supported." }, |
130 | | { 0x12, "AFI_RSP: Reject: Packet Rate value Not Supported." }, |
131 | | { 0x13, "AFI_RSP: Reject: Checksum Invalid." }, |
132 | | { 0x14, "AFI_RSP: Reject: No more flows available." }, |
133 | | |
134 | | { 0x20, "DFI_RSP: Reject: Data Mode Field value does not match Flow ID." }, |
135 | | { 0x21, "DFI_RSP: Reject: Explicit Multi-timeslots value does not match." }, |
136 | | { 0x22, "DFI_RSP: Reject: Packet Rate value does not match." }, |
137 | | { 0x23, "DFI_RSP: Reject: Checksum Invalid." }, |
138 | | { 0x24, "DFI_RSP: Reject: Flow ID invalid (out of range)." }, |
139 | | { 0x25, "DFI_RSP: Reject: Flow ID not currently allocated." }, |
140 | | { 0x26, "DFI_RSP: Reject: Other Flow ID in pair has active connections." }, |
141 | | { 0, NULL } |
142 | | }; |
143 | | |
144 | | static const value_string itdm_ctl_data_mode_vals[] = { |
145 | | { 0, "Not Used." }, |
146 | | { 1, "I-TDM 1ms Data Mode." }, |
147 | | { 2, "I-TDM 125usec Data Mode." }, |
148 | | { 3, "I-TDM Explicit Multi-timeslot Data Mode." }, |
149 | | { 4, "I-TDM CAS Signaling Data Mode." }, |
150 | | { 0, NULL } |
151 | | }; |
152 | | |
153 | | static const value_string itdm_ctl_pktrate_vals[] = { |
154 | | { 0x447A0000, "I-TDM 1ms Data Mode." }, |
155 | | { 0x45FA0000, "I-TDM 125usec/EMTS Data Mode." }, |
156 | | { 0x43A6AAAB, "I-TDM T1 CAS Mode." }, |
157 | | { 0x43FA0000, "I-TDM E1 CAS Mode." }, |
158 | | { 0, NULL } |
159 | | }; |
160 | | |
161 | | static void |
162 | | dissect_itdm_125usec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
163 | 0 | { |
164 | 0 | tvbuff_t *next_tvb; |
165 | 0 | proto_item *itdm_item = NULL; |
166 | 0 | proto_tree *itdm_tree = NULL; |
167 | 0 | int offset; |
168 | 0 | uint32_t flowid; |
169 | 0 | uint32_t chanid; |
170 | 0 | uint16_t chloc1; |
171 | 0 | uint16_t chloc2; |
172 | 0 | uint8_t chcmd; |
173 | 0 | uint8_t actbit; |
174 | 0 | uint8_t ackbit; |
175 | | |
176 | |
|
177 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "ITDM"); |
178 | |
|
179 | 0 | flowid = tvb_get_ntoh24(tvb, ITDM_FLOWID_OFFSET); |
180 | 0 | chanid = tvb_get_ntoh24(tvb, ITDM_CHANID_OFFSET); |
181 | 0 | chcmd = tvb_get_uint8(tvb, ITDM_CHCMD_OFFSET); |
182 | 0 | chloc1 = tvb_get_ntohs(tvb, ITDM_CHLOC1_OFFSET); |
183 | 0 | actbit = (chcmd & 0x10) ? 1 : 0; |
184 | 0 | ackbit = (chcmd & 0x20) ? 1 : 0; |
185 | 0 | chcmd = chcmd & 0x0f; |
186 | |
|
187 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, |
188 | 0 | "Flow %d Chan %d ACT %d ACK %d %s", |
189 | 0 | flowid, chanid, actbit, ackbit, |
190 | 0 | val_to_str_const(chcmd, chcmd_vals, "Reserved")); |
191 | 0 | if (chcmd == ITDM_CMD_NEW_CHAN || |
192 | 0 | chcmd == ITDM_CMD_CLOSE_CHAN || |
193 | 0 | chcmd == ITDM_CMD_CYCLIC_REAF) |
194 | 0 | { |
195 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, |
196 | 0 | " Loc1 %d", chloc1); |
197 | 0 | } |
198 | 0 | else if (chcmd == ITDM_CMD_RELOC_CHAN) |
199 | 0 | { |
200 | 0 | chloc2 = tvb_get_ntohs(tvb, ITDM_CHLOC2_OFFSET); |
201 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, |
202 | 0 | " Loc1 %d Loc2 %d", chloc1, chloc2); |
203 | 0 | } |
204 | |
|
205 | 0 | offset = 0; |
206 | |
|
207 | 0 | if (tree) |
208 | 0 | { |
209 | 0 | itdm_item = proto_tree_add_item(tree, proto_itdm, tvb, 0, -1, ENC_NA); |
210 | 0 | itdm_tree = proto_item_add_subtree(itdm_item, ett_itdm); |
211 | |
|
212 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_timestamp, tvb, offset, 2, ENC_BIG_ENDIAN); |
213 | 0 | offset += 2; |
214 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_seqnum, tvb, offset, 1, ENC_BIG_ENDIAN); |
215 | 0 | offset += 1; |
216 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_sop_eop, tvb, offset, 1, ENC_BIG_ENDIAN); |
217 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_last_pack, tvb, offset, 1, ENC_BIG_ENDIAN); |
218 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_pktlen, tvb, offset, 2, ENC_BIG_ENDIAN); |
219 | 0 | offset += 2; |
220 | 0 | proto_tree_add_checksum(itdm_tree, tvb, offset, hf_itdm_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); |
221 | 0 | offset += 2; |
222 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_uid, tvb, offset, 3, ENC_BIG_ENDIAN); |
223 | 0 | offset += 3; |
224 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_ack, tvb, offset, 1, ENC_BIG_ENDIAN); |
225 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_act, tvb, offset, 1, ENC_BIG_ENDIAN); |
226 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_chcmd, tvb, offset, 1, ENC_BIG_ENDIAN); |
227 | 0 | offset += 1; |
228 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_chid, tvb, offset, 3, ENC_BIG_ENDIAN); |
229 | 0 | offset += 3; |
230 | 0 | if (chcmd == ITDM_CMD_PACKET_RATE) |
231 | 0 | { |
232 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_pktrate, tvb, offset, 4, ENC_BIG_ENDIAN); |
233 | 0 | offset += 4; |
234 | 0 | } |
235 | 0 | else |
236 | 0 | { |
237 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_chloc1, tvb, offset, 2, ENC_BIG_ENDIAN); |
238 | 0 | offset += 2; |
239 | 0 | if (chcmd == ITDM_CMD_CYCLIC_REAF || |
240 | 0 | chcmd == ITDM_CMD_NEW_CHAN || |
241 | 0 | chcmd == ITDM_CMD_CLOSE_CHAN) |
242 | 0 | { |
243 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_cxnsize, tvb, offset, 2, ENC_BIG_ENDIAN); |
244 | 0 | offset += 2; |
245 | 0 | } |
246 | 0 | else |
247 | 0 | { |
248 | 0 | proto_tree_add_item(itdm_tree, hf_itdm_chloc2, tvb, offset, 2, ENC_BIG_ENDIAN); |
249 | 0 | offset += 2; |
250 | 0 | } |
251 | 0 | } |
252 | 0 | } |
253 | |
|
254 | 0 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
255 | 0 | call_data_dissector(next_tvb, pinfo, tree); |
256 | 0 | } |
257 | | |
258 | | static void |
259 | | dissect_itdm_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
260 | 0 | { |
261 | 0 | tvbuff_t *next_tvb; |
262 | 0 | proto_item *itdm_ctl_item = NULL; |
263 | 0 | proto_tree *itdm_ctl_tree = NULL; |
264 | 0 | int offset; |
265 | 0 | uint32_t flowid; |
266 | 0 | uint8_t command; |
267 | 0 | uint32_t trans_id; |
268 | 0 | uint32_t paired_trans_id; |
269 | 0 | uint32_t allocd_flowid; |
270 | |
|
271 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "ITDM-Control"); |
272 | |
|
273 | 0 | flowid = tvb_get_ntoh24(tvb, ITDM_FLOWID_OFFSET); |
274 | 0 | command = tvb_get_uint8(tvb, ITDM_CTL_CMD_OFFSET); |
275 | 0 | allocd_flowid = tvb_get_ntoh24(tvb, ITDM_CTL_FLOWID_OFFSET); |
276 | 0 | trans_id = tvb_get_ntohl(tvb, ITDM_CTL_TRANSID_OFFSET); |
277 | 0 | paired_trans_id = tvb_get_ntohl(tvb, ITDM_CTL_PAIRED_TRANSID_OFFSET); |
278 | |
|
279 | 0 | col_add_fstr(pinfo->cinfo, COL_INFO, |
280 | 0 | "Flow %d Command %s ", |
281 | 0 | flowid, val_to_str_const(command, itdm_ctl_command_vals, "Reserved")); |
282 | |
|
283 | 0 | if (command != ITDM_CTL_CMD_AFI_REQ ) |
284 | 0 | { |
285 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, |
286 | 0 | " Alloc'd FlowID %d", allocd_flowid); |
287 | 0 | } |
288 | |
|
289 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " TransID 0x%x ", trans_id); |
290 | |
|
291 | 0 | if (command != ITDM_CTL_CMD_AFI_REQ ) |
292 | 0 | { |
293 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, |
294 | 0 | " Paired TransID 0x%x", paired_trans_id); |
295 | 0 | } |
296 | |
|
297 | 0 | offset = 0; |
298 | |
|
299 | 0 | if (tree) |
300 | 0 | { |
301 | 0 | itdm_ctl_item = proto_tree_add_item(tree, proto_itdm, tvb, 0, -1, ENC_NA); |
302 | 0 | itdm_ctl_tree = proto_item_add_subtree(itdm_ctl_item, ett_itdm_ctl); |
303 | | |
304 | | /* These eventually should go into a SFP.0 dissector... */ |
305 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_timestamp, tvb, offset, 2, ENC_BIG_ENDIAN); |
306 | 0 | offset += 2; |
307 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_seqnum, tvb, offset, 1, ENC_BIG_ENDIAN); |
308 | 0 | offset += 1; |
309 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_sop_eop, tvb, offset, 1, ENC_BIG_ENDIAN); |
310 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_last_pack, tvb, offset, 1, ENC_BIG_ENDIAN); |
311 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_pktlen, tvb, offset, 2, ENC_BIG_ENDIAN); |
312 | 0 | offset += 2; |
313 | 0 | proto_tree_add_checksum(itdm_ctl_tree, tvb, offset, hf_itdm_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); |
314 | 0 | offset += 2; |
315 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_uid, tvb, offset, 3, ENC_BIG_ENDIAN); |
316 | 0 | offset += 3; |
317 | |
|
318 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_transid, tvb, offset, 4, ENC_BIG_ENDIAN); |
319 | 0 | offset += 4; |
320 | |
|
321 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_command, tvb, offset, 1, ENC_BIG_ENDIAN); |
322 | 0 | offset += 1; |
323 | 0 | if (command != ITDM_CTL_CMD_AFI_REQ) { |
324 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_flowid, tvb, offset, 3, ENC_BIG_ENDIAN); |
325 | 0 | } |
326 | 0 | offset += 3; |
327 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_dm, tvb, offset, 1, ENC_BIG_ENDIAN); |
328 | 0 | offset += 1; |
329 | | /* rsvd.. */ |
330 | 0 | offset += 1; |
331 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_emts, tvb, offset, 2, ENC_BIG_ENDIAN); |
332 | 0 | offset += 2; |
333 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_pktrate, tvb, offset, 4, ENC_BIG_ENDIAN); |
334 | 0 | offset += 4; |
335 | 0 | if (command != ITDM_CTL_CMD_AFI_REQ) { |
336 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_ptid, tvb, offset, 4, ENC_BIG_ENDIAN); |
337 | 0 | } |
338 | 0 | offset += 4; |
339 | | /* rsvd.. */ |
340 | 0 | offset += 2; |
341 | 0 | proto_tree_add_item(itdm_ctl_tree, hf_itdm_ctl_cksum, tvb, offset, 2, ENC_BIG_ENDIAN); |
342 | 0 | offset += 2; |
343 | 0 | } |
344 | |
|
345 | 0 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
346 | 0 | call_data_dissector(next_tvb, pinfo, tree); |
347 | 0 | } |
348 | | |
349 | | static int |
350 | | dissect_itdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
351 | 0 | { |
352 | 0 | uint32_t flowid; |
353 | | |
354 | | /* ZZZ for now, 125 usec mode and I-TDM control protocol |
355 | | * need to add 1ms mode */ |
356 | 0 | if (tvb_captured_length(tvb) < 18) |
357 | 0 | return 0; |
358 | | |
359 | | /* See if this packet is a data flow or the I-TDM control flow. */ |
360 | 0 | flowid = tvb_get_ntoh24(tvb, ITDM_FLOWID_OFFSET); |
361 | | |
362 | | /* gbl_ItdmCTLFlowNo is the configurable flow number where |
363 | | * the control protocol resides... Usually 0. |
364 | | */ |
365 | 0 | if (flowid == gbl_ItdmCTLFlowNo) |
366 | 0 | dissect_itdm_control(tvb, pinfo, tree); |
367 | 0 | else |
368 | 0 | dissect_itdm_125usec(tvb, pinfo, tree); |
369 | 0 | return tvb_captured_length(tvb); |
370 | 0 | } |
371 | | |
372 | | void |
373 | | proto_register_itdm(void) |
374 | 16 | { |
375 | | |
376 | 16 | static hf_register_info hf[] = { |
377 | 16 | { &hf_itdm_timestamp,{ "Timestamp", "itdm.timestamp", |
378 | 16 | FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, |
379 | 16 | { &hf_itdm_seqnum,{ "Sequence Number", "itdm.seqnum", |
380 | 16 | FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, |
381 | 16 | { &hf_itdm_sop_eop,{ "Start/End of Packet", "itdm.sop_eop", |
382 | 16 | FT_UINT8, BASE_DEC, VALS(sop_eop_vals), 0xc0, NULL, HFILL } }, |
383 | 16 | { &hf_itdm_last_pack,{ "Last Packet", "itdm.last_pack", |
384 | 16 | FT_BOOLEAN, 8, NULL, 0x20, NULL, HFILL } }, |
385 | 16 | { &hf_itdm_pktlen,{ "Packet Length", "itdm.pktlen", |
386 | 16 | FT_UINT16, BASE_DEC, NULL, 0x07ff, NULL, HFILL } }, |
387 | 16 | { &hf_itdm_chksum,{ "Checksum", "itdm.chksum", |
388 | 16 | FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
389 | 16 | { &hf_itdm_uid,{ "Flow ID", "itdm.uid", |
390 | 16 | FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } }, |
391 | 16 | { &hf_itdm_ack,{ "ACK", "itdm.ack", |
392 | 16 | FT_BOOLEAN, 8, TFS(&ack_tfs), 0x20, NULL, HFILL } }, |
393 | 16 | { &hf_itdm_act,{ "Activate", "itdm.act", |
394 | 16 | FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL } }, |
395 | 16 | { &hf_itdm_chcmd,{ "Channel Command", "itdm.chcmd", |
396 | 16 | FT_UINT8, BASE_DEC, VALS(chcmd_vals), 0x0f, NULL, HFILL } }, |
397 | 16 | { &hf_itdm_chid,{ "Channel ID", "itdm.chid", |
398 | 16 | FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } }, |
399 | 16 | { &hf_itdm_chloc1,{ "Channel Location 1", "itdm.chloc1", |
400 | 16 | FT_UINT16, BASE_DEC, NULL, 0x01ff, NULL, HFILL } }, |
401 | 16 | { &hf_itdm_chloc2,{ "Channel Location 2", "itdm.chloc2", |
402 | 16 | FT_UINT16, BASE_DEC, NULL, 0x01ff, NULL, HFILL } }, |
403 | 16 | { &hf_itdm_pktrate,{ "IEEE 754 Packet Rate", "itdm.pktrate", |
404 | 16 | FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
405 | 16 | { &hf_itdm_cxnsize, { "Connection Size", "itdm.cxnsize", |
406 | 16 | FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, |
407 | | |
408 | 16 | { &hf_itdm_ctl_transid, { "Transaction ID", "itdm.ctl_transid", |
409 | 16 | FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
410 | 16 | { &hf_itdm_ctl_command, { "Control Command", "itdm.ctl_cmd", |
411 | 16 | FT_UINT8, BASE_DEC, VALS(itdm_ctl_command_vals), 0x0, NULL, HFILL } }, |
412 | 16 | { &hf_itdm_ctl_flowid, { "Allocated Flow ID", "itdm.ctl_flowid", |
413 | 16 | FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL } }, |
414 | 16 | { &hf_itdm_ctl_dm, { "I-TDM Data Mode", "itdm.ctl_dm", |
415 | 16 | FT_UINT8, BASE_DEC, VALS(itdm_ctl_data_mode_vals), 0x0, NULL, HFILL } }, |
416 | 16 | { &hf_itdm_ctl_emts, { "I-TDM Explicit Multi-timeslot Size", "itdm.ctlemts", |
417 | 16 | FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, |
418 | 16 | { &hf_itdm_ctl_pktrate, { "I-TDM Packet Rate", "itdm.ctl_pktrate", |
419 | 16 | FT_UINT32, BASE_HEX, VALS(itdm_ctl_pktrate_vals), 0x0, NULL, HFILL } }, |
420 | 16 | { &hf_itdm_ctl_ptid, { "Paired Transaction ID", "itdm.ctl_ptid", |
421 | 16 | FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, |
422 | 16 | { &hf_itdm_ctl_cksum, { "ITDM Control Message Checksum", "itdm.ctl_cksum", |
423 | 16 | FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } } |
424 | 16 | }; |
425 | | |
426 | 16 | static int *ett[] = { |
427 | 16 | &ett_itdm, |
428 | 16 | &ett_itdm_ctl |
429 | 16 | }; |
430 | | |
431 | 16 | module_t *itdm_module; |
432 | | |
433 | 16 | proto_itdm = proto_register_protocol("Internal TDM", "ITDM", "itdm"); |
434 | 16 | itdm_handle = register_dissector("itdm", dissect_itdm, proto_itdm); |
435 | | |
436 | 16 | proto_register_field_array(proto_itdm, hf, array_length(hf)); |
437 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
438 | | |
439 | 16 | itdm_module = prefs_register_protocol(proto_itdm, proto_reg_handoff_itdm); |
440 | | |
441 | 16 | prefs_register_uint_preference(itdm_module, "mpls_label", |
442 | 16 | "ITDM MPLS label (Flow Bundle ID in hex)", |
443 | 16 | "The MPLS label (aka Flow Bundle ID) used by ITDM traffic.", |
444 | 16 | 16, &gbl_ItdmMPLSLabel); |
445 | | |
446 | 16 | prefs_register_uint_preference(itdm_module, "ctl_flowno", |
447 | 16 | "I-TDM Control Protocol Flow Number", |
448 | 16 | "Flow Number used by I-TDM Control Protocol traffic.", |
449 | 16 | 10, &gbl_ItdmCTLFlowNo); |
450 | 16 | } |
451 | | |
452 | | void |
453 | | proto_reg_handoff_itdm(void) |
454 | 16 | { |
455 | 16 | static bool Initialized=false; |
456 | 16 | static unsigned ItdmMPLSLabel; |
457 | | |
458 | 16 | if (!Initialized) { |
459 | 16 | Initialized=true; |
460 | 16 | } else { |
461 | 0 | dissector_delete_uint("mpls.label", ItdmMPLSLabel, itdm_handle); |
462 | 0 | } |
463 | | |
464 | 16 | ItdmMPLSLabel = gbl_ItdmMPLSLabel; |
465 | 16 | dissector_add_uint("mpls.label", gbl_ItdmMPLSLabel, itdm_handle); |
466 | 16 | } |
467 | | |
468 | | /* |
469 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
470 | | * |
471 | | * Local Variables: |
472 | | * c-basic-offset: 2 |
473 | | * tab-width: 8 |
474 | | * indent-tabs-mode: nil |
475 | | * End: |
476 | | * |
477 | | * ex: set shiftwidth=2 tabstop=8 expandtab: |
478 | | * :indentSize=2:tabSize=8:noTabs=true: |
479 | | */ |