Coverage Report

Created: 2026-11-12 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-indigocare-netrix.c
Line
Count
Source
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
5
 *
6
 * Wireshark - Network traffic analyzer
7
 * By Gerald Combs <gerald@wireshark.org>
8
 * Copyright 1998 Gerald Combs
9
 *
10
 * SPDX-License-Identifier: GPL-2.0-or-later
11
 */
12
13
#include "config.h"
14
15
#include <range.h>
16
#include <epan/packet.h>
17
#include <epan/expert.h>
18
#include <wsutil/strtoi.h>
19
20
0
#define INDIGOCARE_NETRIX_SOH       0x01
21
0
#define INDIGOCARE_NETRIX_STX       0x02
22
0
#define INDIGOCARE_NETRIX_ETX       0x03
23
0
#define INDIGOCARE_NETRIX_EOT       0x04
24
0
#define INDIGOCARE_NETRIX_ACK       0x06
25
0
#define INDIGOCARE_NETRIX_US        0x1F
26
0
#define INDIGOCARE_NETRIX_RS        0x1E
27
28
0
#define INDIGOCARE_NETRIX_SYSTEMINFO      0x01
29
0
#define INDIGOCARE_NETRIX_GROUP       0x0A
30
0
#define INDIGOCARE_NETRIX_PROFILE     0x0F
31
0
#define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE   0x23
32
0
#define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_BEGIN 0x88B8
33
0
#define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_END 0x8C9E
34
0
#define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_NONE  0x8C9F
35
0
#define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES 0x24
36
0
#define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_BEGIN 0x8CA0
37
0
#define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_END 0x9086
38
0
#define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_NONE  0x9087
39
0
#define INDIGOCARE_NETRIX_BOSCH       0x69
40
41
0
#define INDIGOCARE_NETRIX_SYSTEMINFO_COMPUTERNAME 0x01
42
0
#define INDIGOCARE_NETRIX_SYSTEMINFO_IPADDRESS    0x02
43
0
#define INDIGOCARE_NETRIX_SYSTEMINFO_VERSION    0x03
44
0
#define INDIGOCARE_NETRIX_SYSTEMINFO_BEEP   0x04
45
46
0
#define INDIGOCARE_NETRIX_GROUP_GROUPNUMBER   0x01
47
0
#define INDIGOCARE_NETRIX_GROUP_TYPE      0x02
48
0
#define INDIGOCARE_NETRIX_GROUP_ADDITION    0x03
49
0
#define INDIGOCARE_NETRIX_GROUP_IDBOSCHLOC    0x04
50
0
#define INDIGOCARE_NETRIX_GROUP_NAME      0x05
51
0
#define INDIGOCARE_NETRIX_GROUP_ROOM      0x06
52
0
#define INDIGOCARE_NETRIX_GROUP_LOCATION    0x07
53
54
0
#define INDIGOCARE_NETRIX_PROFILE_PROFILENUMBER   0x01
55
0
#define INDIGOCARE_NETRIX_PROFILE_TYPE      0x02
56
0
#define INDIGOCARE_NETRIX_PROFILE_ADDITION    0x03
57
0
#define INDIGOCARE_NETRIX_PROFILE_IDBOSCHLOC    0x04
58
0
#define INDIGOCARE_NETRIX_PROFILE_NAME      0x05
59
0
#define INDIGOCARE_NETRIX_PROFILE_ROOM      0x06
60
0
#define INDIGOCARE_NETRIX_PROFILE_LOCATION    0x07
61
62
0
#define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_TABLE 0x01
63
64
0
#define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_KEY 0x01
65
0
#define INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_VALUE 0x02
66
67
0
#define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_KEY 0x01
68
69
0
#define INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_TABLE 0x01
70
71
void proto_reg_handoff_netrix(void);
72
void proto_register_netrix(void);
73
74
static dissector_handle_t netrix_handle;
75
76
static expert_field ei_netrix_unexpected_header;
77
static expert_field ei_netrix_unexpected_record;
78
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;
90
91
static int hf_netrix_ack_type;
92
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;
97
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;
105
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;
113
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;
117
118
static int hf_netrix_search_conversiontables_key_type;
119
static int hf_netrix_search_conversiontables_table_type;
120
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;
131
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 }
142
};
143
144
static int
145
dissect_netrix(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, void *data _U_)
146
0
{
147
0
  proto_item *ti;
148
0
  proto_item *header_item;
149
0
  proto_tree *netrix_tree;
150
0
  proto_tree *netrix_header_tree;
151
0
  uint32_t current_offset = 0, header_offset, identifier_start, identifier_offset, data_start, data_offset, ett;
152
0
  int32_t header;
153
0
  int32_t record_identifier;
154
0
  int32_t group_number;
155
0
  int32_t profile_number;
156
0
  const char * record_data;
157
158
  /* Corner case: 'EssecProtocolWithAck' ACK */
159
0
  if (( tvb_get_uint8(tvb, 0) == INDIGOCARE_NETRIX_ACK ) && (tvb_reported_length(tvb) == 1)) {
160
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netrix");
161
0
    col_clear(pinfo->cinfo, COL_INFO);
162
0
    ti = proto_tree_add_item(tree, proto_netrix, tvb, 0, -1, ENC_NA);
163
0
    netrix_tree = proto_item_add_subtree(ti, ett_netrix);
164
0
    col_set_str(pinfo->cinfo, COL_INFO, "Ack");
165
0
    proto_tree_add_item(netrix_tree, hf_netrix_ack_type, tvb, 0, 1, ENC_NA);
166
0
    return 1;
167
0
  }
168
169
  /* Starts with SOH */
170
0
  if ( tvb_get_uint8(tvb, 0) != INDIGOCARE_NETRIX_SOH )
171
0
    return 0;
172
  /* Ends with ETX or EOT */
173
0
  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
0
    return 0;
175
0
  }
176
  /* It is a Netrix Communication Protocol packet */
177
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netrix");
178
0
  col_clear(pinfo->cinfo, COL_INFO);
179
0
  ti = proto_tree_add_item(tree, proto_netrix, tvb, 0, -1, ENC_NA);
180
0
  netrix_tree = proto_item_add_subtree(ti, ett_netrix);
181
0
  current_offset++;
182
183
  /* Read header */
184
0
  tvb_find_uint8_remaining(tvb, current_offset, INDIGOCARE_NETRIX_STX, &header_offset);
185
0
  if(!tvb_get_string_int(tvb, current_offset, header_offset - current_offset, ENC_STR_DEC, &header, NULL)) {
186
    /* Warn about invalid header? */
187
0
    return 0;
188
0
  }
189
0
  switch(header) {
190
0
    case INDIGOCARE_NETRIX_SYSTEMINFO:
191
0
      ett = ett_netrix_systeminfo;
192
0
      header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_systeminfo_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
193
0
      col_set_str(pinfo->cinfo, COL_INFO, "Systeminfo:");
194
0
    break;
195
0
    case INDIGOCARE_NETRIX_GROUP:
196
0
      ett = ett_netrix_groupcall;
197
0
      header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_groupcall_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
198
0
      col_set_str(pinfo->cinfo, COL_INFO, "Group Call:");
199
0
    break;
200
0
    case INDIGOCARE_NETRIX_PROFILE:
201
0
      ett = ett_netrix_profilecall;
202
0
      header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_profilecall_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
203
0
      col_set_str(pinfo->cinfo, COL_INFO, "Profile Call:");
204
0
    break;
205
0
    case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE:
206
0
      ett = ett_netrix_get_conversiontable;
207
0
      header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_get_conversiontable_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
208
0
      col_set_str(pinfo->cinfo, COL_INFO, "Get Conversiontable:");
209
0
    break;
210
0
    case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_NONE:
211
0
      ett = ett_netrix_get_conversiontable_result;
212
0
      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
0
      col_set_str(pinfo->cinfo, COL_INFO, "Get Conversiontable: No Results");
214
0
    break;
215
0
    case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES:
216
0
      ett = ett_netrix_search_conversiontables;
217
0
      header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_search_conversiontables_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
218
0
      col_set_str(pinfo->cinfo, COL_INFO, "Search Conversiontables:");
219
0
    break;
220
0
    case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_NONE:
221
0
      ett = ett_netrix_search_conversiontables_result;
222
0
      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
0
      col_set_str(pinfo->cinfo, COL_INFO, "Search Conversiontables: No Results");
224
0
    break;
225
0
    case INDIGOCARE_NETRIX_BOSCH:
226
0
      ett = ett_netrix_boschcall;
227
0
      header_item = proto_tree_add_item(netrix_tree, hf_netrix_header_boschcall_type, tvb, current_offset, header_offset - current_offset, ENC_NA);
228
0
      col_set_str(pinfo->cinfo, COL_INFO, "Bosch Call:");
229
0
    break;
230
0
    default:
231
0
      if ((header >= INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_BEGIN) && (header <= INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_END)) {
232
0
        ett = ett_netrix_get_conversiontable_result;
233
0
        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
0
        col_add_fstr(pinfo->cinfo, COL_INFO, "Get Conversiontable result %d:", header - INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_BEGIN);
235
0
      } else if ((header >= INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_BEGIN) && (header <= INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_END)) {
236
0
        ett = ett_netrix_search_conversiontables_result;
237
0
        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
0
        col_add_fstr(pinfo->cinfo, COL_INFO, "Search Conversiontables result %d:", header - INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_BEGIN);
239
0
      } else {
240
0
        proto_tree_add_expert_format(netrix_tree, pinfo, &ei_netrix_unexpected_header, tvb, current_offset, header_offset -  current_offset, "Unexpected header %d", header);
241
0
        ett = ett_netrix_unknown;
242
0
        header_item = proto_tree_add_uint(netrix_tree, hf_netrix_header_type, tvb, current_offset, header_offset - current_offset, header);
243
0
        col_add_fstr(pinfo->cinfo, COL_INFO, "%s:", val_to_str(pinfo->pool, header, netrix_headertypenames, "Unknown (%d)"));
244
0
      }
245
0
    break;
246
0
  }
247
0
  netrix_header_tree = proto_item_add_subtree(header_item, ett);
248
0
  current_offset = header_offset + 1;
249
250
  /* Read records */
251
0
  while (tvb_get_uint8(tvb, current_offset) != INDIGOCARE_NETRIX_ETX) {
252
0
    identifier_start = current_offset;
253
0
    tvb_find_uint8_remaining(tvb, current_offset, INDIGOCARE_NETRIX_US, &identifier_offset);
254
0
    tvb_get_string_int(tvb, current_offset, identifier_offset - current_offset, ENC_STR_DEC, &record_identifier, NULL);
255
0
    current_offset = identifier_offset + 1;
256
257
0
    data_start = current_offset;
258
0
    tvb_find_uint8_remaining(tvb, current_offset, INDIGOCARE_NETRIX_RS, &data_offset);
259
0
    record_data = (char*)tvb_get_string_enc(pinfo->pool, tvb, current_offset, data_offset - current_offset, ENC_ASCII|ENC_NA);
260
261
0
    current_offset = data_offset + 1;
262
263
0
    switch (header) {
264
0
      case INDIGOCARE_NETRIX_SYSTEMINFO:
265
0
        switch (record_identifier) {
266
0
          case INDIGOCARE_NETRIX_SYSTEMINFO_COMPUTERNAME:
267
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_systeminfo_computername_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
268
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Computername=%s", record_data);
269
0
          break;
270
0
          case INDIGOCARE_NETRIX_SYSTEMINFO_IPADDRESS:
271
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_systeminfo_ipaddress_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
272
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " IP Address=%s", record_data);
273
0
          break;
274
0
          case INDIGOCARE_NETRIX_SYSTEMINFO_VERSION:
275
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_systeminfo_version_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
276
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Systeminfo=%s", record_data);
277
0
          break;
278
0
          case INDIGOCARE_NETRIX_SYSTEMINFO_BEEP:
279
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_systeminfo_beep_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
280
0
          break;
281
0
          default:
282
0
            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
0
          break;
284
0
        }
285
0
      break;
286
0
      case INDIGOCARE_NETRIX_GROUP:
287
0
        switch (record_identifier) {
288
0
          case INDIGOCARE_NETRIX_GROUP_GROUPNUMBER:
289
0
            ws_strtoi32(record_data, NULL, &group_number);
290
0
            proto_tree_add_uint(netrix_header_tree, hf_netrix_groupcall_groupnumber_type, tvb, identifier_start, data_offset - identifier_start, group_number);
291
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Groupnumber=%d", group_number);
292
0
          break;
293
0
          case INDIGOCARE_NETRIX_GROUP_TYPE:
294
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_type_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
295
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Type=%s", record_data);
296
0
          break;
297
0
          case INDIGOCARE_NETRIX_GROUP_ADDITION:
298
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_addition_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
299
0
          break;
300
0
          case INDIGOCARE_NETRIX_GROUP_IDBOSCHLOC:
301
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_idboschloc_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
302
0
          break;
303
0
          case INDIGOCARE_NETRIX_GROUP_NAME:
304
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_name_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
305
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Name=%s", record_data);
306
0
          break;
307
0
          case INDIGOCARE_NETRIX_GROUP_ROOM:
308
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_room_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
309
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Room=%s", record_data);
310
0
          break;
311
0
          case INDIGOCARE_NETRIX_GROUP_LOCATION:
312
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_groupcall_location_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
313
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Location=%s", record_data);
314
0
          break;
315
0
          default:
316
0
            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
0
          break;
318
0
        }
319
0
      break;
320
0
      case INDIGOCARE_NETRIX_PROFILE:
321
0
        switch (record_identifier) {
322
0
          case INDIGOCARE_NETRIX_PROFILE_PROFILENUMBER:
323
0
            ws_strtoi32(record_data, NULL, &profile_number);
324
0
            proto_tree_add_uint(netrix_header_tree, hf_netrix_profilecall_groupnumber_type, tvb, identifier_start, data_offset - identifier_start, profile_number);
325
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Profilenumber=%d", profile_number);
326
0
          break;
327
0
          case INDIGOCARE_NETRIX_PROFILE_TYPE:
328
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_type_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
329
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Type=%s", record_data);
330
0
          break;
331
0
          case INDIGOCARE_NETRIX_PROFILE_ADDITION:
332
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_addition_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
333
0
          break;
334
0
          case INDIGOCARE_NETRIX_PROFILE_IDBOSCHLOC:
335
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_idboschloc_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
336
0
          break;
337
0
          case INDIGOCARE_NETRIX_PROFILE_NAME:
338
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_name_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
339
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Name=%s", record_data);
340
0
          break;
341
0
          case INDIGOCARE_NETRIX_PROFILE_ROOM:
342
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_room_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
343
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Room=%s", record_data);
344
0
          break;
345
0
          case INDIGOCARE_NETRIX_PROFILE_LOCATION:
346
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_profilecall_location_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
347
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Location=%s", record_data);
348
0
          break;
349
0
          default:
350
0
            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
0
          break;
352
0
        }
353
0
      break;
354
0
      case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE:
355
0
        switch (record_identifier) {
356
0
          case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_TABLE:
357
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_get_conversiontable_table_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
358
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Table=%s", record_data);
359
0
          break;
360
0
        }
361
0
      break;
362
0
      case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES:
363
0
        switch (record_identifier) {
364
0
          case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_KEY:
365
0
            proto_tree_add_item(netrix_header_tree, hf_netrix_search_conversiontables_key_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
366
0
            col_append_fstr(pinfo->cinfo, COL_INFO, " Key=%s", record_data);
367
0
          break;
368
0
          default:
369
0
            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
0
          break;
371
0
        }
372
0
      break;
373
0
      default:
374
0
        if ((header >= INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_BEGIN) && (header <= INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_END)) {
375
0
          switch (record_identifier) {
376
0
            case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_KEY:
377
0
              proto_tree_add_item(netrix_header_tree, hf_netrix_get_conversiontable_key_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
378
0
              col_append_fstr(pinfo->cinfo, COL_INFO, " Key=%s", record_data);
379
0
            break;
380
0
            case INDIGOCARE_NETRIX_GET_CONVERSIONTABLE_VALUE:
381
0
              proto_tree_add_item(netrix_header_tree, hf_netrix_get_conversiontable_value_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
382
0
              col_append_fstr(pinfo->cinfo, COL_INFO, " Value=%s", record_data);
383
0
            break;
384
0
            default:
385
0
              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
0
            break;
387
0
          }
388
0
        } else if ((header >= INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_BEGIN) && (header <= INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_END)) {
389
0
          switch (record_identifier) {
390
0
            case INDIGOCARE_NETRIX_SEARCH_CONVERSIONTABLES_TABLE:
391
0
              proto_tree_add_item(netrix_header_tree, hf_netrix_search_conversiontables_table_type, tvb, data_start, data_offset - data_start, ENC_ASCII);
392
0
              col_append_fstr(pinfo->cinfo, COL_INFO, " Table=%s", record_data);
393
0
            break;
394
0
            default:
395
0
              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
0
            break;
397
0
          }
398
0
        }
399
0
      break;
400
0
    }
401
0
  }
402
0
  return tvb_captured_length(tvb);
403
0
}
404
405
void
406
proto_reg_handoff_netrix(void)
407
16
{
408
16
  dissector_add_for_decode_as("tcp.port", netrix_handle);
409
16
}
410
411
void
412
proto_register_netrix(void)
413
16
{
414
16
  static hf_register_info hf[] = {
415
16
  { &hf_netrix_header_type,
416
16
    { "Header Type", "netrix.header",
417
16
    FT_UINT32, BASE_DEC,
418
16
    NULL, 0x0,
419
16
    NULL, HFILL }
420
16
  },
421
16
  { &hf_netrix_header_systeminfo_type,
422
16
    { "System Info", "netrix.systeminfo",
423
16
    FT_NONE, BASE_NONE,
424
16
    NULL, 0x0,
425
16
    NULL, HFILL }
426
16
  },
427
16
  { &hf_netrix_header_groupcall_type,
428
16
    { "Group call", "netrix.groupcall",
429
16
    FT_NONE, BASE_NONE,
430
16
    NULL, 0x0,
431
16
    NULL, HFILL }
432
16
  },
433
16
  { &hf_netrix_header_profilecall_type,
434
16
    { "Profile call", "netrix.profilecall",
435
16
    FT_NONE, BASE_NONE,
436
16
    NULL, 0x0,
437
16
    NULL, HFILL }
438
16
  },
439
16
  { &hf_netrix_header_get_conversiontable_type,
440
16
    { "Get conversiontable", "netrix.getconversiontable",
441
16
    FT_NONE, BASE_NONE,
442
16
    NULL, 0x0,
443
16
    NULL, HFILL }
444
16
  },
445
16
  { &hf_netrix_header_get_conversiontable_none_type,
446
16
    { "Get conversiontable: no results", "netrix.getconversiontable.noresult",
447
16
    FT_NONE, BASE_NONE,
448
16
    NULL, 0x0,
449
16
    NULL, HFILL }
450
16
  },
451
16
  { &hf_netrix_header_get_conversiontable_result_type,
452
16
    { "Get conversiontable result", "netrix.getconversiontable.result",
453
16
    FT_NONE, BASE_NONE,
454
16
    NULL, 0x0,
455
16
    NULL, HFILL }
456
16
  },
457
16
  { &hf_netrix_header_search_conversiontables_type,
458
16
    { "Search conversiontables", "netrix.searchconversiontables",
459
16
    FT_NONE, BASE_NONE,
460
16
    NULL, 0x0,
461
16
    NULL, HFILL }
462
16
  },
463
16
  { &hf_netrix_header_search_conversiontables_none_type,
464
16
    { "Search conversiontables: no results", "netrix.searchconversiontables.noresult",
465
16
    FT_NONE, BASE_NONE,
466
16
    NULL, 0x0,
467
16
    NULL, HFILL }
468
16
  },
469
16
  { &hf_netrix_header_boschcall_type,
470
16
    { "Bosch call", "netrix.boschcall",
471
16
    FT_NONE, BASE_NONE,
472
16
    NULL, 0x0,
473
16
    NULL, HFILL }
474
16
  },
475
16
  { &hf_netrix_ack_type,
476
16
    { "Ack", "netrix.ack",
477
16
    FT_NONE, BASE_NONE,
478
16
    NULL, 0x0,
479
16
    NULL, HFILL }
480
16
  },
481
16
  { &hf_netrix_systeminfo_computername_type,
482
16
    { "Computername", "netrix.systeminfo.computername",
483
16
    FT_STRING, BASE_NONE,
484
16
    NULL, 0x0,
485
16
    NULL, HFILL }
486
16
  },
487
16
  { &hf_netrix_systeminfo_ipaddress_type,
488
16
    { "IP Address", "netrix.systeminfo.ipaddress",
489
16
    FT_STRING, BASE_NONE,
490
16
    NULL, 0x0,
491
16
    NULL, HFILL }
492
16
  },
493
16
  { &hf_netrix_systeminfo_version_type,
494
16
    { "Version", "netrix.systeminfo.version",
495
16
    FT_STRING, BASE_NONE,
496
16
    NULL, 0x0,
497
16
    NULL, HFILL }
498
16
  },
499
16
  { &hf_netrix_systeminfo_beep_type,
500
16
    { "Beep", "netrix.systeminfo.beep",
501
16
    FT_STRING, BASE_NONE,
502
16
    NULL, 0x0,
503
16
    NULL, HFILL }
504
16
  },
505
16
  { &hf_netrix_groupcall_groupnumber_type,
506
16
    { "Groupnumber", "netrix.groupcall.groupnumber",
507
16
    FT_UINT32, BASE_DEC,
508
16
    NULL, 0x0,
509
16
    NULL, HFILL }
510
16
  },
511
16
  { &hf_netrix_groupcall_type_type,
512
16
    { "MSG1 (Type)", "netrix.groupcall.type",
513
16
    FT_STRING, BASE_NONE,
514
16
    NULL, 0x0,
515
16
    NULL, HFILL }
516
16
  },
517
16
  { &hf_netrix_groupcall_addition_type,
518
16
    { "MSG2 (Addition)", "netrix.groupcall.addition",
519
16
    FT_STRING, BASE_NONE,
520
16
    NULL, 0x0,
521
16
    NULL, HFILL }
522
16
  },
523
16
  { &hf_netrix_groupcall_idboschloc_type,
524
16
    { "MSG3 (ID / Bosch Loc)", "netrix.groupcall.idboschloc",
525
16
    FT_STRING, BASE_NONE,
526
16
    NULL, 0x0,
527
16
    NULL, HFILL }
528
16
  },
529
16
  { &hf_netrix_groupcall_name_type,
530
16
    { "MSG4 (Name)", "netrix.groupcall.name",
531
16
    FT_STRING, BASE_NONE,
532
16
    NULL, 0x0,
533
16
    NULL, HFILL }
534
16
  },
535
16
  { &hf_netrix_groupcall_room_type,
536
16
    { "MSG5 (Room)", "netrix.groupcall.room",
537
16
    FT_STRING, BASE_NONE,
538
16
    NULL, 0x0,
539
16
    NULL, HFILL }
540
16
  },
541
16
  { &hf_netrix_groupcall_location_type,
542
16
    { "MSG6 (Location)", "netrix.groupcall.location",
543
16
    FT_STRING, BASE_NONE,
544
16
    NULL, 0x0,
545
16
    NULL, HFILL }
546
16
  },
547
16
  { &hf_netrix_profilecall_groupnumber_type,
548
16
    { "Profilenumber", "netrix.profilecall.profilenumber",
549
16
    FT_UINT32, BASE_DEC,
550
16
    NULL, 0x0,
551
16
    NULL, HFILL }
552
16
  },
553
16
  { &hf_netrix_profilecall_type_type,
554
16
    { "MSG1 (Type)", "netrix.profilecall.type",
555
16
    FT_STRING, BASE_NONE,
556
16
    NULL, 0x0,
557
16
    NULL, HFILL }
558
16
  },
559
16
  { &hf_netrix_profilecall_addition_type,
560
16
    { "MSG2 (Addition)", "netrix.profilecall.addition",
561
16
    FT_STRING, BASE_NONE,
562
16
    NULL, 0x0,
563
16
    NULL, HFILL }
564
16
  },
565
16
  { &hf_netrix_profilecall_idboschloc_type,
566
16
    { "MSG3 (ID / Bosch Loc)", "netrix.profilecall.idboschloc",
567
16
    FT_STRING, BASE_NONE,
568
16
    NULL, 0x0,
569
16
    NULL, HFILL }
570
16
  },
571
16
  { &hf_netrix_profilecall_name_type,
572
16
    { "MSG4 (Name)", "netrix.profilecall.name",
573
16
    FT_STRING, BASE_NONE,
574
16
    NULL, 0x0,
575
16
    NULL, HFILL }
576
16
  },
577
16
  { &hf_netrix_profilecall_room_type,
578
16
    { "MSG5 (Room)", "netrix.profilecall.room",
579
16
    FT_STRING, BASE_NONE,
580
16
    NULL, 0x0,
581
16
    NULL, HFILL }
582
16
  },
583
16
  { &hf_netrix_profilecall_location_type,
584
16
    { "MSG6 (Location)", "netrix.profilecall.location",
585
16
    FT_STRING, BASE_NONE,
586
16
    NULL, 0x0,
587
16
    NULL, HFILL }
588
16
  },
589
16
  { &hf_netrix_get_conversiontable_table_type,
590
16
    { "Table", "netrix.getconversiontable.table",
591
16
    FT_STRING, BASE_NONE,
592
16
    NULL, 0x0,
593
16
    NULL, HFILL }
594
16
  },
595
16
  { &hf_netrix_get_conversiontable_key_type,
596
16
    { "Key", "netrix.getconversiontable.key",
597
16
    FT_STRING, BASE_NONE,
598
16
    NULL, 0x0,
599
16
    NULL, HFILL }
600
16
  },
601
16
  { &hf_netrix_get_conversiontable_value_type,
602
16
    { "Value", "netrix.getconversiontable.value",
603
16
    FT_STRING, BASE_NONE,
604
16
    NULL, 0x0,
605
16
    NULL, HFILL }
606
16
  },
607
16
  { &hf_netrix_search_conversiontables_key_type,
608
16
    { "Key", "netrix.searchconversiontables.key",
609
16
    FT_STRING, BASE_NONE,
610
16
    NULL, 0x0,
611
16
    NULL, HFILL }
612
16
  },
613
16
  { &hf_netrix_search_conversiontables_table_type,
614
16
    { "Table", "netrix.searchconversiontables.table",
615
16
    FT_STRING, BASE_NONE,
616
16
    NULL, 0x0,
617
16
    NULL, HFILL }
618
16
  }
619
16
  };
620
621
16
  static ei_register_info ei[] = {
622
16
    { &ei_netrix_unexpected_header, { "netrix.unexpected.header", PI_MALFORMED, PI_WARN, "Unexpected header", EXPFILL }},
623
16
    { &ei_netrix_unexpected_record, { "netrix.unexpected.record", PI_MALFORMED, PI_WARN, "Unexpected record", EXPFILL }}
624
16
  };
625
626
16
  expert_module_t* expert_netrix;
627
628
  /* Setup protocol subtree array */
629
16
  static int *ett[] = {
630
16
    &ett_netrix,
631
16
    &ett_netrix_systeminfo,
632
16
    &ett_netrix_groupcall,
633
16
    &ett_netrix_profilecall,
634
16
    &ett_netrix_get_conversiontable,
635
16
    &ett_netrix_get_conversiontable_result,
636
16
    &ett_netrix_search_conversiontables,
637
16
    &ett_netrix_search_conversiontables_result,
638
16
    &ett_netrix_boschcall,
639
16
    &ett_netrix_unknown
640
16
  };
641
642
16
  proto_netrix = proto_register_protocol ("Netrix Communication Protocol", "Netrix", "netrix");
643
644
16
  proto_register_field_array(proto_netrix, hf, array_length(hf));
645
16
  proto_register_subtree_array(ett, array_length(ett));
646
647
16
  expert_netrix = expert_register_protocol(proto_netrix);
648
16
  expert_register_field_array(expert_netrix, ei, array_length(ei));
649
650
16
  netrix_handle = register_dissector("netrix", dissect_netrix, proto_netrix);
651
16
}
652
653
/*
654
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
655
 *
656
 * Local variables:
657
 * c-basic-offset: 8
658
 * tab-width: 8
659
 * indent-tabs-mode: t
660
 * End:
661
 *
662
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
663
 * :indentSize=8:tabSize=8:noTabs=false:
664
 */