epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-ipdc.c
blob0a22e910ff8d83182e6c8584bac764b4552229f0
1 /* packet-ipdc.c
2 * Routines for IP Device Control (SS7 over IP) dissection
3 * Copyright Lucent Technologies 2004
4 * Josh Bailey <joshbailey@lucent.com> and Ruud Linders <ruud@lucent.com>
6 * Using IPDC spec 0.20.2
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
16 * I couldn't find the IPDC spec in question, but, for reference,
17 * there are some Internet-Drafts for a protocol that looks like a
18 * descendant or other variant of this:
20 * https://tools.ietf.org/html/draft-taylor-ipdc-00
21 * https://tools.ietf.org/html/draft-dugan-ipdc-connection-00
22 * https://tools.ietf.org/html/draft-elliott-ipdc-media-00
23 * https://tools.ietf.org/html/draft-bell-ipdc-signaling-00
24 * https://tools.ietf.org/html/draft-pickett-ipdc-management-00
27 #include "config.h"
29 #include <math.h>
31 #include <epan/packet.h>
32 #include <epan/to_str.h>
33 #include "packet-tcp.h"
34 #include <epan/prefs.h>
35 #include <epan/expert.h>
37 void proto_register_ipdc(void);
38 void proto_reg_handoff_ipdc(void);
40 static dissector_handle_t ipdc_tcp_handle;
42 #define TCP_PORT_IPDC 6668 /* Not IANA registered */
43 #define TRANS_ID_SIZE_IPDC 4
45 #define TEXT_UNDEFINED "UNDEFINED"
47 #define IPDC_STR_LEN 255
49 typedef enum {
50 IPDC_UNKNOWN,
51 IPDC_UINT,
52 IPDC_ASCII,
53 IPDC_BYTE,
54 IPDC_OCTET,
55 IPDC_IPA,
56 IPDC_LINESTATUS,
57 IPDC_CHANNELSTATUS,
58 IPDC_Q931,
59 IPDC_ENCTYPE
60 } ipdc_tag_type;
62 static const value_string encoding_type_vals[] = {
63 { 0x00, "PCMU (G.711 mu-law)" },
64 { 0x04, "G.723.1" },
65 { 0x08, "PCMA (G.711 A-law)" },
66 { 0x12, "G.729A" },
67 { 0x60, "Transparent data encoding" },
68 { 0x61, "T.38 fax over UPD" },
69 { 0, NULL }
72 static const value_string line_status_vals[] = {
73 { 0x00, "Not present" },
74 { 0x01, "Disabled" },
75 { 0x02, "Red alarm (loss of sync)" },
76 { 0x03, "Yellow alarm" },
77 { 0x04, "Other alarm or error" },
78 { 0x05, "Up" },
79 { 0x06, "Loopback" },
80 { 0, NULL }
83 static const value_string channel_status_vals[] = {
84 { 0x00, "Not present" },
85 { 0x01, "Out of service" },
86 { 0x03, "Maintenance (continuity test pending/in progress)" },
87 { 0x04, "Blocked" },
88 { 0x05, "Loopback" },
89 { 0x06, "Idle" },
90 { 0x07, "In use (dialing, ringing, etc.)" },
91 { 0x08, "Connected" },
92 { 0x50, "On hook" },
93 { 0x51, "Off hook" },
94 { 0, NULL }
97 /* XXX: Note duplicate values in the following ?? */
98 /* dups after the first commented out since a */
99 /* linear search will always match the first */
100 /* of the dups. */
101 static const value_string message_code_vals[] = {
102 { 0x0001, "SS -> GW: RCSI: Request inbound call setup" },
103 { 0x0002, "GW -> SS: ACSI: Accept inbound call setup" },
104 { 0x0003, "GW -> SS: CONI: Connect inbound call (answer)" },
105 { 0x0005, "TD -> SS: RCSO: Request outbound call setup" },
106 { 0x0006, "SS -> TD: ACSO: Accept outbound call setup" },
107 { 0x0007, "SS -> TD: CONO: Outbound call connected" },
108 { 0x0009, "SS -> GW: RCST: Request pass-through call setup (TDM connection between two channels)" },
109 { 0x000A, "GW -> SS: ACST: Accept pass-through call" },
110 { 0x0011, "RCR: Release channel request" },
111 { 0x0012, "ACR: Release channel complete" },
112 { 0x0013, "SS -> GW: RCCP: Request packet call setup" },
113 { 0x0014, "GW -> SS: ACCP: Accept packet call setup" },
114 { 0x0015, "SS -> GW: RMPC: Modify/Query request packet call" },
115 { 0x0016, "GW -> SS: AMPC: Accept modify to packet call" },
116 { 0x0041, "SS -> GW: RMS: Request module status" },
117 { 0x0042, "GW -> SS: NMS: Notify module status" },
118 { 0x0043, "SS -> GW: RLS: Request line status" },
119 { 0x0044, "GW -> SS: NLS: Notify line status" },
120 { 0x0045, "SS -> GW: RCS: Request channel status" },
121 { 0x0046, "GW -> SS: NCS: Notify channel status" },
122 { 0x0047, "SS -> GW: RRS: Request RTP port Status" },
123 { 0x0048, "SS -> GW: RARS: Request All RTP port Status" },
124 { 0x0049, "GW -> SS: NRS: Notify RTP port Status" },
125 { 0x004A, "GW -> SS: NARS: Notify All RTP port Status" },
126 { 0x0051, "SS -> GW: SMS: Set a module to a given state" },
127 { 0x0053, "SS -> GW: SLS: Set a line to a given state" },
128 { 0x0055, "SS -> GW: SCS: Set a group of channels to a given state" },
129 { 0x0056, "GW -> SS: RSCS: Response to SCS" },
130 { 0x0061, "SS -> GW: PCT: Prepare channel for continuity test" },
131 { 0x0062, "GW -> SS: APCT: Response to PCT" },
132 { 0x0063, "SS -> GW: SCT: Start continuity test procedure with far end as loopback (Generate tone and check for received tone)" },
133 { 0x0064, "GW -> SS: ASCT: Continuity test result" },
134 { 0x0071, "SS -> GW: LTN: Listen for tones" },
135 { 0x0072, "GW -> SS: ALTN: Response to Listen for tones" },
136 { 0x0073, "SS -> GW: STN: Send tones" },
137 { 0x0074, "GW -> SS: ASTN: Completion result of STN command" },
138 { 0x0079, "NATV: Native Mode Q.931 Signaling Transport" },
139 { 0x007A, "TUNL: Tunneled Transport of signaling protocol data units" },
140 { 0x007D, "RTE: Request Test Echo" },
141 { 0x007E, "ARTE: Response to Request Test Echo" },
142 { 0x0081, "GW -> SS: NSUP: Notify the soft switch that the GW is coming up" },
143 { 0x0082, "SS -> GW: ASUP: Acknowledgment to NSUP" },
144 { 0x0083, "GW -> SS: NSDN: Indication that the GW is going down" },
145 { 0x0084, "SS -> GW: LNK: Link Active" },
146 { 0x0085, "GW -> SS: ALNK: Acknowledgement to Link Active" },
147 { 0x0086, "GW -> SS: SLNK: Link Status" },
148 { 0x0087, "SS -> GW: RCGST: Request Congestion Status" },
149 { 0x0088, "GW -> SS: CGST: Congestion Status" },
150 { 0x0091, "SS -> GW: RSI: Request system information" },
151 { 0x0092, "GW -> SS: NSI: Notify System Information" },
152 { 0x00F0, "GW -> SS: NTN: Notify ToNe" },
153 { 0x00FF, "MRJ: Message reject." },
154 { 0, NULL }
156 static value_string_ext message_code_vals_ext = VALUE_STRING_EXT_INIT(message_code_vals);
158 static const value_string tag_description[] = {
159 { 0x01, "Protocol version" },
160 { 0x02, "System ID/ Serial Number" },
161 { 0x03, "System type" },
162 { 0x04, "Maximum number of modules (slot cards) supported" },
163 { 0x05, "Bay number" },
164 { 0x07, "Module number" },
165 { 0x0A, "Module type" },
166 { 0x0C, "Module status" },
167 { 0x0D, "Line number" },
168 { 0x14, "Line status" },
169 { 0x15, "Channel number" },
170 { 0x17, "Bearer capability" },
171 { 0x18, "Calling party number" },
172 { 0x19, "Dialed number" },
173 { 0x1B, "Primary SS IP address" },
174 { 0x1C, "Primary SS TCP port" },
175 { 0x20, "Number of lines in the Line status array" },
176 { 0x21, "Line status array" },
177 { 0x22, "Number of channels in the Channel status array" },
178 { 0x23, "Channel status array" },
179 { 0x24, "Requested module state" },
180 { 0x25, "Requested line state" },
181 { 0x26, "Requested channel status action" },
182 { 0x27, "Set channel status option" },
183 { 0x28, "Channel number first (for grouping)" },
184 { 0x29, "End Channel Number (for grouping)" },
185 { 0x2A, "Set channel status result" },
186 { 0x2B, "Prepare for continuity check result" },
187 { 0x2C, "Continuity timeout (ms)" },
188 { 0x2D, "Continuity test result" },
189 { 0x31, "Maximum time between digits in digits recognition/ tone" \
190 "detection (inter-digit time-out) (ms)" },
191 { 0x32, "Tone string length" },
192 { 0x33, "Tone string" },
193 { 0x34, "Tone to complete collection" },
194 { 0x35, "Tone listen completion status" },
195 { 0x36, "Tone send completion status" },
196 { 0x37, "TDM destination Module" },
197 { 0x38, "TDM destination Line" },
198 { 0x39, "TDM destination channel" },
199 { 0x3A, "DTMF send IP address" },
200 { 0x3B, "DTMF send RTP port number" },
201 { 0x3C, "DTMF send format" },
202 { 0x3D, "DTMF Named Events to Expect" },
203 { 0x3E, "DTMF Payload Indicator" },
204 { 0x40, "Access server Call identifier" },
205 { 0x46, "Maximum time for digit collection (ms)" },
206 { 0x49, "Tone Type" },
207 { 0x4A, "Apply/Cancel Tone" },
208 { 0x5D, "Destination listen IP address" },
209 { 0x5E, "Destination listen RTP port number" },
210 { 0x5F, "Destination send IP address" },
211 { 0x60, "Destination send RTP port number" },
212 { 0x65, "Source port type" },
213 { 0x66, "Destination port type" },
214 { 0x67, "Start RTP Port Number" },
215 { 0x68, "End RTP Port Number" },
216 { 0x69, "Rogue Session Addresses" },
217 { 0x6A, "RTP Port Status" },
218 { 0x6F, "Receive Encoding Type" },
219 { 0x70, "Send Encoding Type" },
220 { 0x71, "Silence Suppression Activation Timer (ms)" },
221 { 0x72, "Comfort Noise Generation" },
222 { 0x73, "Packet Loading (ms)" },
223 { 0x74, "Echo Cancellation" },
224 { 0x75, "Constant DTMF Tone Detection on/off" },
225 { 0x76, "Constant MF Tone Detection on/off" },
226 { 0x77, "Constant Fax tone detection on/off" },
227 { 0x78, "Constant Modem tone detection on/off" },
228 { 0x7B, "Constant Packet Loss Detection on/off" },
229 { 0x7C, "Packet Loss Threshold" },
230 { 0x7D, "Constant Latency Threshold Detection on/off" },
231 { 0x7E, "Latency Threshold (ms)" },
232 { 0x86, "Announcement treatment" },
233 { 0x90, "Packet Statistics Reset Indicator" },
234 { 0x91, "Number of audio packets sent" },
235 { 0x92, "Number of audio packets dropped" },
236 { 0x93, "Number of audio bytes sent" },
237 { 0x94, "Number of audio bytes dropped" },
238 { 0x95, "Number of signaling packets sent" },
239 { 0x96, "Number of signaling packets dropped" },
240 { 0x97, "Number of signaling bytes sent" },
241 { 0x98, "Number of signaling bytes dropped" },
242 { 0x99, "Estimated average latency (ms)" },
243 { 0x9D, "Number of audio packets received" },
244 { 0x9E, "Number of audio bytes received" },
245 { 0x9F, "Number of signaling packets received" },
246 { 0xA0, "Number of signaling bytes received" },
247 { 0xA1, "Protocol Type" },
248 { 0xA2, "PDU Data Block" },
249 { 0xA3, "Jitter estimated (m ticks)" },
250 { 0xA4, "Global call ID" },
251 { 0xA5, "User information line 1 proto" },
252 { 0xA6, "Congestion level indicator" },
253 { 0xA7, "RADIUS Ascend-auth-type" },
254 { 0xB0, "Link status" },
255 { 0xB1, "Action request" },
256 { 0xB2, "Calling Party Info1" },
257 { 0xB3, "Called Party Info2" },
258 { 0xC1, "Country Code" },
259 { 0xC2, "Number of Operational Universal Ports" },
260 { 0xC3, "Number of Operational HDLC-only (digital) ports" },
261 { 0xFE, "Q.850 Cause code" },
262 { 0, NULL }
264 static value_string_ext tag_description_ext = VALUE_STRING_EXT_INIT(tag_description);
266 typedef struct _ipdc_tag_type_val {
267 int tag;
268 ipdc_tag_type type;
269 } ipdc_tag_type_val;
271 static const ipdc_tag_type_val ipdc_tag_types[] = {
272 { 0x01, IPDC_UINT },
273 { 0x02, IPDC_ASCII },
274 { 0x03, IPDC_ASCII },
275 { 0x04, IPDC_UINT },
276 { 0x05, IPDC_ASCII },
277 { 0x07, IPDC_UINT },
278 { 0x0A, IPDC_BYTE },
279 { 0x0C, IPDC_BYTE },
280 { 0x0D, IPDC_UINT },
281 { 0x14, IPDC_BYTE },
282 { 0x15, IPDC_UINT },
283 { 0x17, IPDC_BYTE },
284 { 0x18, IPDC_ASCII },
285 { 0x19, IPDC_ASCII },
286 { 0x1B, IPDC_IPA },
287 { 0x1C, IPDC_UINT },
288 { 0x20, IPDC_UINT },
289 { 0x21, IPDC_LINESTATUS },
290 { 0x22, IPDC_UINT },
291 { 0x23, IPDC_CHANNELSTATUS },
292 { 0x24, IPDC_BYTE },
293 { 0x25, IPDC_OCTET }, /* TBD */
294 { 0x26, IPDC_BYTE },
295 { 0x27, IPDC_BYTE },
296 { 0x28, IPDC_UINT },
297 { 0x29, IPDC_UINT },
298 { 0x2A, IPDC_BYTE },
299 { 0x2B, IPDC_BYTE },
300 { 0x2C, IPDC_UINT },
301 { 0x2D, IPDC_BYTE },
302 { 0x31, IPDC_UINT },
303 { 0x32, IPDC_UINT },
304 { 0x33, IPDC_ASCII },
305 { 0x34, IPDC_ASCII },
306 { 0x35, IPDC_BYTE },
307 { 0x36, IPDC_UINT },
308 { 0x37, IPDC_UINT },
309 { 0x38, IPDC_UINT },
310 { 0x39, IPDC_UINT },
311 { 0x3A, IPDC_IPA },
312 { 0x3B, IPDC_UINT },
313 { 0x3C, IPDC_BYTE },
314 { 0x3D, IPDC_ASCII },
315 { 0x3E, IPDC_UINT },
316 { 0x40, IPDC_UINT },
317 { 0x46, IPDC_UINT },
318 { 0x49, IPDC_BYTE },
319 { 0x4A, IPDC_BYTE },
320 { 0x5D, IPDC_IPA },
321 { 0x5E, IPDC_UINT },
322 { 0x5F, IPDC_IPA },
323 { 0x60, IPDC_UINT },
324 { 0x65, IPDC_BYTE },
325 { 0x66, IPDC_BYTE },
326 { 0x67, IPDC_UINT },
327 { 0x68, IPDC_UINT },
328 { 0x69, IPDC_IPA },
329 { 0x6A, IPDC_BYTE },
330 { 0x6F, IPDC_ENCTYPE },
331 { 0x70, IPDC_ENCTYPE },
332 { 0x71, IPDC_UINT },
333 { 0x72, IPDC_BYTE },
334 { 0x73, IPDC_UINT },
335 { 0x74, IPDC_BYTE },
336 { 0x75, IPDC_BYTE },
337 { 0x76, IPDC_BYTE },
338 { 0x77, IPDC_BYTE },
339 { 0x78, IPDC_BYTE },
340 { 0x7B, IPDC_BYTE },
341 { 0x7C, IPDC_UINT },
342 { 0x7D, IPDC_BYTE },
343 { 0x7E, IPDC_UINT },
344 { 0x86, IPDC_BYTE },
345 { 0x90, IPDC_BYTE },
346 { 0x91, IPDC_UINT },
347 { 0x92, IPDC_UINT },
348 { 0x93, IPDC_UINT },
349 { 0x94, IPDC_UINT },
350 { 0x95, IPDC_UINT },
351 { 0x96, IPDC_UINT },
352 { 0x97, IPDC_UINT },
353 { 0x98, IPDC_UINT },
354 { 0x99, IPDC_UINT },
355 { 0x9D, IPDC_UINT },
356 { 0x9E, IPDC_UINT },
357 { 0x9F, IPDC_UINT },
358 { 0xA0, IPDC_UINT },
359 { 0xA1, IPDC_UINT },
360 { 0xA2, IPDC_Q931 },
361 { 0xA3, IPDC_BYTE },
362 { 0xA4, IPDC_BYTE },
363 { 0xA5, IPDC_BYTE },
364 { 0xA6, IPDC_UINT },
365 { 0xA7, IPDC_UINT },
366 { 0xB0, IPDC_BYTE },
367 { 0xB1, IPDC_BYTE },
368 { 0xB2, IPDC_OCTET },
369 { 0xB3, IPDC_OCTET },
370 { 0xC1, IPDC_BYTE },
371 { 0xC2, IPDC_UINT },
372 { 0xC3, IPDC_UINT },
373 { 0xFE, IPDC_UINT },
374 { 0xFFFF, IPDC_UNKNOWN }
377 #define IPDC_TAG(x) (256 * (x))
379 static const value_string tag_enum_type[] = {
380 /* Protocol Version */
381 { IPDC_TAG(0x01) + 0x00, "Version 0 (Xcom NMI 5.0)" },
382 { IPDC_TAG(0x01) + 0x01, "IPDC Version 0.12" },
383 { IPDC_TAG(0x01) + 0x02, "IPDC Version 0.15" },
384 { IPDC_TAG(0x01) + 0x03, "IPDC Version 0.17" },
385 { IPDC_TAG(0x01) + 0x04, "IPDC Version 0.18" },
386 { IPDC_TAG(0x01) + 0x05, "IPDC Version 0.19" },
387 { IPDC_TAG(0x01) + 0x06, "IPDC Version 0.20" },
388 /* Module type, from Annex B. */
389 { IPDC_TAG(0x0a) + 0x01, "Unknown" },
390 { IPDC_TAG(0x0a) + 0x02, "Shelf" },
391 { IPDC_TAG(0x0a) + 0x03, "Router Card" },
392 { IPDC_TAG(0x0a) + 0x04, "8-line Channelized T1" },
393 { IPDC_TAG(0x0a) + 0x05, "8-line Channelized E1" },
394 { IPDC_TAG(0x0a) + 0x06, "48-modem Card" },
395 { IPDC_TAG(0x0a) + 0x07, "192 HDLC Card" },
396 { IPDC_TAG(0x0a) + 0x08, "4-port Ethernet Card" },
397 { IPDC_TAG(0x0a) + 0x09, "Serial WAN Card" },
398 { IPDC_TAG(0x0a) + 0x0A, "HSSI Card" },
399 { IPDC_TAG(0x0a) + 0x0B, "10-line Unchannelized T1" },
400 { IPDC_TAG(0x0a) + 0x0C, "36-modem (Analog) Card" },
401 { IPDC_TAG(0x0a) + 0x0D, "T3 Card" },
402 { IPDC_TAG(0x0a) + 0x0E, "48-modem 56K Card" },
403 { IPDC_TAG(0x0a) + 0x0F, "Forward" },
404 { IPDC_TAG(0x0a) + 0x10, "SDSL Card" },
405 { IPDC_TAG(0x0a) + 0x11, "CAP ADSL Card" },
406 { IPDC_TAG(0x0a) + 0x12, "DMT ADSL Card" },
407 { IPDC_TAG(0x0a) + 0x13, "Standalone Modem Controller" },
408 { IPDC_TAG(0x0a) + 0x14, "32-port IDSL Card" },
409 { IPDC_TAG(0x0a) + 0x15, "10-line Unchannelized E1" },
410 { IPDC_TAG(0x0a) + 0x16, "36-modem (Analog) 2 Card" },
411 { IPDC_TAG(0x0a) + 0x17, "CSMX Modem Card" },
412 { IPDC_TAG(0x0a) + 0x18, "UDS3 Card" },
413 { IPDC_TAG(0x0a) + 0x19, "DS3 ATM Card" },
414 { IPDC_TAG(0x0a) + 0x1A, "4-port Ethernet 2 Card" },
415 { IPDC_TAG(0x0a) + 0x1B, "192 HDLC 2 Card" },
416 { IPDC_TAG(0x0a) + 0x1C, "SDSL 70 Data Card" },
417 { IPDC_TAG(0x0a) + 0x1D, "MADD Card" },
418 { IPDC_TAG(0x0a) + 0x1E, "SDSL 70 Voice Card" },
419 { IPDC_TAG(0x0a) + 0x1F, "OC3 Daughter Card" },
420 { IPDC_TAG(0x0a) + 0x20, "OC3 ATM Card" },
421 { IPDC_TAG(0x0a) + 0x21, "4-port Ethernet 3 Card" },
422 { IPDC_TAG(0x0a) + 0x22, "SRS Ethernet Card" },
423 { IPDC_TAG(0x0a) + 0x23, "SDSL ATM Card" },
424 { IPDC_TAG(0x0a) + 0x24, "AL DADSL ATM Card" },
425 { IPDC_TAG(0x0a) + 0x25, "CSM3V Modem Card" },
426 { IPDC_TAG(0x0a) + 0x26, "HDLC2EC Card" },
427 { IPDC_TAG(0x0a) + 0x27, "DS3 Daughter Card" },
428 { IPDC_TAG(0x0a) + 0x28, "2-port Ethernet Card" },
429 { IPDC_TAG(0x0a) + 0x2A, "STM0 Card" },
430 { IPDC_TAG(0x0a) + 0x2B, "SDSL Ripper Card" },
431 { IPDC_TAG(0x0a) + 0x2F, "Stinger Terminator Card" },
432 { IPDC_TAG(0x0a) + 0x30, "GS DADSL Ripper Card" },
433 { IPDC_TAG(0x0a) + 0x31, "PCTFIT Card" },
434 { IPDC_TAG(0x0a) + 0x32, "PCTFIE Card" },
435 { IPDC_TAG(0x0a) + 0x33, "CT DADSL GLITE Card" },
436 { IPDC_TAG(0x0a) + 0x34, "DS3 ATM 2 Card" },
437 { IPDC_TAG(0x0a) + 0x35, "E3 ATM Card" },
438 { IPDC_TAG(0x0a) + 0x36, "24-line Stinger IMA T1 Card" },
439 { IPDC_TAG(0x0a) + 0x37, "MADD 2 Card" },
440 { IPDC_TAG(0x0a) + 0x38, "GS HDSL 2 Card" },
441 { IPDC_TAG(0x0a) + 0x39, "32-line Stinger IDSL Card" },
442 { IPDC_TAG(0x0a) + 0x3A, "ANNEXB DADSL ATM Card" },
443 { IPDC_TAG(0x0a) + 0x3B, "24-line Stinger IMA E1 Card" },
444 { IPDC_TAG(0x0a) + 0x3C, "40C CT DADSL ATM Card" },
445 { IPDC_TAG(0x0a) + 0x3D, "4-port Ethernet 3+ Card" },
446 { IPDC_TAG(0x0a) + 0x3E, "CLPMT Card" },
447 { IPDC_TAG(0x0a) + 0x3F, "CLPME Card" },
448 { IPDC_TAG(0x0a) + 0x40, "E3 Daughter Card" },
449 { IPDC_TAG(0x0a) + 0x41, "8-line Stinger IMA T1 Card" },
450 { IPDC_TAG(0x0a) + 0x42, "8-line Stinger IMA E1 Card" },
451 { IPDC_TAG(0x0a) + 0x43, "48A GS DADSL ATM Card" },
452 { IPDC_TAG(0x0a) + 0x44, "48B GS DADSL ATM Card" },
453 { IPDC_TAG(0x0a) + 0x45, "48C GS DADSL ATM Card" },
454 { IPDC_TAG(0x0a) + 0x46, "40A CT DADSL ATM Card" },
455 { IPDC_TAG(0x0a) + 0x47, "OC3 ATM 2 Card" },
456 { IPDC_TAG(0x0a) + 0x48, "4-port Serial WAN 2 Card" },
457 { IPDC_TAG(0x0a) + 0x49, "CDS3 LIM Card" },
458 { IPDC_TAG(0x0a) + 0x4A, "R7000 Card" },
459 { IPDC_TAG(0x0a) + 0x4B, "VPN Card" },
460 { IPDC_TAG(0x0a) + 0x4C, "HSE Card" },
461 { IPDC_TAG(0x0a) + 0x4D, "MADD 3 Card" },
462 { IPDC_TAG(0x0a) + 0x4E, "Stinger CM V2 Card" },
463 { IPDC_TAG(0x0a) + 0x4F, "COC3 LIM Card" },
464 { IPDC_TAG(0x0a) + 0x50, "Stinger SHDSL Card" },
465 { IPDC_TAG(0x0a) + 0x51, "2-port OC34-port DS3 Daughter Card" },
466 { IPDC_TAG(0x0a) + 0x52, "72-line DADSL ATM Card" },
467 { IPDC_TAG(0x0a) + 0x53, "36-line DMT MRT Card" },
468 { IPDC_TAG(0x0a) + 0x54, "24-line T1 Card" },
469 { IPDC_TAG(0x0a) + 0x55, "24-line E1 Card" },
470 { IPDC_TAG(0x0a) + 0x56, "Stinger MRT CM Card" },
471 { IPDC_TAG(0x0a) + 0x57, "CSTM1 LIM Card" },
472 /* Module status */
473 { IPDC_TAG(0x0c) + 0x00, "Not present (empty)" },
474 { IPDC_TAG(0x0c) + 0x01, "Out of service (down)" },
475 { IPDC_TAG(0x0c) + 0x02, "Up" },
476 { IPDC_TAG(0x0c) + 0x03, "Error" },
477 { IPDC_TAG(0x0c) + 0x04, "Does not exist" },
478 /* Line status */
479 { IPDC_TAG(0x14) + 0x00, "Not present" },
480 { IPDC_TAG(0x14) + 0x01, "Disabled" },
481 { IPDC_TAG(0x14) + 0x02, "Red alarm (loss of sync)" },
482 { IPDC_TAG(0x14) + 0x03, "Yellow alarm" },
483 { IPDC_TAG(0x14) + 0x04, "Other alarms or errors" },
484 { IPDC_TAG(0x14) + 0x05, "Up" },
485 { IPDC_TAG(0x14) + 0x06, "Loopback" },
486 /* Bearer capability */
487 { IPDC_TAG(0x17) + 0x00, "Voice call" },
488 { IPDC_TAG(0x17) + 0x08, "64K data call" },
489 { IPDC_TAG(0x17) + 0x09, "56K data call" },
490 { IPDC_TAG(0x17) + 0x10,
491 "Modem call (3.1K Audio call) (applies to RCSI for modem call only)" },
492 /* Line status array */
493 /* { IPDC_TAG(0x21) + 0x0, "" }, */
494 /* Channel status array */
495 /* { IPDC_TAG(0x23) + 0x0, "" }, */
496 /* Requested module state */
497 { IPDC_TAG(0x24) + 0x00, "Out of service" },
498 { IPDC_TAG(0x24) + 0x01, "Initialize (bring up)" },
499 /* Requested line state */
500 { IPDC_TAG(0x25) + 0x00, "Disable" },
501 { IPDC_TAG(0x25) + 0x01, "Enable" },
502 { IPDC_TAG(0x25) + 0x02, "Start loopback" },
503 { IPDC_TAG(0x25) + 0x03, "Terminate loopback" },
504 /* Requested channel status action */
505 { IPDC_TAG(0x26) + 0x00, "Reset to idle" },
506 { IPDC_TAG(0x26) + 0x01, "Reset to out of service" },
507 { IPDC_TAG(0x26) + 0x02, "Start loopback" },
508 { IPDC_TAG(0x26) + 0x03, "Terminate loopback" },
509 /* Set channel status option */
510 { IPDC_TAG(0x27) + 0x00,
511 "Do not perform the indicated action if any of the" \
512 "channels is not in the valid initial state" },
513 { IPDC_TAG(0x27) + 0x01,
514 "Perform the indicated action on channels that are on" \
515 "the valid initial state. Other channels are not affected" },
516 /* Set channel status result */
517 { IPDC_TAG(0x2a) + 0x00,
518 "action successfully performed in all channels" },
519 { IPDC_TAG(0x2a) + 0x01, "at least one channel failed" },
520 /* Prepare for continuity check result */
521 { IPDC_TAG(0x2b) + 0x00, "Resources reserved successfully" },
522 { IPDC_TAG(0x2b) + 0x01, "Resource not available" },
523 /* Continuity test result */
524 { IPDC_TAG(0x2d) + 0x00, "Test completed successfully" },
525 { IPDC_TAG(0x2d) + 0x01, "Test failed" },
526 /* Tone listen completion status */
527 { IPDC_TAG(0x35) + 0x00, "Timeout" },
528 { IPDC_TAG(0x35) + 0x01, "No resources available for this operation" },
529 { IPDC_TAG(0x35) + 0x02, "Operation terminated by the SS" },
530 { IPDC_TAG(0x35) + 0x03, "Tone-to-complete-collection received" },
531 { IPDC_TAG(0x35) + 0x04,
532 "The specified maximum number of tones received" },
533 { IPDC_TAG(0x35) + 0x05, "Wait between successive tones too long" },
534 /* Tone send completion status */
535 { IPDC_TAG(0x36) + 0x00, "Operation succeeded" },
536 { IPDC_TAG(0x36) + 0x01, "Operation failed" },
537 { IPDC_TAG(0x36) + 0x02, "Operation terminated by SS" },
538 { IPDC_TAG(0x36) + 0x03, "Operation started" },
539 { IPDC_TAG(0x36) + 0x04,
540 "Operation terminated by administrative action" },
541 /* DTMF send format */
542 { IPDC_TAG(0x3c) + 0x00, "Tone" },
543 { IPDC_TAG(0x3c) + 0x01, "Event" },
544 { IPDC_TAG(0x3c) + 0x02, "Both (default)" },
545 /* Tone Type */
546 { IPDC_TAG(0x49) + 0x00, "MF Tone" },
547 { IPDC_TAG(0x49) + 0x01, "DTMF Tone" },
548 { IPDC_TAG(0x49) + 0x02, "Analog Test Tone" },
549 { IPDC_TAG(0x49) + 0x03, "Announcement" },
550 { IPDC_TAG(0x49) + 0x04, "Digital Milli-watt tone" },
551 { IPDC_TAG(0x49) + 0x05, "Supplemental tones" },
552 { IPDC_TAG(0x49) + 0x06,
553 "Fax tone (CED, no phase reversal, or V.21 flags)" },
554 { IPDC_TAG(0x49) + 0x07, "Modem tone (CED, phase reversal)" },
555 { IPDC_TAG(0x49) + 0x41, "Ringback tone" },
556 /* Apply/Cancel Tone */
557 { IPDC_TAG(0x4a) + 0x00, "Apply tone" },
558 { IPDC_TAG(0x4a) + 0x01, "Cancel tone" },
559 { IPDC_TAG(0x4a) + 0x02, "Listen for tone" },
560 /* Source port type */
561 { IPDC_TAG(0x65) + 0x00, "SCN channel" },
562 /* Destination port type */
563 { IPDC_TAG(0x66) + 0x01, "RTP port" },
564 /* RTP Port Status */
565 { IPDC_TAG(0x6a) + 0x00, "Idle", },
566 { IPDC_TAG(0x6a) + 0x01, "Active" },
567 /* Receive Encoding Type */
568 { IPDC_TAG(0x6f) + 0x00, "PCMU (G.711 mu-law)" },
569 { IPDC_TAG(0x6f) + 0x04, "G723.1" },
570 { IPDC_TAG(0x6f) + 0x08, "PCMA (G.711 A-law)" },
571 { IPDC_TAG(0x6f) + 0x12, "G729A" },
572 { IPDC_TAG(0x6f) + 0x60, "Transparent data encoding" },
573 { IPDC_TAG(0x6f) + 0x61, "T.38 fax over UPD" },
574 /* Send Encoding Type */
575 { IPDC_TAG(0x70) + 0x00, "PCMU (G.711 mu-law)" },
576 { IPDC_TAG(0x70) + 0x04, "G723.1" },
577 { IPDC_TAG(0x70) + 0x08, "PCMA (G.711 A-law)" },
578 { IPDC_TAG(0x70) + 0x12, "G729A" },
579 { IPDC_TAG(0x70) + 0x60, "Transparent data encoding" },
580 { IPDC_TAG(0x70) + 0x61, "T.38 fax over UPD" },
581 /* Comfort Noise Generation */
582 { IPDC_TAG(0x72) + 0x00, "off" },
583 { IPDC_TAG(0x72) + 0x01, "on" },
584 /* Echo Cancellation */
585 { IPDC_TAG(0x74) + 0x00, "Off" },
586 { IPDC_TAG(0x74) + 0x01, "On, 16 ms tail" },
587 { IPDC_TAG(0x74) + 0x02, "On, 32 ms tail (default)" },
588 { IPDC_TAG(0x74) + 0x03, "On, 64ms tail" },
589 /* Constant DTMF Tone Detection on/off */
590 { IPDC_TAG(0x75) + 0x00, "Off" },
591 { IPDC_TAG(0x75) + 0x01, "On (Default)" },
592 /* Constant MF Tone Detection on/off" */
593 { IPDC_TAG(0x76) + 0x00, "Off (Default)" },
594 { IPDC_TAG(0x76) + 0x01, "On" },
595 /* Constant Fax tone detection on/off */
596 { IPDC_TAG(0x77) + 0x00, "Off" },
597 { IPDC_TAG(0x77) + 0x01, "On (Default)" },
598 /* Constant Modem tone detection on/off */
599 { IPDC_TAG(0x78) + 0x00, "Off" },
600 { IPDC_TAG(0x78) + 0x01, "On (Default)" },
601 /* Constant Packet Loss Detection on/off */
602 { IPDC_TAG(0x7b) + 0x00, "Off" },
603 { IPDC_TAG(0x7b) + 0x01, "On (Default)" },
604 /* Constant Latency Threshold Detection on/off */
605 { IPDC_TAG(0x7d) + 0x00, "Off" },
606 { IPDC_TAG(0x7d) + 0x01, "On (Default)" },
607 /* Announcement treatment */
608 { IPDC_TAG(0x86) + 0x00, "Continuous play" },
609 { IPDC_TAG(0x86) + 0x01, "Play 1 time and terminate the call" },
610 { IPDC_TAG(0x86) + 0x02, "Play 2 times and terminate the call" },
611 { IPDC_TAG(0x86) + 0x03, "Play 3 times and terminate the call" },
612 { IPDC_TAG(0x86) + 0x04, "Play 4 times and terminate the call" },
613 { IPDC_TAG(0x86) + 0x05, "Play 5 times and terminate the call" },
614 /* Packet Statistics Reset Indicator */
615 { IPDC_TAG(0x90) + 0x00, "Do not reset" },
616 { IPDC_TAG(0x90) + 0x01, "Reset (default)" },
617 /* Protocol Type */
618 { IPDC_TAG(0xa1) + 0x01, "ITU-T Q931" },
619 { IPDC_TAG(0xa1) + 0x02, "Nortel-ISDN" },
620 { IPDC_TAG(0xa1) + 0x03, "5ESS-ISDN" },
621 { IPDC_TAG(0xa1) + 0x04, "Euro-ISDN" },
622 /* Global call ID Refer Annex A */
623 /* IPDC_TAG(0xa4) .... */
624 /* User information line 1 proto */
625 /* IPDC_TAG(0xa5) .... */
626 /* Congestion level indicator */
627 { IPDC_TAG(0xa6) + 0x00, "No Congestion" },
628 { IPDC_TAG(0xa6) + 0x01, "Congestion Level 1" },
629 { IPDC_TAG(0xa6) + 0x02, "Congestion Level 2" },
630 /* RADIUS Ascend-auth-type */
631 { IPDC_TAG(0xa7) + 0x00, "None" },
632 { IPDC_TAG(0xa7) + 0x01, "Any" },
633 { IPDC_TAG(0xa7) + 0x02, "PAP (Default)" },
634 { IPDC_TAG(0xa7) + 0x03, "CHAP" },
635 /* ??? { IPDC_TAG(0xa7) + 0x03, "MS-CHAP" }, */
636 /* Link status */
637 { IPDC_TAG(0xb0) + 0x00, "Successfully connected" },
638 { IPDC_TAG(0xb0) + 0x01, "Not connected" },
639 /* Action request */
640 { IPDC_TAG(0xb1) + 0x00, "Registration request" },
641 /* Calling Party Info */
642 /* Called Party Info */
643 /* Country Code */
644 { IPDC_TAG(0xc1) + 0x00, "Argentina" },
645 { IPDC_TAG(0xc1) + 0x02, "Australia" },
646 { IPDC_TAG(0xc1) + 0x03, "Belgium" },
647 { IPDC_TAG(0xc1) + 0x04, "China" },
648 { IPDC_TAG(0xc1) + 0x05, "Costa Rica" },
649 { IPDC_TAG(0xc1) + 0x06, "Finland" },
650 { IPDC_TAG(0xc1) + 0x07, "France" },
651 { IPDC_TAG(0xc1) + 0x08, "Germany" },
652 { IPDC_TAG(0xc1) + 0x09, "Hong Kong" },
653 { IPDC_TAG(0xc1) + 0x0a, "Italy" },
654 { IPDC_TAG(0xc1) + 0x0b, "Japan" },
655 { IPDC_TAG(0xc1) + 0x0c, "Korea" },
656 { IPDC_TAG(0xc1) + 0x0d, "Mexico" },
657 { IPDC_TAG(0xc1) + 0x0e, "Netherlands" },
658 { IPDC_TAG(0xc1) + 0x0f, "New Zealand" },
659 { IPDC_TAG(0xc1) + 0x10, "Singapore" },
660 { IPDC_TAG(0xc1) + 0x11, "Spain" },
661 { IPDC_TAG(0xc1) + 0x12, "Sweden" },
662 { IPDC_TAG(0xc1) + 0x13, "Switzerland" },
663 { IPDC_TAG(0xc1) + 0x14, "UK" },
664 { IPDC_TAG(0xc1) + 0x15, "US" },
665 /* ??? { IPDC_TAG(0xc1) + 0x15, "Brazil" }, */
666 { 0, NULL }
668 static value_string_ext tag_enum_type_ext = VALUE_STRING_EXT_INIT(tag_enum_type);
670 static int proto_ipdc;
671 static int hf_ipdc_nr;
672 static int hf_ipdc_ns;
673 static int hf_ipdc_payload_len;
674 static int hf_ipdc_protocol_id;
675 static int hf_ipdc_trans_id_size;
676 static int hf_ipdc_trans_id;
677 static int hf_ipdc_message_code;
678 static int hf_ipdc_ascii;
679 static int hf_ipdc_uint;
680 static int hf_ipdc_ipv4;
681 static int hf_ipdc_line_status;
682 static int hf_ipdc_channel_status;
683 static int hf_ipdc_enctype;
684 static int hf_ipdc_end_of_tags;
685 static int hf_ipdc_data_trailing_end_of_tags;
686 static int hf_ipdc_type_unknown;
688 static int ett_ipdc;
689 static int ett_ipdc_tag;
690 static int ett_ipdc_line_status;
692 static expert_field ei_ipdc_ipv4;
694 static bool ipdc_desegment = true;
696 static dissector_handle_t q931_handle;
699 static unsigned
700 get_ipdc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
702 /* lower 10 bits only */
703 unsigned raw_len = (tvb_get_ntohs(tvb,offset+2) & 0x03FF);
705 return raw_len + 4;
708 static int
709 dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
711 proto_item *ti;
712 proto_tree *ipdc_tree;
713 proto_tree *tag_tree, *line_tree;
714 tvbuff_t *q931_tvb;
716 const char *des;
717 const char *enum_val = "";
718 char *tmp_tag_text;
719 const value_string *val_ptr;
720 int hf_ptr;
721 uint32_t type;
722 unsigned len;
723 unsigned i;
724 unsigned status;
725 uint8_t tag;
726 uint32_t tmp_tag;
728 uint8_t nr = tvb_get_uint8(tvb,0);
729 uint8_t ns = tvb_get_uint8(tvb,1);
730 unsigned payload_len = get_ipdc_pdu_len(pinfo,tvb,0,NULL);
731 /* payload_len will be at least 4 bytes... */
733 int trans_id_size;
734 uint32_t trans_id;
735 uint16_t message_code;
736 uint16_t offset;
738 /* display IPDC protocol ID */
739 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPDC");
741 /* clear info column and display send/receive sequence numbers */
742 col_append_fstr(pinfo->cinfo, COL_INFO, "r=%u s=%u ", nr, ns);
744 if (payload_len == 4) {
746 ti = proto_tree_add_item(tree, proto_ipdc, tvb, 0, -1, ENC_NA);
747 ipdc_tree = proto_item_add_subtree(ti, ett_ipdc);
748 proto_tree_add_item(ipdc_tree, hf_ipdc_nr, tvb, 0, 1, ENC_BIG_ENDIAN);
749 proto_tree_add_item(ipdc_tree, hf_ipdc_ns, tvb, 1, 1, ENC_BIG_ENDIAN);
750 proto_tree_add_uint(ipdc_tree, hf_ipdc_payload_len, tvb, 2, 2,
751 payload_len);
752 col_set_fence(pinfo->cinfo, COL_INFO);
753 return 4;
756 /* IPDC tags present - display message code and trans. ID */
757 trans_id_size = TRANS_ID_SIZE_IPDC; /* tvb_get_uint8(tvb,5); */
758 trans_id = tvb_get_ntohl(tvb,6);
759 message_code = tvb_get_ntohs(tvb,6+trans_id_size);
760 offset = 6 + trans_id_size + 2; /* past message_code */
762 col_append_fstr(pinfo->cinfo, COL_INFO,
763 "TID=%x %s ",
764 trans_id,
765 val_to_str_ext_const(message_code, &message_code_vals_ext,
766 TEXT_UNDEFINED));
769 ti = proto_tree_add_item(tree, proto_ipdc, tvb, 0, -1, ENC_NA);
770 ipdc_tree = proto_item_add_subtree(ti, ett_ipdc);
772 proto_tree_add_item(ipdc_tree, hf_ipdc_nr, tvb, 0, 1, ENC_BIG_ENDIAN);
773 proto_tree_add_item(ipdc_tree, hf_ipdc_ns, tvb, 1, 1, ENC_BIG_ENDIAN);
774 proto_tree_add_uint(ipdc_tree, hf_ipdc_payload_len, tvb,
775 2, 2, payload_len);
777 proto_tree_add_item(ipdc_tree, hf_ipdc_protocol_id, tvb,
778 4, 1, ENC_BIG_ENDIAN);
779 proto_tree_add_item(ipdc_tree, hf_ipdc_trans_id_size, tvb,
780 5, 1, ENC_BIG_ENDIAN);
781 proto_tree_add_item(ipdc_tree, hf_ipdc_trans_id, tvb,
782 6, trans_id_size, ENC_NA);
783 proto_tree_add_item(ipdc_tree, hf_ipdc_message_code, tvb,
784 6 + trans_id_size, 2, ENC_BIG_ENDIAN);
786 tag_tree = proto_tree_add_subtree(ipdc_tree, tvb, offset, payload_len - offset,
787 ett_ipdc_tag, NULL, "IPDC tags");
789 /* iterate through tags. first byte is tag, second is length,
790 in bytes, following is tag data. tag of 0x0 should be
791 end of tags. */
792 for (;;) {
793 tag = tvb_get_uint8(tvb, offset);
795 if (tag == 0x0) {
796 if (offset == payload_len - 1) {
797 proto_tree_add_item(tag_tree, hf_ipdc_end_of_tags, tvb, offset, 1, ENC_NA);
798 } else {
799 proto_tree_add_item(tag_tree, hf_ipdc_data_trailing_end_of_tags, tvb, offset, 1, ENC_NA);
802 break;
805 len = tvb_get_uint8(tvb,offset+1);
806 des = val_to_str_ext_const(tag, &tag_description_ext, TEXT_UNDEFINED);
807 /* lookup tag type */
808 for (i = 0; (ipdc_tag_types[i].tag != tag &&
809 ipdc_tag_types[i].type != IPDC_UNKNOWN); i++)
811 type = ipdc_tag_types[i].type;
813 tmp_tag = 0;
815 switch (type) {
816 /* simple IPDC_ASCII strings */
817 case IPDC_ASCII:
818 if (len <= IPDC_STR_LEN) {
819 tmp_tag_text = (char *) tvb_get_string_enc(pinfo->pool, tvb, offset+2, len, ENC_ASCII|ENC_NA);
820 proto_tree_add_string_format(tag_tree, hf_ipdc_ascii, tvb, offset,
821 len + 2, tmp_tag_text, "%s (0x%2.2x): %s", des, tag,
822 tmp_tag_text);
824 break;
826 /* unsigned integers, or bytes */
827 case IPDC_UINT:
828 case IPDC_BYTE:
829 if (len <= 4) {
830 for (i = 0; i < len; i++)
831 tmp_tag += tvb_get_uint8(tvb,
832 offset + 2 + i) * (uint32_t)pow(256, len - (i + 1));
834 if (len == 1)
835 enum_val =
836 val_to_str_ext_const(IPDC_TAG(tag) + tmp_tag,
837 &tag_enum_type_ext, TEXT_UNDEFINED);
839 if (len == 1 && strcmp(enum_val, TEXT_UNDEFINED) != 0) {
840 proto_tree_add_uint_format(tag_tree, hf_ipdc_uint, tvb,
841 offset, len + 2, tmp_tag,
842 "%s (0x%2.2x): %s",
843 des, tag, enum_val);
844 } else {
845 proto_tree_add_uint_format(tag_tree, hf_ipdc_uint, tvb,
846 offset, len + 2, tmp_tag,
847 "%s (0x%2.2x): %u",
848 des, tag, tmp_tag);
851 break;
853 /* IP addresses */
854 case IPDC_IPA:
855 switch (len) {
856 case 4:
857 proto_tree_add_ipv4_format(tag_tree, hf_ipdc_ipv4, tvb,
858 offset, len + 2, tvb_get_ntohl(tvb, offset + 2),
859 "%s (0x%2.2x): %s",
860 des, tag, tvb_ip_to_str(pinfo->pool, tvb, offset + 2));
861 break;
862 case 6:
863 proto_tree_add_ipv4_format(tag_tree, hf_ipdc_ipv4, tvb,
864 offset, len + 2, tvb_get_ntohl(tvb, offset + 2),
865 "%s (0x%2.2x): %s:%u",
866 des, tag, tvb_ip_to_str(pinfo->pool, tvb, offset + 2), tvb_get_ntohs(tvb, offset + 6));
867 break;
868 default:
869 proto_tree_add_expert_format(tag_tree, pinfo, &ei_ipdc_ipv4, tvb, offset, len + 2, "%s (0x%2.2x): Invalid IP address length %u",
870 des, tag, len);
872 break;
873 /* Line status arrays */
874 case IPDC_LINESTATUS:
875 case IPDC_CHANNELSTATUS:
876 line_tree = proto_tree_add_subtree_format(tag_tree, tvb, offset, len + 2, ett_ipdc_line_status, NULL, "%s (0x%2.2x)", des, tag);
877 val_ptr = (type == IPDC_LINESTATUS) ? line_status_vals : channel_status_vals;
878 hf_ptr = (type == IPDC_LINESTATUS) ? hf_ipdc_line_status : hf_ipdc_channel_status;
879 for (i = 0; i < len; i++) {
880 status = tvb_get_uint8(tvb,offset+2+i);
881 proto_tree_add_uint_format(line_tree, hf_ptr, tvb,
882 offset + 2 + i, 1, status,
883 "%s (0x%2.2x) %.2u: %u (%s)",
884 des, tag, i + 1, status,
885 val_to_str_const(status,
886 val_ptr,
887 TEXT_UNDEFINED));
889 break;
890 case IPDC_Q931:
891 q931_tvb =
892 tvb_new_subset_length(tvb, offset+2, len);
893 call_dissector(q931_handle,q931_tvb,pinfo,tree);
894 break;
895 case IPDC_ENCTYPE:
896 proto_tree_add_uint_format(tag_tree, hf_ipdc_enctype, tvb,
897 offset, len + 2, tvb_get_uint8(tvb,offset+2),
898 "%s (0x%2.2x): %s",
899 des, tag, val_to_str_const(
900 tvb_get_uint8(tvb,offset+2),
901 encoding_type_vals,
902 TEXT_UNDEFINED));
904 if (len == 2) {
905 proto_tree_add_uint_format(tag_tree, hf_ipdc_enctype, tvb,
906 offset, len + 2, tvb_get_uint8(tvb,offset+3),
907 "%s (0x%2.2x): %u",
908 des, tag, tvb_get_uint8(tvb,offset+3));
910 break;
911 /* default */
912 default:
913 proto_tree_add_bytes_format(tag_tree, hf_ipdc_type_unknown, tvb, offset, len + 2, NULL, "0x%2.2x: %s", tag, des);
914 } /* switch */
915 offset += len + 2;
918 col_set_fence(pinfo->cinfo, COL_INFO);
919 return tvb_captured_length(tvb);
922 static int
923 dissect_ipdc_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
925 return dissect_ipdc_common(tvb, pinfo, tree, data);
928 static int
929 dissect_ipdc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
931 tcp_dissect_pdus(tvb, pinfo, tree, ipdc_desegment, 4,
932 get_ipdc_pdu_len, dissect_ipdc_tcp_pdu, data);
933 return tvb_captured_length(tvb);
936 void
937 proto_register_ipdc(void)
940 static hf_register_info hf[] = {
941 { &hf_ipdc_nr,
942 { "N(r)", "ipdc.nr",
943 FT_UINT8, BASE_DEC, NULL, 0x0,
944 "Receive sequence number", HFILL }
947 { &hf_ipdc_ns,
948 { "N(s)", "ipdc.ns",
949 FT_UINT8, BASE_DEC, NULL, 0x0,
950 "Transmit sequence number", HFILL }
953 { &hf_ipdc_payload_len,
954 { "Payload length", "ipdc.length",
955 FT_UINT16, BASE_DEC, NULL, 0x0,
956 NULL, HFILL }
959 { &hf_ipdc_protocol_id,
960 { "Protocol ID", "ipdc.protocol_id",
961 FT_UINT8, BASE_HEX, NULL, 0x0,
962 NULL, HFILL }
965 { &hf_ipdc_trans_id_size,
966 { "Transaction ID size", "ipdc.trans_id_size",
967 FT_UINT8, BASE_DEC, NULL, 0x0,
968 NULL, HFILL }
971 { &hf_ipdc_trans_id,
972 { "Transaction ID", "ipdc.trans_id",
973 FT_BYTES, BASE_NONE, NULL, 0x0,
974 NULL, HFILL }
977 { &hf_ipdc_message_code,
978 { "Message code", "ipdc.message_code",
979 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &message_code_vals_ext, 0x0,
980 NULL, HFILL }
983 { &hf_ipdc_ascii,
984 { "ASCII value", "ipdc.ascii",
985 FT_STRING, BASE_NONE, NULL, 0x0,
986 NULL, HFILL }
989 { &hf_ipdc_uint,
990 { "Byte/UINT value", "ipdc.uint",
991 FT_UINT32, BASE_DEC, NULL, 0x0,
992 NULL, HFILL }
995 { &hf_ipdc_ipv4,
996 { "IPv4 value", "ipdc.ipv4",
997 FT_IPv4, BASE_NONE, NULL, 0x0,
998 NULL, HFILL }
1001 { &hf_ipdc_line_status,
1002 { "Line Status value", "ipdc.line_status",
1003 FT_UINT8, BASE_DEC, VALS(line_status_vals), 0x0,
1004 NULL, HFILL }
1007 { &hf_ipdc_channel_status,
1008 { "Channel Status value", "ipdc.channel_status",
1009 FT_UINT8, BASE_DEC, VALS(channel_status_vals), 0x0,
1010 NULL, HFILL }
1013 { &hf_ipdc_enctype,
1014 { "Enctype value", "ipdc.enctype",
1015 FT_UINT16, BASE_DEC, NULL, 0x0,
1016 NULL, HFILL }
1019 { &hf_ipdc_end_of_tags,
1020 { "end of tags", "ipdc.end_of_tags",
1021 FT_NONE, BASE_NONE, NULL, 0x0,
1022 NULL, HFILL }
1025 { &hf_ipdc_data_trailing_end_of_tags,
1026 { "data trailing end of tags", "ipdc.data_trailing_end_of_tags",
1027 FT_NONE, BASE_NONE, NULL, 0x0,
1028 NULL, HFILL }
1031 { &hf_ipdc_type_unknown,
1032 { "Unknown type", "ipdc.type_unknown",
1033 FT_BYTES, BASE_NONE, NULL, 0x0,
1034 NULL, HFILL }
1038 static int *ett[] = {
1039 &ett_ipdc,
1040 &ett_ipdc_tag,
1041 &ett_ipdc_line_status,
1044 static ei_register_info ei[] = {
1045 { &ei_ipdc_ipv4, { "ipdc.ipv4.invalid_length", PI_PROTOCOL, PI_WARN, "Invalid IP address length", EXPFILL }},
1048 module_t *ipdc_module;
1049 expert_module_t* expert_ipdc;
1051 proto_ipdc = proto_register_protocol("IP Device Control (SS7 over IP)",
1052 "IPDC", "ipdc");
1053 proto_register_field_array(proto_ipdc, hf, array_length(hf));
1054 proto_register_subtree_array(ett, array_length(ett));
1055 expert_ipdc = expert_register_protocol(proto_ipdc);
1056 expert_register_field_array(expert_ipdc, ei, array_length(ei));
1058 ipdc_module = prefs_register_protocol(proto_ipdc, NULL);
1059 prefs_register_bool_preference(ipdc_module, "desegment_ipdc_messages",
1060 "Reassemble IPDC messages spanning multiple TCP segments",
1061 "Whether the IPDC dissector should reassemble messages spanning multiple TCP segments."
1062 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
1063 &ipdc_desegment);
1065 ipdc_tcp_handle = register_dissector("ipdc", dissect_ipdc_tcp, proto_ipdc);
1068 void
1069 proto_reg_handoff_ipdc(void)
1071 q931_handle = find_dissector_add_dependency("q931", proto_ipdc);
1073 dissector_add_uint_with_preference("tcp.port", TCP_PORT_IPDC, ipdc_tcp_handle);
1077 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1079 * Local variables:
1080 * c-basic-offset: 8
1081 * tab-width: 8
1082 * indent-tabs-mode: t
1083 * End:
1085 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1086 * :indentSize=8:tabSize=8:noTabs=false: