Coverage Report

Created: 2026-09-28 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-yami.c
Line
Count
Source
1
/* packet-yami.c
2
 * Routines for YAMI dissection
3
 * Copyright 2010, Pawel Korbut
4
 * Copyright 2012, Jakub Zawadzki <darkjames-ws@darkjames.pl>
5
 *
6
 * Protocol documentation available at http://www.inspirel.com/yami4/book/B-2.html
7
 *
8
 * Wireshark - Network traffic analyzer
9
 * By Gerald Combs <gerald@wireshark.org>
10
 * Copyright 1998 Gerald Combs
11
 *
12
 * SPDX-License-Identifier: GPL-2.0-or-later
13
 */
14
#include "config.h"
15
16
#include <epan/packet.h>
17
#include <epan/prefs.h>
18
#include <epan/to_str.h>
19
#include <wsutil/ws_roundup.h>
20
#include "packet-tcp.h"
21
22
void proto_reg_handoff_yami(void);
23
void proto_register_yami(void);
24
25
static bool yami_desegment = true;
26
27
static dissector_handle_t yami_handle;
28
29
0
#define YAMI_TYPE_BOOLEAN 1
30
0
#define YAMI_TYPE_INTEGER 2
31
0
#define YAMI_TYPE_LONGLONG 3
32
0
#define YAMI_TYPE_DOUBLE 4
33
0
#define YAMI_TYPE_STRING 5
34
0
#define YAMI_TYPE_BINARY 6
35
0
#define YAMI_TYPE_BOOLEAN_ARRAY 7
36
0
#define YAMI_TYPE_INTEGER_ARRAY 8
37
0
#define YAMI_TYPE_LONGLONG_ARRAY 9
38
0
#define YAMI_TYPE_DOUBLE_ARRAY 10
39
0
#define YAMI_TYPE_STRING_ARRAY 11
40
0
#define YAMI_TYPE_BINARY_ARRAY 12
41
0
#define YAMI_TYPE_NESTED 13
42
43
static const value_string yami_param_type_vals[] = {
44
  { YAMI_TYPE_BOOLEAN,        "boolean" },
45
  { YAMI_TYPE_INTEGER,        "integer" },
46
  { YAMI_TYPE_LONGLONG,       "long long" },
47
  { YAMI_TYPE_DOUBLE,         "double" },
48
  { YAMI_TYPE_STRING,         "string" },
49
  { YAMI_TYPE_BINARY,         "binary" },
50
  { YAMI_TYPE_BOOLEAN_ARRAY,  "boolean array" },
51
  { YAMI_TYPE_INTEGER_ARRAY,  "integer array" },
52
  { YAMI_TYPE_LONGLONG_ARRAY, "long long array" },
53
  { YAMI_TYPE_DOUBLE_ARRAY,   "double array" },
54
  { YAMI_TYPE_STRING_ARRAY,   "string array" },
55
  { YAMI_TYPE_BINARY_ARRAY,   "binary array" },
56
  { YAMI_TYPE_NESTED,         "nested parameters" },
57
  { 0, NULL }
58
};
59
60
static int proto_yami;
61
62
static int hf_yami_frame_number;
63
static int hf_yami_frame_payload_size;
64
static int hf_yami_items_count;
65
static int hf_yami_message_data;
66
static int hf_yami_message_hdr;
67
static int hf_yami_message_header_size;
68
static int hf_yami_message_id;
69
static int hf_yami_param;
70
static int hf_yami_param_name;
71
static int hf_yami_param_type;
72
static int hf_yami_param_value_bin;
73
static int hf_yami_param_value_bool;
74
static int hf_yami_param_value_double;
75
static int hf_yami_param_value_int;
76
static int hf_yami_param_value_long;
77
static int hf_yami_param_value_str;
78
static int hf_yami_params_count;
79
80
static int ett_yami;
81
static int ett_yami_msg_hdr;
82
static int ett_yami_msg_data;
83
static int ett_yami_param;
84
85
static int
86
// NOLINTNEXTLINE(misc-no-recursion)
87
dissect_yami_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_item *par_ti)
88
0
{
89
0
  const int orig_offset = offset;
90
91
0
  proto_tree *yami_param;
92
0
  proto_item *ti;
93
94
0
  char *name;
95
0
  int name_offset;
96
0
  uint32_t name_len;
97
98
0
  uint32_t type;
99
100
0
  ti = proto_tree_add_item(tree, hf_yami_param, tvb, offset, 0, ENC_NA);
101
0
  yami_param = proto_item_add_subtree(ti, ett_yami_param);
102
103
0
  name_offset = offset;
104
  /* coverity[sanitize] */
105
0
  name_len = tvb_get_letohl(tvb, offset);
106
0
  offset += 4;
107
108
0
  name = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, name_len, ENC_ASCII | ENC_NA);
