Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-indigocare-netrix.c
blob6f9164d592fe8cfe679034c3e6040fb99cac20e3
1 /* packet-indigocare-netrix.c
2 * Dissector routines for the IndigoCare Netrix protocols
3 * By Erik de Jong <erikdejong@gmail.com>
4 * Copyright 2016 Erik de Jong
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
13 #include "config.h"
15 #include <range.h>
16 #include <epan/packet.h>
17 #include <epan/expert.h>
18 #include <wsutil/strtoi.h>
20 #define INDIGOCARE_NETRIX_SOH 0x01
21 #define INDIGOCARE_NETRIX_STX 0x02
22 #define INDIGOCARE_NETRIX_ETX 0x03
23 #define INDIGOCARE_NETRIX_EOT 0x04
24 #define INDIGOCARE_NETRIX_ACK 0x06
25 #define INDIGOCARE_NETRIX_US 0x1F
26 #define INDIGOCARE_NETRIX_RS 0x1E
28 #define INDIGOCARE_NETRIX_SYSTEMINFO 0x01
29 #define INDIGOCARE_NETRIX_GROUP 0x0A
30 #define INDIGOCARE_NETRIX_PROFILE 0x0F
31 #define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE 0x23
32 #define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_BEGIN 0x88B8
33 #define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_END 0x8C9E
34 #define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_NONE 0x8C9F
35 #define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES 0x24
36 #define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_BEGIN 0x8CA0
37 #define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_END 0x9086
38 #define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_NONE 0x9087
39 #define INDIGOCARE_NETRIX_BOSCH 0x69
41 #define INDIGOCARE_NETRIX_SYSTEMINFO_COMPUTERNAME 0x01
42 #define INDIGOCARE_NETRIX_SYSTEMINFO_IPADDRESS 0x02
43 #define INDIGOCARE_NETRIX_SYSTEMINFO_VERSION 0x03
44 #define INDIGOCARE_NETRIX_SYSTEMINFO_BEEP 0x04
46 #define INDIGOCARE_NETRIX_GROUP_GROUPNUMBER 0x01
47 #define INDIGOCARE_NETRIX_GROUP_TYPE 0x02
48 #define INDIGOCARE_NETRIX_GROUP_ADDITION 0x03
49 #define INDIGOCARE_NETRIX_GROUP_IDBOSCHLOC 0x04
50 #define INDIGOCARE_NETRIX_GROUP_NAME 0x05
51 #define INDIGOCARE_NETRIX_GROUP_ROOM 0x06
52 #define INDIGOCARE_NETRIX_GROUP_LOCATION 0x07
54 #define INDIGOCARE_NETRIX_PROFILE_PROFILENUMBER 0x01
55 #define INDIGOCARE_NETRIX_PROFILE_TYPE 0x02
56 #define INDIGOCARE_NETRIX_PROFILE_ADDITION 0x03
57 #define INDIGOCARE_NETRIX_PROFILE_IDBOSCHLOC 0x04
58 #define INDIGOCARE_NETRIX_PROFILE_NAME 0x05
59 #define INDIGOCARE_NETRIX_PROFILE_ROOM 0x06
60 #define INDIGOCARE_NETRIX_PROFILE_LOCATION 0x07
62 #define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_TABLE 0x01
64 #define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_KEY 0x01
65 #define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_VALUE 0x02
67 #define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_KEY 0x01
69 #define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_TABLE 0x01
71 void proto_reg_handoff_netrix(void);
72 void proto_register_netrix(void);
74 static dissector_handle_t netrix_handle;
76 static expert_field ei_netrix_unexpected_header;
77 static expert_field ei_netrix_unexpected_record;
79 static int proto_netrix;
80 static int hf_netrix_header_type;
81 static int hf_netrix_header_systeminfo_type;
82 static int hf_netrix_header_groupcall_type;
83 static int hf_netrix_header_profilecall_type;
84 static int hf_netrix_header_get_conversiontable_type;
85 static int hf_netrix_header_get_conversiontable_none_type;
86 static int hf_netrix_header_get_conversiontable_result_type;
87 static int hf_netrix_header_search_conversiontables_type;
88 static int hf_netrix_header_search_conversiontables_none_type;
89 static int hf_netrix_header_boschcall_type;
91 static int hf_netrix_ack_type;
93 static int hf_netrix_systeminfo_computername_type;
94 static int hf_netrix_systeminfo_ipaddress_type;
95 static int hf_netrix_systeminfo_version_type;
96 static int hf_netrix_systeminfo_beep_type;
98 static int hf_netrix_groupcall_groupnumber_type;
99 static int hf_netrix_groupcall_type_type;
100 static int hf_netrix_groupcall_addition_type;
101 static int hf_netrix_groupcall_idboschloc_type;
102 static int hf_netrix_groupcall_name_type;
103 static int hf_netrix_groupcall_room_type;
104 static int hf_netrix_groupcall_location_type;
106 static int hf_netrix_profilecall_groupnumber_type;
107 static int hf_netrix_profilecall_type_type;
108 static int hf_netrix_profilecall_addition_type;
109 static int hf_netrix_profilecall_idboschloc_type;
110 static int hf_netrix_profilecall_name_type;
111 static int hf_netrix_profilecall_room_type;
112 static int hf_netrix_profilecall_location_type;
114 static int hf_netrix_get_conversiontable_table_type;
115 static int hf_netrix_get_conversiontable_key_type;
116 static int hf_netrix_get_conversiontable_value_type;
118 static int hf_netrix_search_conversiontables_key_type;
119 static int hf_netrix_search_conversiontables_table_type;
121 static int ett_netrix;
122 static int ett_netrix_systeminfo;
123 static int ett_netrix_groupcall;
124 static int ett_netrix_profilecall;
125 static int ett_netrix_get_conversiontable;
126 static int ett_netrix_get_conversiontable_result;
127 static int ett_netrix_search_conversiontables;
128 static int ett_netrix_search_conversiontables_result;
129 static int ett_netrix_boschcall;
130 static int ett_netrix_unknown;
132 static const value_string netrix_headertypenames[] = {
133 { INDIGOCARE_NETRIX_SYSTEMINFO, "System Info" },
134 { INDIGOCARE_NETRIX_GROUP, "Group Call" },
135 { INDIGOCARE_NETRIX_PROFILE, "Profile Call" },
136 { INDIGOCARE_NETRIX_GET_CONVERSIONTABLE, "Get Conversiontable" },
137 { INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_NONE, "Get Conversiontable - No Results" },
138 { INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES, "Search Conversiontables" },
139 { INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_NONE, "Search Conversiontables - No Results" },
140 { INDIGOCARE_NETRIX_BOSCH, "Bosch Call" },
141 { 0, NULL }
144 static int
145 dissect_netrix(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, void *data _U_)
147 proto_item *ti;
148 proto_item *header_item;
149 proto_tree *netrix_tree;
150 proto_tree *netrix_header_tree;
151 int32_t current_offset = 0, header_offset, identifier_start, identifier_offset, data_start, data_offset, ett;
152 int32_t header;
153 int32_t record_identifier;
154 int32_t group_number;
155 int32_t profile_number;
156 const char * record_data;
158 /* Corner case: 'EssecProtocolWithAck' ACK */
159 if (( tvb_get_uint8(tvb, 0) == INDIGOCARE_NETRIX_ACK ) && (tvb_reported_length(tvb) == 1)) {
160 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netrix");
161 col_clear(pinfo->cinfo, COL_INFO);
162 ti = proto_tree_add_item(tree, proto_netrix, tvb, 0, -1, ENC_NA);
163 netrix_tree = proto_item_add_subtree(ti, ett_netrix);
164 col_set_str(pinfo->cinfo, COL_INFO, "Ack");
165 proto_tree_add_item(netrix_tree, hf_netrix_ack_type, tvb, 0, 1, ENC_NA);
166 return 1;
169 /* Starts with SOH */
170 if ( tvb_get_uint8(tvb, 0) != INDIGOCARE_NETRIX_SOH )
171 return 0;
172 /* Ends with ETX or EOT */
173 if ((tvb_captured_length(tvb) == tvb_reported_length(tvb)) && (( tvb_get_uint8(tvb, tvb_reported_length(tvb) - 1) != INDIGOCARE_NETRIX_ETX ) && ( tvb_get_uint8(tvb, tvb_reported_length(tvb) - 1) != INDIGOCARE_NETRIX_EOT ))) {
174 return 0;
176 /* It is a Netrix Communication Protocol packet */
177 col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netrix");
178 col_clear(pinfo->cinfo, COL_INFO);
179 ti = proto_tree_add_item(tree, proto_netrix, tvb, 0, -1, ENC_NA);
180 netrix_tree = proto_item_add_subtree(ti, ett_netrix);
181 current_offset++;
183 /* Read header */
184 header_offset = tvb_find_uint8(tvb, current_offset, -1, INDIGOCARE_NETRIX_STX);
185 if(!ws_strtoi32(tvb_get_string_enc(pinfo->pool, tvb, current_offset, header_offset - current_offset, ENC_ASCII|ENC_NA), NULL, &header)) {
186 /* Warn about invalid header? */
187 return 0;
189 switch(header) {
190 case INDIGOCARE_NETRIX_SYSTEMINFO:
191 ett = ett_netrix_systeminfo;
192 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_systeminfo_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
193 col_set_str(pinfo->cinfo, COL_INFO, "Systeminfo:");
194 break;
195 case INDIGOCARE_NETRIX_GROUP:
196 ett = ett_netrix_groupcall;
197 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_groupcall_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
198 col_set_str(pinfo->cinfo, COL_INFO, "Group Call:");
199 break;
200 case INDIGOCARE_NETRIX_PROFILE:
201 ett = ett_netrix_profilecall;
202 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_profilecall_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
203 col_set_str(pinfo->cinfo, COL_INFO, "Profile Call:");
204 break;
205 case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE:
206 ett = ett_netrix_get_conversiontable;
207 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_get_conversiontable_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
208 col_set_str(pinfo->cinfo, COL_INFO, "Get Conversiontable:");
209 break;
210 case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_NONE:
211 ett = ett_netrix_get_conversiontable_result;
212 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_get_conversiontable_none_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
213 col_set_str(pinfo->cinfo, COL_INFO, "Get Conversiontable: No Results");
214 break;
215 case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES:
216 ett = ett_netrix_search_conversiontables;
217 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_search_conversiontables_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
218 col_set_str(pinfo->cinfo, COL_INFO, "Search Conversiontables:");
219 break;
220 case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_NONE:
221 ett = ett_netrix_search_conversiontables_result;
222 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_search_conversiontables_none_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
223 col_set_str(pinfo->cinfo, COL_INFO, "Search Conversiontables: No Results");
224 break;
225 case INDIGOCARE_NETRIX_BOSCH:
226 ett = ett_netrix_boschcall;
227 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_boschcall_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
228 col_set_str(pinfo->cinfo, COL_INFO, "Bosch Call:");
229 break;
230 default:
231 if ((header >= INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_BEGIN) && (header <= INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_END)) {
232 ett = ett_netrix_get_conversiontable_result;
233 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_get_conversiontable_result_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
234 col_add_fstr(pinfo->cinfo, COL_INFO, "Get Conversiontable result %d:", header - INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_BEGIN);
235 } else if ((header >= INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_BEGIN) && (header <= INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_END)) {
236 ett = ett_netrix_search_conversiontables_result;
237 header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_get_conversiontable_result_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
238 col_add_fstr(pinfo->cinfo, COL_INFO, "Search Conversiontables result %d:", header - INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_BEGIN);
239 } else {
240 proto_tree_add_expert_format(netrix_tree, pinfo, &ei_netrix_unexpected_header, tvb, current_offset, header_offset - current_offset, "Unexpected header %d", header);
241 ett = ett_netrix_unknown;
242 header_item = proto_tree_add_uint_format_value(netrix_tree, hf_netrix_header_type, tvb, current_offset, header_offset - current_offset, header, "%d", header);
243 col_add_fstr(pinfo->cinfo, COL_INFO, "%s:", val_to_str(header, netrix_headertypenames, "Unknown (%d)"));
245 break;
247 netrix_header_tree = proto_item_add_subtree(header_item, ett);
248 current_offset = header_offset + 1;
250 /* Read records */
251 while (tvb_get_uint8(tvb, current_offset) != INDIGOCARE_NETRIX_ETX) {
252 identifier_start = current_offset;
253 identifier_offset = tvb_find_uint8(tvb, current_offset, -1, INDIGOCARE_NETRIX_US);
254 ws_strtoi32(tvb_get_string_enc(pinfo->pool, tvb, current_offset, identifier_offset - current_offset, ENC_ASCII|ENC_NA), NULL, &record_identifier);
255 current_offset = identifier_offset + 1;
257 data_start = current_offset;
258 data_offset = tvb_find_uint8(tvb, current_offset, -1, INDIGOCARE_NETRIX_RS);
259 record_data = tvb_get_string_enc(pinfo->pool, tvb, current_offset, data_offset - current_offset, ENC_ASCII|ENC_NA);
261 current_offset = data_offset + 1;
263 switch (header) {
264 case INDIGOCARE_NETRIX_SYSTEMINFO:
265 switch (record_identifier) {
266 case INDIGOCARE_NETRIX_SYSTEMINFO_COMPUTERNAME:
267 proto_tree_add_item(netrix_header_tree, hf_netrix_systeminfo_computername_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
268 col_append_fstr(pinfo->cinfo, COL_INFO, " Computername=%s", record_data);
269 break;
270 case INDIGOCARE_NETRIX_SYSTEMINFO_IPADDRESS:
271 proto_tree_add_item(netrix_header_tree, hf_netrix_systeminfo_ipaddress_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
272 col_append_fstr(pinfo->cinfo, COL_INFO, " IP Address=%s", record_data);
273 break;
274 case INDIGOCARE_NETRIX_SYSTEMINFO_VERSION:
275 proto_tree_add_item(netrix_header_tree, hf_netrix_systeminfo_version_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
276 col_append_fstr(pinfo->cinfo, COL_INFO, " Systeminfo=%s", record_data);
277 break;
278 case INDIGOCARE_NETRIX_SYSTEMINFO_BEEP:
279 proto_tree_add_item(netrix_header_tree, hf_netrix_systeminfo_beep_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
280 break;
281 default:
282 proto_tree_add_expert_format(netrix_header_tree, pinfo, &ei_netrix_unexpected_record, tvb, identifier_start, data_offset - identifier_start, "Unexpected record %d with value %s", record_identifier, record_data);
283 break;
285 break;
286 case INDIGOCARE_NETRIX_GROUP:
287 switch (record_identifier) {
288 case INDIGOCARE_NETRIX_GROUP_GROUPNUMBER:
289 ws_strtoi32(record_data, NULL, &group_number);
290 proto_tree_add_uint_format_value(netrix_header_tree, hf_netrix_groupcall_groupnumber_type, tvb, identifier_start, data_offset - identifier_start, group_number, "%d", group_number);
291 col_append_fstr(pinfo->cinfo, COL_INFO, " Groupnumber=%d", group_number);
292 break;
293 case INDIGOCARE_NETRIX_GROUP_TYPE:
294 proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_type_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
295 col_append_fstr(pinfo->cinfo, COL_INFO, " Type=%s", record_data);
296 break;
297 case INDIGOCARE_NETRIX_GROUP_ADDITION:
298 proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_addition_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
299 break;
300 case INDIGOCARE_NETRIX_GROUP_IDBOSCHLOC:
301 proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_idboschloc_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
302 break;
303 case INDIGOCARE_NETRIX_GROUP_NAME:
304 proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_name_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
305 col_append_fstr(pinfo->cinfo, COL_INFO, " Name=%s", record_data);
306 break;
307 case INDIGOCARE_NETRIX_GROUP_ROOM:
308 proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_room_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
309 col_append_fstr(pinfo->cinfo, COL_INFO, " Room=%s", record_data);
310 break;
311 case INDIGOCARE_NETRIX_GROUP_LOCATION:
312 proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_location_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
313 col_append_fstr(pinfo->cinfo, COL_INFO, " Location=%s", record_data);
314 break;
315 default:
316 proto_tree_add_expert_format(netrix_header_tree, pinfo, &ei_netrix_unexpected_record, tvb, identifier_start, data_offset - identifier_start, "Unexpected record %d with value %s", record_identifier, record_data);
317 break;
319 break;
320 case INDIGOCARE_NETRIX_PROFILE:
321 switch (record_identifier) {
322 case INDIGOCARE_NETRIX_PROFILE_PROFILENUMBER:
323 ws_strtoi32(record_data, NULL, &profile_number);
324 proto_tree_add_uint_format_value(netrix_header_tree, hf_netrix_profilecall_groupnumber_type, tvb, identifier_start, data_offset - identifier_start, profile_number, "%d", profile_number);
325 col_append_fstr(pinfo->cinfo, COL_INFO, " Profilenumber=%d", profile_number);
326 break;
327 case INDIGOCARE_NETRIX_PROFILE_TYPE:
328 proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_type_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
329 col_append_fstr(pinfo->cinfo, COL_INFO, " Type=%s", record_data);
330 break;
331 case INDIGOCARE_NETRIX_PROFILE_ADDITION:
332 proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_addition_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
333 break;
334 case INDIGOCARE_NETRIX_PROFILE_IDBOSCHLOC:
335 proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_idboschloc_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
336 break;
337 case INDIGOCARE_NETRIX_PROFILE_NAME:
338 proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_name_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
339 col_append_fstr(pinfo->cinfo, COL_INFO, " Name=%s", record_data);
340 break;
341 case INDIGOCARE_NETRIX_PROFILE_ROOM:
342 proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_room_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
343 col_append_fstr(pinfo->cinfo, COL_INFO, " Room=%s", record_data);
344 break;
345 case INDIGOCARE_NETRIX_PROFILE_LOCATION:
346 proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_location_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
347 col_append_fstr(pinfo->cinfo, COL_INFO, " Location=%s", record_data);
348 break;
349 default:
350 proto_tree_add_expert_format(netrix_header_tree, pinfo, &ei_netrix_unexpected_record, tvb, identifier_start, data_offset - identifier_start, "Unexpected record %d with value %s", record_identifier, record_data);
351 break;
353 break;
354 case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE:
355 switch (record_identifier) {
356 case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_TABLE:
357 proto_tree_add_item(netrix_header_tree, hf_netrix_get_conversiontable_table_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
358 col_append_fstr(pinfo->cinfo, COL_INFO, " Table=%s", record_data);
359 break;
361 break;
362 case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES:
363 switch (record_identifier) {
364 case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_KEY:
365 proto_tree_add_item(netrix_header_tree, hf_netrix_search_conversiontables_key_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
366 col_append_fstr(pinfo->cinfo, COL_INFO, " Key=%s", record_data);
367 break;
368 default:
369 proto_tree_add_expert_format(netrix_header_tree, pinfo, &ei_netrix_unexpected_record, tvb, identifier_start, data_offset - identifier_start, "Unexpected record %d with value %s", record_identifier, record_data);
370 break;
372 break;
373 default:
374 if ((header >= INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_BEGIN) && (header <= INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_END)) {
375 switch (record_identifier) {
376 case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_KEY:
377 proto_tree_add_item(netrix_header_tree, hf_netrix_get_conversiontable_key_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
378 col_append_fstr(pinfo->cinfo, COL_INFO, " Key=%s", record_data);
379 break;
380 case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_VALUE:
381 proto_tree_add_item(netrix_header_tree, hf_netrix_get_conversiontable_value_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
382 col_append_fstr(pinfo->cinfo, COL_INFO, " Value=%s", record_data);
383 break;
384 default:
385 proto_tree_add_expert_format(netrix_header_tree, pinfo, &ei_netrix_unexpected_record, tvb, identifier_start, data_offset - identifier_start, "Unexpected record %d with value %s", record_identifier, record_data);
386 break;
388 } else if ((header >= INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_BEGIN) && (header <= INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_END)) {
389 switch (record_identifier) {
390 case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_TABLE:
391 proto_tree_add_item(netrix_header_tree, hf_netrix_search_conversiontables_table_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
392 col_append_fstr(pinfo->cinfo, COL_INFO, " Table=%s", record_data);
393 break;
394 default:
395 proto_tree_add_expert_format(netrix_header_tree, pinfo, &ei_netrix_unexpected_record, tvb, identifier_start, data_offset - identifier_start, "Unexpected record %d with value %s", record_identifier, record_data);
396 break;
399 break;
402 return tvb_captured_length(tvb);
405 void
406 proto_reg_handoff_netrix(void)
408 dissector_add_for_decode_as("tcp.port", netrix_handle);
411 void
412 proto_register_netrix(void)
414 static hf_register_info hf[] = {
415 { &hf_netrix_header_type,
416 { "Header Type", "netrix.header",
417 FT_UINT32, BASE_DEC,
418 NULL, 0x0,
419 NULL, HFILL }
421 { &hf_netrix_header_systeminfo_type,
422 { "System Info", "netrix.systeminfo",
423 FT_NONE, BASE_NONE,
424 NULL, 0x0,
425 NULL, HFILL }
427 { &hf_netrix_header_groupcall_type,
428 { "Group call", "netrix.groupcall",
429 FT_NONE, BASE_NONE,
430 NULL, 0x0,
431 NULL, HFILL }
433 { &hf_netrix_header_profilecall_type,
434 { "Profile call", "netrix.profilecall",
435 FT_NONE, BASE_NONE,
436 NULL, 0x0,
437 NULL, HFILL }
439 { &hf_netrix_header_get_conversiontable_type,
440 { "Get conversiontable", "netrix.getconversiontable",
441 FT_NONE, BASE_NONE,
442 NULL, 0x0,
443 NULL, HFILL }
445 { &hf_netrix_header_get_conversiontable_none_type,
446 { "Get conversiontable: no results", "netrix.getconversiontable.noresult",
447 FT_NONE, BASE_NONE,
448 NULL, 0x0,
449 NULL, HFILL }
451 { &hf_netrix_header_get_conversiontable_result_type,
452 { "Get conversiontable result", "netrix.getconversiontable.result",
453 FT_NONE, BASE_NONE,
454 NULL, 0x0,
455 NULL, HFILL }
457 { &hf_netrix_header_search_conversiontables_type,
458 { "Search conversiontables", "netrix.searchconversiontables",
459 FT_NONE, BASE_NONE,
460 NULL, 0x0,
461 NULL, HFILL }
463 { &hf_netrix_header_search_conversiontables_none_type,
464 { "Search converstiontables: no results", "netrix.searchconversiontables.noresult",
465 FT_NONE, BASE_NONE,
466 NULL, 0x0,
467 NULL, HFILL }
469 { &hf_netrix_header_boschcall_type,
470 { "Bosch call", "netrix.boschcall",
471 FT_NONE, BASE_NONE,
472 NULL, 0x0,
473 NULL, HFILL }
475 { &hf_netrix_ack_type,
476 { "Ack", "netrix.ack",
477 FT_NONE, BASE_NONE,
478 NULL, 0x0,
479 NULL, HFILL }
481 { &hf_netrix_systeminfo_computername_type,
482 { "Computername", "netrix.systeminfo.computername",
483 FT_STRING, BASE_NONE,
484 NULL, 0x0,
485 NULL, HFILL }
487 { &hf_netrix_systeminfo_ipaddress_type,
488 { "IP Address", "netrix.systeminfo.ipaddress",
489 FT_STRING, BASE_NONE,
490 NULL, 0x0,
491 NULL, HFILL }
493 { &hf_netrix_systeminfo_version_type,
494 { "Version", "netrix.systeminfo.version",
495 FT_STRING, BASE_NONE,
496 NULL, 0x0,
497 NULL, HFILL }
499 { &hf_netrix_systeminfo_beep_type,
500 { "Beep", "netrix.systeminfo.beep",
501 FT_STRING, BASE_NONE,
502 NULL, 0x0,
503 NULL, HFILL }
505 { &hf_netrix_groupcall_groupnumber_type,
506 { "Groupnumber", "netrix.groupcall.groupnumber",
507 FT_UINT32, BASE_DEC,
508 NULL, 0x0,
509 NULL, HFILL }
511 { &hf_netrix_groupcall_type_type,
512 { "MSG1 (Type)", "netrix.groupcall.type",
513 FT_STRING, BASE_NONE,
514 NULL, 0x0,
515 NULL, HFILL }
517 { &hf_netrix_groupcall_addition_type,
518 { "MSG2 (Addition)", "netrix.groupcall.addition",
519 FT_STRING, BASE_NONE,
520 NULL, 0x0,
521 NULL, HFILL }
523 { &hf_netrix_groupcall_idboschloc_type,
524 { "MSG3 (ID / Bosch Loc)", "netrix.groupcall.idboschloc",
525 FT_STRING, BASE_NONE,
526 NULL, 0x0,
527 NULL, HFILL }
529 { &hf_netrix_groupcall_name_type,
530 { "MSG4 (Name)", "netrix.groupcall.name",
531 FT_STRING, BASE_NONE,
532 NULL, 0x0,
533 NULL, HFILL }
535 { &hf_netrix_groupcall_room_type,
536 { "MSG5 (Room)", "netrix.groupcall.room",
537 FT_STRING, BASE_NONE,
538 NULL, 0x0,
539 NULL, HFILL }
541 { &hf_netrix_groupcall_location_type,
542 { "MSG6 (Location)", "netrix.groupcall.location",
543 FT_STRING, BASE_NONE,
544 NULL, 0x0,
545 NULL, HFILL }
547 { &hf_netrix_profilecall_groupnumber_type,
548 { "Profilenumber", "netrix.profilecall.profilenumber",
549 FT_UINT32, BASE_DEC,
550 NULL, 0x0,
551 NULL, HFILL }
553 { &hf_netrix_profilecall_type_type,
554 { "MSG1 (Type)", "netrix.profilecall.type",
555 FT_STRING, BASE_NONE,
556 NULL, 0x0,
557 NULL, HFILL }
559 { &hf_netrix_profilecall_addition_type,
560 { "MSG2 (Addition)", "netrix.profilecall.addition",
561 FT_STRING, BASE_NONE,
562 NULL, 0x0,
563 NULL, HFILL }
565 { &hf_netrix_profilecall_idboschloc_type,
566 { "MSG3 (ID / Bosch Loc)", "netrix.profilecall.idboschloc",
567 FT_STRING, BASE_NONE,
568 NULL, 0x0,
569 NULL, HFILL }
571 { &hf_netrix_profilecall_name_type,
572 { "MSG4 (Name)", "netrix.profilecall.name",
573 FT_STRING, BASE_NONE,
574 NULL, 0x0,
575 NULL, HFILL }
577 { &hf_netrix_profilecall_room_type,
578 { "MSG5 (Room)", "netrix.profilecall.room",
579 FT_STRING, BASE_NONE,
580 NULL, 0x0,
581 NULL, HFILL }
583 { &hf_netrix_profilecall_location_type,
584 { "MSG6 (Location)", "netrix.profilecall.location",
585 FT_STRING, BASE_NONE,
586 NULL, 0x0,
587 NULL, HFILL }
589 { &hf_netrix_get_conversiontable_table_type,
590 { "Table", "netrix.getconversiontable.table",
591 FT_STRING, BASE_NONE,
592 NULL, 0x0,
593 NULL, HFILL }
595 { &hf_netrix_get_conversiontable_key_type,
596 { "Key", "netrix.getconversiontable.key",
597 FT_STRING, BASE_NONE,
598 NULL, 0x0,
599 NULL, HFILL }
601 { &hf_netrix_get_conversiontable_value_type,
602 { "Value", "netrix.getconversiontable.value",
603 FT_STRING, BASE_NONE,
604 NULL, 0x0,
605 NULL, HFILL }
607 { &hf_netrix_search_conversiontables_key_type,
608 { "Key", "netrix.searchconversiontables.key",
609 FT_STRING, BASE_NONE,
610 NULL, 0x0,
611 NULL, HFILL }
613 { &hf_netrix_search_conversiontables_table_type,
614 { "Table", "netrix.searchconversiontables.table",
615 FT_STRING, BASE_NONE,
616 NULL, 0x0,
617 NULL, HFILL }
621 static ei_register_info ei[] = {
622 { &ei_netrix_unexpected_header, { "netrix.unexpected.header", PI_MALFORMED, PI_WARN, "Unexpected header", EXPFILL }},
623 { &ei_netrix_unexpected_record, { "netrix.unexpected.record", PI_MALFORMED, PI_WARN, "Unexpected record", EXPFILL }}
626 expert_module_t* expert_netrix;
628 /* Setup protocol subtree array */
629 static int *ett[] = {
630 &ett_netrix,
631 &ett_netrix_systeminfo,
632 &ett_netrix_groupcall,
633 &ett_netrix_profilecall,
634 &ett_netrix_get_conversiontable,
635 &ett_netrix_get_conversiontable_result,
636 &ett_netrix_search_conversiontables,
637 &ett_netrix_search_conversiontables_result,
638 &ett_netrix_boschcall,
639 &ett_netrix_unknown
642 proto_netrix = proto_register_protocol (
643 "Netrix Communication Protocol", /* name */
644 "Netrix", /* short name */
645 "netrix" /* abbrev */
648 proto_register_field_array(proto_netrix, hf, array_length(hf));
649 proto_register_subtree_array(ett, array_length(ett));
651 expert_netrix = expert_register_protocol(proto_netrix);
652 expert_register_field_array(expert_netrix, ei, array_length(ei));
654 netrix_handle = register_dissector("netrix", dissect_netrix, proto_netrix);
658 * Editor modelines - https://www.wireshark.org/tools/modelines.html
660 * Local variables:
661 * c-basic-offset: 8
662 * tab-width: 8
663 * indent-tabs-mode: t
664 * End:
666 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
667 * :indentSize=8:tabSize=8:noTabs=false: