Coverage Report

Created: 2026-07-12 07:10

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-locamation-im.c
Line
Count
Source
1
/* packet-locamation-im.c
2
 * Routines for Locamation Interface Modules packet disassembly.
3
 *
4
 * Copyright (c) 2022 Locamation BV.
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
/*
14
 * Locamation Interface Modules
15
 *
16
 * The modules send SNAP packets.
17
 *
18
 * Several types of IMs are supported:
19
 * - Current Interface Module (CIM), version 1
20
 * - Current Interface Module (CIM), version 2, revision 0
21
 * - Voltage Interface Module (VIM), version 1
22
 * - Voltage Interface Module (VIM), version 2, revision 0
23
 */
24
25
/* clang-format off */
26
#include "config.h"
27
#include <epan/packet.h>
28
/* clang-format on */
29
30
#include <epan/expert.h>
31
#include <epan/tfs.h>
32
#include <wsutil/array.h>
33
34
#include "packet-llc.h"
35
36
#ifndef ETH_FRAME_LEN
37
#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
38
#endif
39
40
/*
41
 * ########################################################################
42
 * #
43
 * # Forward Declarations
44
 * #
45
 * ########################################################################
46
 */
47
48
void proto_register_locamation_im(void);
49
void proto_reg_handoff_locamation_im(void);
50
51
/*
52
 * ########################################################################
53
 * #
54
 * # Defines
55
 * #
56
 * ########################################################################
57
 */
58
59
60
#define COMPANY_NAME "Locamation"
60
15
#define COMPANY_OUI 0x0040d6
61
62
#define COMPANY_IM_TEXT "Interface Module"
63
64
15
#define COMPANY_PID_CALIBRATION 0x0000
65
15
#define COMPANY_PID_IDENT 0xffff
66
15
#define COMPANY_PID_SAMPLES_IM1 0x0002
67
15
#define COMPANY_PID_SAMPLES_IM2R0 0x000e
68
69
30
#define PROTOCOL_NAME_IM_CALIBRATION "CALIBRATION"
70
30
#define PROTOCOL_NAME_IM_IDENT "IDENT"
71
30
#define PROTOCOL_NAME_IM_SAMPLES_IM1 "SAMPLES - IM1"
72
30
#define PROTOCOL_NAME_IM_SAMPLES_IM2R0 "SAMPLES - IM2R0"
73
74
15
#define PROTOCOL_NAME_CALIBRATION (COMPANY_NAME " " COMPANY_IM_TEXT " " PROTOCOL_NAME_IM_CALIBRATION)
75
15
#define PROTOCOL_NAME_IDENT (COMPANY_NAME " " COMPANY_IM_TEXT " " PROTOCOL_NAME_IM_IDENT)
76
15
#define PROTOCOL_NAME_SAMPLES_IM1 (COMPANY_NAME " " COMPANY_IM_TEXT " " PROTOCOL_NAME_IM_SAMPLES_IM1)
77
15
#define PROTOCOL_NAME_SAMPLES_IM2R0 (COMPANY_NAME " " COMPANY_IM_TEXT " " PROTOCOL_NAME_IM_SAMPLES_IM2R0)
78
79
15
#define PROTOCOL_SHORTNAME_CALIBRATION PROTOCOL_NAME_IM_CALIBRATION
80
15
#define PROTOCOL_SHORTNAME_IDENT PROTOCOL_NAME_IM_IDENT
81
15
#define PROTOCOL_SHORTNAME_SAMPLES_IM1 PROTOCOL_NAME_IM_SAMPLES_IM1
82
15
#define PROTOCOL_SHORTNAME_SAMPLES_IM2R0 PROTOCOL_NAME_IM_SAMPLES_IM2R0
83
84
0
#define MASK_SAMPLES_CONTROL_TYPE 0x80
85
#define MASK_SAMPLES_CONTROL_SIMULATED 0x40
86
0
#define MASK_SAMPLES_CONTROL_VERSION 0x30
87
#define MASK_SAMPLES_CONTROL_SEQUENCE_NUMBER 0x0f
88
89
0
#define MASK_RANGES_SAMPLE_8 0xc000
90
0
#define MASK_RANGES_SAMPLE_7 0x3000
91
0
#define MASK_RANGES_SAMPLE_6 0x0c00
92
0
#define MASK_RANGES_SAMPLE_5 0x0300
93
0
#define MASK_RANGES_SAMPLE_4 0x00c0
94
0
#define MASK_RANGES_SAMPLE_3 0x0030
95
0
#define MASK_RANGES_SAMPLE_2 0x000c
96
0
#define MASK_RANGES_SAMPLE_1 0x0003
97
98
#define MASK_TIMESTAMP_ADDITIONAL_STATUS_HOLDOVER_STATE 0x01
99
#define MASK_TIMESTAMP_ADDITIONAL_STATUS_MASTER_CLOCK_SWITCH 0x02
100
101
/*
102
 * ########################################################################
103
 * #
104
 * # PID Table
105
 * #
106
 * ########################################################################
107
 */
108
109
static const value_string company_pid_vals[] = {
110
    {COMPANY_PID_CALIBRATION, PROTOCOL_NAME_IM_CALIBRATION},
111
    {COMPANY_PID_IDENT, PROTOCOL_NAME_IM_IDENT},
112
    {COMPANY_PID_SAMPLES_IM1, PROTOCOL_NAME_IM_SAMPLES_IM1},
113
    {COMPANY_PID_SAMPLES_IM2R0, PROTOCOL_NAME_IM_SAMPLES_IM2R0},
114
    {0, NULL}};
115
116
/*
117
 * ########################################################################
118
 * #
119
 * # Types
120
 * #
121
 * ########################################################################
122
 */
123
124
/*
125
 * struct _sample_set_t {
126
 *  uint16_t ranges;
127
 *  int32_t sample_1;
128
 *  int32_t sample_2;
129
 *  int32_t sample_3;
130
 *  int32_t sample_4;
131
 *  int32_t sample_5;
132
 *  int32_t sample_6;
133
 *  int32_t sample_7;
134
 *  int32_t sample_8;
135
 * };
136
 */
137
0
#define SAMPLE_SET_SIZE 34
138
139
/*
140
 * struct _timestamp_t {
141
 *  uint8_t sync_status;
142
 *  uint8_t additional_status;
143
 *  uint32_t sec;
144
 *  uint32_t nsec;
145
 * };
146
 */
147
0
#define TIMESTAMP_SIZE 10
148
149
/*
150
 * struct _timestamps_t {
151
 *  uint8_t version;
152
 *  uint24_t reserved;
153
 *  struct _timestamp_t timestamps[8];
154
 * };
155
 */
156
0
#define TIMESTAMPS_SIZE 84
157
158
/*
159
 * ########################################################################
160
 * #
161
 * # Helpers
162
 * #
163
 * ########################################################################
164
 */
165
166
0
static void add_split_lines(packet_info *pinfo, tvbuff_t *tvb, unsigned offset, proto_tree *tree, int hf) {
167
0
        unsigned next_offset;
168
169
0
  while (tvb_offset_exists(tvb, offset)) {
170
0
            unsigned len;
171
0
    if (!tvb_find_line_end_remaining(tvb, offset, &len, &next_offset)) {
172
0
      break;
173
0
    }
174
175
0
    char *line = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, len, ENC_UTF_8);
176
0
    proto_tree_add_string(tree, hf, tvb, offset, (next_offset - offset), line);
177
0
    offset = next_offset;
178
0
  }
179
0
}
180
181
/*
182
 * ########################################################################
183
 * #
184
 * # CALIBRATION
185
 * #
186
 * ########################################################################
187
 *
188
 * Calibration Packets
189
 *
190
 * Calibration Packets are sent by IM1 sensors.
191
 *
192
 * The calibration packets are sent in a burst, with a header packet
193
 * followed by a number of chunk packets. Both packet types start with a
194
 * Sequence Number.
195
 *
196
 * The calibration file can be reconstructed by appending all chunk packets
197
 * in the Sequence Number order.
198
 *
199
 * Sequence Number: 2 bytes, unsigned
200
 *   == 0: Header Packet
201
 *   != 0: Chunk Packet
202
 *
203
 * Header Packet
204
 * =============
205
 * Sequence Number      : 2 bytes, unsigned (fixed value 0)
206
 * First Sequence Number: 2 bytes, unsigned (fixed value 1)
207
 * Last Sequence Number : 2 bytes, unsigned (N)
208
 * Name                 : string
209
 *
210
 * Chunk Packet
211
 * ============
212
 * Sequence Number  : 2 bytes, unsigned (1 <= Sequence Number <= N)
213
 * Calibration Chunk: string
214
 */
215
216
static int hf_calibration_sequence_number;
217
static int hf_calibration_first_sequence_number;
218
static int hf_calibration_last_sequence_number;
219
static int hf_calibration_name;
220
static int hf_calibration_name_line;
221
static int hf_calibration_chunk;
222
static int hf_calibration_chunk_line;
223
224
static hf_register_info protocol_registration_calibration[] = {
225
    {&hf_calibration_sequence_number, {"Sequence Number", "locamation-im.calibration.sequence_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
226
    {&hf_calibration_first_sequence_number, {"First Sequence Number", "locamation-im.calibration.first_sequence_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
227
    {&hf_calibration_last_sequence_number, {"Last Sequence Number", "locamation-im.calibration.last_sequence_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
228
    {&hf_calibration_name, {"Name", "locamation-im.calibration.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
229
    {&hf_calibration_name_line, {"Name Line", "locamation-im.calibration.name.line", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
230
    {&hf_calibration_chunk, {"Chunk", "locamation-im.calibration.chunk", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
231
    {&hf_calibration_chunk_line, {"Chunk Line", "locamation-im.calibration.chunk.line", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}};
232
233
static expert_field ei_calibration_header;
234
235
static ei_register_info ei_calibration[] = {
236
    {&ei_calibration_header, {"locamation-im.calibration.header", PI_SEQUENCE, PI_NOTE, "Header Packet", EXPFILL}}};
237
238
static int h_protocol_calibration = -1;
239
240
static int ett_protocol_calibration;
241
static int ett_calibration_lines;
242
243
0
static int dissect_calibration(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
244
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTOCOL_SHORTNAME_CALIBRATION);
245
0
  col_set_str(pinfo->cinfo, COL_INFO, PROTOCOL_NAME_CALIBRATION);
246
247
0
  proto_item *calibration_item = proto_tree_add_item(tree, h_protocol_calibration, tvb, 0, -1, ENC_NA);
248
0
  proto_tree *calibration_item_subtree = proto_item_add_subtree(calibration_item, ett_protocol_calibration);
249
250
0
  unsigned offset = 0;
251
252
  /* Sequence Number */
253
0
  int item_size = 2;
254
0
  uint16_t sequence_number = tvb_get_uint16(tvb, 0, ENC_BIG_ENDIAN);
255
0
  if (sequence_number == 0) {
256
0
    expert_add_info(pinfo, calibration_item, &ei_calibration_header);
257
0
  }
258
0
  proto_tree_add_item(calibration_item_subtree, hf_calibration_sequence_number, tvb, offset, item_size, ENC_BIG_ENDIAN);
259
0
  offset += item_size;
260
261
0
  if (sequence_number == 0) {
262
    /* Header Packet */
263
264
    /* First Sequence Number */
265
0
    item_size = 2;
266
0
    proto_tree_add_item(calibration_item_subtree, hf_calibration_first_sequence_number, tvb, offset, item_size, ENC_BIG_ENDIAN);
267
0
    offset += item_size;
268
269
    /* Last Sequence Number */
270
0
    item_size = 2;
271
0
    proto_tree_add_item(calibration_item_subtree, hf_calibration_last_sequence_number, tvb, offset, item_size, ENC_BIG_ENDIAN);
272
0
    offset += item_size;
273
274
    /* Name */
275
0
    int name_length = tvb_reported_length_remaining(tvb, offset);
276
0
    proto_item *name_item = proto_tree_add_item(calibration_item_subtree, hf_calibration_name, tvb, offset, name_length, ENC_UTF_8);
277
278
    /* Name - Lines */
279
0
    proto_tree *name_item_subtree = proto_item_add_subtree(name_item, ett_calibration_lines);
280
0
    add_split_lines(pinfo, tvb, offset, name_item_subtree, hf_calibration_name_line);
281
0
  } else {
282
    /* Chunk Packet */
283
284
    /* Chunk */
285
0
    int chunk_length = tvb_reported_length_remaining(tvb, offset);
286
0
    proto_item *chunk_item = proto_tree_add_item(calibration_item_subtree, hf_calibration_chunk, tvb, offset, chunk_length, ENC_UTF_8);
287
288
    /* Chunk - Lines */
289
0
    proto_tree *chunk_item_subtree = proto_item_add_subtree(chunk_item, ett_calibration_lines);
290
0
    add_split_lines(pinfo, tvb, offset, chunk_item_subtree, hf_calibration_chunk_line);
291
0
  }
292
293
0
  return tvb_captured_length(tvb);
294
0
}
295
296
/*
297
 * ########################################################################
298
 * #
299
 * # IDENT
300
 * #
301
 * ########################################################################
302
 *
303
 * Ident Packets
304
 *
305
 * Ident Packets are sent by IM1 and IM2R0 sensors.
306
 *
307
 * Ident Packet
308
 * ============
309
 * Content: string
310
 */
311
312
static int hf_ident_contents;
313
static int hf_ident_contents_line;
314
315
static hf_register_info protocol_registration_ident[] = {
316
    {&hf_ident_contents, {"Contents", "locamation-im.ident.contents", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
317
    {&hf_ident_contents_line, {"Contents Line", "locamation-im.ident.contents.line", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}};
318
319
static int h_protocol_ident = -1;
320
321
static int ett_protocol_ident;
322
static int ett_ident_lines;
323
324
0
static int dissect_ident(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
325
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTOCOL_SHORTNAME_IDENT);
326
0
  col_set_str(pinfo->cinfo, COL_INFO, PROTOCOL_NAME_IDENT);
327
328
0
  proto_item *ident_item = proto_tree_add_item(tree, h_protocol_ident, tvb, 0, -1, ENC_NA);
329
0
  proto_tree *ident_item_subtree = proto_item_add_subtree(ident_item, ett_protocol_ident);
330
331
  /* Contents */
332
0
  int contents_length = tvb_reported_length_remaining(tvb, 0);
333
0
  proto_item *contents_item = proto_tree_add_item(ident_item_subtree, hf_ident_contents, tvb, 0, contents_length, ENC_UTF_8);
334
335
  /* Contents - Lines */
336
0
  proto_tree *contents_item_subtree = proto_item_add_subtree(contents_item, ett_ident_lines);
337
0
  add_split_lines(pinfo, tvb, 0, contents_item_subtree, hf_ident_contents_line);
338
339
0
  return tvb_captured_length(tvb);
340
0
}
341
342
/*
343
 * ########################################################################
344
 * #
345
 * # SAMPLES - Common
346
 * #
347
 * ########################################################################
348
 */
349
350
static expert_field ei_samples_ranges_sample_1_invalid;
351
static expert_field ei_samples_ranges_sample_2_invalid;
352
static expert_field ei_samples_ranges_sample_3_invalid;
353
static expert_field ei_samples_ranges_sample_4_invalid;
354
static expert_field ei_samples_ranges_sample_5_invalid;
355
static expert_field ei_samples_ranges_sample_6_invalid;
356
static expert_field ei_samples_ranges_sample_7_invalid;
357
static expert_field ei_samples_ranges_sample_8_invalid;
358
359
0
static void check_ranges(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_item *item) {
360
0
  uint16_t ranges = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
361
362
0
  if ((ranges & MASK_RANGES_SAMPLE_8) == MASK_RANGES_SAMPLE_8) {
363
0
    expert_add_info(pinfo, item, &ei_samples_ranges_sample_8_invalid);
364
0
  }
365
0
  if ((ranges & MASK_RANGES_SAMPLE_7) == MASK_RANGES_SAMPLE_7) {
366
0
    expert_add_info(pinfo, item, &ei_samples_ranges_sample_7_invalid);
367
0
  }
368
0
  if ((ranges & MASK_RANGES_SAMPLE_6) == MASK_RANGES_SAMPLE_6) {
369
0
    expert_add_info(pinfo, item, &ei_samples_ranges_sample_6_invalid);
370
0
  }
371
0
  if ((ranges & MASK_RANGES_SAMPLE_5) == MASK_RANGES_SAMPLE_5) {
372
0
    expert_add_info(pinfo, item, &ei_samples_ranges_sample_5_invalid);
373
0
  }
374
0
  if ((ranges & MASK_RANGES_SAMPLE_4) == MASK_RANGES_SAMPLE_4) {
375
0
    expert_add_info(pinfo, item, &ei_samples_ranges_sample_4_invalid);
376
0
  }
377
0
  if ((ranges & MASK_RANGES_SAMPLE_3) == MASK_RANGES_SAMPLE_3) {
378
0
    expert_add_info(pinfo, item, &ei_samples_ranges_sample_3_invalid);
379
0
  }
380
0
  if ((ranges & MASK_RANGES_SAMPLE_2) == MASK_RANGES_SAMPLE_2) {
381
0
    expert_add_info(pinfo, item, &ei_samples_ranges_sample_2_invalid);
382
0
  }
383
0
  if ((ranges & MASK_RANGES_SAMPLE_1) == MASK_RANGES_SAMPLE_1) {
384
0
    expert_add_info(pinfo, item, &ei_samples_ranges_sample_1_invalid);
385
0
  }
386
0
}
387
388
static int ett_samples_sample_set_ranges;
389
390
static int hf_samples_sample_set_ranges;
391
392
static int hf_samples_sample_set_ranges_sample_1;
393
static int hf_samples_sample_set_ranges_sample_2;
394
static int hf_samples_sample_set_ranges_sample_3;
395
static int hf_samples_sample_set_ranges_sample_4;
396
static int hf_samples_sample_set_ranges_sample_5;
397
static int hf_samples_sample_set_ranges_sample_6;
398
static int hf_samples_sample_set_ranges_sample_7;
399
static int hf_samples_sample_set_ranges_sample_8;
400
401
static int *const rangesBits[] = {
402
    &hf_samples_sample_set_ranges_sample_8,
403
    &hf_samples_sample_set_ranges_sample_7,
404
    &hf_samples_sample_set_ranges_sample_6,
405
    &hf_samples_sample_set_ranges_sample_5,
406
    &hf_samples_sample_set_ranges_sample_4,
407
    &hf_samples_sample_set_ranges_sample_3,
408
    &hf_samples_sample_set_ranges_sample_2,
409
    &hf_samples_sample_set_ranges_sample_1,
410
    NULL};
411
412
static int hf_samples_sample_set_sample_1;
413
static int hf_samples_sample_set_sample_2;
414
static int hf_samples_sample_set_sample_3;
415
static int hf_samples_sample_set_sample_4;
416
static int hf_samples_sample_set_sample_5;
417
static int hf_samples_sample_set_sample_6;
418
static int hf_samples_sample_set_sample_7;
419
static int hf_samples_sample_set_sample_8;
420
421
0
static void add_sample_set(tvbuff_t *tvb, packet_info *pinfo, unsigned *offset, int hf, proto_tree *tree) {
422
0
  int item_size = SAMPLE_SET_SIZE;
423
0
  proto_item *sample_set_item = proto_tree_add_item(tree, hf, tvb, *offset, item_size, ENC_BIG_ENDIAN);
424
425
0
  proto_tree *sample_set_item_subtree = proto_item_add_subtree(sample_set_item, ett_samples_sample_set_ranges);
426
427
  /* Ranges */
428
0
  item_size = 2;
429
0
  proto_item *ranges_item = proto_tree_add_bitmask(sample_set_item_subtree, tvb, *offset, hf_samples_sample_set_ranges, ett_samples_sample_set_ranges, rangesBits, ENC_BIG_ENDIAN);
430
0
  check_ranges(tvb, pinfo, *offset, ranges_item);
431
0
  *offset += item_size;
432
433
  /* Samples */
434
0
  int const hfs[] = {
435
0
      hf_samples_sample_set_sample_1,
436
0
      hf_samples_sample_set_sample_2,
437
0
      hf_samples_sample_set_sample_3,
438
0
      hf_samples_sample_set_sample_4,
439
0
      hf_samples_sample_set_sample_5,
440
0
      hf_samples_sample_set_sample_6,
441
0
      hf_samples_sample_set_sample_7,
442
0
      hf_samples_sample_set_sample_8};
443
444
0
  item_size = 4;
445
0
  for (unsigned index_sample = 0; index_sample < array_length(hfs); index_sample++) {
446
0
    proto_tree_add_item(sample_set_item_subtree, hfs[index_sample], tvb, *offset, item_size, ENC_BIG_ENDIAN);
447
0
    *offset += item_size;
448
0
  }
449
0
}
450
451
0
static void add_sample_sets(tvbuff_t *tvb, packet_info *pinfo, unsigned *offset, int *hfs, unsigned hfs_size, proto_tree *tree) {
452
0
  for (unsigned index_sample_set = 0; index_sample_set < hfs_size; index_sample_set++) {
453
0
    add_sample_set(tvb, pinfo, offset, hfs[index_sample_set], tree);
454
0
  }
455
0
}
456
457
0
static void add_rms_values(tvbuff_t *tvb, unsigned *offset, int *hfs, unsigned hfs_size, proto_tree *tree) {
458
0
  int item_size = 4;
459
0
  for (unsigned index_rms_value = 0; index_rms_value < hfs_size; index_rms_value++) {
460
0
    proto_tree_add_item(tree, hfs[index_rms_value], tvb, *offset, item_size, ENC_BIG_ENDIAN);
461
0
    *offset += item_size;
462
0
  }
463
0
}
464
465
static int ett_samples_timestamps_sample;
466
static int ett_samples_timestamps_sample_reserved;
467
static int ett_samples_timestamps_sample_timestamp;
468
469
static int hf_samples_timestamps_sample_sync_status;
470
static int hf_samples_timestamps_sample_additional_status;
471
static int hf_samples_timestamps_sample_additional_status_holdover_state;
472
static int hf_samples_timestamps_sample_additional_status_master_clock_switch;
473
static int hf_samples_timestamps_sample_timestamp;
474
static int hf_samples_timestamps_sample_timestamp_seconds;
475
static int hf_samples_timestamps_sample_timestamp_nanoseconds;
476
477
static const value_string samples_timestamps_sample_sync_status[] = {
478
    {0, "None"},
479
    {1, "Local"},
480
    {2, "Global"},
481
    {0, NULL}};
482
483
static int *const timestamp_additional_status_bits[] = {
484
    &hf_samples_timestamps_sample_additional_status_holdover_state,
485
    &hf_samples_timestamps_sample_additional_status_master_clock_switch,
486
    NULL};
487
488
static expert_field ei_samples_timestamp_sync_status_invalid;
489
490
0
static void add_timestamp_sample(tvbuff_t *tvb, packet_info *pinfo, unsigned *previous_offset, unsigned *offset, int hf, proto_tree *tree) {
491
0
  int item_size = TIMESTAMP_SIZE;
492
  /* Get the timestamp components */
493
0
  uint8_t sync_status = tvb_get_uint8(tvb, *offset);
494
0
  uint32_t seconds = tvb_get_uint32(tvb, *offset + 2, ENC_BIG_ENDIAN);
495
0
  uint32_t nanoseconds = tvb_get_uint32(tvb, *offset + 6, ENC_BIG_ENDIAN);
496
497
  /* Convert the timestamp seconds to a split time type */
498
0
  time_t sample_time = (time_t)seconds;
499
0
  struct tm *sample_time_split = gmtime(&sample_time);
500
501
  /* Construct the readable sync status */
502
0
  const char *sync_status_buf = val_to_str(pinfo->pool, sync_status, samples_timestamps_sample_sync_status, "Unknown (%u)");
503
504
  /* Construct the readable timestamp */
505
0
  char timestamp_buf[ITEM_LABEL_LENGTH];
506
0
  size_t timestamp_length = 0;
507
0
  if (sample_time_split != NULL) {
508
0
    timestamp_length += strftime(&timestamp_buf[timestamp_length], ITEM_LABEL_LENGTH - timestamp_length, "%Y-%m-%d %H:%M:%S.", sample_time_split);
509
0
  } else {
510
0
    timestamp_length += snprintf(&timestamp_buf[timestamp_length], ITEM_LABEL_LENGTH - timestamp_length, "\?\?\?\?-\?\?-\?\? \?\?:\?\?:\?\?.");
511
0
  }
512
0
  snprintf(&timestamp_buf[timestamp_length], ITEM_LABEL_LENGTH - timestamp_length, "%09u TAI", nanoseconds);
513
514
  /* Construct the readable sample text */
515
0
  char title_buf[ITEM_LABEL_LENGTH];
516
0
  size_t title_length = 0;
517
0
  title_length += snprintf(&title_buf[title_length], ITEM_LABEL_LENGTH - title_length, "%s (Sync: %s", timestamp_buf, sync_status_buf);
518
0
  if (previous_offset != NULL) {
519
    /* Get the previous timestamp components and calculate the time difference */
520
0
    uint32_t seconds_previous = tvb_get_uint32(tvb, *previous_offset + 2, ENC_BIG_ENDIAN);
521
0
    uint32_t nanoseconds_previous = tvb_get_uint32(tvb, *previous_offset + 6, ENC_BIG_ENDIAN);
522
0
    uint64_t time_previous = ((uint64_t)seconds_previous * 1000000000) + nanoseconds_previous;
523
0
    uint64_t time_now = ((uint64_t)seconds * 1000000000) + nanoseconds;
524
0
    uint64_t time_diff = 0;
525
0
    char time_difference_sign[2] = {'\0', '\0'};
526
0
    if (time_now > time_previous) {
527
0
      time_diff = time_now - time_previous;
528
0
      time_difference_sign[0] = '\0';
529
0
    } else if (time_now < time_previous) {
530
0
      time_diff = time_previous - time_now;
531
0
      time_difference_sign[0] = '-';
532
0
    }
533
0
    double frequency = 0.0;
534
0
    if (time_diff != 0) {
535
0
      frequency = 1.0 / ((double)time_diff * 1.0E-09);
536
0
    }
537
0
    title_length += snprintf(&title_buf[title_length], ITEM_LABEL_LENGTH - title_length, ", Time Difference: %s%" PRIu64 " nsec", time_difference_sign, time_diff);
538
0
    if (frequency != 0.0) {
539
0
      title_length += snprintf(&title_buf[title_length], ITEM_LABEL_LENGTH - title_length, " = %f Hz", frequency);
540
0
    }
541
0
  }
542
0
  snprintf(&title_buf[title_length], ITEM_LABEL_LENGTH - title_length, ")");
543
544
0
  proto_item *sample_timestamp_item = proto_tree_add_string(tree, hf, tvb, *offset, item_size, title_buf);
545
546
0
  proto_tree *sample_timestamp_item_subtree = proto_item_add_subtree(sample_timestamp_item, ett_samples_timestamps_sample);
547
548
  /* Sync Status */
549
0
  item_size = 1;
550
0
  proto_item *sync_status_item = proto_tree_add_item(sample_timestamp_item_subtree, hf_samples_timestamps_sample_sync_status, tvb, *offset, item_size, ENC_BIG_ENDIAN);
551
0
  *offset += item_size;
552
553
0
  if (sync_status > 2) {
554
0
    expert_add_info(pinfo, sync_status_item, &ei_samples_timestamp_sync_status_invalid);
555
0
  }
556
557
  /* Additional Status */
558
0
  item_size = 1;
559
0
  proto_tree_add_bitmask(sample_timestamp_item_subtree, tvb, *offset, hf_samples_timestamps_sample_additional_status, ett_samples_timestamps_sample_reserved, timestamp_additional_status_bits, ENC_BIG_ENDIAN);
560
0
  *offset += item_size;
561
562
  /* Timestamp */
563
0
  item_size = 8;
564
0
  proto_item *sample_timestamp_timestamp_item = proto_tree_add_string(sample_timestamp_item_subtree, hf_samples_timestamps_sample_timestamp, tvb, *offset, item_size, timestamp_buf);
565
566
0
  proto_tree *sample_timestamp_timestamp_item_subtree = proto_item_add_subtree(sample_timestamp_timestamp_item, ett_samples_timestamps_sample_timestamp);
567
568
  /* Seconds */
569
0
  item_size = 4;
570
0
  proto_tree_add_item(sample_timestamp_timestamp_item_subtree, hf_samples_timestamps_sample_timestamp_seconds, tvb, *offset, item_size, ENC_BIG_ENDIAN);
571
0
  *offset += item_size;
572
573
  /* Nanoseconds */
574
0
  item_size = 4;
575
0
  proto_tree_add_item(sample_timestamp_timestamp_item_subtree, hf_samples_timestamps_sample_timestamp_nanoseconds, tvb, *offset, item_size, ENC_BIG_ENDIAN);
576
0
  *offset += item_size;
577
0
}
578
579
0
static void add_timestamps_set(tvbuff_t *tvb, packet_info *pinfo, unsigned *offset, int *hfs, unsigned hfs_size, proto_tree *tree) {
580
0
    unsigned previous_offset = 0;
581
0
  for (unsigned index_timestamp = 0; index_timestamp < hfs_size; index_timestamp++) {
582
0
            unsigned tvb_offset_saved = *offset;
583
0
    add_timestamp_sample(tvb, pinfo, (index_timestamp == 0) ? NULL : &previous_offset, offset, hfs[index_timestamp], tree);
584
0
    previous_offset = tvb_offset_saved;
585
0
  }
586
0
}
587
588
/*
589
 * Samples Packets
590
 *
591
 * Samples Packets are sent by IM1 and IM2R0 sensors.
592
 * However, details of the packets differ between the sensors.
593
 *
594
 * Samples Packet
595
 * ==============
596
 * Transport Delay: 2 bytes, unsigned (resolution = 10ns)
597
 * Hop Count: 1 byte, unsigned
598
 * Control data: 1 byte, bitmap
599
 *   bit  [7]   : type     : 0 = CIM, 1 = VIM
600
 *   bit  [6]   : simulated: 0 = Real Samples, 1 = Simulated Samples
601
 *   bits [5..4]: version  : 00 = IM1, 11 = IM2R0
602
 *   bits [3..0]: seqnr    : Sequence Number, in the range [0,15], monotonically
603
 *                           increasing and wrapping
604
 * Temperature: 2 bytes, signed (resolution = 0.25C)
605
 * Padding: 1 byte
606
 * ADC Status: 1 byte, unsigned
607
 * Sample Data
608
 *   * Sample data is stored in sample data sets.
609
 *     Each sample data set contains ranges and the data of 8 samples, and
610
 *     samples are equi-distant in time.
611
 *
612
 *     Sample Data Set
613
 *     ===============
614
 *       Range: 2 bytes, bitmap
615
 *              - bits [15,14]: Range of sample 8 (newest sample)
616
 *              - bits [13,12]: Range of sample 7
617
 *              - bits [11,10]: Range of sample 6
618
 *              - bits [ 9, 8]: Range of sample 5
619
 *              - bits [ 7, 6]: Range of sample 4
620
 *              - bits [ 5, 4]: Range of sample 3
621
 *              - bits [ 3, 2]: Range of sample 2
622
 *              - bits [ 1, 0]: Range of sample 1 (oldest sample)
623
 *              Range values:
624
 *                00 = measurement ADC channel
625
 *                01 = protection ADC channel, range low
626
 *                10 = protection ADC channel, range high
627
 *                11 = unused
628
 *       Sample 1: 4 bytes, signed (oldest sample)
629
 *       Sample 2: 4 bytes, signed
630
 *       Sample 3: 4 bytes, signed
631
 *       Sample 4: 4 bytes, signed
632
 *       Sample 5: 4 bytes, signed
633
 *       Sample 6: 4 bytes, signed
634
 *       Sample 7: 4 bytes, signed
635
 *       Sample 8: 4 bytes, signed (newest sample)
636
 *
637
 *   * IM1
638
 *     6 sample data sets, one set per ADC channel:
639
 *
640
 *     Sample Data
641
 *     ===========
642
 *              CIM                             VIM
643
 *     set 1    channel 1, measurement          channel 1
644
 *     set 2    channel 2, measurement          channel 2
645
 *     set 3    channel 3, measurement          channel 3
646
 *     set 4    channel 1, protection           0
647
 *     set 5    channel 2, protection           0
648
 *     set 6    channel 3, protection           0
649
 *
650
 *   * IM2R0
651
 *     8 sample data sets, one set per ADC channel:
652
 *
653
 *     Sample Data
654
 *     ===========
655
 *              CIM                             VIM
656
 *     set 1    channel 1, measurement          channel 1
657
 *     set 2    channel 2, measurement          channel 2
658
 *     set 3    channel 3, measurement          channel 3
659
 *     set 4    channel 1, protection           neutral channel
660
 *     set 5    channel 2, protection           0
661
 *     set 6    channel 3, protection           0
662
 *     set 7    neutral channel, measurement    0
663
 *     set 8    neutral channel, protection     0
664
 * RMS values
665
 *   * RMS values are stored as 4 byte signed values.
666
 *
667
 *   * IM1
668
 *     6 values, one per ADC-channel:
669
 *
670
 *     RMS values
671
 *     ==========
672
 *              CIM                             VIM
673
 *     value 1  channel 1, measurement          channel 1
674
 *     value 2  channel 2, measurement          channel 2
675
 *     value 3  channel 3, measurement          channel 3
676
 *     value 4  channel 1, protection           0
677
 *     value 5  channel 2, protection           0
678
 *     value 6  channel 3, protection           0
679
 *
680
 *   * IM2R0
681
 *     8 values, one per ADC-channel:
682
 *
683
 *     RMS values
684
 *     ==========
685
 *              CIM                             VIM
686
 *     value 1  0                               0
687
 *     value 2  0                               0
688
 *     value 3  0                               0
689
 *     value 4  0                               0
690
 *     value 5  0                               0
691
 *     value 6  0                               0
692
 *     value 7  0                               0
693
 *     value 8  0                               0
694
 * Timestamps
695
 *   * Timestamps are PTP driven and are stored in a versioned block.
696
 *     Each timestamp also has status information.
697
 *
698
 *   * IM1
699
 *     Timestamps are not applicable for IM1.
700
 *
701
 *   * IM2R0
702
 *     Timestamps are optional.
703
 *
704
 *     Timestamps Block
705
 *     ================
706
 *     Version   1 byte, unsigned
707
 *     Reserved  3 bytes, unsigned
708
 *     Sample 1  Timestamp (oldest sample)
709
 *     Sample 2  Timestamp
710
 *     Sample 3  Timestamp
711
 *     Sample 4  Timestamp
712
 *     Sample 5  Timestamp
713
 *     Sample 6  Timestamp
714
 *     Sample 7  Timestamp
715
 *     Sample 8  Timestamp (newest sample)
716
 *
717
 *     Timestamp
718
 *     =========
719
 *     Sync Status  1 byte, unsigned
720
 *       0     = Not synchronized (during start-up or synchronization lost)
721
 *       1     = Synchronized but not to a Grand Master Clock
722
 *       2     = Synchronized to a Grand Master Clock
723
 *       3-255 = Invalid
724
 *     Additional Status  1 byte, bitmap
725
 *       bits [7, 2]: Reserved
726
 *       bits [1]   : Master clock switch
727
 *         1 = The device switched to a different master clock or
728
 *             became synchronized to a master clock for the first time.
729
 *         0 = The device did not switch to a different master clock nor
730
 *             became synchronized to a master clock for the first time.
731
 *       bits [0]   : Holdover state
732
 *         1 = The device is in its holdover state.
733
 *         0 = The device is not in its holdover state.
734
 *     Seconds      4 bytes, unsigned
735
 *     Nanoseconds  4 bytes, unsigned
736
 */
737
738
static int ett_protocol_samples;
739
static int ett_samples_control;
740
static int ett_samples_sets;
741
static int ett_samples_sets_set;
742
static int ett_samples_rms;
743
static int ett_samples_rms_values;
744
static int ett_samples_timestamps;
745
static int ett_samples_timestamps_set;
746
747
static expert_field ei_samples_im_version_invalid;
748
749
static int hf_samples_transport_delay;
750
static int hf_samples_hop_count;
751
static int hf_samples_control;
752
static int hf_samples_control_type;
753
static int hf_samples_control_simulated;
754
static int hf_samples_control_version;
755
static int hf_samples_control_sequence_number;
756
static int hf_samples_temperature;
757
static int hf_samples_padding;
758
static int hf_samples_adc_status;
759
static int hf_samples_sample_set;
760
static int hf_samples_rms_values;
761
static int hf_samples_timestamps;
762
763
static int *const controlBits[] = {
764
    &hf_samples_control_type,
765
    &hf_samples_control_simulated,
766
    &hf_samples_control_version,
767
    &hf_samples_control_sequence_number,
768
    NULL};
769
770
static int hf_samples_sample_set_measurement_channel_1;
771
static int hf_samples_sample_set_measurement_channel_2;
772
static int hf_samples_sample_set_measurement_channel_3;
773
static int hf_samples_sample_set_measurement_channel_n;
774
static int hf_samples_sample_set_protection_channel_1;
775
static int hf_samples_sample_set_protection_channel_2;
776
static int hf_samples_sample_set_protection_channel_3;
777
static int hf_samples_sample_set_protection_channel_n;
778
static int hf_samples_sample_set_channel_unused;
779
780
static int hf_samples_rms_values_measurement_channel_1;
781
static int hf_samples_rms_values_measurement_channel_2;
782
static int hf_samples_rms_values_measurement_channel_3;
783
static int hf_samples_rms_values_protection_channel_1;
784
static int hf_samples_rms_values_protection_channel_2;
785
static int hf_samples_rms_values_protection_channel_3;
786
static int hf_samples_rms_values_channel_unused;
787
788
static int hf_samples_timestamps_version;
789
static int hf_samples_timestamps_reserved;
790
static int hf_samples_timestamps_sample_1;
791
static int hf_samples_timestamps_sample_2;
792
static int hf_samples_timestamps_sample_3;
793
static int hf_samples_timestamps_sample_4;
794
static int hf_samples_timestamps_sample_5;
795
static int hf_samples_timestamps_sample_6;
796
static int hf_samples_timestamps_sample_7;
797
static int hf_samples_timestamps_sample_8;
798
799
0
static int dissect_samples_im(bool im1, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_, int h_protocol_samples) {
800
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, im1 ? PROTOCOL_SHORTNAME_SAMPLES_IM1 : PROTOCOL_SHORTNAME_SAMPLES_IM2R0);
801
0
  col_set_str(pinfo->cinfo, COL_INFO, im1 ? PROTOCOL_NAME_SAMPLES_IM1 : PROTOCOL_NAME_SAMPLES_IM2R0);
802
803
0
  proto_item *samples_item = proto_tree_add_item(tree, h_protocol_samples, tvb, 0, -1, ENC_NA);
804
0
  proto_tree *samples_item_subtree = proto_item_add_subtree(samples_item, ett_protocol_samples);
805
806
0
  unsigned offset = 0;
807
808
  /* Transport Delay */
809
0
  int item_size = 2;
810
0
  proto_tree_add_item(samples_item_subtree, hf_samples_transport_delay, tvb, offset, item_size, ENC_BIG_ENDIAN);
811
0
  offset += item_size;
812
813
  /* Hop Count */
814
0
  item_size = 1;
815
0
  proto_tree_add_item(samples_item_subtree, hf_samples_hop_count, tvb, offset, item_size, ENC_BIG_ENDIAN);
816
0
  offset += item_size;
817
818
  /* Get Control */
819
0
  uint8_t control = tvb_get_uint8(tvb, offset);
820
0
  bool isIM1 = ((control & MASK_SAMPLES_CONTROL_VERSION) == 0);
821
0
  bool isIM2R0 = ((control & MASK_SAMPLES_CONTROL_VERSION) == MASK_SAMPLES_CONTROL_VERSION);
822
0
  bool isCIM = ((control & MASK_SAMPLES_CONTROL_TYPE) == 0);
823
824
  /* Control */
825
0
  item_size = 1;
826
0
  proto_item *control_item = proto_tree_add_bitmask(samples_item_subtree, tvb, offset, hf_samples_control, ett_samples_control, controlBits, ENC_BIG_ENDIAN);
827
0
  offset += item_size;
828
0
  if (!isIM1 && !isIM2R0) {
829
0
    expert_add_info(pinfo, control_item, &ei_samples_im_version_invalid);
830
0
  }
831
832
  /* Temperature */
833
0
  item_size = 2;
834
0
  proto_tree_add_item(samples_item_subtree, hf_samples_temperature, tvb, offset, item_size, ENC_BIG_ENDIAN);
835
0
  offset += item_size;
836
837
  /* Padding */
838
0
  item_size = 1;
839
0
  proto_tree_add_item(samples_item_subtree, hf_samples_padding, tvb, offset, item_size, ENC_BIG_ENDIAN);
840
0
  offset += item_size;
841
842
  /* ADC status */
843
0
  item_size = 1;
844
0
  proto_tree_add_item(samples_item_subtree, hf_samples_adc_status, tvb, offset, item_size, ENC_BIG_ENDIAN);
845
0
  offset += item_size;
846
847
  /* Sample Sets */
848
0
  {
849
0
    proto_tree *sample_sets_subtree = proto_item_add_subtree(samples_item, ett_samples_sets);
850
851
0
    if (im1) {
852
0
      item_size = SAMPLE_SET_SIZE * 6;
853
0
    } else {
854
0
      item_size = SAMPLE_SET_SIZE * 8;
855
0
    }
856
0
    proto_item *sample_sets_subtree_item = proto_tree_add_item(sample_sets_subtree, hf_samples_sample_set, tvb, offset, item_size, ENC_NA);
857
858
0
    proto_tree *sample_sets_subtree_item_subtree = proto_item_add_subtree(sample_sets_subtree_item, ett_samples_sets_set);
859
860
0
    if (isIM1) {
861
0
      if (isCIM) {
862
        /* IM1 CIM */
863
864
0
        int hfs[] = {
865
0
            hf_samples_sample_set_measurement_channel_1,
866
0
            hf_samples_sample_set_measurement_channel_2,
867
0
            hf_samples_sample_set_measurement_channel_3,
868
0
            hf_samples_sample_set_protection_channel_1,
869
0
            hf_samples_sample_set_protection_channel_2,
870
0
            hf_samples_sample_set_protection_channel_3};
871
872
0
        add_sample_sets(tvb, pinfo, &offset, hfs, array_length(hfs), sample_sets_subtree_item_subtree);
873
0
      } else {
874
        /* IM1 VIM */
875
876
0
        int hfs[] = {
877
0
            hf_samples_sample_set_measurement_channel_1,
878
0
            hf_samples_sample_set_measurement_channel_2,
879
0
            hf_samples_sample_set_measurement_channel_3,
880
0
            hf_samples_sample_set_channel_unused,
881
0
            hf_samples_sample_set_channel_unused,
882
0
            hf_samples_sample_set_channel_unused};
883
884
0
        add_sample_sets(tvb, pinfo, &offset, hfs, array_length(hfs), sample_sets_subtree_item_subtree);
885
0
      }
886
0
    } else if (isIM2R0) {
887
0
      if (isCIM) {
888
        /* IM2R0 CIM */
889
890
0
        int hfs[] = {
891
0
            hf_samples_sample_set_measurement_channel_1,
892
0
            hf_samples_sample_set_measurement_channel_2,
893
0
            hf_samples_sample_set_measurement_channel_3,
894
0
            hf_samples_sample_set_protection_channel_1,
895
0
            hf_samples_sample_set_protection_channel_2,
896
0
            hf_samples_sample_set_protection_channel_3,
897
0
            hf_samples_sample_set_measurement_channel_n,
898
0
            hf_samples_sample_set_protection_channel_n};
899
900
0
        add_sample_sets(tvb, pinfo, &offset, hfs, array_length(hfs), sample_sets_subtree_item_subtree);
901
0
      } else {
902
        /* IM2R0 VIM */
903
904
0
        int hfs[] = {
905
0
            hf_samples_sample_set_measurement_channel_1,
906
0
            hf_samples_sample_set_measurement_channel_2,
907
0
            hf_samples_sample_set_measurement_channel_3,
908
0
            hf_samples_sample_set_measurement_channel_n,
909
0
            hf_samples_sample_set_channel_unused,
910
0
            hf_samples_sample_set_channel_unused,
911
0
            hf_samples_sample_set_channel_unused,
912
0
            hf_samples_sample_set_channel_unused};
913
914
0
        add_sample_sets(tvb, pinfo, &offset, hfs, array_length(hfs), sample_sets_subtree_item_subtree);
915
0
      }
916
0
    }
917
0
  }
918
919
  /* RMS Values */
920
0
  {
921
0
    proto_tree *rms_values_subtree = proto_item_add_subtree(samples_item, ett_samples_rms);
922
923
0
    if (im1) {
924
0
      item_size = 4 * 6;
925
0
    } else {
926
0
      item_size = 4 * 8;
927
0
    }
928
0
    proto_item *rms_values_item = proto_tree_add_item(rms_values_subtree, hf_samples_rms_values, tvb, offset, item_size, ENC_NA);
929
930
0
    proto_tree *rms_values_item_subtree = proto_item_add_subtree(rms_values_item, ett_samples_rms_values);
931
932
0
    if (isIM1) {
933
0
      if (isCIM) {
934
        /* IM1 CIM */
935
936
0
        int hfs[] = {
937
0
            hf_samples_rms_values_measurement_channel_1,
938
0
            hf_samples_rms_values_measurement_channel_2,
939
0
            hf_samples_rms_values_measurement_channel_3,
940
0
            hf_samples_rms_values_protection_channel_1,
941
0
            hf_samples_rms_values_protection_channel_2,
942
0
            hf_samples_rms_values_protection_channel_3};
943
944
0
        add_rms_values(tvb, &offset, hfs, array_length(hfs), rms_values_item_subtree);
945
0
      } else {
946
        /* IM1 VIM */
947
948
0
        int hfs[] = {
949
0
            hf_samples_rms_values_measurement_channel_1,
950
0
            hf_samples_rms_values_measurement_channel_2,
951
0
            hf_samples_rms_values_measurement_channel_3,
952
0
            hf_samples_rms_values_channel_unused,
953
0
            hf_samples_rms_values_channel_unused,
954
0
            hf_samples_rms_values_channel_unused};
955
956
0
        add_rms_values(tvb, &offset, hfs, array_length(hfs), rms_values_item_subtree);
957
0
      }
958
0
    } else if (isIM2R0) {
959
0
      int hfs[] = {
960
0
          hf_samples_rms_values_channel_unused,
961
0
          hf_samples_rms_values_channel_unused,
962
0
          hf_samples_rms_values_channel_unused,
963
0
          hf_samples_rms_values_channel_unused,
964
0
          hf_samples_rms_values_channel_unused,
965
0
          hf_samples_rms_values_channel_unused,
966
0
          hf_samples_rms_values_channel_unused,
967
0
          hf_samples_rms_values_channel_unused};
968
969
0
      add_rms_values(tvb, &offset, hfs, array_length(hfs), rms_values_item_subtree);
970
0
    }
971
0
  }
972
973
  /* Timestamps */
974
0
  if (isIM2R0 && tvb_bytes_exist(tvb, offset, TIMESTAMPS_SIZE)) {
975
0
    proto_tree *samples_timestamps_subtree = proto_item_add_subtree(samples_item, ett_samples_timestamps);
976
977
0
    item_size = TIMESTAMPS_SIZE;
978
0
    proto_item *samples_timestamps_subtree_item = proto_tree_add_item(samples_timestamps_subtree, hf_samples_timestamps, tvb, offset, item_size, ENC_NA);
979
980
0
    proto_tree *samples_timestamps_subtree_item_subtree = proto_item_add_subtree(samples_timestamps_subtree_item, ett_samples_timestamps_set);
981
982
    /* Version */
983
0
    item_size = 1;
984
0
    proto_tree_add_item(samples_timestamps_subtree_item_subtree, hf_samples_timestamps_version, tvb, offset, item_size, ENC_BIG_ENDIAN);
985
0
    offset += item_size;
986
987
    /* Reserved */
988
0
    item_size = 3;
989
0
    proto_tree_add_item(samples_timestamps_subtree_item_subtree, hf_samples_timestamps_reserved, tvb, offset, item_size, ENC_BIG_ENDIAN);
990
0
    offset += item_size;
991
992
    /* Sample Timestamps */
993
994
0
    int hfs[] = {
995
0
        hf_samples_timestamps_sample_1,
996
0
        hf_samples_timestamps_sample_2,
997
0
        hf_samples_timestamps_sample_3,
998
0
        hf_samples_timestamps_sample_4,
999
0
        hf_samples_timestamps_sample_5,
1000
0
        hf_samples_timestamps_sample_6,
1001
0
        hf_samples_timestamps_sample_7,
1002
0
        hf_samples_timestamps_sample_8};
1003
1004
0
    add_timestamps_set(tvb, pinfo, &offset, hfs, array_length(hfs), samples_timestamps_subtree_item_subtree);
1005
0
  }
1006
1007
0
  return tvb_captured_length(tvb);
1008
0
}
1009
1010
/*
1011
 * ########################################################################
1012
 * #
1013
 * # Samples - IM1
1014
 * #
1015
 * ########################################################################
1016
 */
1017
1018
0
static void samples_transport_delay(char *result, uint16_t transport_delay) {
1019
0
  snprintf(result, ITEM_LABEL_LENGTH, "%u ns", transport_delay * 10);
1020
0
}
1021
1022
static const value_string samples_control_type_vals[] = {
1023
    {0, "Current Interface Module"},
1024
    {1, "Voltage Interface Module"},
1025
    {0, NULL}};
1026
1027
static const value_string samples_control_simulated_vals[] = {
1028
    {0, "Sampled"},
1029
    {1, "Simulated"},
1030
    {0, NULL}};
1031
1032
static const value_string samples_control_version_vals[] = {
1033
    {0, "IM1"},
1034
    {1, "Unused"},
1035
    {2, "Unused"},
1036
    {3, "IM2R0"},
1037
    {0, NULL}};
1038
1039
0
static void samples_sequence_number(char *result, uint8_t sequence_number) {
1040
0
  snprintf(result, ITEM_LABEL_LENGTH, "%u", sequence_number);
1041
0
}
1042
1043
0
static void samples_temperature(char *result, int16_t temperature) {
1044
0
  snprintf(result, ITEM_LABEL_LENGTH, "%.2f C", (0.25f * temperature));
1045
0
}
1046
1047
static const value_string ranges_vals[] = {
1048
    {0, "Measurement ADC Channel"},
1049
    {1, "Protection ADC Channel, Range Low"},
1050
    {2, "Protection ADC Channel, Range High"},
1051
    {3, "Unused"},
1052
    {0, NULL}};
1053
1054
static hf_register_info protocol_registration_samples[] = {
1055
    {&hf_samples_transport_delay, {"Transport Delay", "locamation-im.samples.transport_delay", FT_UINT16, BASE_CUSTOM, CF_FUNC(samples_transport_delay), 0x0, NULL, HFILL}},
1056
    {&hf_samples_hop_count, {"Hop Count", "locamation-im.samples.hop_count", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1057
    {&hf_samples_control, {"Control", "locamation-im.samples.control", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1058
    {&hf_samples_control_type, {"Type", "locamation-im.samples.control.type", FT_UINT8, BASE_DEC, VALS(samples_control_type_vals), MASK_SAMPLES_CONTROL_TYPE, NULL, HFILL}},
1059
    {&hf_samples_control_simulated, {"Simulated", "locamation-im.samples.control.simulated", FT_UINT8, BASE_DEC, VALS(samples_control_simulated_vals), MASK_SAMPLES_CONTROL_SIMULATED, NULL, HFILL}},
1060
    {&hf_samples_control_version, {"Version", "locamation-im.samples.control.version", FT_UINT8, BASE_DEC, VALS(samples_control_version_vals), MASK_SAMPLES_CONTROL_VERSION, NULL, HFILL}},
1061
    {&hf_samples_control_sequence_number, {"Sequence Number", "locamation-im.samples.control.sequence_number", FT_UINT8, BASE_CUSTOM, CF_FUNC(samples_sequence_number), MASK_SAMPLES_CONTROL_SEQUENCE_NUMBER, NULL, HFILL}},
1062
    {&hf_samples_temperature, {"Temperature", "locamation-im.samples.temperature", FT_INT16, BASE_CUSTOM, CF_FUNC(samples_temperature), 0x0, NULL, HFILL}},
1063
    {&hf_samples_padding, {"Padding", "locamation-im.samples.padding", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1064
    {&hf_samples_adc_status, {"ADC Status", "locamation-im.samples.adc_status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1065
    {&hf_samples_sample_set, {"Sample Sets", "locamation-im.samples.sets", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1066
    {&hf_samples_rms_values, {"RMS Values", "locamation-im.samples.rms_values", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1067
    {&hf_samples_sample_set_measurement_channel_1, {"Measurement Channel 1", "locamation-im.samples.sets.measurement.channel.1", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1068
    {&hf_samples_sample_set_measurement_channel_2, {"Measurement Channel 2", "locamation-im.samples.sets.measurement.channel.2", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1069
    {&hf_samples_sample_set_measurement_channel_3, {"Measurement Channel 3", "locamation-im.samples.sets.measurement.channel.3", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1070
    {&hf_samples_sample_set_measurement_channel_n, {"Measurement Channel N", "locamation-im.samples.sets.measurement.channel.n", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1071
    {&hf_samples_sample_set_protection_channel_1, {"Protection Channel 1", "locamation-im.samples.sets.protection.channel.1", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1072
    {&hf_samples_sample_set_protection_channel_2, {"Protection Channel 2", "locamation-im.samples.sets.protection.channel.2", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1073
    {&hf_samples_sample_set_protection_channel_3, {"Protection Channel 3", "locamation-im.samples.sets.protection.channel.3", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1074
    {&hf_samples_sample_set_protection_channel_n, {"Protection Channel N", "locamation-im.samples.sets.protection.channel.n", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1075
    {&hf_samples_sample_set_channel_unused, {"Unused Channel", "locamation-im.samples.sets.channel.unused", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1076
    {&hf_samples_sample_set_ranges, {"Ranges", "locamation-im.samples.sets.measurement.ranges", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1077
    {&hf_samples_sample_set_ranges_sample_1, {"Sample 1", "locamation-im.samples.sets.measurement.ranges.sample.1", FT_UINT16, BASE_DEC, VALS(ranges_vals), MASK_RANGES_SAMPLE_1, NULL, HFILL}},
1078
    {&hf_samples_sample_set_ranges_sample_2, {"Sample 2", "locamation-im.samples.sets.measurement.ranges.sample.2", FT_UINT16, BASE_DEC, VALS(ranges_vals), MASK_RANGES_SAMPLE_2, NULL, HFILL}},
1079
    {&hf_samples_sample_set_ranges_sample_3, {"Sample 3", "locamation-im.samples.sets.measurement.ranges.sample.3", FT_UINT16, BASE_DEC, VALS(ranges_vals), MASK_RANGES_SAMPLE_3, NULL, HFILL}},
1080
    {&hf_samples_sample_set_ranges_sample_4, {"Sample 4", "locamation-im.samples.sets.measurement.ranges.sample.4", FT_UINT16, BASE_DEC, VALS(ranges_vals), MASK_RANGES_SAMPLE_4, NULL, HFILL}},
1081
    {&hf_samples_sample_set_ranges_sample_5, {"Sample 5", "locamation-im.samples.sets.measurement.ranges.sample.5", FT_UINT16, BASE_DEC, VALS(ranges_vals), MASK_RANGES_SAMPLE_5, NULL, HFILL}},
1082
    {&hf_samples_sample_set_ranges_sample_6, {"Sample 6", "locamation-im.samples.sets.measurement.ranges.sample.6", FT_UINT16, BASE_DEC, VALS(ranges_vals), MASK_RANGES_SAMPLE_6, NULL, HFILL}},
1083
    {&hf_samples_sample_set_ranges_sample_7, {"Sample 7", "locamation-im.samples.sets.measurement.ranges.sample.7", FT_UINT16, BASE_DEC, VALS(ranges_vals), MASK_RANGES_SAMPLE_7, NULL, HFILL}},
1084
    {&hf_samples_sample_set_ranges_sample_8, {"Sample 8", "locamation-im.samples.sets.measurement.ranges.sample.8", FT_UINT16, BASE_DEC, VALS(ranges_vals), MASK_RANGES_SAMPLE_8, NULL, HFILL}},
1085
    {&hf_samples_sample_set_sample_1, {"Sample 1", "locamation-im.samples.sets.sample.1", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1086
    {&hf_samples_sample_set_sample_2, {"Sample 2", "locamation-im.samples.sets.sample.2", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1087
    {&hf_samples_sample_set_sample_3, {"Sample 3", "locamation-im.samples.sets.sample.3", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1088
    {&hf_samples_sample_set_sample_4, {"Sample 4", "locamation-im.samples.sets.sample.4", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1089
    {&hf_samples_sample_set_sample_5, {"Sample 5", "locamation-im.samples.sets.sample.5", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1090
    {&hf_samples_sample_set_sample_6, {"Sample 6", "locamation-im.samples.sets.sample.6", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1091
    {&hf_samples_sample_set_sample_7, {"Sample 7", "locamation-im.samples.sets.sample.7", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1092
    {&hf_samples_sample_set_sample_8, {"Sample 8", "locamation-im.samples.sets.sample.8", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1093
    {&hf_samples_rms_values_measurement_channel_1, {"Measurement Channel 1", "locamation-im.samples.rms.measurement.channel.1", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1094
    {&hf_samples_rms_values_measurement_channel_2, {"Measurement Channel 2", "locamation-im.samples.rms.measurement.channel.2", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1095
    {&hf_samples_rms_values_measurement_channel_3, {"Measurement Channel 3", "locamation-im.samples.rms.measurement.channel.3", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1096
    {&hf_samples_rms_values_protection_channel_1, {"Protection Channel 1", "locamation-im.samples.rms.protection.channel.1", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1097
    {&hf_samples_rms_values_protection_channel_2, {"Protection Channel 2", "locamation-im.samples.rms.protection.channel.2", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1098
    {&hf_samples_rms_values_protection_channel_3, {"Protection Channel 3", "locamation-im.samples.rms.protection.channel.3", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1099
    {&hf_samples_rms_values_channel_unused, {"Unused Channel", "locamation-im.samples.rms.channel.unused", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}};
1100
1101
static ei_register_info ei_samples_im1[] = {
1102
    {&ei_samples_ranges_sample_1_invalid, {"locamation-im.samples.sets.measurement.ranges.sample.1.invalid", PI_MALFORMED, PI_ERROR, "Invalid Range for sample 1", EXPFILL}},
1103
    {&ei_samples_ranges_sample_2_invalid, {"locamation-im.samples.sets.measurement.ranges.sample.2.invalid", PI_MALFORMED, PI_ERROR, "Invalid Range for sample 2", EXPFILL}},
1104
    {&ei_samples_ranges_sample_3_invalid, {"locamation-im.samples.sets.measurement.ranges.sample.3.invalid", PI_MALFORMED, PI_ERROR, "Invalid Range for sample 3", EXPFILL}},
1105
    {&ei_samples_ranges_sample_4_invalid, {"locamation-im.samples.sets.measurement.ranges.sample.4.invalid", PI_MALFORMED, PI_ERROR, "Invalid Range for sample 4", EXPFILL}},
1106
    {&ei_samples_ranges_sample_5_invalid, {"locamation-im.samples.sets.measurement.ranges.sample.5.invalid", PI_MALFORMED, PI_ERROR, "Invalid Range for sample 5", EXPFILL}},
1107
    {&ei_samples_ranges_sample_6_invalid, {"locamation-im.samples.sets.measurement.ranges.sample.6.invalid", PI_MALFORMED, PI_ERROR, "Invalid Range for sample 6", EXPFILL}},
1108
    {&ei_samples_ranges_sample_7_invalid, {"locamation-im.samples.sets.measurement.ranges.sample.7.invalid", PI_MALFORMED, PI_ERROR, "Invalid Range for sample 7", EXPFILL}},
1109
    {&ei_samples_ranges_sample_8_invalid, {"locamation-im.samples.sets.measurement.ranges.sample.8.invalid", PI_MALFORMED, PI_ERROR, "Invalid Range for sample 8", EXPFILL}}};
1110
1111
static int h_protocol_samples_im1 = -1;
1112
1113
0
static int dissect_samples_im1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
1114
0
  return dissect_samples_im(true, tvb, pinfo, tree, data, h_protocol_samples_im1);
1115
0
}
1116
1117
/*
1118
 * ########################################################################
1119
 * #
1120
 * # Samples - IM2R0
1121
 * #
1122
 * ########################################################################
1123
 */
1124
1125
static hf_register_info protocol_registration_samples_im2[] = {
1126
    {&hf_samples_timestamps, {"Timestamps", "locamation-im.samples.timestamps", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1127
    {&hf_samples_timestamps_version, {"Version", "locamation-im.samples.timestamps.version", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1128
    {&hf_samples_timestamps_reserved, {"Reserved", "locamation-im.samples.timestamps.reserved", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1129
    {&hf_samples_timestamps_sample_1, {"Sample 1", "locamation-im.samples.timestamps.sample.1", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1130
    {&hf_samples_timestamps_sample_2, {"Sample 2", "locamation-im.samples.timestamps.sample.2", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1131
    {&hf_samples_timestamps_sample_3, {"Sample 3", "locamation-im.samples.timestamps.sample.3", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1132
    {&hf_samples_timestamps_sample_4, {"Sample 4", "locamation-im.samples.timestamps.sample.4", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1133
    {&hf_samples_timestamps_sample_5, {"Sample 5", "locamation-im.samples.timestamps.sample.5", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1134
    {&hf_samples_timestamps_sample_6, {"Sample 6", "locamation-im.samples.timestamps.sample.6", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1135
    {&hf_samples_timestamps_sample_7, {"Sample 7", "locamation-im.samples.timestamps.sample.7", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1136
    {&hf_samples_timestamps_sample_8, {"Sample 8", "locamation-im.samples.timestamps.sample.8", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1137
    {&hf_samples_timestamps_sample_sync_status, {"Sync Status", "locamation-im.samples.timestamps.sample.sync.status", FT_UINT8, BASE_DEC, VALS(samples_timestamps_sample_sync_status), 0x0, NULL, HFILL}},
1138
    {&hf_samples_timestamps_sample_additional_status, {"Additional Status", "locamation-im.samples.timestamps.sample.additional.status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}},
1139
    {&hf_samples_timestamps_sample_additional_status_holdover_state, {"Holdover", "locamation-im.samples.timestamps.sample.additional.status.holdover.state", FT_BOOLEAN, 8, TFS(&tfs_active_inactive), MASK_TIMESTAMP_ADDITIONAL_STATUS_HOLDOVER_STATE, NULL, HFILL}},
1140
    {&hf_samples_timestamps_sample_additional_status_master_clock_switch, {"Master Clock Switch", "locamation-im.samples.timestamps.sample.additional.status.master.clock.switch", FT_BOOLEAN, 8, TFS(&tfs_yes_no), MASK_TIMESTAMP_ADDITIONAL_STATUS_MASTER_CLOCK_SWITCH, NULL, HFILL}},
1141
    {&hf_samples_timestamps_sample_timestamp, {"Timestamp", "locamation-im.samples.timestamps.sample.timestamp", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}},
1142
    {&hf_samples_timestamps_sample_timestamp_seconds, {"Seconds", "locamation-im.samples.timestamps.sample.timestamp.seconds", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
1143
    {&hf_samples_timestamps_sample_timestamp_nanoseconds, {"Nanoseconds", "locamation-im.samples.timestamps.sample.timestamp.nanoseconds", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}};
1144
1145
static ei_register_info ei_samples_im2r0[] = {
1146
    {&ei_samples_im_version_invalid, {"locamation-im.samples.control.version.invalid", PI_MALFORMED, PI_ERROR, "Invalid Version", EXPFILL}},
1147
    {&ei_samples_timestamp_sync_status_invalid, {"locamation-im.samples.timestamps.sample.sync.status.invalid", PI_MALFORMED, PI_ERROR, "Invalid Status", EXPFILL}}};
1148
1149
static int h_protocol_samples_im2r0 = -1;
1150
1151
0
static int dissect_samples_im2r0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
1152
0
  return dissect_samples_im(false, tvb, pinfo, tree, data, h_protocol_samples_im2r0);
1153
0
}
1154
1155
/*
1156
 * ########################################################################
1157
 * #
1158
 * # LLC
1159
 * #
1160
 * ########################################################################
1161
 */
1162
1163
static int hf_llc_company_pid;
1164
1165
static hf_register_info llc_registration[] = {
1166
    {&hf_llc_company_pid, {"PID", "locamation-im.llc.pid", FT_UINT16, BASE_HEX, VALS(company_pid_vals), 0x0, "Protocol ID", HFILL}}};
1167
1168
/*
1169
 * ########################################################################
1170
 * #
1171
 * # Registration
1172
 * #
1173
 * ########################################################################
1174
 */
1175
1176
static int *ett[] = {
1177
    &ett_protocol_calibration,
1178
    &ett_calibration_lines,
1179
1180
    &ett_protocol_ident,
1181
    &ett_ident_lines,
1182
1183
    &ett_samples_sample_set_ranges,
1184
    &ett_protocol_samples,
1185
    &ett_samples_control,
1186
    &ett_samples_sets,
1187
    &ett_samples_sets_set,
1188
    &ett_samples_rms,
1189
    &ett_samples_rms_values,
1190
    &ett_samples_timestamps,
1191
    &ett_samples_timestamps_set,
1192
    &ett_samples_timestamps_sample,
1193
    &ett_samples_timestamps_sample_timestamp,
1194
    &ett_samples_timestamps_sample_reserved
1195
};
1196
1197
static dissector_handle_t h_calibration;
1198
static dissector_handle_t h_ident;
1199
static dissector_handle_t h_samples_im1;
1200
static dissector_handle_t h_samples_im2r0;
1201
1202
15
void proto_register_locamation_im(void) {
1203
  /* Setup subtrees */
1204
15
  proto_register_subtree_array(ett, array_length(ett));
1205
1206
  /* Register Protocols */
1207
1208
  /* Calibration */
1209
15
  h_protocol_calibration = proto_register_protocol(PROTOCOL_NAME_CALIBRATION, PROTOCOL_SHORTNAME_CALIBRATION, "locamation-im.calibration");
1210
15
  proto_register_field_array(h_protocol_calibration, protocol_registration_calibration, array_length(protocol_registration_calibration));
1211
15
  expert_module_t *expert_calibration = expert_register_protocol(h_protocol_calibration);
1212
15
  expert_register_field_array(expert_calibration, ei_calibration, array_length(ei_calibration));
1213
1214
  /* Ident */
1215
15
  h_protocol_ident = proto_register_protocol(PROTOCOL_NAME_IDENT, PROTOCOL_SHORTNAME_IDENT, "locamation-im.ident");
1216
15
  proto_register_field_array(h_protocol_ident, protocol_registration_ident, array_length(protocol_registration_ident));
1217
1218
  /* Samples - IM1 */
1219
15
  h_protocol_samples_im1 = proto_register_protocol(PROTOCOL_NAME_SAMPLES_IM1, PROTOCOL_SHORTNAME_SAMPLES_IM1, "locamation-im.samples.im1");
1220
15
  proto_register_field_array(h_protocol_samples_im1, protocol_registration_samples, array_length(protocol_registration_samples));
1221
15
  expert_module_t *expert_samples_im1 = expert_register_protocol(h_protocol_samples_im1);
1222
15
  expert_register_field_array(expert_samples_im1, ei_samples_im1, array_length(ei_samples_im1));
1223
1224
  /* Samples - IM2R0 */
1225
15
  h_protocol_samples_im2r0 = proto_register_protocol(PROTOCOL_NAME_SAMPLES_IM2R0, PROTOCOL_SHORTNAME_SAMPLES_IM2R0, "locamation-im.samples.im2r0");
1226
15
  proto_register_field_array(h_protocol_samples_im2r0, protocol_registration_samples_im2, array_length(protocol_registration_samples_im2));
1227
15
  expert_module_t *expert_samples_im2r0 = expert_register_protocol(h_protocol_samples_im2r0);
1228
15
  expert_register_field_array(expert_samples_im2r0, ei_samples_im2r0, array_length(ei_samples_im2r0));
1229
1230
  /* LLC Handler Registration */
1231
15
  llc_add_oui(COMPANY_OUI, "locamation-im.llc.pid", "LLC " COMPANY_NAME " OUI PID", llc_registration, -1);
1232
15
}
1233
1234
15
void proto_reg_handoff_locamation_im(void) {
1235
  /* Calibration */
1236
15
  h_calibration = create_dissector_handle(dissect_calibration, h_protocol_calibration);
1237
15
  dissector_add_uint("locamation-im.llc.pid", COMPANY_PID_CALIBRATION, h_calibration);
1238
1239
  /* Ident */
1240
15
  h_ident = create_dissector_handle(dissect_ident, h_protocol_ident);
1241
15
  dissector_add_uint("locamation-im.llc.pid", COMPANY_PID_IDENT, h_ident);
1242
1243
  /* Samples - IM1 */
1244
15
  h_samples_im1 = create_dissector_handle(dissect_samples_im1, h_protocol_samples_im1);
1245
15
  dissector_add_uint("locamation-im.llc.pid", COMPANY_PID_SAMPLES_IM1, h_samples_im1);
1246
1247
  /* Samples - IM2R0 */
1248
15
  h_samples_im2r0 = create_dissector_handle(dissect_samples_im2r0, h_protocol_samples_im2r0);
1249
15
  dissector_add_uint("locamation-im.llc.pid", COMPANY_PID_SAMPLES_IM2R0, h_samples_im2r0);
1250
15
}
1251
1252
/*
1253
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1254
 *
1255
 * Local variables:
1256
 * c-basic-offset: 8
1257
 * tab-width: 8
1258
 * indent-tabs-mode: t
1259
 * End:
1260
 *
1261
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1262
 * :indentSize=8:tabSize=8:noTabs=false:
1263
 */