109
0
  proto_item_append_text(ti, ": %s", name);
110
0
  proto_item_append_text(par_ti, "%s, ", name);
111
0
  offset += WS_ROUNDUP_4(name_len);
112
0
  proto_tree_add_string(yami_param, hf_yami_param_name, tvb, name_offset, offset - name_offset, name);
113
114
0
  proto_tree_add_item_ret_uint(yami_param, hf_yami_param_type, tvb, offset, 4, ENC_LITTLE_ENDIAN, &type);
115
0
  offset += 4;
116
117
0
  switch (type) {
118
0
    case YAMI_TYPE_BOOLEAN:
119
0
    {
120
0
      uint32_t val = tvb_get_letohl(tvb, offset);
121
0
      proto_item_append_text(ti, ", Type: boolean, Value: %s", val ? "True" : "False");
122
0
      proto_tree_add_item(yami_param, hf_yami_param_value_bool, tvb, offset, 4, ENC_LITTLE_ENDIAN);
123
0
      offset += 4;
124
0
      break;
125
0
    }
126
127
0
    case YAMI_TYPE_INTEGER:
128
0
    {
129
0
      int32_t val = tvb_get_letohl(tvb, offset);
130
0
      proto_item_append_text(ti, ", Type: integer, Value: %d", val);
131
0
      proto_tree_add_item(yami_param, hf_yami_param_value_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
132
0
      offset += 4;
133
0
      break;
134
0
    }
135
136
0
    case YAMI_TYPE_LONGLONG:
137
0
    {
138
0
      int64_t val = tvb_get_letoh64(tvb, offset);
139
0
      proto_item_append_text(ti, ", Type: long, Value: %" PRId64, val);
140
0
      proto_tree_add_item(yami_param, hf_yami_param_value_long, tvb, offset, 8, ENC_LITTLE_ENDIAN);
141
0
      offset += 8;
142
0
      break;
143
0
    }
144
145
0
    case YAMI_TYPE_DOUBLE:
146
0
    {
147
0
      double val = tvb_get_letohieee_double(tvb, offset);
148
0
      proto_item_append_text(ti, ", Type: double, Value: %g", val);
149
0
      proto_tree_add_item(yami_param, hf_yami_param_value_double, tvb, offset, 8, ENC_LITTLE_ENDIAN);
150
0
      offset += 8;
151
0
      break;
152
0
    }
153
154
0
    case YAMI_TYPE_STRING:
155
0
    {
156
0
      const int val_offset = offset;
157
0
      uint32_t val_len;
158
0
      char *val;
159
160
      /* coverity[sanitize] */
161
0
      val_len = tvb_get_letohl(tvb, offset);
162
0
      offset += 4;
163
164
0
      val = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, val_len, ENC_ASCII | ENC_NA);
165
166
0
      proto_item_append_text(ti, ", Type: string, Value: \"%s\"", val);
167
0
      offset += WS_ROUNDUP_4(val_len);
168
0
      proto_tree_add_string(yami_param, hf_yami_param_value_str, tvb, val_offset, offset - val_offset, val);
169
0
      break;
170
0
    }
171
172
0
    case YAMI_TYPE_BINARY:
173
0
    {
174
0
      const int val_offset = offset;
175
0
      uint32_t val_len;
176
0
      const uint8_t *val;
177
0
      char *repr;
178
179
0
      val_len = tvb_get_letohl(tvb, offset);
180
0
      offset += 4;
181
182
0
      val = tvb_get_ptr(tvb, offset, val_len);
183
0
      repr = bytes_to_str(pinfo->pool, val, val_len);
184
185
0
      proto_item_append_text(ti, ", Type: binary, Value: %s", repr);
186
0
      offset += WS_ROUNDUP_4(val_len);
187
0
      proto_tree_add_bytes_format_value(yami_param, hf_yami_param_value_bin, tvb, val_offset, offset - val_offset, val, "%s", repr);
188
0
      break;
189
0
    }
190
191
0
    case YAMI_TYPE_BOOLEAN_ARRAY:
192
0
    {
193
0
      uint32_t count;
194
0
      unsigned i;
195
0
      int j;
196
197
0
      proto_tree_add_item_ret_uint(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &count);
198
0
      offset += 4;
199
200
0
      proto_item_append_text(ti, ", Type: boolean[], %u items: {", count);
201
202
0
      for (i = 0; i < count/32; i++) {
203
0
        uint32_t val = tvb_get_letohl(tvb, offset);
204
205
0
        for (j = 0; j < 32; j++) {
206
0
          int r = !!(val & (1U << j));
207
208
0
          proto_item_append_text(ti, "%s, ", r ? "T" : "F");
209
0
          proto_tree_add_boolean(yami_param, hf_yami_param_value_bool, tvb, offset+(j/8), 1, r);
210
0
        }
211
0
        offset += 4;
212
0
      }
213
214
0
      if (count % 32) {
215
0
        uint32_t val = tvb_get_letohl(tvb, offset);
216
0
        int tmp = count % 32;
217
218
0
        for (j = 0; j < tmp; j++) {
219
0
          int r = !!(val & (1 << j));
220
221
0
          proto_item_append_text(ti, "%s, ", r ? "T" : "F");
222
0
          proto_tree_add_boolean(yami_param, hf_yami_param_value_bool, tvb, offset+(j/8), 1, r);
223
0
        }
224
0
        offset += 4;
225
0
      }
226
227
0
      proto_item_append_text(ti, "}");
228
0
      break;
229
0
    }
230
231
0
    case YAMI_TYPE_INTEGER_ARRAY:
232
0
    {
233
0
      uint32_t count;
234
0
      unsigned i;
235
236
0
      proto_tree_add_item_ret_uint(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &count);
237
0
      offset += 4;
238
239
0
      proto_item_append_text(ti, ", Type: integer[], %u items: {", count);
240
0
      for (i = 0; i < count; i++) {
241
0
        int32_t val = tvb_get_letohl(tvb, offset);
242
243
0
        proto_item_append_text(ti, "%d, ", val);
244
0
        proto_tree_add_item(yami_param, hf_yami_param_value_int, tvb, offset, 4, ENC_LITTLE_ENDIAN);
245
0
        offset += 4;
246
0
      }
247
0
      proto_item_append_text(ti, "}");
248
0
      break;
249
0
    }
250
251
0
    case YAMI_TYPE_LONGLONG_ARRAY:
252
0
    {
253
0
      uint32_t count;
254
0
      unsigned i;
255
256
0
      proto_tree_add_item_ret_uint(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &count);
257
0
      offset += 4;
258
259
0
      proto_item_append_text(ti, ", Type: long long[], %u items: {", count);
260
261
0
      for (i = 0; i < count; i++) {
262
0
        int64_t val = tvb_get_letoh64(tvb, offset);
263
264
0
        proto_item_append_text(ti, "%" PRId64 ", ", val);
265
0
        proto_tree_add_item(yami_param, hf_yami_param_value_long, tvb, offset, 8, ENC_LITTLE_ENDIAN);
266
0
        offset += 8;
267
0
      }
268
0
      proto_item_append_text(ti, "}");
269
0
      break;
270
0
    }
271
272
0
    case YAMI_TYPE_DOUBLE_ARRAY:
273
0
    {
274
0
      uint32_t count;
275
0
      unsigned i;
276
277
0
      proto_tree_add_item_ret_uint(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &count);
278
0
      offset += 4;
279
280
0
      proto_item_append_text(ti, ", Type: double[], %u items: {", count);
281
282
0
      for (i = 0; i < count; i++) {
283
0
        double val = tvb_get_letohieee_double(tvb, offset);
284
285
0
        proto_item_append_text(ti, "%g, ", val);
286
0
        proto_tree_add_item(yami_param, hf_yami_param_value_double, tvb, offset, 8, ENC_LITTLE_ENDIAN);
287
0
        offset += 8;
288
0
      }
289
0
      proto_item_append_text(ti, "}");
290
0
      break;
291
0
    }
292
293
0
    case YAMI_TYPE_STRING_ARRAY:
294
0
    {
295
0
      uint32_t count;
296
0
      unsigned i;
297
298
0
      proto_tree_add_item_ret_uint(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &count);
299
0
      offset += 4;
300
301
0
      proto_item_append_text(ti, ", Type: string[], %u items: {", count);
302
303
0
      for (i = 0; i < count; i++) {
304
0
        const int val_offset = offset;
305
0
        uint32_t val_len;
306
0
        char *val;
307
308
        /* coverity[sanitize] */
309
0
        val_len = tvb_get_letohl(tvb, offset);
310
0
        offset += 4;
311
312
0
        val = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, val_len, ENC_ASCII | ENC_NA);
313
314
0
        proto_item_append_text(ti, "\"%s\", ", val);
315
0
        proto_tree_add_string(yami_param, hf_yami_param_value_str, tvb, val_offset, offset - val_offset, val);
316
0
        offset += WS_ROUNDUP_4(val_len);
317
0
      }
318
0
      proto_item_append_text(ti, "}");
319
0
      break;
320
0
    }
321
322
0
    case YAMI_TYPE_BINARY_ARRAY:
323
0
    {
324
0
      uint32_t count;
325
0
      unsigned i;
326
327
0
      proto_tree_add_item_ret_uint(yami_param, hf_yami_items_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &count);
328
0
      offset += 4;
329
330
0
      proto_item_append_text(ti, ", Type: binary[], %u items: {", count);
331
332
0
      for (i = 0; i < count; i++) {
333
0
        const int val_offset = offset;
334
0
        uint32_t val_len;
335
0
        const uint8_t *val;
336
0
        char *repr;
337
338
0
        val_len = tvb_get_letohl(tvb, offset);
339
0
        offset += 4;
340
341
0
        val = tvb_get_ptr(tvb, offset, val_len);
342
0
        repr = bytes_to_str(pinfo->pool, val, val_len);
343
344
0
        proto_item_append_text(ti, "%s, ", repr);
345
0
        offset += WS_ROUNDUP_4(val_len);
346
0
        proto_tree_add_bytes_format_value(yami_param, hf_yami_param_value_bin, tvb, val_offset, offset - val_offset, val, "%s", repr);
347
0
      }
348
0
      proto_item_append_text(ti, "}");
349
0
      break;
350
0
    }
351
352
0
    case YAMI_TYPE_NESTED:
353
0
    {
354
0
      uint32_t count;
355
0
      unsigned i;
356
357
0
      proto_tree_add_item_ret_uint(yami_param, hf_yami_params_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &count);
358
0
      offset += 4;
359
360
0
      proto_item_append_text(ti, ", Type: nested, %u parameters: ", count);
361
362
0
      for (i = 0; i < count; i++) {
363
0
        increment_dissection_depth(pinfo);
364
0
        offset = dissect_yami_parameter(tvb, pinfo, yami_param, offset, ti);
365
0
        decrement_dissection_depth(pinfo);
366
        /* smth went wrong */
367
0
        if (offset == -1)
368
0
          return -1;
369
0
      }
370
0
      break;
371
0
    }
372
373
0
    default:
374
0
      proto_item_append_text(ti, ", Type: unknown (%d)!", type);
375
0
      return -1;
376
0
  }
377
378
0
  proto_item_set_len(ti, offset - orig_offset);
379
0
  return offset;
380
0
}
381
382
static int
383
dissect_yami_data(tvbuff_t *tvb, packet_info *pinfo, bool data, proto_tree *tree, int offset)
384
0
{
385
0
  const int orig_offset = offset;
386
387
0
  proto_tree *yami_data_tree;
388
0
  proto_item *ti;
389
390
0
  uint32_t count;
391
0
  unsigned i;
392
393
0
  ti = proto_tree_add_item(tree, (data) ? hf_yami_message_data : hf_yami_message_hdr, tvb, offset, 0, ENC_NA);
394
0
  yami_data_tree = proto_item_add_subtree(ti, (data) ? ett_yami_msg_data : ett_yami_msg_hdr);
395
396
0
  proto_tree_add_item_ret_uint(yami_data_tree, hf_yami_params_count, tvb, offset, 4, ENC_LITTLE_ENDIAN, &count);
397
0
  offset += 4;
398
399
0
  proto_item_append_text(ti, ", %u parameters: ", count);
400
401
0
  for (i = 0; i < count; i++) {
402
0
    offset = dissect_yami_parameter(tvb, pinfo, yami_data_tree, offset, ti);
403
    /* smth went wrong */
404
0
    if (offset == -1)
405
0
      return -1;
406
0
  }
407
408
0
  proto_item_set_len(ti, offset - orig_offset);
409
410
0
  return offset;
411
0
}
412
413
static int
414
dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
415
0
{
416
0
  proto_tree *yami_tree;
417
0
  proto_item *ti;
418
419
0
  int frame_number;
420
0
  int message_header_size;
421
0
  int frame_payload_size;
422
0
  int frame_size;
423
0
  int offset;
424
425
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "YAMI");
426
0
  col_clear(pinfo->cinfo, COL_INFO);
427
428
0
  ti = proto_tree_add_item(tree, proto_yami, tvb, 0, -1, ENC_NA);
429
0
  yami_tree = proto_item_add_subtree(ti, ett_yami);
430
431
0
  offset = 0;
432
433
0
  proto_tree_add_item(yami_tree, hf_yami_message_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
434
0
  offset += 4;
435
436
0
  ti = proto_tree_add_item_ret_int(yami_tree, hf_yami_frame_number, tvb, offset, 4, ENC_LITTLE_ENDIAN, &frame_number);
437
0
  if(frame_number < 0)
438
0
    proto_item_append_text(ti, "%s", " (last frame)");
439
0
  offset += 4;
440
441
0
  proto_tree_add_item_ret_int(yami_tree, hf_yami_message_header_size, tvb, offset, 4, ENC_LITTLE_ENDIAN, &message_header_size);
442
0
  if (message_header_size < 4) {
443
    /* XXX, expert info */
444
0
  }
445
0
  offset += 4;
446
447
0
  ti = proto_tree_add_item_ret_int(yami_tree, hf_yami_frame_payload_size, tvb, offset, 4, ENC_LITTLE_ENDIAN, &frame_payload_size);
448
0
  frame_size = frame_payload_size + 16;
449
0
  proto_item_append_text(ti, ", (YAMI Frame Size: %d)", frame_size);
450
0
  offset += 4;
451
452
0
  if (frame_number == 1 || frame_number == -1) {
453
0
    if (message_header_size <= frame_payload_size) {
454
0
      const int orig_offset = offset;
455
456
0
      offset = dissect_yami_data(tvb, pinfo, false, yami_tree, offset);
457
0
      if (offset != orig_offset + message_header_size) {
458
        /* XXX, expert info */
459
0
        offset = orig_offset + message_header_size;
460
0
      }
461
462
0
      dissect_yami_data(tvb, pinfo, true, yami_tree, offset);
463
0
    }
464
0
  }
465
466
0
  return tvb_captured_length(tvb);
467
0
}
468
469
0
#define FRAME_HEADER_LEN 16
470
471
static unsigned
472
get_yami_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
473
                     int offset, void *data _U_)
474
0
{
475
0
  uint32_t len = tvb_get_letohl(tvb, offset + 12);
476
477
0
  return len + FRAME_HEADER_LEN;
478
0
}
479
480
static int
481
dissect_yami(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
482
0
{
483
0
  tcp_dissect_pdus(tvb, pinfo, tree, yami_desegment, FRAME_HEADER_LEN, get_yami_message_len, dissect_yami_pdu, data);
484
0
  return tvb_captured_length(tvb);
485
0
}
486
487
void
488
proto_register_yami(void)
489
16
{
490
16
  static hf_register_info hf[] = {
491
16
    { &hf_yami_message_id,
492
16
      { "Message ID", "yami.message_id",
493
16
        FT_INT32, BASE_DEC, NULL, 0x00,
494
16
        NULL, HFILL }
495
16
    },
496
16
    { &hf_yami_frame_number,
497
16
      { "Frame Number", "yami.frame_number",
498
16
        FT_INT32, BASE_DEC, NULL, 0x00,
499
16
        NULL, HFILL }
500
16
    },
501
16
    { &hf_yami_message_header_size,
502
16
      { "Message Header Size", "yami.message_header_size",
503
16
        FT_INT32, BASE_DEC, NULL, 0x00,
504
16
        NULL, HFILL }
505
16
    },
506
16
    { &hf_yami_frame_payload_size,
507
16
      { "Frame Payload Size", "yami.frame_payload_size",
508
16
        FT_INT32, BASE_DEC, NULL, 0x00,
509
16
        NULL, HFILL }
510
16
    },
511
16
    { &hf_yami_message_hdr,
512
16
      { "Header message", "yami.msg_hdr",
513
16
        FT_NONE, BASE_NONE, NULL, 0x00,
514
16
        NULL, HFILL }
515
16
    },
516
16
    { &hf_yami_message_data,
517
16
      { "Data message", "yami.msg_data",
518
16
        FT_NONE, BASE_NONE, NULL, 0x00,
519
16
        NULL, HFILL }
520
16
    },
521
16
    { &hf_yami_param,
522
16
      { "Parameter", "yami.param",
523
16
        FT_NONE, BASE_NONE, NULL, 0x00,
524
16
        NULL, HFILL }
525
16
    },
526
16
    { &hf_yami_param_name,
527
16
      { "Name", "yami.param.name",
528
16
        FT_STRING, BASE_NONE, NULL, 0x00,
529
16
        "Parameter name", HFILL }
530
16
    },
531
16
    { &hf_yami_param_type,
532
16
      { "Type", "yami.param.type",
533
16
        FT_UINT32, BASE_DEC, VALS(yami_param_type_vals), 0x00,
534
16
        "Parameter type", HFILL }
535
16
    },
536
16
    { &hf_yami_param_value_bool,
537
16
      { "Value", "yami.param.value_bool",
538
16
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
539
16
        "Parameter value (bool)", HFILL }
540
16
    },
541
16
    { &hf_yami_param_value_int,
542
16
      { "Value", "yami.param.value_int",
543
16
        FT_INT32, BASE_DEC, NULL, 0x00,
544
16
        "Parameter value (int)", HFILL }
545
16
    },
546
16
    { &hf_yami_param_value_long,
547
16
      { "Value", "yami.param.value_long",
548
16
        FT_INT64, BASE_DEC, NULL, 0x00,
549
16
        "Parameter value (long)", HFILL }
550
16
    },
551
16
    { &hf_yami_param_value_double,
552
16
      { "Value", "yami.param.value_double",
553
16
        FT_DOUBLE, BASE_NONE, NULL, 0x00,
554
16
        "Parameter value (double)", HFILL }
555
16
    },
556
16
    { &hf_yami_param_value_str,
557
16
      { "Value", "yami.param.value_str",
558
16
        FT_STRING, BASE_NONE, NULL, 0x00,
559
16
        "Parameter value (string)", HFILL }
560
16
    },
561
16
    { &hf_yami_param_value_bin,
562
16
      { "Value", "yami.param.value_bin",
563
16
        FT_BYTES, BASE_NONE, NULL, 0x00,
564
16
        "Parameter value (binary)", HFILL }
565
16
    },
566
16
    { &hf_yami_params_count,
567
16
      { "Parameters count", "yami.params_count",
568
16
        FT_UINT32, BASE_DEC, NULL, 0x00,
569
16
        NULL, HFILL }
570
16
    },
571
16
    { &hf_yami_items_count,
572
16
      { "Items count", "yami.items_count",
573
16
        FT_UINT32, BASE_DEC, NULL, 0x00,
574
16
        NULL, HFILL }
575
16
    },
576
16
  };
577
578
16
  static int *ett[] = {
579
16
    &ett_yami,
580
16
    &ett_yami_msg_hdr,
581
16
    &ett_yami_msg_data,
582
16
    &ett_yami_param
583
16
  };
584
585
16
  module_t *yami_module;
586
587
16
  proto_yami = proto_register_protocol("YAMI Protocol", "YAMI", "yami");
588
589
16
  proto_register_field_array(proto_yami, hf, array_length(hf));
590
16
  proto_register_subtree_array(ett, array_length(ett));
591
592
16
  yami_module = prefs_register_protocol(proto_yami, NULL);
593
16
  prefs_register_bool_preference(yami_module, "desegment",
594
16
      "Reassemble YAMI messages spanning multiple TCP segments",
595
16
      "Whether the YAMI dissector should reassemble messages spanning multiple TCP segments."
596
16
      "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
597
16
      &yami_desegment);
598
599
16
  yami_handle = register_dissector("yami", dissect_yami, proto_yami);
600
16
}
601
602
void
603
proto_reg_handoff_yami(void)
604
16
{
605
16
  dissector_add_for_decode_as_with_preference("tcp.port", yami_handle);
606
16
  dissector_add_for_decode_as_with_preference("udp.port", yami_handle);
607
16
}
608
609
/*
610
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
611
 *
612
 * Local variables:
613
 * c-basic-offset: 8
614
 * tab-width: 8
615
 * indent-tabs-mode: t
616
 * End:
617
 *
618
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
619
 * :indentSize=8:tabSize=8:noTabs=false:
620
 */