summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-teklink.c
blob: cc486a3f762f4195876b5ce8cfa699532254ea0f (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
/* packet-teklink.c
 * Routines for TEKLINK dissection
 * Copyright (c)2010 Sven Schnelle <svens@stackframe.org>
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "config.h"

#include "packet-rpc.h"

#define PROGRAM_TEKLINK 0x20400034

void proto_reg_handoff_teklink(void);
void proto_register_teklink(void);

static int proto_teklink;
static int hf_teklink_procedure;
static int hf_teklink_unknown_long;
static int hf_teklink_unknown_string;
static int hf_teklink_cmd;
static int hf_teklink_user;
static int hf_teklink_host;
static int hf_teklink_location;
static int hf_teklink_tla_type;
static int hf_teklink_locked;
static int hf_teklink_vtc_srcnames;
static int hf_teklink_vtc_dstnames;
static int hf_teklink_vtc_sigpol;
static int hf_teklink_vtc_sigen;
static int hf_teklink_vtc_clksource;
static int hf_teklink_vtc_clkmode;
static int hf_teklink_vtc_clkedge;
static int hf_teklink_vtc_mode;
static int hf_teklink_vtc_edge;
static int hf_teklink_vtc_sigfeedback;

static int ett_teklink;

static const value_string teklink_vtc_srcnames[] = {
	{ 0, "VTC_SRC_APPSIG0" },
	{ 1, "VTC_SRC_APPSIG1" },
	{ 2, "VTC_SRC_APPSIG2" },
	{ 3, "VTC_SRC_APPSIG3" },
	{ 4, "VTC_SRC_APPSIG4" },
	{ 5, "VTC_SRC_APPSIG5" },
	{ 6, "VTC_SRC_APPSIG6" },
	{ 7, "VTC_SRC_APPSIG7" },
	{ 8, "VTC_SRC_APPSIG8" },
	{ 9, "VTC_SRC_APPSIG9" },
	{ 10, "VTC_SRC_APPSIG10" },
	{ 11, "VTC_SRC_APPSIG11" },
	{ 12, "VTC_SRC_TTLTRIG0" },
	{ 13, "VTC_SRC_TTLTRIG1" },
	{ 14, "VTC_SRC_TTLTRIG2" },
	{ 15, "VTC_SRC_TTLTRIG3" },
	{ 16, "VTC_SRC_TTLTRIG4" },
	{ 17, "VTC_SRC_TTLTRIG5" },
	{ 18, "VTC_SRC_TTLTRIG6" },
	{ 19, "VTC_SRC_TTLTRIG7" },
	{ 20, "VTC_SRC_XBAR1" },
	{ 21, "VTC_SRC_XBAR2" },
	{ 22, "VTC_SRC_ECLTRIG0" },
	{ 23, "VTC_SRC_ECLTRIG1" },
	{ 24, "VTC_SRC_ALL" },
	{ 25, "VTC_SRC_XXX" },
	{ 26, "VTC_SRC_XXX" },
	{ 27, "VTC_SRC_VCC" },
	{ 0, NULL },
};

static const value_string teklink_vtc_dstnames[] = {
	{ 0, "VTC_DST_APPSIG0" },
	{ 1, "VTC_DST_APPSIG1" },
	{ 2, "VTC_DST_APPSIG2" },
	{ 3, "VTC_DST_APPSIG3" },
	{ 4, "VTC_DST_APPSIG4" },
	{ 5, "VTC_DST_APPSIG5" },
	{ 6, "VTC_DST_APPSIG6" },
	{ 7, "VTC_DST_APPSIG7" },
	{ 8, "VTC_DST_APPSIG8" },
	{ 9, "VTC_DST_APPSIG9" },
	{ 10, "VTC_DST_APPSIG10" },
	{ 11, "VTC_DST_APPSIG11" },
	{ 12, "VTC_DST_TTLTRIG0" },
	{ 13, "VTC_DST_TTLTRIG1" },
	{ 14, "VTC_DST_TTLTRIG2" },
	{ 15, "VTC_DST_TTLTRIG3" },
	{ 16, "VTC_DST_TTLTRIG4" },
	{ 17, "VTC_DST_TTLTRIG5" },
	{ 18, "VTC_DST_TTLTRIG6" },
	{ 19, "VTC_DST_TTLTRIG7" },
	{ 20, "VTC_DST_XBAR1" },
	{ 21, "VTC_DST_XBAR2" },
	{ 22, "VTC_DST_ECLTRIG0" },
	{ 23, "VTC_DST_ECLTRIG1" },
	{ 24, "VTC_DST_ALL" },
	{ 0, NULL },
};

static const value_string teklink_vtc_sigen[] = {
	{ 0, "VTC_OUT_FORCE_OFF" },
	{ 1, "VTC_OUT_FORCE_ON" },
	{ 0, NULL },
};

static const value_string teklink_vtc_sigfeedback[] = {
	{ 0, "VTC_MODE_FEEDBK_OFF" },
	{ 1, "VTC_MODE_FEEDBK_ON" },
	{ 0, NULL },
};

static const value_string teklink_vtc_edge[] = {
	{ 0, "VTC_MODE_EDGE_FALL" },
	{ 1, "VTC_MODE_EDGE_RISE" },
	{ 0, NULL },
};

static const value_string teklink_vtc_sigpol[] = {
	{ 0, "VTC_OUT_POL_NORM" },
	{ 1, "VTC_OUT_POL_INVERT" },
	{ 0, NULL },
};

static const value_string teklink_vtc_clkmode[] = {
	{ 0, "VTC_CLK_MODE_ASYNCH" },
	{ 1, "VTC_CLK_MODE_SYNCH" },
	{ 0, NULL },
};

static const value_string teklink_vtc_clkedge[] = {
	{ 0, "VTC_CLK_EDGE_SENS_FALL" },
	{ 1, "VTC_CLK_EDGE_SENS_RISE" },
	{ 0, NULL },
};

static const value_string teklink_vtc_clksource[] = {
	{ 0, "VTC_CLK_SRC_GND" },
	{ 1, "VTC_CLK_SRC_1" },
	{ 2, "VTC_CLK_SRC_2" },
	{ 3, "VTC_CLK_SRC_CPUCLK" },
	{ 0, NULL },
};

static const value_string teklink_vtc_modes[] = {
	{ 0, "VTC_MODE_NONE" },
	{ 1, "VTC_MODE_1" },
	{ 2, "VTC_MODE_2" },
	{ 3, "VTC_MODE_3" },
	{ 4, "VTC_MODE_4" },
	{ 5, "VTC_MODE_5" },
	{ 6, "VTC_MODE_6" },
	{ 7, "VTC_MODE_EVENT_CNT_LAT" },
	{ 0, NULL },
};

static int dissect_teklink_tlaframeopen_call(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL);
	return offset;
}

static int dissect_teklink_tlaframeclose_call(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	return dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, 0);
}

static int dissect_teklink_tlaframeclose_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	return dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, 0);
}

static int dissect_teklink_tlaframeopen_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	return offset;
}

static int dissect_teklink_get_software_version_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL);
	return offset;
}

static int dissect_teklink_call65_call(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_cmd, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	return offset;
}

static int dissect_teklink_call65_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	return dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, 0);
}

static int dissect_teklink_info_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_locked, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_tla_type, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_location, offset, NULL);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_user, offset, NULL);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_host, offset, NULL);
	offset = dissect_rpc_string(tvb, tree, hf_teklink_unknown_string, offset, NULL);
	return offset;
}

static int dissect_teklink_info_call(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	return offset;
}


static int dissect_teklink_vtc_ident(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	return offset;
}

static int dissect_teklink_vtc_sigstatall(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	return offset;
}

static int dissect_teklink_vtc_outen(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	uint32_t sig = tvb_get_ntohl(tvb, offset);
	uint32_t sigon = tvb_get_ntohl(tvb, offset + 4);

	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_dstnames, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_sigen, offset);

	col_append_fstr(pinfo->cinfo, COL_INFO," %s, %s ",
			val_to_str(sig, teklink_vtc_dstnames, "Unknown destination %d"),
			sigon ? "VTC_OUT_FORCE_ON" : "VTC_OUT_FORCE_OFF");
	return offset;
}

static int dissect_teklink_vtc_map(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	uint32_t src, dst;
	int offset = 0;

	src = tvb_get_ntohl(tvb, offset);
	dst = tvb_get_ntohl(tvb, offset + 4);

	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_srcnames, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_dstnames, offset);

	col_append_fstr(pinfo->cinfo, COL_INFO," %s, %s ",
			val_to_str(src, teklink_vtc_srcnames, "Unknown source %d"),
			val_to_str(dst, teklink_vtc_dstnames, "Unknown destination %d"));
	return offset;
}

static int dissect_teklink_vtc_clk(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	uint32_t sig, clksource, clkedge, clkmode;
	int offset = 0;

	sig = tvb_get_ntohl(tvb, offset);
	clksource = tvb_get_ntohl(tvb, offset + 4);
	clkedge = tvb_get_ntohl(tvb, offset + 8);
	clkmode = tvb_get_ntohl(tvb, offset + 12);

	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_dstnames, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_clksource, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_clkedge, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_clkmode, offset);

	col_append_fstr(pinfo->cinfo, COL_INFO,"  %s, %s, %s, %s",
			val_to_str(sig, teklink_vtc_dstnames, "Unknown destination %d"),
			val_to_str(clksource, teklink_vtc_clksource, "Unknown clocksource %d"),
			val_to_str(clkedge, teklink_vtc_clkedge, "Unknown edge setting %d"),
			val_to_str(clkmode, teklink_vtc_clkmode, "Unknown mode setting %d"));
	return offset;
}

static int dissect_teklink_vtc_mode(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	uint32_t sig, edge, mode;
	int offset = 0;

	sig = tvb_get_ntohl(tvb, offset);
	edge = tvb_get_ntohl(tvb, offset + 4);
	mode = tvb_get_ntohl(tvb, offset + 12);

	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_dstnames, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_edge, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_mode, offset);

	col_append_fstr(pinfo->cinfo, COL_INFO," %s, %s, %s",
			val_to_str(sig, teklink_vtc_dstnames, "Unknown destination %d"),
			val_to_str(edge, teklink_vtc_edge, "Unknown edge setting %d"),
			val_to_str(mode, teklink_vtc_modes, "Unknown mode setting %d"));
	return offset;
}

static int dissect_teklink_vtc_outsetup(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	uint32_t sig, en, pol, feedback;
	int offset = 0;

	sig = tvb_get_ntohl(tvb, offset);
	en = tvb_get_ntohl(tvb, offset + 4);
	pol = tvb_get_ntohl(tvb, offset + 8);
	feedback = tvb_get_ntohl(tvb, offset + 12);

	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_dstnames, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_sigen, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_sigpol, offset);
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_sigfeedback, offset);

	col_append_fstr(pinfo->cinfo, COL_INFO," %s, %s, %s, %s",
			val_to_str(sig, teklink_vtc_dstnames, "Unknown destination %d"),
			val_to_str(pol, teklink_vtc_sigpol, "Unknown signal polarity %d"),
			val_to_str(en, teklink_vtc_sigen, "Unknown signal enable %d"),
			val_to_str(feedback, teklink_vtc_sigfeedback, "Unknown signal feedback setting %d"));
	return offset;
}

static int dissect_teklink_vtc_res(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	uint32_t sig = tvb_get_ntohl(tvb, offset);

	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_vtc_dstnames, offset);

	col_append_fstr(pinfo->cinfo, COL_INFO," %s",
			val_to_str(sig, teklink_vtc_dstnames, "Unknown destination %d"));
	return offset;
}

static int dissect_teklink_vtl_spinbits(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	int offset = 0;
	offset = dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, offset);
	return offset;
}

static int dissect_teklink_vtl_zmode(tvbuff_t *tvb, packet_info *pinfo _U_,
	proto_tree *tree, void* data _U_)
{
	return dissect_rpc_uint32(tvb, tree, hf_teklink_unknown_long, 0);
}

static const vsff teklink_proc[] = {
	{ 1, "TLAFrameOpen", dissect_teklink_tlaframeopen_call, dissect_teklink_tlaframeopen_reply },
	{ 2, "TLAFrameClose", dissect_teklink_tlaframeclose_call, dissect_teklink_tlaframeclose_reply },
	{ 3, "GetSoftwareVersion", dissect_rpc_void, dissect_teklink_get_software_version_reply },
	{ 4, "GetInfo", dissect_teklink_info_call, dissect_teklink_info_reply },
	{ 5, "VtcIdent", dissect_rpc_void, dissect_teklink_vtc_ident },
	{ 7, "VtcOutEn", dissect_teklink_vtc_outen, dissect_rpc_void },
	{ 8, "VtcMap", dissect_teklink_vtc_map, dissect_rpc_void },
	{ 9, "VtcOutSetup", dissect_teklink_vtc_outsetup, dissect_rpc_void },
	{ 10, "VtcClk", dissect_teklink_vtc_clk, dissect_rpc_void },
	{ 11, "VtcMode", dissect_teklink_vtc_mode, dissect_rpc_void },
	{ 12, "VtcRes", dissect_teklink_vtc_res, dissect_rpc_void },
	{ 13, "VtcHardRes", dissect_rpc_void, dissect_rpc_void },
	{ 14, "VtcSigStatAll", dissect_rpc_void, dissect_teklink_vtc_sigstatall },
	{ 20, "VtlZMode", dissect_rpc_void, dissect_teklink_vtl_zmode },
	{ 21, "VtlSpinBits", dissect_rpc_void, dissect_teklink_vtl_spinbits },
	{ 65, "Unknown (65)", dissect_teklink_call65_call, dissect_teklink_call65_reply },
	{ 0, NULL, NULL, NULL }
};

static const value_string teklink_proc_vals[] = {
	{ 1, "TLAFrameOpen" },
	{ 2, "TLAFrameClose" },
	{ 3, "TLAFrameGetStatus" },
	{ 4, "GetInfo" },
	{ 5, "VtcIdent" },
	{ 7, "VtcOutEn" },
	{ 8, "VtcMap" },
	{ 9, "VtcOutSetup" },
	{ 10, "VtcClk" },
	{ 11, "VtcMode" },
	{ 12, "VtcRes" },
	{ 13, "VtcHardRes" },
	{ 14, "VtcSigStatAll" },
	{ 15, "VtcPeek" },
	{ 16, "VtcPoke" },
	{ 20, "VtlZMode" },
	{ 21, "VtlSpinBits" },
	{ 30, "TLAFrameResetVISA" },
	{ 35, "VtcRemoteDiag" },
	{ 36, "TLAFrameRunPostDiag" },
	{ 37, "TLAFrameTigerAccess" },
	{ 40, "XXX" },
	{ 41, "XXX" },
	{ 42, "TLAGetFrameError" },
	{ 50, "TLAFileOpen" },
	{ 51, "TLAReadFile" },
	{ 52, "TLAWriteFile" },
	{ 53, "TLAFileClose" },
	{ 54, "TLAFlashImage" },

	{ 0, NULL }
};

static const rpc_prog_vers_info teklink_vers_info[] = {
	{ 1, teklink_proc, &hf_teklink_procedure },
};

#if 0
static const value_string teklink_error_vals[] = {
	{ 0, NULL }
};
#endif

static const value_string teklink_cmd_vals[] = {
	{ 0, "TLKFreeResources" },
	{ 1, "TLKCreateDeleteEventRoute" },
	{ 2, "TLKDeleteRoutesForSignal" },
	{ 3, "CanRequestBeRouted" },
	{ 4, "TLKIsRouted" },
	{ 5, "TLACreateSysRoutes" },
	{ 6, "TLAStart" },
	{ 7, "TLAGetFrameDelay" },
	{ 8, "TLAFrameRegisterCallBack" },
	{ 10, "TLAGetTrggerDelay" },
	{ 0, NULL }
};

static const value_string teklink_tla_types[] = {
	{ 0x02, "TLA711" },
	{ 0x03, "TLA714" },
	{ 0x04, "TLA720" },
	{ 0x05, "TLA60X" },
	{ 0x06, "TLA6XX" },
	{ 0x13, "TLA714A" },
	{ 0x14, "TLA715" },
	{ 0x15, "TLA721" },
	{ 0x16, "TLA520X" },
	{ 0x17, "TLA7012" },
	{ 0x18, "TLA7016" },
	{ 0x00, NULL }
};

void
proto_register_teklink(void)
{
	static hf_register_info hf_core[] = {
		{ &hf_teklink_procedure, {
				"Procedure", "teklink.procedure", FT_UINT8, BASE_DEC,
				VALS(teklink_proc_vals), 0, NULL, HFILL }},
		{ &hf_teklink_unknown_long, {
				"Unknown long", "teklink.long", FT_UINT32, BASE_HEX,
				NULL, 0, NULL, HFILL }},
		{ &hf_teklink_unknown_string, {
				"Unknown String", "teklink.string", FT_STRING, BASE_NONE,
				NULL, 0, NULL, HFILL }},
		{ &hf_teklink_cmd, {
				"Command", "teklink.command", FT_UINT32, BASE_DEC,
				VALS(teklink_cmd_vals), 0, NULL, HFILL }},
		{ &hf_teklink_tla_type, {
				"TLA Type", "teklink.tla_type", FT_UINT32, BASE_DEC,
				VALS(teklink_tla_types), 0, NULL, HFILL }},
		{ &hf_teklink_host, {
				"Host", "teklink.host", FT_STRING, BASE_NONE,
				NULL, 0, NULL, HFILL }},
		{ &hf_teklink_user, {
				"User", "teklink.user", FT_STRING, BASE_NONE,
				NULL, 0, NULL, HFILL }},
		{ &hf_teklink_location, {
				"Location", "teklink.location", FT_STRING, BASE_NONE,
				NULL, 0, NULL, HFILL }},
		{ &hf_teklink_locked, {
				"Locked", "teklink.locked", FT_UINT32, BASE_HEX,
				NULL, 0, NULL, HFILL }},
		{ &hf_teklink_vtc_dstnames, {
				"Destination signal", "teklink.signal.destination", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_dstnames), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_srcnames, {
				"Source signal", "teklink.signal.source", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_srcnames), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_sigen, {
				"Signal Enable", "teklink.signal.enable", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_sigen), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_sigpol, {
				"Signal Polarity", "teklink.signal.polarity", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_sigpol), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_clkmode, {
				"Clock Mode", "teklink.clock.mode", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_clkmode), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_clkedge, {
				"Clock Edge", "teklink.clock.clkedge", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_clkedge), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_clksource, {
				"Clock Source", "teklink.clock.source", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_clksource), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_mode, {
				"Signal Mode", "teklink.signal.mode", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_modes), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_edge, {
				"Signal Edge", "teklink.signal.edge", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_edge), 0, NULL, HFILL }},
		{ &hf_teklink_vtc_sigfeedback, {
				"Signal Feedbmode", "teklink.signal.feedback", FT_UINT32, BASE_HEX,
				VALS(teklink_vtc_sigfeedback), 0, NULL, HFILL }}
	};

	static int *ett[] = {
		&ett_teklink
	};

	proto_teklink = proto_register_protocol("TEKLINK", "TEKLINK", "teklink");
	proto_register_field_array(proto_teklink, hf_core, array_length(hf_core));
	proto_register_subtree_array(ett, array_length(ett));
}

void
proto_reg_handoff_teklink(void)
{
	/* Register the protocol as RPC */
	rpc_init_prog(proto_teklink, PROGRAM_TEKLINK, ett_teklink,
	    G_N_ELEMENTS(teklink_vers_info), teklink_vers_info);
}

/*
 * Editor modelines  -  https://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:
 */