2 * Routines for Avaya IPSI Control packet disassembly
3 * Traffic is encapsulated Avaya proprietary CCMS
4 * (Control Channel Message Set) between PCD and SIM
6 * Copyright 2008, Randy McEoin <rmceoin@ahbelo.com>
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
17 #include <epan/packet.h>
19 void proto_register_ipsictl(void);
20 void proto_reg_handoff_ipsictl(void);
22 static dissector_handle_t ipsictl_handle
;
24 #define IPSICTL_PORT 5010 /* Not IANA registered */
25 #define IPSICTL_PDU_MAGIC 0x0300
27 static int proto_ipsictl
;
29 static int hf_ipsictl_pdu
;
30 static int hf_ipsictl_magic
;
31 static int hf_ipsictl_length
;
32 static int hf_ipsictl_type
;
33 static int hf_ipsictl_sequence
;
34 static int hf_ipsictl_field1
;
35 static int hf_ipsictl_data
;
37 static int ett_ipsictl
;
38 static int ett_ipsictl_pdu
;
40 static int dissect_ipsictl(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
43 proto_tree
*ipsictl_tree
;
54 int first_sequence
=-1;
60 remaining_length
=tvb_reported_length_remaining(tvb
, offset
);
62 ti
= proto_tree_add_item(tree
, proto_ipsictl
, tvb
, offset
, remaining_length
, ENC_NA
);
63 ipsictl_tree
= proto_item_add_subtree(ti
, ett_ipsictl
);
65 magic
= tvb_get_ntohs(tvb
, offset
);
66 if (magic
== IPSICTL_PDU_MAGIC
)
72 ((remaining_length
=tvb_reported_length_remaining(tvb
, offset
)) > 6))
76 magic
= tvb_get_ntohs(tvb
, loffset
); loffset
+=2;
77 length
= tvb_get_ntohs(tvb
, loffset
); loffset
+=2;
80 if (remaining_length
>=2)
82 type
= tvb_get_ntohs(tvb
, loffset
); loffset
+=2;
86 if (remaining_length
>=2)
88 sequence
= tvb_get_ntohs(tvb
, loffset
); loffset
+=2;
91 if (first_sequence
==-1)
93 first_sequence
=sequence
;
95 last_sequence
=sequence
;
98 if (remaining_length
>=2)
100 field1
= tvb_get_ntohs(tvb
, loffset
);
104 ti
= proto_tree_add_uint(ipsictl_tree
, hf_ipsictl_pdu
, tvb
,
105 offset
, (length
+4), pdu
);
106 pdu_tree
= proto_item_add_subtree(ti
, ett_ipsictl_pdu
);
109 remaining_length
=tvb_reported_length_remaining(tvb
, offset
);
112 proto_tree_add_uint(pdu_tree
, hf_ipsictl_magic
, tvb
, loffset
, 2, magic
);
114 loffset
+=2; remaining_length
-=2;
116 proto_tree_add_uint(pdu_tree
, hf_ipsictl_length
, tvb
, loffset
, 2, length
);
118 loffset
+=2; remaining_length
-=2;
120 if (remaining_length
>=2)
123 proto_tree_add_uint(pdu_tree
, hf_ipsictl_type
, tvb
, loffset
, 2, type
);
125 loffset
+=2; remaining_length
-=2;
127 if (remaining_length
>=2)
130 proto_tree_add_uint(pdu_tree
, hf_ipsictl_sequence
, tvb
, loffset
, 2, sequence
);
132 loffset
+=2; remaining_length
-=2;
134 if (remaining_length
>=2)
137 proto_tree_add_uint(pdu_tree
, hf_ipsictl_field1
, tvb
, loffset
, 2, field1
);
139 loffset
+=2; remaining_length
-=2;
141 if (remaining_length
>=2)
144 proto_tree_add_item(pdu_tree
, hf_ipsictl_data
, tvb
, loffset
, llength
, ENC_NA
);
155 proto_tree_add_item(ipsictl_tree
, hf_ipsictl_data
, tvb
, offset
, -1, ENC_NA
);
158 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "IPSICTL");
162 if (last_sequence
==-1)
164 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "PDUS=%d, Seq=0x%04x",
167 col_add_fstr(pinfo
->cinfo
, COL_INFO
, "PDUS=%d, Seq=0x%04x-0x%04x",
168 pdu
,first_sequence
,last_sequence
);
171 col_set_str(pinfo
->cinfo
, COL_INFO
, "Initialization");
174 return tvb_captured_length(tvb
);
176 } /* dissect_ipsictl */
178 void proto_register_ipsictl(void)
181 static hf_register_info hf
[] = {
183 { "PDU", "ipsictl.pdu",
184 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
185 "IPSICTL PDU", HFILL
}},
187 { "Magic", "ipsictl.magic",
188 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
189 "IPSICTL Magic", HFILL
}},
190 { &hf_ipsictl_length
,
191 { "Length", "ipsictl.length",
192 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
193 "IPSICTL Length", HFILL
}},
195 { "Type", "ipsictl.type",
196 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
197 "IPSICTL Type", HFILL
}},
198 { &hf_ipsictl_sequence
,
199 { "Sequence", "ipsictl.sequence",
200 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
201 "IPSICTL Sequence", HFILL
}},
202 { &hf_ipsictl_field1
,
203 { "Field1", "ipsictl.field1",
204 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
205 "IPSICTL Field1", HFILL
}},
207 { "Data", "ipsictl.data",
208 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
209 "IPSICTL data", HFILL
}},
212 static int *ett
[] = {
217 proto_ipsictl
= proto_register_protocol("IPSICTL", "IPSICTL", "ipsictl");
218 proto_register_field_array(proto_ipsictl
, hf
, array_length(hf
));
219 proto_register_subtree_array(ett
, array_length(ett
));
221 ipsictl_handle
= register_dissector("ipsictl", dissect_ipsictl
, proto_ipsictl
);
224 void proto_reg_handoff_ipsictl(void)
227 dissector_add_uint_with_preference("tcp.port", IPSICTL_PORT
, ipsictl_handle
);
232 * Editor modelines - https://www.wireshark.org/tools/modelines.html
237 * indent-tabs-mode: nil
240 * ex: set shiftwidth=2 tabstop=8 expandtab:
241 * :indentSize=2:tabSize=8:noTabs=true: