aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-epl_v1.c
blob: 70a979d61c68d765bc2bfda0ceb61a56ba823445 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
/* packet-epl_v1.c
 * Routines for "ETHERNET Powerlink 1.0" dissection
 * (ETHERNET Powerlink Powerlink WhitePaper V0006-B)
 *
 * Copyright (c) 2006: Zurich University of Applied Sciences Winterthur (ZHW)
 *                     Institute of Embedded Systems (InES)
 *                     http://ines.zhwin.ch
 *
 *                     - Dominic Bechaz <bdo@zhwin.ch>
 *                     - David Buechi <bhd@zhwin.ch>
 *
 *
 * A dissector for:
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1999 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "config.h"

#include <epan/packet.h>
#include <epan/etypes.h>
void proto_register_epl_v1(void);
void proto_reg_handoff_epl_v1(void);

/* Offsets of fields within an EPL_V1 packet. */
#define EPL_V1_SERVICE_OFFSET                     0   /* same offset for all message types*/
#define EPL_V1_DEST_OFFSET                        1   /* same offset for all message types*/
#define EPL_V1_SRC_OFFSET                         2   /* same offset for all message types*/

#define EPL_V1_SOC_C2_OFFSET                      3
#define EPL_V1_SOC_PF_OFFSET                      3
#define EPL_V1_SOC_NET_COMMAND_OFFSET             4
#define EPL_V1_SOC_NET_TIME_OFFSET                6
#define EPL_V1_SOC_POWERLINK_CYCLE_TIME_OFFSET   10
#define EPL_V1_SOC_NET_COMMAND_PARAMETER_OFFSET  14

#define EPL_V1_PREQ_C2_OFFSET                     3
/* "Powerlink Multimanager Konzept V1.1" protocol extension*/
#define PMM_KONZEPT_V1_1_PREQ_YA                  3
#define PMM_KONZEPT_V1_1_PREQ_SC                  3
/* end "Powerlink Multimanager Konzept V1.1" protocol extension*/
#define EPL_V1_PREQ_RD_OFFSET                     3
#define EPL_V1_PREQ_RD_OFFSET                     3
#define EPL_V1_PREQ_POLL_SIZE_OUT_OFFSET          4
#define EPL_V1_PREQ_OUT_DATA_OFFSET              10

#define EPL_V1_PRES_C2_OFFSET                     3
#define EPL_V1_PRES_EX_OFFSET                     3
#define EPL_V1_PRES_RS_OFFSET                     3
#define EPL_V1_PRES_WA_OFFSET                     3
#define EPL_V1_PRES_ER_OFFSET                     3
#define EPL_V1_PRES_RD_OFFSET                     3
#define EPL_V1_PRES_POLL_SIZE_IN_OFFSET           4
#define EPL_V1_PRES_IN_DATA_OFFSET               10

#define EPL_V1_EOC_NET_COMMAND_OFFSET             4
#define EPL_V1_EOC_NET_COMMAND_PARAMETER_OFFSET  14

#define EPL_V1_AINV_CHANNEL_OFFSET                3

#define EPL_V1_ASND_CHANNEL_OFFSET                3
#define EPL_V1_ASND_SIZE_OFFSET                   4
#define EPL_V1_ASND_DATA_OFFSET                   6
#define EPL_V1_ASND_NODE_ID_OFFSET                6
#define EPL_V1_ASND_HARDWARE_REVISION_OFFSET     10
#define EPL_V1_ASND_FIRMWARE_VERSION_OFFSET      14
#define EPL_V1_ASND_DEVICE_VARIANT_OFFSET        18
#define EPL_V1_ASND_POLL_IN_SIZE_OFFSET          22
#define EPL_V1_ASND_POLL_OUT_SIZE_OFFSET         26

/* EPL_V1 message types */
#define EPL_V1_SOC    0x01
#define EPL_V1_EOC    0x02
#define EPL_V1_PREQ   0x03
#define EPL_V1_PRES   0x04
#define EPL_V1_AINV   0x05
#define EPL_V1_ASND   0x06

static const value_string service_vals[] = {
	{EPL_V1_SOC,  "Start of Cyclic (SoC)"   },
	{EPL_V1_EOC,  "End of Cyclic (EoC)"     },
	{EPL_V1_PREQ, "Poll Request (PReq)"     },
	{EPL_V1_PRES, "Poll Response (PRes)"    },
	{EPL_V1_AINV, "Acyclic Invite (AInv)"   },
	{EPL_V1_ASND, "Acyclic Send (ASnd)"     },
	{0,NULL}
};

/* Channel values for EPL_V1 message type "AInv" */
#define EPL_V1_AINV_IDENT         1
#define EPL_V1_AINV_GENERIC     255

static const value_string ainv_channel_number_vals[] = {
	{EPL_V1_AINV_IDENT,     "Ident"             },
	{EPL_V1_AINV_GENERIC,   "Generic Channel"   },
	{0,NULL}
};

/* Channel values for EPL_V1 message type "ASnd" */
#define EPL_V1_ASND_IDENT         1
#define EPL_V1_ASND_GENERIC     255

static const value_string asnd_channel_number_vals[] = {
	{EPL_V1_ASND_IDENT,     "Ident"             },
	{EPL_V1_ASND_GENERIC,   "Generic Channel"   },
	{0,NULL}
};

/* Net Command values for EPL_V1 message type "SoC" */
#define EPL_V1_SOC_NET_COMMAND_IDLE   0
#define EPL_V1_SOC_NET_COMMAND_ACTIVE 1

static const value_string soc_net_command_vals[] = {
	{EPL_V1_SOC_NET_COMMAND_IDLE,   "Net Command Idle"  },
	{EPL_V1_SOC_NET_COMMAND_ACTIVE, "Net Command Active"},
	{0,NULL}
};

/* Net Command values for EPL_V1 message type "EoC" */
#define EPL_V1_EOC_NET_COMMAND_IDLE   0
#define EPL_V1_EOC_NET_COMMAND_ACTIVE 1

static const value_string eoc_net_command_vals[] = {
	{EPL_V1_EOC_NET_COMMAND_IDLE,   "Net Command Idle"  },
	{EPL_V1_EOC_NET_COMMAND_ACTIVE, "Net Command Active"},
	{0,NULL}
};


/* Initialize the protocol and registered fields */
static int proto_epl_v1                           = -1;
static int hf_epl_v1_service                      = -1;
static int hf_epl_v1_dest                         = -1;
static int hf_epl_v1_src                          = -1;

static int hf_epl_v1_soc_ms                       = -1;
static int hf_epl_v1_soc_ps                       = -1;
static int hf_epl_v1_soc_net_command              = -1;
static int hf_epl_v1_soc_net_time                 = -1;
static int hf_epl_v1_soc_powerlink_cycle_time     = -1;
static int hf_epl_v1_soc_net_command_parameter    = -1;

static int hf_epl_v1_preq_ms                      = -1;
static int hf_epl_v1_preq_rd                      = -1;
static int hf_epl_v1_preq_poll_size_out           = -1;
static int hf_epl_v1_preq_out_data                = -1;

static int hf_epl_v1_pres_ms                      = -1;
static int hf_epl_v1_pres_ex                      = -1;
static int hf_epl_v1_pres_rs                      = -1;
static int hf_epl_v1_pres_wa                      = -1;
static int hf_epl_v1_pres_er                      = -1;
static int hf_epl_v1_pres_rd                      = -1;
static int hf_epl_v1_pres_poll_size_in            = -1;
static int hf_epl_v1_pres_in_data                 = -1;

static int hf_epl_v1_eoc_net_command              = -1;
static int hf_epl_v1_eoc_net_command_parameter    = -1;

static int hf_epl_v1_ainv_channel                 = -1;

static int hf_epl_v1_asnd_channel                 = -1;
static int hf_epl_v1_asnd_size                    = -1;
static int hf_epl_v1_asnd_data                    = -1;
static int hf_epl_v1_asnd_node_id                 = -1;
static int hf_epl_v1_asnd_hardware_revision       = -1;
static int hf_epl_v1_asnd_firmware_version        = -1;
static int hf_epl_v1_asnd_device_variant          = -1;
static int hf_epl_v1_asnd_poll_in_size            = -1;
static int hf_epl_v1_asnd_poll_out_size           = -1;

static gint ett_epl_v1 = -1;


static gint
dissect_epl_v1_soc(proto_tree *epl_v1_tree, tvbuff_t *tvb, gint offset)
{
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_soc_ms, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_soc_ps, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	offset += 1;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_soc_net_command, tvb, offset, 2, ENC_LITTLE_ENDIAN);
	offset += 2;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_soc_net_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
	offset += 4;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_soc_powerlink_cycle_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
	offset += 4;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_soc_net_command_parameter, tvb, offset, 32, ENC_NA);
	offset += 32;

	return offset;
}


static gint
dissect_epl_v1_eoc(proto_tree *epl_v1_tree, tvbuff_t *tvb, gint offset)
{
	offset += 1;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_eoc_net_command, tvb, offset, 2, ENC_LITTLE_ENDIAN);
	offset += 8;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_eoc_net_command_parameter, tvb, offset, 32, ENC_NA);
	offset += 32;

	return offset;
}


static gint
dissect_epl_v1_preq(proto_tree *epl_v1_tree, tvbuff_t *tvb, gint offset)
{
	guint16 len;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_preq_ms, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_preq_rd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	offset += 1;

	/* get length of data */
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_preq_poll_size_out, tvb, offset, 2, ENC_LITTLE_ENDIAN);
	len = tvb_get_letohs(tvb, offset);
	offset += 6;

	if(len>0){
		proto_tree_add_item(epl_v1_tree, hf_epl_v1_preq_out_data, tvb, offset, len, ENC_NA);
		offset += len;
	}

	return offset;
}



static gint
dissect_epl_v1_pres(proto_tree *epl_v1_tree, tvbuff_t *tvb, gint offset)
{
	guint16 len;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_pres_ms, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_pres_ex, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_pres_rs, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_pres_wa, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_pres_er, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_pres_rd, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	offset += 1;

	/* get length of data */
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_pres_poll_size_in, tvb, offset, 2, ENC_LITTLE_ENDIAN);
	len = tvb_get_letohs(tvb, offset);
	offset += 6;

	if(len>0){
		proto_tree_add_item(epl_v1_tree, hf_epl_v1_pres_in_data, tvb, offset, len, ENC_NA);
		offset += len;
	}

	return offset;
}



static gint
dissect_epl_v1_ainv(proto_tree *epl_v1_tree, tvbuff_t *tvb, gint offset)
{
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_ainv_channel, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	offset += 1;

	return offset;
}



static gint
dissect_epl_v1_asnd(proto_tree *epl_v1_tree, tvbuff_t *tvb, gint offset)
{
	guint8  epl_v1_asnd_channel;
	guint16 len;

	/* get ASnd channel */
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_channel, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	epl_v1_asnd_channel = tvb_get_guint8(tvb, offset);
	offset += 1;

	/* get length of data */
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
	len = tvb_get_letohs(tvb, offset);
	offset += 2;

	/* "Ident" or "Generic" channel? */
	if(epl_v1_asnd_channel == EPL_V1_AINV_IDENT){   /* Ident channel*/
		proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_node_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
		offset += 4;

		proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_hardware_revision, tvb, offset, 4, ENC_LITTLE_ENDIAN);
		offset += 4;

		proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_firmware_version, tvb, offset, 4, ENC_LITTLE_ENDIAN);
		offset += 4;

		proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_device_variant, tvb, offset, 4, ENC_LITTLE_ENDIAN);
		offset += 4;

		proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_poll_in_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
		offset += 4;

		proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_poll_out_size, tvb, offset, 4, ENC_LITTLE_ENDIAN);
		offset += 4;
	} else {   /* "Generic" and all other channels */
		proto_tree_add_item(epl_v1_tree, hf_epl_v1_asnd_data, tvb, offset, len, ENC_NA);
		offset += len;
	}

	return offset;
}



/* Code to actually dissect the packets */
static int
dissect_epl_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
	guint8  epl_v1_service, epl_v1_dest, epl_v1_src, epl_v1_ainv_ch, epl_v1_asnd_ch;
	gint    offset;
	proto_item *ti=NULL;
	proto_tree *epl_v1_tree=NULL;


	if(tvb_captured_length(tvb) < 3){
		/* Not enough data for an EPL_V1 header; don't try to interpret it */
		return FALSE;
	}

	offset = 0;

	/* make entries in Protocol column and Info column on summary display */
	col_set_str(pinfo->cinfo, COL_PROTOCOL, "EPL_V1");
	col_clear(pinfo->cinfo, COL_INFO);

	/* get service type */
	epl_v1_service = tvb_get_guint8(tvb, EPL_V1_SERVICE_OFFSET) & 0x7F;

	/* get destination */
	epl_v1_dest = tvb_get_guint8(tvb, EPL_V1_DEST_OFFSET);

	/* get source */
	epl_v1_src = tvb_get_guint8(tvb, EPL_V1_SRC_OFFSET);

	/* choose the right string for "Info" column */
	switch(epl_v1_service){
	case EPL_V1_SOC:
		col_add_fstr(pinfo->cinfo, COL_INFO, "SoC    dest = %3d   src = %3d   ", epl_v1_dest, epl_v1_src);
		break;

	case EPL_V1_EOC:
		col_add_fstr(pinfo->cinfo, COL_INFO, "EoC    dest = %3d   src = %3d   ", epl_v1_dest, epl_v1_src);
		break;

	case EPL_V1_PREQ:
		col_add_fstr(pinfo->cinfo, COL_INFO, "PReq   dest = %3d   src = %3d   ", epl_v1_dest, epl_v1_src);
		break;

	case EPL_V1_PRES:
		col_add_fstr(pinfo->cinfo, COL_INFO, "PRes   dest = %3d   src = %3d   ", epl_v1_dest, epl_v1_src);
		break;

	case EPL_V1_AINV:
		/* get AInv channel */
		epl_v1_ainv_ch = tvb_get_guint8(tvb, EPL_V1_AINV_CHANNEL_OFFSET);
		col_add_fstr(pinfo->cinfo, COL_INFO, "AInv   dest = %3d   src = %3d   channel = %s   ",
			epl_v1_dest, epl_v1_src, val_to_str(epl_v1_ainv_ch, ainv_channel_number_vals, "unknown Channel (%d)"));
		break;

	case EPL_V1_ASND:
		/* get ASnd channel */
		epl_v1_asnd_ch = tvb_get_guint8(tvb, EPL_V1_ASND_CHANNEL_OFFSET);
		col_add_fstr(pinfo->cinfo, COL_INFO, "ASnd   dest = %3d   src = %3d   channel = %s   ",
			epl_v1_dest, epl_v1_src, val_to_str(epl_v1_asnd_ch, asnd_channel_number_vals, "unknown Channel (%d)"));
		break;

	default:     /* no valid EPL packet */
		return FALSE;
	}

	if(tree){
		/* create display subtree for the protocol */
		ti = proto_tree_add_item(tree, proto_epl_v1, tvb, 0, -1, ENC_NA);

		epl_v1_tree = proto_item_add_subtree(ti, ett_epl_v1);
	}
	proto_tree_add_item(epl_v1_tree, hf_epl_v1_service, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	offset += 1;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_dest, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	offset += 1;

	proto_tree_add_item(epl_v1_tree, hf_epl_v1_src, tvb, offset, 1, ENC_LITTLE_ENDIAN);
	offset += 1;

	/* The rest of the epl_v1 dissector depends on the message type  */
	switch(epl_v1_service){
	case EPL_V1_SOC:
		offset = dissect_epl_v1_soc(epl_v1_tree, tvb, offset);
		break;

	case EPL_V1_EOC:
		offset = dissect_epl_v1_eoc(epl_v1_tree, tvb, offset);
		break;

	case EPL_V1_PREQ:
		offset = dissect_epl_v1_preq(epl_v1_tree, tvb, offset);
		break;

	case EPL_V1_PRES:
		offset = dissect_epl_v1_pres(epl_v1_tree, tvb,  offset);
		break;

	case EPL_V1_AINV:
		offset = dissect_epl_v1_ainv(epl_v1_tree, tvb,  offset);
		break;

	case EPL_V1_ASND:
		offset = dissect_epl_v1_asnd(epl_v1_tree, tvb,  offset);
		break;

	default: /* not a valid MessageType - can't dissect any further. */
		return FALSE;
	}
	return offset;
}



void
proto_register_epl_v1(void)
{
	static hf_register_info hf[] = {
		/* Common data fields (same for all message types) */
		{ &hf_epl_v1_service,
		  { "Service", "epl_v1.service",
		    FT_UINT8, BASE_DEC, VALS(service_vals), 0x7F,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_dest,
		  { "Destination", "epl_v1.dest",
		    FT_UINT8, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_src,
		  { "Source", "epl_v1.src",
		    FT_UINT8, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		/* SoC data fields*/
		{ &hf_epl_v1_soc_ms,
		  { "MS (Multiplexed Slot)", "epl_v1.soc.ms",
		    FT_UINT8, BASE_DEC, NULL, 0x80,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_soc_ps,
		  { "PS (Prescaled Slot)", "epl_v1.soc.ps",
		    FT_UINT8, BASE_DEC, NULL, 0x40,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_soc_net_command,
		  { "Net Command", "epl_v1.soc.netcommand",
		    FT_UINT16, BASE_DEC, VALS(soc_net_command_vals), 0x0,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_soc_net_time,
		  { "Net Time", "epl_v1.soc.nettime",
		    FT_UINT32, BASE_DEC, NULL, 0x0,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_soc_powerlink_cycle_time,
		  { "Cycle Time", "epl_v1.soc.cycletime",
		    FT_UINT32, BASE_DEC, NULL, 0x0,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_soc_net_command_parameter,
		  { "Net Command Parameter", "epl_v1.soc.netcommand.parameter",
		    FT_BYTES, BASE_NONE, NULL, 0x0,
		    NULL, HFILL }
		},
		/* PReq data fields*/
		{ &hf_epl_v1_preq_ms,
		  { "MS (Multiplexed Slot)", "epl_v1.preq.ms",
		    FT_UINT8, BASE_DEC, NULL, 0x20,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_preq_rd,
		  { "RD (Ready)", "epl_v1.preq.rd",
		    FT_UINT8, BASE_DEC, NULL, 0x01,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_preq_poll_size_out,
		  { "Poll Size OUT", "epl_v1.preq.pollsize",
		    FT_UINT16, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_preq_out_data,
		  { "OUT Data", "epl_v1.preq.data",
		    FT_BYTES, BASE_NONE, NULL, 0x00,
		    NULL, HFILL }
		},
		/* PRes data fields*/
		{ &hf_epl_v1_pres_ms,
		  { "MS (Multiplexed)", "epl_v1.pres.ms",
		    FT_UINT8, BASE_DEC, NULL, 0x20,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_pres_ex,
		  { "EX (Exception)", "epl_v1.pres.ex",
		    FT_UINT8, BASE_DEC, NULL, 0x10,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_pres_rs,
		  { "RS (Request to Send)", "epl_v1.pres.rs",
		    FT_UINT8, BASE_DEC, NULL, 0x08,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_pres_wa,
		  { "WA (Warning)", "epl_v1.pres.wa",
		    FT_UINT8, BASE_DEC, NULL, 0x04,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_pres_er,
		  { "ER (Error)", "epl_v1.pres.er",
		    FT_UINT8, BASE_DEC, NULL, 0x02,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_pres_rd,
		  { "RD (Ready)", "epl_v1.pres.rd",
		    FT_UINT8, BASE_DEC, NULL, 0x01,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_pres_poll_size_in,
		  { "Poll Size IN", "epl_v1.pres.pollsize",
		    FT_UINT16, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_pres_in_data,
		  { "IN Data", "epl_v1.pres.data",
		    FT_BYTES, BASE_NONE, NULL, 0x00,
		    NULL, HFILL }
		},
		/* EoC data fields*/
		{ &hf_epl_v1_eoc_net_command,
		  { "Net Command", "epl_v1.eoc.netcommand",
		    FT_UINT16, BASE_DEC, VALS(eoc_net_command_vals), 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_eoc_net_command_parameter,
		  { "Net Command Parameter", "epl_v1.soa.netcommand.parameter",
		    FT_BYTES, BASE_NONE, NULL, 0x00,
		    NULL, HFILL }
		},
		/* AInv data fields*/
		{ &hf_epl_v1_ainv_channel,
		  { "Channel", "epl_v1.ainv.channel",
		    FT_UINT8, BASE_DEC, VALS(ainv_channel_number_vals), 0x00,
		    NULL, HFILL }
		},
		/* ASnd data fields*/
		{ &hf_epl_v1_asnd_channel,
		  { "Channel", "epl_v1.asnd.channel",
		    FT_UINT8, BASE_DEC, VALS(asnd_channel_number_vals), 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_asnd_size,
		  { "Size", "epl_v1.asnd.size",
		    FT_UINT16, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_asnd_data,
		  { "Data", "epl_v1.asnd.data",
		    FT_BYTES, BASE_NONE, NULL, 0x00,
		    NULL, HFILL }
		},

		{ &hf_epl_v1_asnd_node_id,
		  { "NodeID", "epl_v1.asnd.node_id",
		    FT_UINT32, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_asnd_hardware_revision,
		  { "Hardware Revision", "epl_v1.asnd.hardware.revision",
		    FT_UINT32, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_asnd_firmware_version,
		  { "Firmware Version", "epl_v1.asnd.firmware.version",
		    FT_UINT32, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_asnd_device_variant,
		  { "Device Variant", "epl_v1.asnd.device.variant",
		    FT_UINT32, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_asnd_poll_in_size,
		  { "Poll IN Size", "epl_v1.asnd.poll.in.size",
		    FT_UINT32, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
		{ &hf_epl_v1_asnd_poll_out_size,
		  { "Poll OUT Size", "epl_v1.asnd.poll.out.size",
		    FT_UINT32, BASE_DEC, NULL, 0x00,
		    NULL, HFILL }
		},
	};

	/* Setup protocol subtree array */
	static gint *ett[] = {
		&ett_epl_v1,
	};

	/* Register the protocol name and description */
	proto_epl_v1 = proto_register_protocol("ETHERNET Powerlink V1.0", "EPL_V1", "epl_v1");

	/* Required function calls to register the header fields and subtrees used */
	proto_register_field_array(proto_epl_v1, hf, array_length(hf));
	proto_register_subtree_array(ett, array_length(ett));
}



void
proto_reg_handoff_epl_v1(void)
{
	dissector_handle_t epl_v1_handle;

	epl_v1_handle = create_dissector_handle(dissect_epl_v1, proto_epl_v1);
	dissector_add_uint("ethertype", ETHERTYPE_EPL_V1, epl_v1_handle);
}

/*
 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: t
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
 * :indentSize=8:tabSize=8:noTabs=false:
 */