Coverage Report

Created: 2026-11-12 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-uftp4.c
Line
Count
Source
1
/* packet-uftp4.c
2
 * Routines for UFTP version 4 packet dissection
3
 * Copyright Dennis Bush <bush@tcnj.edu>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
*/
11
12
#include "config.h"
13
14
#include <epan/packet.h>
15
#include <epan/expert.h>
16
#include <math.h>
17
18
4
#define UFTP_VER_NUM 0x40
19
20
0
#define ANNOUNCE       1
21
0
#define REGISTER       2
22
0
#define CLIENT_KEY     3
23
0
#define REG_CONF       4
24
1
#define KEYINFO        5
25
0
#define KEYINFO_ACK    6
26
0
#define FILEINFO       7
27
0
#define FILEINFO_ACK   8
28
0
#define FILESEG        9
29
0
#define DONE          10
30
0
#define STATUS        11
31
0
#define COMPLETE      12
32
0
#define DONE_CONF     13
33
4
#define HB_REQ        14
34
4
#define HB_RESP       15
35
0
#define KEY_REQ       16
36
0
#define PROXY_KEY     17
37
0
#define ENCRYPTED     18
38
0
#define ABORT         19
39
3
#define CONG_CTRL     20
40
0
#define CC_ACK        21
41
42
#define FTYPE_REG   0
43
#define FTYPE_DIR   1
44
#define FTYPE_LINK  2
45
#define FTYPE_DELETE    3
46
#define FTYPE_FREESPACE 4
47
48
#define KEY_NONE        0
49
#define KEY_DES         1
50
#define KEY_DES_EDE3    2
51
#define KEY_AES128_CBC  3
52
#define KEY_AES256_CBC  4
53
#define KEY_AES128_GCM  5
54
#define KEY_AES256_GCM  6
55
#define KEY_AES128_CCM  7
56
#define KEY_AES256_CCM  8
57
58
#define HASH_NONE   0
59
#define HASH_MD5    1
60
#define HASH_SHA1   2
61
#define HASH_SHA256 3
62
#define HASH_SHA384 4
63
#define HASH_SHA512 5
64
65
#define SIG_NONE    0
66
#define SIG_HMAC    1
67
#define SIG_KEYEX   2
68
#define SIG_AUTHENC 3
69
70
#define KEYEX_NONE          0
71
#define KEYEX_RSA           1
72
#define KEYEX_ECDH_RSA      2
73
#define KEYEX_ECDH_ECDSA    3
74
75
0
#define KEYBLOB_RSA     1
76
0
#define KEYBLOB_EC      2
77
78
#define CURVE_sect163k1     1
79
#define CURVE_sect163r1     2
80
#define CURVE_sect163r2     3
81
#define CURVE_sect193r1     4
82
#define CURVE_sect193r2     5
83
#define CURVE_sect233k1     6
84
#define CURVE_sect233r1     7
85
#define CURVE_sect239k1     8
86
#define CURVE_sect283k1     9
87
#define CURVE_sect283r1     10
88
#define CURVE_sect409k1     11
89
#define CURVE_sect409r1     12
90
#define CURVE_sect571k1     13
91
#define CURVE_sect571r1     14
92
#define CURVE_secp160k1     15
93
#define CURVE_secp160r1     16
94
#define CURVE_secp160r2     17
95
#define CURVE_secp192k1     18
96
#define CURVE_secp192r1     19
97
#define CURVE_secp224k1     20
98
#define CURVE_secp224r1     21
99
#define CURVE_secp256k1     22
100
#define CURVE_secp256r1     23
101
#define CURVE_secp384r1     24
102
#define CURVE_secp521r1     25
103
#define CURVE_prime192v1    CURVE_secp192r1
104
#define CURVE_prime256v1    CURVE_secp256r1
105
106
#define CC_NONE     0
107
#define CC_UFTP3    1
108
#define CC_TFMCC    2
109
#define CC_PGMCC    3
110
111
0
#define EXT_ENC_INFO        1
112
0
#define EXT_TFMCC_DATA_INFO 2
113
0
#define EXT_TFMCC_ACK_INFO  3
114
115
#define EXT_PGMCC_DATA_INFO 4
116
#define EXT_PGMCC_NAK_INFO  5
117
#define EXT_PGMCC_ACK_INFO  6
118
119
0
#define EXT_FREESPACE_INFO 7
120
121
16
#define FLAG_SYNC_MODE      0x01
122
16
#define FLAG_SYNC_PREVIEW   0x02
123
16
#define FLAG_IPV6           0x04
124
16
#define FLAG_ANNOUNCE_RESERVED 0xF8
125
126
16
#define FLAG_CLIENT_AUTH    0x01
127
16
#define FLAG_ENCINFO_RESERVED 0xFE
128
129
16
#define FLAG_PARTIAL        0x01
130
16
#define FLAG_FILEINFOACK_RESERVED 0xFE
131
132
16
#define FLAG_CURRENT_FILE   0x01
133
16
#define FLAG_ABORT_RESERVED 0xFE
134
135
32
#define FLAG_CC_CLR         0x01
136
32
#define FLAG_CC_RTT         0x02
137
32
#define FLAG_CC_START       0x04
138
32
#define FLAG_CC_LEAVE       0x08
139
32
#define FLAG_CC_RESERVED    0xF0
140
141
#define COMP_STAT_NORMAL    0
142
#define COMP_STAT_SKIPPED   1
143
#define COMP_STAT_OVERWRITE 2
144
#define COMP_STAT_REJECTED  3
145
146
#define HB_AUTH_FAILED      0
147
#define HB_AUTH_OK          1
148
#define HB_AUTH_CHALLENGE   2
149
150
#define MAXFILENAME 100
151
#define MAXDIRNAME 200
152
#define MAXPATHNAME 300
153
#define MAXBACKUPPATHNAME 600
154
#define MAXPROXYDEST 1000
155
#define MAXDIR 10
156
#define MAXSECTION 65536
157
158
#define DESTNAME_LEN 80
159
#define IFNAME_LEN 25
160
#define MAX_INTERFACES 100
161
#define IPSTR_LEN 16
162
163
#define PUBKEY_LEN 256  /* big enough for RSA-2048 */
164
0
#define RAND_LEN 32     /* rfc 5246 */
165
#define HMAC_LEN 64     /* big enough for SHA-512 */
166
0
#define VERIFY_LEN 12   /* rfc 5246 */
167
#define MASTER_LEN 48   /* rfc 5246 */
168
#define MAXIV 16        /* big enough for AES256 */
169
#define MAXKEY 32       /* big enough for AES256 */
170
#define KEYBLSIZE 16    /* Maximum symmetric key blocksize */
171
#define DEF_RSA_LEN 512 /* Default length of generated RSA keys */
172
#define RSA_EXP 65537   /* Public key exponent of generated RSA keys */
173
#define SALT_LEN 4      /* Length of salt for IV */
174
#define GCM_IV_LEN 12   /* Length of IV for ciphers in GCM mode */
175
#define CCM_IV_LEN 12   /* Length of IV for ciphers in CCM mode */
176
#define GCM_TAG_LEN 16  /* Length of tag for ciphers in GCM mode */
177
#define CCM_TAG_LEN 16  /* Length of tag for ciphers in CCM mode */
178
179
8
#define UFTP_LEN 16
180
0
#define ANNOUNCE_LEN 16
181
0
#define ENC_INFO_LEN 44
182
0
#define REGISTER_LEN 44
183
0
#define CLIENT_KEY_LEN 8
184
0
#define REG_CONF_LEN 4
185
2
#define KEYINFO_LEN 12
186
20
#define DESTKEY_LEN 52
187
0
#define KEYINFO_ACK_LEN 16
188
0
#define FILEINFO_LEN 28
189
0
#define FILEINFO_ACK_LEN 16
190
0
#define FILESEG_LEN 8
191
0
#define TFMCC_DATA_LEN 8
192
0
#define DONE_LEN 8
193
0
#define STATUS_LEN 8
194
0
#define COMPLETE_LEN 8
195
0
#define FREESPACE_LEN 12
196
0
#define DONE_CONF_LEN 4
197
0
#define HB_REQ_LEN 12
198
0
#define HB_RESP_LEN 8
199
0
#define KEY_REQ_LEN 4
200
0
#define PROXY_KEY_LEN 12
201
0
#define ENCRYPTED_LEN 12
202
0
#define ABORT_LEN 308
203
6
#define CONG_CTRL_LEN 16
204
282
#define CC_ITEM_LEN 8
205
0
#define CC_ACK_LEN 4
206
0
#define TFMCC_ACK_LEN 20
207
0
#define RSA_BLOB_LEN 8
208
0
#define EC_BLOB_LEN 4
209
210
void proto_register_uftp4(void);
211
212
static int proto_uftp;
213
214
/* main header and common fields */
215
static int hf_uftp_version;
216
static int hf_uftp_func;
217
static int hf_uftp_seq;
218
static int hf_uftp_src_id;
219
static int hf_uftp_group_id;
220
static int hf_uftp_group_inst;
221
static int hf_uftp_grtt;
222
static int hf_uftp_gsize;
223
static int hf_uftp_reserved;
224
225
static int hf_uftp_destlist;
226
static int hf_uftp_dest;
227
228
/* ANNOUNCE fields */
229
static int hf_uftp_announce;
230
static int hf_uftp_announce_func;
231
static int hf_uftp_announce_hlen;
232
static int hf_uftp_announce_flags;
233
static int hf_uftp_announce_flags_sync;
234
static int hf_uftp_announce_flags_syncpreview;
235
static int hf_uftp_announce_flags_ipv6;
236
static int hf_uftp_announce_flags_reserved;
237
static int hf_uftp_announce_robust;
238
static int hf_uftp_announce_cc_type;
239
static int hf_uftp_announce_reserved;
240
static int hf_uftp_announce_blocksize;
241
static int hf_uftp_announce_tstamp;
242
static int hf_uftp_announce_publicmcast_ipv4;
243
static int hf_uftp_announce_publicmcast_ipv6;
244
static int hf_uftp_announce_privatemcast_ipv4;
245
static int hf_uftp_announce_privatemcast_ipv6;
246
247
/* EXT_ENC_INFO fields */
248
static int hf_uftp_encinfo;
249
static int hf_uftp_encinfo_exttype;
250
static int hf_uftp_encinfo_extlen;
251
static int hf_uftp_encinfo_flags;
252
static int hf_uftp_encinfo_flags_client_auth;
253
static int hf_uftp_encinfo_flags_reserved;
254
static int hf_uftp_encinfo_keyextype;
255
static int hf_uftp_encinfo_sigtype;
256
static int hf_uftp_encinfo_keytype;
257
static int hf_uftp_encinfo_hashtype;
258
static int hf_uftp_encinfo_keylen;
259
static int hf_uftp_encinfo_dhlen;
260
static int hf_uftp_encinfo_siglen;
261
static int hf_uftp_encinfo_rand1;
262
static int hf_uftp_encinfo_keyblob;
263
static int hf_uftp_encinfo_dhblob;
264
static int hf_uftp_encinfo_sig;
265
266
/* rsa_blob_t fields */
267
static int hf_uftp_rsablob_blobtype;
268
static int hf_uftp_rsablob_reserved;
269
static int hf_uftp_rsablob_modlen;
270
static int hf_uftp_rsablob_exponent;
271
static int hf_uftp_rsablob_modulus;
272
273
/* ec_blob_t fields */
274
static int hf_uftp_ecblob_blobtype;
275
static int hf_uftp_ecblob_curve;
276
static int hf_uftp_ecblob_keylen;
277
static int hf_uftp_ecblob_key;
278
279
/* REGISTER fields */
280
static int hf_uftp_register;
281
static int hf_uftp_register_func;
282
static int hf_uftp_register_hlen;
283
static int hf_uftp_register_keyinfo_len;
284
static int hf_uftp_register_tstamp;
285
static int hf_uftp_register_rand2;
286
static int hf_uftp_register_keyinfo;
287
288
/* CLIENT_KEY fields */
289
static int hf_uftp_clientkey;
290
static int hf_uftp_clientkey_func;
291
static int hf_uftp_clientkey_hlen;
292
static int hf_uftp_clientkey_reserved;
293
static int hf_uftp_clientkey_bloblen;
294
static int hf_uftp_clientkey_siglen;
295
static int hf_uftp_clientkey_keyblob;
296
static int hf_uftp_clientkey_verify;
297
298
/* REG_CONF fields */
299
static int hf_uftp_regconf;
300
static int hf_uftp_regconf_func;
301
static int hf_uftp_regconf_hlen;
302
static int hf_uftp_regconf_reserved;
303
304
/* KEYINFO fields */
305
static int hf_uftp_keyinfo;
306
static int hf_uftp_keyinfo_func;
307
static int hf_uftp_keyinfo_hlen;
308
static int hf_uftp_keyinfo_reserved;
309
static int hf_uftp_keyinfo_ivctr;
310
static int hf_uftp_keyinfo_destkey;
311
static int hf_uftp_keyinfo_destid;
312
static int hf_uftp_keyinfo_groupmaster;
313
314
/* KEYINFO_ACK fields */
315
static int hf_uftp_keyinfoack;
316
static int hf_uftp_keyinfoack_func;
317
static int hf_uftp_keyinfoack_hlen;
318
static int hf_uftp_keyinfoack_reserved;
319
static int hf_uftp_keyinfoack_verify_data;
320
321
/* FILEINFO fields */
322
static int hf_uftp_fileinfo;
323
static int hf_uftp_fileinfo_func;
324
static int hf_uftp_fileinfo_hlen;
325
static int hf_uftp_fileinfo_file_id;
326
static int hf_uftp_fileinfo_ftype;
327
static int hf_uftp_fileinfo_reserved;
328
static int hf_uftp_fileinfo_namelen;
329
static int hf_uftp_fileinfo_linklen;
330
static int hf_uftp_fileinfo_fsize;
331
static int hf_uftp_fileinfo_ftstamp;
332
static int hf_uftp_fileinfo_tstamp;
333
static int hf_uftp_fileinfo_name;
334
static int hf_uftp_fileinfo_link;
335
336
/* FILEINFO_ACK fields */
337
static int hf_uftp_fileinfoack;
338
static int hf_uftp_fileinfoack_func;
339
static int hf_uftp_fileinfoack_hlen;
340
static int hf_uftp_fileinfoack_file_id;
341
static int hf_uftp_fileinfoack_flags;
342
static int hf_uftp_fileinfoack_flags_partial;
343
static int hf_uftp_fileinfoack_flags_reserved;
344
static int hf_uftp_fileinfoack_reserved;
345
static int hf_uftp_fileinfoack_tstamp;
346
347
/* FILESEG fields */
348
static int hf_uftp_fileseg;
349
static int hf_uftp_fileseg_func;
350
static int hf_uftp_fileseg_hlen;
351
static int hf_uftp_fileseg_file_id;
352
static int hf_uftp_fileseg_section;
353
static int hf_uftp_fileseg_sec_block;
354
static int hf_uftp_fileseg_data;
355
356
/* EXT_TFMCC_DATA_INFO fields */
357
static int hf_uftp_tfmccdata;
358
static int hf_uftp_tfmccdata_exttype;
359
static int hf_uftp_tfmccdata_extlen;
360
static int hf_uftp_tfmccdata_send_rate;
361
static int hf_uftp_tfmccdata_cc_seq;
362
static int hf_uftp_tfmccdata_cc_rate;
363
364
/* DONE fields */
365
static int hf_uftp_done;
366
static int hf_uftp_done_func;
367
static int hf_uftp_done_hlen;
368
static int hf_uftp_done_file_id;
369
static int hf_uftp_done_section;
370
static int hf_uftp_done_reserved;
371
372
/* STATUS fields */
373
static int hf_uftp_status;
374
static int hf_uftp_status_func;
375
static int hf_uftp_status_hlen;
376
static int hf_uftp_status_file_id;
377
static int hf_uftp_status_section;
378
static int hf_uftp_status_reserved;
379
static int hf_uftp_status_naks;
380
381
/* COMPLETE fields */
382
static int hf_uftp_complete;
383
static int hf_uftp_complete_func;
384
static int hf_uftp_complete_hlen;
385
static int hf_uftp_complete_file_id;
386
static int hf_uftp_complete_status;
387
static int hf_uftp_complete_reserved;
388
389
/* EXT_FREESPACE_INFO fields */
390
static int hf_uftp_freespace;
391
static int hf_uftp_freespace_exttype;
392
static int hf_uftp_freespace_extlen;
393
static int hf_uftp_freespace_reserved;
394
static int hf_uftp_freespace_freespace;
395
396
/* DONE_CONF fields */
397
static int hf_uftp_doneconf;
398
static int hf_uftp_doneconf_func;
399
static int hf_uftp_doneconf_hlen;
400
static int hf_uftp_doneconf_reserved;
401
402
/* HB_REQ fields */
403
static int hf_uftp_hbreq;
404
static int hf_uftp_hbreq_func;
405
static int hf_uftp_hbreq_hlen;
406
static int hf_uftp_hbreq_reserved;
407
static int hf_uftp_hbreq_bloblen;
408
static int hf_uftp_hbreq_siglen;
409
static int hf_uftp_hbreq_nonce;
410
static int hf_uftp_hbreq_keyblob;
411
static int hf_uftp_hbreq_verify;
412
413
/* HB_RESP fields */
414
static int hf_uftp_hbresp;
415
static int hf_uftp_hbresp_func;
416
static int hf_uftp_hbresp_hlen;
417
static int hf_uftp_hbresp_authenticated;
418
static int hf_uftp_hbresp_reserved;
419
static int hf_uftp_hbresp_nonce;
420
421
/* KEY_REQ fields */
422
static int hf_uftp_keyreq;
423
static int hf_uftp_keyreq_func;
424
static int hf_uftp_keyreq_hlen;
425
static int hf_uftp_keyreq_reserved;
426
427
/* PROXY_KEY fields */
428
static int hf_uftp_proxykey;
429
static int hf_uftp_proxykey_func;
430
static int hf_uftp_proxykey_hlen;
431
static int hf_uftp_proxykey_bloblen;
432
static int hf_uftp_proxykey_dhlen;
433
static int hf_uftp_proxykey_siglen;
434
static int hf_uftp_proxykey_nonce;
435
static int hf_uftp_proxykey_keyblob;
436
static int hf_uftp_proxykey_dhblob;
437
static int hf_uftp_proxykey_verify;
438
439
/* CONG_CTRL fields */
440
static int hf_uftp_congctrl;
441
static int hf_uftp_congctrl_func;
442
static int hf_uftp_congctrl_hlen;
443
static int hf_uftp_congctrl_reserved;
444
static int hf_uftp_congctrl_cc_seq;
445
static int hf_uftp_congctrl_cc_rate;
446
static int hf_uftp_congctrl_tstamp;
447
static int hf_uftp_congctrl_cclist;
448
static int hf_uftp_congctrl_item;
449
static int hf_uftp_congctrl_item_destid;
450
static int hf_uftp_congctrl_item_flags;
451
static int hf_uftp_congctrl_item_flags_clr;
452
static int hf_uftp_congctrl_item_flags_rtt;
453
static int hf_uftp_congctrl_item_flags_start;
454
static int hf_uftp_congctrl_item_flags_leave;
455
static int hf_uftp_congctrl_item_flags_reserved;
456
static int hf_uftp_congctrl_item_rtt;
457
static int hf_uftp_congctrl_item_rate;
458
459
/* CC_ACK fields */
460
static int hf_uftp_ccack;
461
static int hf_uftp_ccack_func;
462
static int hf_uftp_ccack_hlen;
463
static int hf_uftp_ccack_reserved;
464
465
/* EXT_TFMCC_ACK_INFO fields */
466
static int hf_uftp_tfmccack;
467
static int hf_uftp_tfmccack_exttype;
468
static int hf_uftp_tfmccack_extlen;
469
static int hf_uftp_tfmccack_flags;
470
static int hf_uftp_tfmccack_flags_clr;
471
static int hf_uftp_tfmccack_flags_rtt;
472
static int hf_uftp_tfmccack_flags_start;
473
static int hf_uftp_tfmccack_flags_leave;
474
static int hf_uftp_tfmccack_flags_reserved;
475
static int hf_uftp_tfmccack_reserved;
476
static int hf_uftp_tfmccack_cc_seq;
477
static int hf_uftp_tfmccack_cc_rate;
478
static int hf_uftp_tfmccack_client_id;
479
static int hf_uftp_tfmccack_tstamp;
480
481
/* ENCRYPTED fields */
482
static int hf_uftp_encrypted;
483
static int hf_uftp_encrypted_ivctr;
484
static int hf_uftp_encrypted_sig_len;
485
static int hf_uftp_encrypted_payload_len;
486
static int hf_uftp_encrypted_signature;
487
static int hf_uftp_encrypted_payload;
488
489
/* ABORT fields */
490
static int hf_uftp_abort;
491
static int hf_uftp_abort_func;
492
static int hf_uftp_abort_hlen;
493
static int hf_uftp_abort_flags;
494
static int hf_uftp_abort_flags_curfile;
495
static int hf_uftp_abort_flags_reserved;
496
static int hf_uftp_abort_reserved;
497
static int hf_uftp_abort_clientid;
498
static int hf_uftp_abort_message;
499
500
static int ett_uftp;
501
static int ett_uftp_announce;
502
static int ett_uftp_register;
503
static int ett_uftp_clientkey;
504
static int ett_uftp_regconf;
505
static int ett_uftp_keyinfo;
506
static int ett_uftp_keyinfoack;
507
static int ett_uftp_fileinfo;
508
static int ett_uftp_fileinfoack;
509
static int ett_uftp_fileseg;
510
static int ett_uftp_done;
511
static int ett_uftp_status;
512
static int ett_uftp_complete;
513
static int ett_uftp_doneconf;
514
static int ett_uftp_hbreq;
515
static int ett_uftp_hbresp;
516
static int ett_uftp_keyreq;
517
static int ett_uftp_proxykey;
518
static int ett_uftp_congctrl;
519
static int ett_uftp_ccack;
520
static int ett_uftp_encrypted;
521
static int ett_uftp_abort;
522
523
static int ett_uftp_announce_flags;
524
static int ett_uftp_encinfo;
525
static int ett_uftp_encinfo_flags;
526
static int ett_uftp_keyinfo_destkey;
527
static int ett_uftp_fileinfoack_flags;
528
static int ett_uftp_congctrl_cclist;
529
static int ett_uftp_congctrl_item;
530
static int ett_uftp_congctrl_item_flags;
531
static int ett_uftp_tfmccdata;
532
static int ett_uftp_tfmccack;
533
static int ett_uftp_tfmccack_flags;
534
static int ett_uftp_freespace;
535
static int ett_uftp_abort_flags;
536
537
static int ett_uftp_destlist;
538
static int ett_uftp_rsablob;
539
static int ett_uftp_ecblob;
540
541
static expert_field ei_uftp_length_invalid;
542
static expert_field ei_uftp_func_unknown;
543
544
static const value_string messages[] = {
545
    { ANNOUNCE,      "ANNOUNCE" },
546
    { REGISTER,      "REGISTER" },
547
    { CLIENT_KEY,    "CLIENT_KEY" },
548
    { REG_CONF,      "REG_CONF" },
549
    { KEYINFO,       "KEYINFO" },
550
    { KEYINFO_ACK,   "KEYINFO_ACK" },
551
    { FILEINFO,      "FILEINFO" },
552
    { FILEINFO_ACK,  "FILEINFO_ACK" },
553
    { FILESEG,       "FILESEG" },
554
    { DONE,          "DONE" },
555
    { STATUS,        "STATUS" },
556
    { COMPLETE,      "COMPLETE" },
557
    { DONE_CONF,     "DONE_CONF" },
558
    { HB_REQ,        "HB_REQ" },
559
    { HB_RESP,       "HB_RESP" },
560
    { KEY_REQ,       "KEY_REQ" },
561
    { PROXY_KEY,     "PROXY_KEY" },
562
    { ENCRYPTED,     "ENCRYPTED" },
563
    { ABORT,         "ABORT" },
564
    { CONG_CTRL,     "CONG_CTRL" },
565
    { CC_ACK,        "CC_ACK" },
566
    { 0, NULL }
567
};
568
569
static const value_string extensions[] = {
570
    { EXT_ENC_INFO,         "EXT_ENC_INFO" },
571
    { EXT_TFMCC_DATA_INFO,  "EXT_TFMCC_DATA_INFO" },
572
    { EXT_TFMCC_ACK_INFO,   "EXT_TFMCC_ACK_INFO" },
573
    { EXT_PGMCC_DATA_INFO,  "EXT_PGMCC_DATA_INFO" },
574
    { EXT_PGMCC_NAK_INFO,   "EXT_PGMCC_NAK_INFO" },
575
    { EXT_PGMCC_ACK_INFO,   "EXT_PGMCC_ACK_INFO" },
576
    { EXT_FREESPACE_INFO,   "EXT_FREESPACE_INFO" },
577
    { 0, NULL }
578
};
579
580
static const value_string cc_types[] = {
581
    { CC_NONE,  "NONE" },
582
    { CC_UFTP3,  "UFTP3" },
583
    { CC_TFMCC,  "TFMCC" },
584
    { CC_PGMCC,  "PGMCC" },
585
    { 0, NULL }
586
};
587
588
static const value_string keyblob_types[] = {
589
    { KEYBLOB_RSA,  "RSA" },
590
    { KEYBLOB_EC,   "EC" },
591
    { 0, NULL }
592
};
593
594
static const value_string curves[] = {
595
    { CURVE_sect163k1,  "sect163k1" },
596
    { CURVE_sect163r1,  "sect163r1" },
597
    { CURVE_sect163r2,  "sect163r2" },
598
    { CURVE_sect193r1,  "sect193r1" },
599
    { CURVE_sect193r2,  "sect193r2" },
600
    { CURVE_sect233k1,  "sect233k1" },
601
    { CURVE_sect233r1,  "sect233r1" },
602
    { CURVE_sect239k1,  "sect239k1" },
603
    { CURVE_sect283k1,  "sect283k1" },
604
    { CURVE_sect283r1,  "sect283r1" },
605
    { CURVE_sect409k1,  "sect409k1" },
606
    { CURVE_sect409r1,  "sect409r1" },
607
    { CURVE_sect571k1,  "sect571k1" },
608
    { CURVE_sect571r1,  "sect571r1" },
609
    { CURVE_secp160k1,  "secp160k1" },
610
    { CURVE_secp160r1,  "secp160r1" },
611
    { CURVE_secp160r2,  "secp160r2" },
612
    { CURVE_secp192k1,  "secp192k1" },
613
    { CURVE_secp192r1,  "prime192v1" },
614
    { CURVE_secp224k1,  "secp224k1" },
615
    { CURVE_secp224r1,  "secp224r1" },
616
    { CURVE_secp256k1,  "secp256k1" },
617
    { CURVE_secp256r1,  "prime256v1" },
618
    { CURVE_secp384r1,  "secp384r1" },
619
    { CURVE_secp521r1,  "secp521r1" },
620
    { 0, NULL }
621
};
622
623
624
static const value_string keyexchange_types[] = {
625
    { KEYEX_NONE,       "NONE" },
626
    { KEYEX_RSA,        "RSA" },
627
    { KEYEX_ECDH_RSA,   "ECDH_RSA" },
628
    { KEYEX_ECDH_ECDSA, "ECDH_ECDSA" },
629
    { 0, NULL }
630
};
631
632
static const value_string signature_types[] = {
633
    { SIG_NONE,     "NONE" },
634
    { SIG_HMAC,     "HMAC" },
635
    { SIG_KEYEX,    "KEYEX" },
636
    { SIG_AUTHENC,  "AUTHENC" },
637
    { 0, NULL }
638
};
639
640
static const value_string hash_types[] = {
641
    { HASH_NONE,   "NONE" },
642
    { HASH_MD5,    "MD5" },
643
    { HASH_SHA1,   "SHA-1" },
644
    { HASH_SHA256, "SHA-256" },
645
    { HASH_SHA384, "SHA-384" },
646
    { HASH_SHA512, "SHA-512" },
647
    { 0, NULL }
648
};
649
650
static const value_string key_types[] = {
651
    { KEY_NONE,         "NONE" },
652
    { KEY_DES,          "DES" },
653
    { KEY_DES_EDE3,     "3 Key Triple DES" },
654
    { KEY_AES128_CBC,   "AES-128-CBC" },
655
    { KEY_AES256_CBC,   "AES-256-CBC" },
656
    { KEY_AES128_GCM,   "AES-128-GCM" },
657
    { KEY_AES256_GCM,   "AES-256-GCM" },
658
    { KEY_AES128_CCM,   "AES-128-CCM" },
659
    { KEY_AES256_CCM,   "AES-256-CCM" },
660
    { 0, NULL }
661
};
662
663
static const value_string hb_auth_types[] = {
664
    { HB_AUTH_FAILED,    "Authorization Failed" },
665
    { HB_AUTH_OK,        "Authorization Succeeded" },
666
    { HB_AUTH_CHALLENGE, "Authorization Required" },
667
    { 0, NULL }
668
};
669
670
static const value_string file_types[] = {
671
    { FTYPE_REG,        "Regular file" },
672
    { FTYPE_DIR,        "Directory" },
673
    { FTYPE_LINK,       "Symbolic link" },
674
    { FTYPE_DELETE,     "Delete request" },
675
    { FTYPE_FREESPACE,  "Free space request" },
676
    { 0, NULL }
677
};
678
679
static int * const announce_flags[] = {
680
    &hf_uftp_announce_flags_sync,
681
    &hf_uftp_announce_flags_syncpreview,
682
    &hf_uftp_announce_flags_ipv6,
683
    &hf_uftp_announce_flags_reserved,
684
    NULL
685
};
686
687
static int * const encinfo_flags[] = {
688
    &hf_uftp_encinfo_flags_client_auth,
689
    &hf_uftp_encinfo_flags_reserved,
690
    NULL
691
};
692
693
static int * const fileinfoack_flags[] = {
694
    &hf_uftp_fileinfoack_flags_partial,
695
    &hf_uftp_fileinfoack_flags_reserved,
696
    NULL
697
};
698
699
static int * const abort_flags[] = {
700
    &hf_uftp_abort_flags_curfile,
701
    &hf_uftp_abort_flags_reserved,
702
    NULL
703
};
704
705
static int * const cc_item_flags[] = {
706
    &hf_uftp_congctrl_item_flags_clr,
707
    &hf_uftp_congctrl_item_flags_rtt,
708
    &hf_uftp_congctrl_item_flags_start,
709
    &hf_uftp_congctrl_item_flags_leave,
710
    &hf_uftp_congctrl_item_flags_reserved,
711
    NULL
712
};
713
714
static int * const tfmcc_ack_flags[] = {
715
    &hf_uftp_tfmccack_flags_clr,
716
    &hf_uftp_tfmccack_flags_rtt,
717
    &hf_uftp_tfmccack_flags_start,
718
    &hf_uftp_tfmccack_flags_leave,
719
    &hf_uftp_tfmccack_flags_reserved,
720
    NULL
721
};
722
723
static const value_string comp_status[] = {
724
    { COMP_STAT_NORMAL,     "Normal" },
725
    { COMP_STAT_SKIPPED,    "Skipped" },
726
    { COMP_STAT_OVERWRITE,  "Overwrite" },
727
    { COMP_STAT_REJECTED,   "Rejected" },
728
    { 0, NULL }
729
};
730
731
138
#define RTT_MIN 1.0e-6
732
142
#define RTT_MAX 1000.0
733
734
static double unquantize_grtt(uint8_t rtt)
735
280
{
736
280
    return ((rtt <= 31) ?
737
138
            (((double)(rtt + 1)) * (double)RTT_MIN) :
738
280
            (RTT_MAX / exp(((double)(255 - rtt)) / (double)13.0)));
739
280
}
740
741
static unsigned unquantize_gsize(uint8_t size)
742
4
{
743
4
    int E, i;
744
4
    double rval;
745
746
4
    E = size & 0x7;
747
4
    rval =  (size >> 3) * (10.0 / 32.0);
748
8
    for (i = 0; i < E; i++) {
749
4
        rval *= 10;
750
4
    }
751
752
4
    return (unsigned)(rval + 0.5);
753
4
}
754
755
static unsigned unquantize_rate(uint16_t rate)
756
279
{
757
279
    int E, i;
758
279
    double rval;
759
760
279
    E = rate & 0xF;
761
279
    rval = (rate >> 4) * (10.0 / 4096.0);
762
1.59k
    for (i = 0; i < E; i++) {
763
1.32k
        rval *= 10;
764
1.32k
    }
765
766
279
    return (unsigned)rval;
767
279
}
768
769
static int dissect_uftp_rsablob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int tree_hf)
770
0
{
771
0
    proto_item *ti = NULL;
772
0
    proto_tree *rsablob_tree = NULL;
773
0
    unsigned offset = 0, modlen;
774
775
0
    if (tvb_reported_length(tvb) < RSA_BLOB_LEN) {
776
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
777
0
                            "Invalid length: %d", tvb_reported_length(tvb));
778
0
        return 0;
779
0
    }
780
781
0
    modlen = (int)tvb_get_ntohs(tvb, 2);
782
0
    if (tvb_reported_length(tvb) < modlen + RSA_BLOB_LEN) {
783
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
784
0
                            "Invalid length, len = %d", tvb_reported_length(tvb));
785
0
        return 0;
786
0
    }
787
788
0
    ti = proto_tree_add_item(tree, tree_hf, tvb, offset, RSA_BLOB_LEN + modlen, ENC_NA);
789
0
    rsablob_tree = proto_item_add_subtree(ti, ett_uftp_rsablob);
790
0
    proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_blobtype, tvb, offset, 1, ENC_BIG_ENDIAN);
791
0
    offset += 1;
792
0
    proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
793
0
    offset += 1;
794
0
    proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_modlen, tvb, offset, 2, ENC_BIG_ENDIAN);
795
0
    offset += 2;
796
0
    proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_exponent, tvb, offset, 4, ENC_BIG_ENDIAN);
797
0
    offset += 4;
798
0
    proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_modulus, tvb, offset, modlen, ENC_NA);
799
800
0
    return RSA_BLOB_LEN + modlen;
801
0
}
802
803
static int dissect_uftp_ecblob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int tree_hf)
804
0
{
805
0
    proto_item *ti = NULL;
806
0
    proto_tree *ecblob_tree = NULL;
807
0
    unsigned offset = 0, keylen;
808
809
0
    if (tvb_reported_length(tvb) < EC_BLOB_LEN) {
810
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
811
0
                            "Invalid length: %d", tvb_reported_length(tvb));
812
0
        return 0;
813
0
    }
814
815
0
    keylen = (int)tvb_get_ntohs(tvb, 2);
816
0
    if (tvb_reported_length(tvb) < keylen + EC_BLOB_LEN) {
817
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
818
0
                            "Invalid length, len = %d", tvb_reported_length(tvb));
819
0
        return 0;
820
0
    }
821
822
0
    ti = proto_tree_add_item(tree, tree_hf, tvb, offset, EC_BLOB_LEN + keylen, ENC_NA);
823
0
    ecblob_tree = proto_item_add_subtree(ti, ett_uftp_ecblob);
824
0
    proto_tree_add_item(ecblob_tree, hf_uftp_ecblob_blobtype, tvb, offset, 1, ENC_BIG_ENDIAN);
825
0
    offset += 1;
826
0
    proto_tree_add_item(ecblob_tree, hf_uftp_ecblob_curve, tvb, offset, 1, ENC_BIG_ENDIAN);
827
0
    offset += 1;
828
0
    proto_tree_add_item(ecblob_tree, hf_uftp_ecblob_keylen, tvb, offset, 2, ENC_BIG_ENDIAN);
829
0
    offset += 2;
830
0
    proto_tree_add_item(ecblob_tree, hf_uftp_ecblob_key, tvb, offset, keylen, ENC_NA);
831
832
0
    return EC_BLOB_LEN + keylen;
833
0
}
834
835
static int dissect_uftp_encinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
836
0
{
837
0
    proto_item *ti = NULL;
838
0
    proto_tree *encinfo_tree = NULL;
839
0
    unsigned offset = 0, hlen, keylen, dhlen, siglen;
840
0
    int8_t blobtype;
841
0
    tvbuff_t *next_tvb;
842
843
0
    if (tvb_reported_length(tvb) < ENC_INFO_LEN) {
844
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
845
0
                            "Invalid length: %d", tvb_reported_length(tvb));
846
0
        return 0;
847
0
    }
848
849
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
850
0
    keylen = (int)tvb_get_ntohs(tvb, 6);
851
0
    dhlen = (int)tvb_get_ntohs(tvb, 8);
852
0
    siglen = (int)tvb_get_ntohs(tvb, 10);
853
0
    if ((tvb_reported_length(tvb) < hlen) ||
854
0
            (hlen < ENC_INFO_LEN + keylen + dhlen + siglen)) {
855
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
856
0
                            "Invalid length, len = %d, hlen = %d, "
857
0
                            "keylen = %d, dhlen = %d, siglen = %d",
858
0
                            tvb_reported_length(tvb), hlen, keylen, dhlen, siglen);
859
0
        return 0;
860
0
    }
861
862
0
    ti = proto_tree_add_item(tree, hf_uftp_encinfo, tvb, offset, ENC_INFO_LEN + keylen + dhlen + siglen, ENC_NA);
863
0
    encinfo_tree = proto_item_add_subtree(ti, ett_uftp_encinfo);
864
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_exttype, tvb, offset, 1, ENC_BIG_ENDIAN);
865
0
    offset += 1;
866
0
    proto_tree_add_uint_format_value(encinfo_tree, hf_uftp_encinfo_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
867
0
    offset += 1;
868
0
    proto_tree_add_bitmask(encinfo_tree, tvb, offset, hf_uftp_encinfo_flags, ett_uftp_encinfo_flags, encinfo_flags, ENC_BIG_ENDIAN);
869
0
    offset += 1;
870
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_keyextype, tvb, offset, 1, ENC_BIG_ENDIAN);
871
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_sigtype, tvb, offset, 1, ENC_BIG_ENDIAN);
872
0
    offset += 1;
873
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_keytype, tvb, offset, 1, ENC_BIG_ENDIAN);
874
0
    offset += 1;
875
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_hashtype, tvb, offset, 1, ENC_BIG_ENDIAN);
876
0
    offset += 1;
877
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_keylen, tvb, offset, 2, ENC_BIG_ENDIAN);
878
0
    offset += 2;
879
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_dhlen, tvb, offset, 2, ENC_BIG_ENDIAN);
880
0
    offset += 2;
881
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
882
0
    offset += 2;
883
0
    proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_rand1, tvb, offset, RAND_LEN, ENC_NA);
884
0
    offset += RAND_LEN;
885
0
    if (keylen > 0) {
886
0
        int parsed = 0;
887
888
0
        next_tvb = tvb_new_subset_length(tvb, offset, keylen);
889
0
        blobtype = tvb_get_uint8(tvb, offset);
890
0
        switch (blobtype) {
891
0
        case KEYBLOB_RSA:
892
0
            parsed = dissect_uftp_rsablob(next_tvb, pinfo, encinfo_tree, hf_uftp_encinfo_keyblob);
893
0
            break;
894
0
        case KEYBLOB_EC:
895
0
            parsed = dissect_uftp_ecblob(next_tvb, pinfo, encinfo_tree, hf_uftp_encinfo_keyblob);
896
0
            break;
897
0
        }
898
0
        offset += parsed;
899
0
    }
900
0
    if (dhlen > 0) {
901
0
        int parsed = 0;
902
903
0
        next_tvb = tvb_new_subset_length(tvb, offset, dhlen);
904
0
        blobtype = tvb_get_uint8(tvb, offset);
905
0
        switch (blobtype) {
906
0
        case KEYBLOB_RSA:
907
0
            parsed = dissect_uftp_rsablob(next_tvb, pinfo, encinfo_tree, hf_uftp_encinfo_dhblob);
908
0
            break;
909
0
        case KEYBLOB_EC:
910
0
            parsed = dissect_uftp_ecblob(next_tvb, pinfo, encinfo_tree, hf_uftp_encinfo_dhblob);
911
0
            break;
912
0
        }
913
0
        offset += parsed;
914
0
    }
915
0
    if (siglen > 0) {
916
0
        proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_sig, tvb, offset, siglen, ENC_NA);
917
0
    }
918
919
0
    return ENC_INFO_LEN + keylen + dhlen + siglen;
920
0
}
921
922
static void dissect_uftp_announce(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
923
0
{
924
0
    proto_item *ti = NULL;
925
0
    proto_item *destlist = NULL;
926
0
    proto_tree *announce_tree = NULL;
927
0
    proto_tree *destlist_tree = NULL;
928
0
    unsigned offset = 0;
929
0
    unsigned hlen, iplen, destcount, idx, extlen_total;
930
0
    uint8_t flags, ext_type;
931
0
    tvbuff_t *next_tvb;
932
933
0
    if (tvb_reported_length(tvb) < ANNOUNCE_LEN) {
934
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
935
0
                            "Invalid length: %d", tvb_reported_length(tvb));
936
0
        return;
937
0
    }
938
939
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
940
0
    if (tvb_reported_length(tvb) < hlen) {
941
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
942
0
                            "Invalid length, len = %d, hlen = %d",
943
0
                            tvb_reported_length(tvb), hlen);
944
0
        return;
945
0
    }
946
947
0
    flags = tvb_get_uint8(tvb, 2);
948
949
0
    ti = proto_tree_add_item(tree, hf_uftp_announce, tvb, offset, -1, ENC_NA);
950
0
    announce_tree = proto_item_add_subtree(ti, ett_uftp_announce);
951
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_func, tvb, offset, 1, ENC_BIG_ENDIAN);
952
0
    offset += 1;
953
0
    proto_tree_add_uint_format_value(announce_tree, hf_uftp_announce_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
954
0
    offset += 1;
955
0
    proto_tree_add_bitmask(announce_tree, tvb, offset, hf_uftp_announce_flags, ett_uftp_announce_flags, announce_flags, ENC_BIG_ENDIAN);
956
0
    offset += 1;
957
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_robust, tvb, offset, 1, ENC_BIG_ENDIAN);
958
0
    offset += 1;
959
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_cc_type, tvb, offset, 1, ENC_BIG_ENDIAN);
960
0
    offset += 1;
961
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
962
0
    offset += 1;
963
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_blocksize, tvb, offset, 2, ENC_BIG_ENDIAN);
964
0
    offset += 2;
965
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
966
0
    offset += 8;
967
0
    if (flags & FLAG_IPV6) {
968
0
        iplen = 16;
969
0
        proto_tree_add_item(announce_tree, hf_uftp_announce_publicmcast_ipv6, tvb, offset, iplen, ENC_NA);
970
0
        offset += iplen;
971
0
        proto_tree_add_item(announce_tree, hf_uftp_announce_privatemcast_ipv6, tvb, offset, iplen, ENC_NA);
972
0
        offset += iplen;
973
0
    } else {
974
0
        iplen = 4;
975
0
        proto_tree_add_item(announce_tree, hf_uftp_announce_publicmcast_ipv4, tvb, offset, iplen, ENC_BIG_ENDIAN);
976
0
        offset += iplen;
977
0
        proto_tree_add_item(announce_tree, hf_uftp_announce_privatemcast_ipv4, tvb, offset, iplen, ENC_BIG_ENDIAN);
978
0
        offset += iplen;
979
0
    }
980
981
0
    extlen_total = hlen - (ANNOUNCE_LEN + ( 2 * iplen));
982
0
    while (extlen_total > 0) {
983
0
        int parsed = 0;
984
985
0
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
986
0
        ext_type = tvb_get_uint8(tvb, offset);
987
0
        switch (ext_type) {
988
0
        case EXT_ENC_INFO:
989
0
            parsed = dissect_uftp_encinfo(next_tvb, pinfo, announce_tree);
990
0
            break;
991
0
        }
992
0
        if (!parsed) break;
993
0
        extlen_total -= parsed;
994
0
        offset += parsed;
995
0
    }
996
997
0
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
998
0
    offset = hlen;
999
0
    if (destcount > 0) {
1000
0
        destlist = proto_tree_add_item(announce_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1001
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1002
0
    }
1003
0
    for (idx = 0; idx < destcount; idx++) {
1004
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1005
0
        offset += 4;
1006
0
    }
1007
0
}
1008
1009
static void dissect_uftp_register(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1010
0
{
1011
0
    proto_item *ti = NULL;
1012
0
    proto_item *destlist = NULL;
1013
0
    proto_tree *register_tree = NULL;
1014
0
    proto_tree *destlist_tree = NULL;
1015
0
    unsigned offset = 0, hlen;
1016
0
    unsigned destcount, keylen, idx;
1017
1018
0
    if (tvb_reported_length(tvb) < REGISTER_LEN) {
1019
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1020
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1021
0
        return;
1022
0
    }
1023
1024
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1025
0
    keylen = tvb_get_ntohs(tvb, 2);
1026
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < REGISTER_LEN + keylen)) {
1027
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1028
0
                            "Invalid length, len = %d, hlen = %d, keylen = %d",
1029
0
                            tvb_reported_length(tvb), hlen, keylen);
1030
0
        return;
1031
0
    }
1032
1033
0
    ti = proto_tree_add_item(tree, hf_uftp_register, tvb, offset, -1, ENC_NA);
1034
0
    register_tree = proto_item_add_subtree(ti, ett_uftp_register);
1035
0
    proto_tree_add_item(register_tree, hf_uftp_register_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1036
0
    offset += 1;
1037
0
    proto_tree_add_uint_format_value(register_tree, hf_uftp_register_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1038
0
    offset += 1;
1039
0
    proto_tree_add_item(register_tree, hf_uftp_register_keyinfo_len, tvb, offset, 2, ENC_BIG_ENDIAN);
1040
0
    offset += 2;
1041
0
    proto_tree_add_item(register_tree, hf_uftp_register_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
1042
0
    offset += 8;
1043
0
    proto_tree_add_item(register_tree, hf_uftp_register_rand2, tvb, offset, RAND_LEN, ENC_NA);
1044
0
    offset += RAND_LEN;
1045
0
    if (keylen > 0) {
1046
0
        proto_tree_add_item(register_tree, hf_uftp_register_keyinfo, tvb, offset, keylen, ENC_NA);
1047
0
    }
1048
1049
0
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1050
0
    offset = hlen;
1051
0
    if (destcount > 0) {
1052
0
        destlist = proto_tree_add_item(register_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1053
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1054
0
    }
1055
0
    for (idx = 0; idx < destcount; idx++) {
1056
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1057
0
        offset += 4;
1058
0
    }
1059
0
}
1060
1061
static void dissect_uftp_clientkey(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1062
0
{
1063
0
    proto_item *ti = NULL;
1064
0
    proto_tree *clientkey_tree = NULL;
1065
0
    unsigned offset = 0, hlen;
1066
0
    unsigned keylen, verifylen;
1067
0
    int8_t blobtype;
1068
0
    tvbuff_t *next_tvb;
1069
1070
0
    if (tvb_reported_length(tvb) < CLIENT_KEY_LEN) {
1071
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1072
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1073
0
        return;
1074
0
    }
1075
1076
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1077
0
    keylen = tvb_get_ntohs(tvb, 4);
1078
0
    verifylen = tvb_get_ntohs(tvb, 6);
1079
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < CLIENT_KEY_LEN + keylen + verifylen)) {
1080
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1081
0
                            "Invalid length, len = %d, hlen = %d, keylen = %d verifylen = %d",
1082
0
                            tvb_reported_length(tvb), hlen, keylen, verifylen);
1083
0
        return;
1084
0
    }
1085
1086
0
    ti = proto_tree_add_item(tree, hf_uftp_clientkey, tvb, offset, -1, ENC_NA);
1087
0
    clientkey_tree = proto_item_add_subtree(ti, ett_uftp_clientkey);
1088
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1089
0
    offset += 1;
1090
0
    proto_tree_add_uint_format_value(clientkey_tree, hf_uftp_clientkey_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1091
0
    offset += 1;
1092
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1093
0
    offset += 2;
1094
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_bloblen, tvb, offset, 2, ENC_BIG_ENDIAN);
1095
0
    offset += 2;
1096
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1097
0
    offset += 2;
1098
0
    if (keylen > 0) {
1099
0
        int parsed = 0;
1100
1101
0
        next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1102
0
        blobtype = tvb_get_uint8(tvb, offset);
1103
0
        switch (blobtype) {
1104
0
        case KEYBLOB_RSA:
1105
0
            parsed = dissect_uftp_rsablob(next_tvb, pinfo, clientkey_tree, hf_uftp_clientkey_keyblob);
1106
0
            break;
1107
0
        case KEYBLOB_EC:
1108
0
            parsed = dissect_uftp_ecblob(next_tvb, pinfo, clientkey_tree, hf_uftp_clientkey_keyblob);
1109
0
            break;
1110
0
        }
1111
0
        offset += parsed;
1112
0
    }
1113
0
    if (verifylen > 0) {
1114
0
        proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_verify, tvb, offset, verifylen, ENC_NA);
1115
0
    }
1116
0
}
1117
1118
static void dissect_uftp_regconf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1119
0
{
1120
0
    proto_item *ti = NULL;
1121
0
    proto_item *destlist = NULL;
1122
0
    proto_tree *regconf_tree = NULL;
1123
0
    proto_tree *destlist_tree = NULL;
1124
0
    unsigned offset = 0, hlen;
1125
0
    uint16_t destcount, idx;
1126
1127
0
    if (tvb_reported_length(tvb) < REG_CONF_LEN) {
1128
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1129
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1130
0
        return;
1131
0
    }
1132
1133
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1134
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < REG_CONF_LEN)) {
1135
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1136
0
                            "Invalid length, len = %d, hlen = %d",
1137
0
                            tvb_reported_length(tvb), hlen);
1138
0
        return;
1139
0
    }
1140
1141
0
    ti = proto_tree_add_item(tree, hf_uftp_regconf, tvb, offset, -1, ENC_NA);
1142
0
    regconf_tree = proto_item_add_subtree(ti, ett_uftp_regconf);
1143
0
    proto_tree_add_item(regconf_tree, hf_uftp_regconf_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1144
0
    offset += 1;
1145
0
    proto_tree_add_uint_format_value(regconf_tree, hf_uftp_regconf_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1146
0
    offset += 1;
1147
0
    proto_tree_add_item(regconf_tree, hf_uftp_regconf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1148
1149
0
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1150
0
    offset = hlen;
1151
0
    if (destcount > 0) {
1152
0
        destlist = proto_tree_add_item(regconf_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1153
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1154
0
    }
1155
0
    for (idx = 0; idx < destcount; idx++) {
1156
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1157
0
        offset += 4;
1158
0
    }
1159
0
}
1160
1161
static void dissect_uftp_keyinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1162
1
{
1163
1
    proto_item *ti = NULL;
1164
1
    proto_item *destlist = NULL;
1165
1
    proto_item *destkey = NULL;
1166
1
    proto_tree *keyinfo_tree = NULL;
1167
1
    proto_tree *destlist_tree = NULL;
1168
1
    proto_tree *destkey_tree = NULL;
1169
1
    unsigned offset = 0, hlen;
1170
1
    uint8_t destcount, idx;
1171
1172
1
    if (tvb_reported_length(tvb) < KEYINFO_LEN) {
1173
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1174
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1175
0
        return;
1176
0
    }
1177
1178
1
    hlen = tvb_get_uint8(tvb, 1) * 4;
1179
1
    if ((tvb_reported_length(tvb) < hlen) || (hlen < KEYINFO_LEN)) {
1180
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1181
0
                            "Invalid length, len = %d, hlen = %d",
1182
0
                            tvb_reported_length(tvb), hlen);
1183
0
        return;
1184
0
    }
1185
1186
1
    ti = proto_tree_add_item(tree, hf_uftp_keyinfo, tvb, offset, -1, ENC_NA);
1187
1
    keyinfo_tree = proto_item_add_subtree(ti, ett_uftp_keyinfo);
1188
1
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1189
1
    offset += 1;
1190
1
    proto_tree_add_uint_format_value(keyinfo_tree, hf_uftp_keyinfo_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1191
1
    offset += 1;
1192
1
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1193
1
    offset += 2;
1194
1
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_ivctr, tvb, offset, 8, ENC_BIG_ENDIAN);
1195
1196
1
    destcount = (tvb_reported_length(tvb) - hlen) / DESTKEY_LEN;
1197
1
    offset = hlen;
1198
1
    if (destcount > 0) {
1199
1
        destlist = proto_tree_add_item(keyinfo_tree, hf_uftp_destlist, tvb, offset, destcount * DESTKEY_LEN, ENC_NA);
1200
1
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1201
1
    }
1202
19
    for (idx = 0; idx < destcount; idx++) {
1203
18
        destkey = proto_tree_add_item(destlist_tree, hf_uftp_keyinfo_destkey, tvb, offset, DESTKEY_LEN, ENC_NA);
1204
18
        destkey_tree = proto_item_add_subtree(destkey, ett_uftp_keyinfo_destkey);
1205
18
        proto_tree_add_item(destkey_tree, hf_uftp_keyinfo_destid, tvb, offset, 4, ENC_BIG_ENDIAN);
1206
18
        offset += 4;
1207
18
        proto_tree_add_item(destkey_tree, hf_uftp_keyinfo_groupmaster, tvb, offset, 48, ENC_NA);
1208
18
        offset += 48;
1209
18
    }
1210
1
}
1211
1212
static void dissect_uftp_keyinfoack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1213
0
{
1214
0
    proto_item *ti = NULL;
1215
0
    proto_tree *keyinfoack_tree = NULL;
1216
0
    unsigned offset = 0, hlen;
1217
1218
0
    if (tvb_reported_length(tvb) < KEYINFO_ACK_LEN) {
1219
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1220
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1221
0
        return;
1222
0
    }
1223
1224
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1225
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < KEYINFO_ACK_LEN)) {
1226
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1227
0
                            "Invalid length, len = %d, hlen = %d",
1228
0
                            tvb_reported_length(tvb), hlen);
1229
0
        return;
1230
0
    }
1231
1232
0
    ti = proto_tree_add_item(tree, hf_uftp_keyinfoack, tvb, offset, -1, ENC_NA);
1233
0
    keyinfoack_tree = proto_item_add_subtree(ti, ett_uftp_keyinfoack);
1234
0
    proto_tree_add_item(keyinfoack_tree, hf_uftp_keyinfoack_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1235
0
    offset += 1;
1236
0
    proto_tree_add_uint_format_value(keyinfoack_tree, hf_uftp_keyinfoack_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1237
0
    offset += 1;
1238
0
    proto_tree_add_item(keyinfoack_tree, hf_uftp_keyinfoack_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1239
0
    offset += 3;
1240
0
    proto_tree_add_item(keyinfoack_tree, hf_uftp_keyinfoack_verify_data, tvb, offset, VERIFY_LEN, ENC_NA);
1241
0
}
1242
1243
static void dissect_uftp_fileinfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1244
0
{
1245
0
    proto_item *ti = NULL;
1246
0
    proto_item *destlist = NULL;
1247
0
    proto_tree *fileinfo_tree = NULL;
1248
0
    proto_tree *destlist_tree = NULL;
1249
0
    unsigned offset = 0, hlen;
1250
0
    unsigned file_id, destcount, idx, namelen, linklen;
1251
1252
0
    if (tvb_reported_length(tvb) < FILEINFO_LEN) {
1253
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1254
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1255
0
        return;
1256
0
    }
1257
1258
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1259
0
    namelen = tvb_get_uint8(tvb, 8) * 4;
1260
0
    linklen = tvb_get_uint8(tvb, 9) * 4;
1261
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < FILEINFO_LEN + namelen + linklen)) {
1262
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1263
0
                            "Invalid length, len = %d, hlen = %d, namelen = %d, linklen = %d",
1264
0
                            tvb_reported_length(tvb), hlen, namelen, linklen);
1265
0
        return;
1266
0
    }
1267
1268
0
    file_id = tvb_get_ntohs(tvb, 2);
1269
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1270
1271
0
    ti = proto_tree_add_item(tree, hf_uftp_fileinfo, tvb, offset, -1, ENC_NA);
1272
0
    fileinfo_tree = proto_item_add_subtree(ti, ett_uftp_fileinfo);
1273
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1274
0
    offset += 1;
1275
0
    proto_tree_add_uint_format_value(fileinfo_tree, hf_uftp_fileinfo_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1276
0
    offset += 1;
1277
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1278
0
    offset += 2;
1279
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftype, tvb, offset, 1, ENC_BIG_ENDIAN);
1280
0
    offset += 1;
1281
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1282
0
    offset += 3;
1283
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_namelen, tvb, offset, 1, ENC_BIG_ENDIAN);
1284
0
    offset += 1;
1285
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_linklen, tvb, offset, 1, ENC_BIG_ENDIAN);
1286
0
    offset += 1;
1287
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_fsize, tvb, offset, 6, ENC_BIG_ENDIAN);
1288
0
    offset += 6;
1289
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftstamp, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
1290
0
    offset += 4;
1291
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
1292
0
    offset += 8;
1293
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_name, tvb, offset, namelen, ENC_ASCII);
1294
0
    offset += namelen;
1295
0
    if (linklen > 0) {
1296
0
        proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_link, tvb, offset, linklen, ENC_ASCII);
1297
0
    }
1298
1299
0
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1300
0
    offset = hlen;
1301
0
    if (destcount > 0) {
1302
0
        destlist = proto_tree_add_item(fileinfo_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1303
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1304
0
    }
1305
0
    for (idx = 0; idx < destcount; idx++) {
1306
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1307
0
        offset += 4;
1308
0
    }
1309
0
}
1310
1311
static void dissect_uftp_fileinfoack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1312
0
{
1313
0
    proto_item *ti = NULL;
1314
0
    proto_item *destlist = NULL;
1315
0
    proto_tree *fileinfoack_tree = NULL;
1316
0
    proto_tree *destlist_tree = NULL;
1317
0
    unsigned offset = 0, hlen;
1318
0
    unsigned file_id, destcount, idx;
1319
1320
0
    if (tvb_reported_length(tvb) < FILEINFO_ACK_LEN) {
1321
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1322
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1323
0
        return;
1324
0
    }
1325
1326
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1327
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < FILEINFO_ACK_LEN)) {
1328
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1329
0
                            "Invalid length, len = %d, hlen = %d",
1330
0
                            tvb_reported_length(tvb), hlen);
1331
0
        return;
1332
0
    }
1333
1334
0
    file_id = tvb_get_ntohs(tvb, 2);
1335
0
    if (file_id > 0) {
1336
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1337
0
    }
1338
1339
0
    ti = proto_tree_add_item(tree, hf_uftp_fileinfoack, tvb, offset, -1, ENC_NA);
1340
0
    fileinfoack_tree = proto_item_add_subtree(ti, ett_uftp_fileinfoack);
1341
0
    proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1342
0
    offset += 1;
1343
0
    proto_tree_add_uint_format_value(fileinfoack_tree, hf_uftp_fileinfoack_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1344
0
    offset += 1;
1345
0
    proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1346
0
    offset += 2;
1347
0
    proto_tree_add_bitmask(fileinfoack_tree, tvb, offset, hf_uftp_fileinfoack_flags, ett_uftp_fileinfoack_flags, fileinfoack_flags, ENC_BIG_ENDIAN);
1348
0
    offset += 1;
1349
0
    proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1350
0
    offset += 3;
1351
0
    proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
1352
1353
0
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1354
0
    offset = hlen;
1355
0
    if (destcount > 0) {
1356
0
        destlist = proto_tree_add_item(fileinfoack_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1357
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1358
0
    }
1359
0
    for (idx = 0; idx < destcount; idx++) {
1360
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1361
0
        offset += 4;
1362
0
    }
1363
0
}
1364
1365
static int dissect_uftp_tfmccdata(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1366
0
{
1367
0
    proto_item *ti = NULL;
1368
0
    proto_tree *tfmccdata_tree = NULL;
1369
0
    unsigned offset = 0, hlen;
1370
0
    unsigned rate, srate;
1371
1372
0
    if (tvb_reported_length(tvb) < TFMCC_DATA_LEN) {
1373
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1374
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1375
0
        return 0;
1376
0
    }
1377
1378
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1379
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < TFMCC_DATA_LEN)) {
1380
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1381
0
                            "Invalid length, len = %d, hlen = %d",
1382
0
                            tvb_reported_length(tvb), hlen);
1383
0
        return 0;
1384
0
    }
1385
1386
0
    rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
1387
0
    srate = unquantize_rate(tvb_get_ntohs(tvb, 2));
1388
1389
0
    ti = proto_tree_add_item(tree, hf_uftp_tfmccdata, tvb, offset, TFMCC_DATA_LEN, ENC_NA);
1390
0
    tfmccdata_tree = proto_item_add_subtree(ti, ett_uftp_tfmccdata);
1391
0
    proto_tree_add_item(tfmccdata_tree, hf_uftp_tfmccdata_exttype, tvb, offset, 1, ENC_BIG_ENDIAN);
1392
0
    offset += 1;
1393
0
    proto_tree_add_uint_format_value(tfmccdata_tree, hf_uftp_tfmccdata_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1394
0
    offset += 1;
1395
0
    proto_tree_add_uint(tfmccdata_tree, hf_uftp_tfmccdata_send_rate, tvb, offset, 2, srate);
1396
0
    offset += 2;
1397
0
    proto_tree_add_item(tfmccdata_tree, hf_uftp_tfmccdata_cc_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
1398
0
    offset += 2;
1399
0
    proto_tree_add_uint(tfmccdata_tree, hf_uftp_tfmccdata_cc_rate, tvb, offset, 2, rate);
1400
1401
0
    return TFMCC_DATA_LEN;
1402
0
}
1403
1404
static void dissect_uftp_fileseg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1405
0
{
1406
0
    proto_item *ti = NULL;
1407
0
    proto_tree *fileseg_tree = NULL;
1408
0
    unsigned offset = 0, hlen, extlen_total;
1409
0
    uint16_t file_id, section, sec_block;
1410
0
    uint8_t ext_type;
1411
0
    tvbuff_t *next_tvb;
1412
1413
0
    if (tvb_reported_length(tvb) < FILESEG_LEN) {
1414
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1415
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1416
0
        return;
1417
0
    }
1418
1419
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1420
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < FILESEG_LEN)) {
1421
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1422
0
                            "Invalid length, len = %d, hlen = %d",
1423
0
                            tvb_reported_length(tvb), hlen);
1424
0
        return;
1425
0
    }
1426
1427
0
    file_id = tvb_get_ntohs(tvb, 2);
1428
0
    section = tvb_get_ntohs(tvb, 4);
1429
0
    sec_block = tvb_get_ntohs(tvb, 6);
1430
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Section=%d  Block=%d",
1431
0
                    file_id, section, sec_block);
1432
1433
0
    ti = proto_tree_add_item(tree, hf_uftp_fileseg, tvb, offset, -1, ENC_NA);
1434
0
    fileseg_tree = proto_item_add_subtree(ti, ett_uftp_fileseg);
1435
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1436
0
    offset += 1;
1437
0
    proto_tree_add_uint_format_value(fileseg_tree, hf_uftp_fileseg_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1438
0
    offset += 1;
1439
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1440
0
    offset += 2;
1441
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_section, tvb, offset, 2, ENC_BIG_ENDIAN);
1442
0
    offset += 2;
1443
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_sec_block, tvb, offset, 2, ENC_BIG_ENDIAN);
1444
0
    offset += 2;
1445
1446
0
    extlen_total = hlen - FILESEG_LEN;
1447
0
    while (extlen_total > 0) {
1448
0
        int parsed = 0;
1449
1450
0
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1451
0
        ext_type = tvb_get_uint8(tvb, offset);
1452
0
        switch (ext_type) {
1453
0
        case EXT_TFMCC_DATA_INFO:
1454
0
            parsed = dissect_uftp_tfmccdata(next_tvb, pinfo, fileseg_tree);
1455
0
            break;
1456
0
        }
1457
0
        if (!parsed) break;
1458
0
        extlen_total -= parsed;
1459
0
        offset += parsed;
1460
0
    }
1461
1462
0
    offset = hlen;
1463
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_data, tvb, offset, -1, ENC_NA);
1464
0
}
1465
1466
static void dissect_uftp_done(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1467
0
{
1468
0
    proto_item *ti = NULL;
1469
0
    proto_item *destlist = NULL;
1470
0
    proto_tree *done_tree = NULL;
1471
0
    proto_tree *destlist_tree = NULL;
1472
0
    unsigned offset = 0, hlen;
1473
0
    uint16_t file_id, section, destcount, idx;
1474
1475
0
    if (tvb_reported_length(tvb) < DONE_LEN) {
1476
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1477
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1478
0
        return;
1479
0
    }
1480
1481
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1482
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < DONE_LEN)) {
1483
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1484
0
                            "Invalid length, len = %d, hlen = %d",
1485
0
                            tvb_reported_length(tvb), hlen);
1486
0
        return;
1487
0
    }
1488
1489
0
    file_id = tvb_get_ntohs(tvb, 2);
1490
0
    section = tvb_get_ntohs(tvb, 6);
1491
0
    if (file_id > 0) {
1492
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Section=%d",
1493
0
                        file_id, section);
1494
0
    }
1495
1496
0
    ti = proto_tree_add_item(tree, hf_uftp_done, tvb, offset, -1, ENC_NA);
1497
0
    done_tree = proto_item_add_subtree(ti, ett_uftp_done);
1498
0
    proto_tree_add_item(done_tree, hf_uftp_done_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1499
0
    offset += 1;
1500
0
    proto_tree_add_uint_format_value(done_tree, hf_uftp_done_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1501
0
    offset += 1;
1502
0
    proto_tree_add_item(done_tree, hf_uftp_done_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1503
0
    offset += 2;
1504
0
    proto_tree_add_item(done_tree, hf_uftp_done_section, tvb, offset, 2, ENC_BIG_ENDIAN);
1505
0
    offset += 2;
1506
0
    proto_tree_add_item(done_tree, hf_uftp_done_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1507
1508
0
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1509
0
    offset = hlen;
1510
0
    if (destcount > 0) {
1511
0
        destlist = proto_tree_add_item(done_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1512
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1513
0
    }
1514
0
    for (idx = 0; idx < destcount; idx++) {
1515
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1516
0
        offset += 4;
1517
0
    }
1518
0
}
1519
1520
static int dissect_uftp_tfmccack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1521
0
{
1522
0
    proto_item *ti = NULL;
1523
0
    proto_tree *tfmccack_tree = NULL;
1524
0
    unsigned offset = 0, hlen;
1525
0
    unsigned rate;
1526
1527
0
    if (tvb_reported_length(tvb) < TFMCC_ACK_LEN) {
1528
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1529
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1530
0
        return 0;
1531
0
    }
1532
1533
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1534
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < TFMCC_ACK_LEN)) {
1535
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1536
0
                            "Invalid length, len = %d, hlen = %d",
1537
0
                            tvb_reported_length(tvb), hlen);
1538
0
        return 0;
1539
0
    }
1540
1541
0
    rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
1542
1543
0
    ti = proto_tree_add_item(tree, hf_uftp_tfmccack, tvb, offset, TFMCC_ACK_LEN, ENC_NA);
1544
0
    tfmccack_tree = proto_item_add_subtree(ti, ett_uftp_tfmccack);
1545
0
    proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_exttype, tvb, offset, 1, ENC_BIG_ENDIAN);
1546
0
    offset += 1;
1547
0
    proto_tree_add_uint_format_value(tfmccack_tree, hf_uftp_tfmccack_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1548
0
    offset += 1;
1549
0
    proto_tree_add_bitmask(tfmccack_tree, tvb, offset, hf_uftp_tfmccack_flags, ett_uftp_tfmccack_flags, tfmcc_ack_flags, ENC_BIG_ENDIAN);
1550
0
    offset += 1;
1551
0
    proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1552
0
    offset += 1;
1553
0
    proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_cc_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
1554
0
    offset += 2;
1555
0
    proto_tree_add_uint(tfmccack_tree, hf_uftp_tfmccack_cc_rate, tvb, offset, 2, rate);
1556
0
    offset += 2;
1557
0
    proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_client_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1558
0
    offset += 4;
1559
0
    proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
1560
1561
0
    return TFMCC_ACK_LEN;
1562
0
}
1563
1564
static void dissect_uftp_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1565
0
{
1566
0
    proto_item *ti = NULL;
1567
0
    proto_tree *status_tree = NULL;
1568
0
    unsigned offset = 0, hlen, extlen_total;
1569
0
    uint16_t file_id, section;
1570
0
    uint8_t ext_type;
1571
0
    tvbuff_t *next_tvb;
1572
1573
0
    if (tvb_reported_length(tvb) < STATUS_LEN) {
1574
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1575
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1576
0
        return;
1577
0
    }
1578
1579
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1580
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < STATUS_LEN)) {
1581
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1582
0
                            "Invalid length, len = %d, hlen = %d",
1583
0
                            tvb_reported_length(tvb), hlen);
1584
0
        return;
1585
0
    }
1586
1587
0
    file_id = tvb_get_ntohs(tvb, 2);
1588
0
    section = tvb_get_ntohs(tvb, 4);
1589
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Section=%d",
1590
0
                    file_id, section);
1591
1592
0
    ti = proto_tree_add_item(tree, hf_uftp_status, tvb, offset, -1, ENC_NA);
1593
0
    status_tree = proto_item_add_subtree(ti, ett_uftp_status);
1594
0
    proto_tree_add_item(status_tree, hf_uftp_status_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1595
0
    offset += 1;
1596
0
    proto_tree_add_uint_format_value(status_tree, hf_uftp_status_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1597
0
    offset += 1;
1598
0
    proto_tree_add_item(status_tree, hf_uftp_status_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1599
0
    offset += 2;
1600
0
    proto_tree_add_item(status_tree, hf_uftp_status_section, tvb, offset, 2, ENC_BIG_ENDIAN);
1601
0
    offset += 2;
1602
0
    proto_tree_add_item(status_tree, hf_uftp_status_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1603
0
    offset += 2;
1604
1605
0
    extlen_total = hlen - STATUS_LEN;
1606
0
    while (extlen_total > 0) {
1607
0
        int parsed = 0;
1608
1609
0
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1610
0
        ext_type = tvb_get_uint8(tvb, offset);
1611
0
        switch (ext_type) {
1612
0
        case EXT_TFMCC_ACK_INFO:
1613
0
            parsed = dissect_uftp_tfmccack(next_tvb, pinfo, status_tree);
1614
0
            break;
1615
0
        }
1616
0
        if (!parsed) break;
1617
0
        extlen_total -= parsed;
1618
0
        offset += parsed;
1619
0
    }
1620
1621
0
    offset = hlen;
1622
0
    proto_tree_add_item(status_tree, hf_uftp_status_naks, tvb, offset, -1, ENC_NA);
1623
0
}
1624
1625
static int dissect_uftp_freespace(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1626
0
{
1627
0
    proto_item *ti = NULL;
1628
0
    proto_tree *freespace_tree = NULL;
1629
0
    unsigned offset = 0, hlen;
1630
1631
0
    if (tvb_reported_length(tvb) < FREESPACE_LEN) {
1632
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1633
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1634
0
        return 0;
1635
0
    }
1636
1637
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1638
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < FREESPACE_LEN)) {
1639
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1640
0
                            "Invalid length, len = %d, hlen = %d",
1641
0
                            tvb_reported_length(tvb), hlen);
1642
0
        return 0;
1643
0
    }
1644
1645
0
    ti = proto_tree_add_item(tree, hf_uftp_freespace, tvb, offset, FREESPACE_LEN, ENC_NA);
1646
0
    freespace_tree = proto_item_add_subtree(ti, ett_uftp_freespace);
1647
0
    proto_tree_add_item(freespace_tree, hf_uftp_freespace_exttype, tvb, offset, 1, ENC_BIG_ENDIAN);
1648
0
    offset += 1;
1649
0
    proto_tree_add_uint_format_value(freespace_tree, hf_uftp_freespace_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1650
0
    offset += 1;
1651
0
    proto_tree_add_item(freespace_tree, hf_uftp_freespace_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1652
0
    offset += 2;
1653
0
    proto_tree_add_item(freespace_tree, hf_uftp_freespace_freespace, tvb, offset, 8, ENC_BIG_ENDIAN);
1654
1655
0
    return FREESPACE_LEN;
1656
0
}
1657
1658
static void dissect_uftp_complete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1659
0
{
1660
0
    proto_item *ti = NULL;
1661
0
    proto_item *destlist = NULL;
1662
0
    proto_tree *complete_tree = NULL;
1663
0
    proto_tree *destlist_tree = NULL;
1664
0
    unsigned offset = 0, hlen, extlen_total;
1665
0
    uint16_t file_id, destcount, idx;
1666
0
    uint8_t ext_type;
1667
0
    tvbuff_t *next_tvb;
1668
1669
0
    if (tvb_reported_length(tvb) < COMPLETE_LEN) {
1670
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1671
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1672
0
        return;
1673
0
    }
1674
1675
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1676
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < COMPLETE_LEN)) {
1677
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1678
0
                            "Invalid length, len = %d, hlen = %d",
1679
0
                            tvb_reported_length(tvb), hlen);
1680
0
        return;
1681
0
    }
1682
1683
0
    file_id = tvb_get_ntohs(tvb, 2);
1684
0
    if (file_id > 0) {
1685
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1686
0
    }
1687
1688
0
    ti = proto_tree_add_item(tree, hf_uftp_complete, tvb, offset, -1, ENC_NA);
1689
0
    complete_tree = proto_item_add_subtree(ti, ett_uftp_complete);
1690
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1691
0
    offset += 1;
1692
0
    proto_tree_add_uint_format_value(complete_tree, hf_uftp_complete_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1693
0
    offset += 1;
1694
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1695
0
    offset += 2;
1696
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_status, tvb, offset, 1, ENC_BIG_ENDIAN);
1697
0
    offset += 1;
1698
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1699
0
    offset += 3;
1700
1701
0
    extlen_total = hlen - COMPLETE_LEN;
1702
0
    while (extlen_total > 0) {
1703
0
        int parsed = 0;
1704
1705
0
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1706
0
        ext_type = tvb_get_uint8(tvb, offset);
1707
0
        switch (ext_type) {
1708
0
        case EXT_FREESPACE_INFO:
1709
0
            parsed = dissect_uftp_freespace(next_tvb, pinfo, complete_tree);
1710
0
            break;
1711
0
        }
1712
0
        if (!parsed) break;
1713
0
        extlen_total -= parsed;
1714
0
        offset += parsed;
1715
0
    }
1716
1717
0
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1718
0
    offset = hlen;
1719
0
    if (destcount > 0) {
1720
0
        destlist = proto_tree_add_item(complete_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1721
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1722
0
    }
1723
0
    for (idx = 0; idx < destcount; idx++) {
1724
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1725
0
        offset += 4;
1726
0
    }
1727
0
}
1728
1729
static void dissect_uftp_doneconf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1730
0
{
1731
0
    proto_item *ti = NULL;
1732
0
    proto_item *destlist = NULL;
1733
0
    proto_tree *doneconf_tree = NULL;
1734
0
    proto_tree *destlist_tree = NULL;
1735
0
    unsigned offset = 0, hlen;
1736
0
    uint16_t destcount, idx;
1737
1738
0
    if (tvb_reported_length(tvb) < DONE_CONF_LEN) {
1739
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1740
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1741
0
        return;
1742
0
    }
1743
1744
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1745
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < DONE_CONF_LEN)) {
1746
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1747
0
                            "Invalid length, len = %d, hlen = %d",
1748
0
                            tvb_reported_length(tvb), hlen);
1749
0
        return;
1750
0
    }
1751
1752
0
    ti = proto_tree_add_item(tree, hf_uftp_doneconf, tvb, offset, -1, ENC_NA);
1753
0
    doneconf_tree = proto_item_add_subtree(ti, ett_uftp_doneconf);
1754
0
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1755
0
    offset += 1;
1756
0
    proto_tree_add_uint_format_value(doneconf_tree, hf_uftp_doneconf_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1757
0
    offset += 1;
1758
0
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1759
1760
0
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1761
0
    offset = hlen;
1762
0
    if (destcount > 0) {
1763
0
        destlist = proto_tree_add_item(doneconf_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1764
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1765
0
    }
1766
0
    for (idx = 0; idx < destcount; idx++) {
1767
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1768
0
        offset += 4;
1769
0
    }
1770
0
}
1771
1772
static void dissect_uftp_hbreq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1773
0
{
1774
0
    proto_item *ti = NULL;
1775
0
    proto_tree *hbreq_tree = NULL;
1776
0
    unsigned offset = 0, hlen;
1777
0
    unsigned keylen, siglen;
1778
0
    int8_t blobtype;
1779
0
    tvbuff_t *next_tvb;
1780
1781
0
    if (tvb_reported_length(tvb) < HB_REQ_LEN) {
1782
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1783
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1784
0
        return;
1785
0
    }
1786
1787
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1788
0
    keylen = tvb_get_ntohs(tvb, 4);
1789
0
    siglen = tvb_get_ntohs(tvb, 6);
1790
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < HB_REQ_LEN + keylen + siglen)) {
1791
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1792
0
                            "Invalid length, len = %d, hlen = %d, keylen=%d siglen=%d",
1793
0
                            tvb_reported_length(tvb), hlen, keylen, siglen);
1794
0
        return;
1795
0
    }
1796
1797
0
    ti = proto_tree_add_item(tree, hf_uftp_hbreq, tvb, offset, -1, ENC_NA);
1798
0
    hbreq_tree = proto_item_add_subtree(ti, ett_uftp_hbreq);
1799
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1800
0
    offset += 1;
1801
0
    proto_tree_add_uint_format_value(hbreq_tree, hf_uftp_hbreq_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1802
0
    offset += 1;
1803
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1804
0
    offset += 2;
1805
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_bloblen, tvb, offset, 2, ENC_BIG_ENDIAN);
1806
0
    offset += 2;
1807
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1808
0
    offset += 2;
1809
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1810
0
    offset += 4;
1811
0
    if (keylen > 0) {
1812
0
        int parsed = 0;
1813
1814
0
        next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1815
0
        blobtype = tvb_get_uint8(tvb, offset);
1816
0
        switch (blobtype) {
1817
0
        case KEYBLOB_RSA:
1818
0
            parsed = dissect_uftp_rsablob(next_tvb, pinfo, hbreq_tree, hf_uftp_hbreq_keyblob);
1819
0
            break;
1820
0
        case KEYBLOB_EC:
1821
0
            parsed = dissect_uftp_ecblob(next_tvb, pinfo, hbreq_tree, hf_uftp_hbreq_keyblob);
1822
0
            break;
1823
0
        }
1824
0
        offset += parsed;
1825
0
    }
1826
0
    if (siglen > 0) {
1827
0
        proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_verify, tvb, offset, siglen, ENC_NA);
1828
0
    }
1829
0
}
1830
1831
static void dissect_uftp_hbresp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1832
0
{
1833
0
    proto_item *ti = NULL;
1834
0
    proto_tree *hbresp_tree = NULL;
1835
0
    unsigned offset = 0, hlen;
1836
1837
0
    if (tvb_reported_length(tvb) < HB_RESP_LEN) {
1838
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1839
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1840
0
        return;
1841
0
    }
1842
1843
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1844
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < HB_RESP_LEN)) {
1845
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1846
0
                            "Invalid length, len = %d, hlen = %d",
1847
0
                            tvb_reported_length(tvb), hlen);
1848
0
        return;
1849
0
    }
1850
1851
0
    ti = proto_tree_add_item(tree, hf_uftp_hbresp, tvb, offset, -1, ENC_NA);
1852
0
    hbresp_tree = proto_item_add_subtree(ti, ett_uftp_hbresp);
1853
0
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1854
0
    offset += 1;
1855
0
    proto_tree_add_uint_format_value(hbresp_tree, hf_uftp_hbresp_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1856
0
    offset += 1;
1857
0
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_authenticated, tvb, offset, 1, ENC_BIG_ENDIAN);
1858
0
    offset += 1;
1859
0
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1860
0
    offset += 1;
1861
0
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1862
0
}
1863
1864
static void dissect_uftp_keyreq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1865
0
{
1866
0
    proto_item *ti = NULL;
1867
0
    proto_tree *keyreq_tree = NULL;
1868
0
    unsigned offset = 0, hlen;
1869
1870
0
    if (tvb_reported_length(tvb) < KEY_REQ_LEN) {
1871
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1872
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1873
0
        return;
1874
0
    }
1875
1876
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1877
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < KEY_REQ_LEN)) {
1878
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1879
0
                            "Invalid length, len = %d, hlen = %d",
1880
0
                            tvb_reported_length(tvb), hlen);
1881
0
        return;
1882
0
    }
1883
1884
0
    ti = proto_tree_add_item(tree, hf_uftp_keyreq, tvb, offset, -1, ENC_NA);
1885
0
    keyreq_tree = proto_item_add_subtree(ti, ett_uftp_keyreq);
1886
0
    proto_tree_add_item(keyreq_tree, hf_uftp_keyreq_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1887
0
    offset += 1;
1888
0
    proto_tree_add_uint_format_value(keyreq_tree, hf_uftp_keyreq_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1889
0
    offset += 1;
1890
0
    proto_tree_add_item(keyreq_tree, hf_uftp_keyreq_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1891
0
}
1892
1893
static void dissect_uftp_proxykey(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1894
0
{
1895
0
    proto_item *ti = NULL;
1896
0
    proto_tree *proxykey_tree = NULL;
1897
0
    unsigned offset = 0, hlen;
1898
0
    unsigned keylen, dhlen, siglen;
1899
0
    int8_t blobtype;
1900
0
    tvbuff_t *next_tvb;
1901
1902
0
    if (tvb_reported_length(tvb) < PROXY_KEY_LEN) {
1903
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1904
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1905
0
        return;
1906
0
    }
1907
1908
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
1909
0
    keylen = tvb_get_ntohs(tvb, 2);
1910
0
    dhlen = tvb_get_ntohs(tvb, 4);
1911
0
    siglen = tvb_get_ntohs(tvb, 6);
1912
0
    if ((tvb_reported_length(tvb) < hlen) ||
1913
0
            (hlen < PROXY_KEY_LEN + keylen + dhlen + siglen)) {
1914
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1915
0
                "Invalid length, len = %d, hlen = %d, keylen=%d, dhlen=%d, siglen=%d",
1916
0
                tvb_reported_length(tvb), hlen, keylen, dhlen, siglen);
1917
0
        return;
1918
0
    }
1919
1920
0
    ti = proto_tree_add_item(tree, hf_uftp_proxykey, tvb, offset, -1, ENC_NA);
1921
0
    proxykey_tree = proto_item_add_subtree(ti, ett_uftp_proxykey);
1922
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1923
0
    offset += 1;
1924
0
    proto_tree_add_uint_format_value(proxykey_tree, hf_uftp_proxykey_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1925
0
    offset += 1;
1926
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_bloblen, tvb, offset, 2, ENC_BIG_ENDIAN);
1927
0
    offset += 2;
1928
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_dhlen, tvb, offset, 2, ENC_BIG_ENDIAN);
1929
0
    offset += 2;
1930
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1931
0
    offset += 2;
1932
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1933
0
    offset += 4;
1934
0
    if (keylen > 0) {
1935
0
        int parsed = 0;
1936
1937
0
        next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1938
0
        blobtype = tvb_get_uint8(tvb, offset);
1939
0
        switch (blobtype) {
1940
0
        case KEYBLOB_RSA:
1941
0
            parsed = dissect_uftp_rsablob(next_tvb, pinfo, proxykey_tree, hf_uftp_proxykey_keyblob);
1942
0
            break;
1943
0
        case KEYBLOB_EC:
1944
0
            parsed = dissect_uftp_ecblob(next_tvb, pinfo, proxykey_tree, hf_uftp_proxykey_keyblob);
1945
0
            break;
1946
0
        }
1947
0
        offset += parsed;
1948
0
    }
1949
0
    if (dhlen > 0) {
1950
0
        int parsed = 0;
1951
1952
0
        next_tvb = tvb_new_subset_length(tvb, offset, dhlen);
1953
0
        blobtype = tvb_get_uint8(tvb, offset);
1954
0
        switch (blobtype) {
1955
0
        case KEYBLOB_RSA:
1956
0
            parsed = dissect_uftp_rsablob(next_tvb, pinfo, proxykey_tree, hf_uftp_proxykey_dhblob);
1957
0
            break;
1958
0
        case KEYBLOB_EC:
1959
0
            parsed = dissect_uftp_ecblob(next_tvb, pinfo, proxykey_tree, hf_uftp_proxykey_dhblob);
1960
0
            break;
1961
0
        }
1962
0
        offset += parsed;
1963
0
    }
1964
0
    if (siglen > 0) {
1965
0
        proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_verify, tvb, offset, siglen, ENC_NA);
1966
0
    }
1967
0
}
1968
1969
static void dissect_uftp_congctrl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1970
3
{
1971
3
    proto_item *ti = NULL;
1972
3
    proto_item *cclist = NULL;
1973
3
    proto_item *ccitem = NULL;
1974
3
    proto_tree *congctrl_tree = NULL;
1975
3
    proto_tree *cclist_tree = NULL;
1976
3
    proto_tree *ccitem_tree = NULL;
1977
3
    unsigned offset = 0, hlen;
1978
3
    unsigned rate;
1979
3
    uint8_t itemcount, idx;
1980
1981
3
    if (tvb_reported_length(tvb) < CONG_CTRL_LEN) {
1982
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1983
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1984
0
        return;
1985
0
    }
1986
1987
3
    hlen = tvb_get_uint8(tvb, 1) * 4;
1988
3
    if ((tvb_reported_length(tvb) < hlen) || (hlen < CONG_CTRL_LEN)) {
1989
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1990
0
                            "Invalid length, len = %d, hlen = %d",
1991
0
                            tvb_reported_length(tvb), hlen);
1992
0
        return;
1993
0
    }
1994
1995
3
    rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
1996
1997
3
    ti = proto_tree_add_item(tree, hf_uftp_congctrl, tvb, offset, -1, ENC_NA);
1998
3
    congctrl_tree = proto_item_add_subtree(ti, ett_uftp_congctrl);
1999
3
    proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_func, tvb, offset, 1, ENC_BIG_ENDIAN);
2000
3
    offset += 1;
2001
3
    proto_tree_add_uint_format_value(congctrl_tree, hf_uftp_congctrl_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
2002
3
    offset += 1;
2003
3
    proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2004
3
    offset += 2;
2005
3
    proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_cc_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
2006
3
    offset += 2;
2007
3
    proto_tree_add_uint(congctrl_tree, hf_uftp_congctrl_cc_rate, tvb, offset, 2, rate);
2008
3
    offset += 2;
2009
3
    proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
2010
2011
3
    itemcount = (tvb_reported_length(tvb) - hlen) / CC_ITEM_LEN;
2012
3
    offset = hlen;
2013
3
    if (itemcount > 0) {
2014
3
        cclist = proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_cclist, tvb, offset, itemcount * CC_ITEM_LEN, ENC_NA);
2015
3
        cclist_tree = proto_item_add_subtree(cclist, ett_uftp_congctrl_cclist);
2016
3
    }
2017
279
    for (idx = 0; idx < itemcount; idx++) {
2018
276
        unsigned itemrate;
2019
276
        double itemrtt;
2020
276
        itemrtt = unquantize_grtt(tvb_get_uint8(tvb, offset + 5));
2021
276
        itemrate = unquantize_rate(tvb_get_ntohs(tvb, offset + 6));
2022
2023
276
        ccitem = proto_tree_add_item(cclist_tree, hf_uftp_congctrl_item, tvb, offset, CC_ITEM_LEN, ENC_NA);
2024
276
        ccitem_tree = proto_item_add_subtree(ccitem, ett_uftp_congctrl_item);
2025
276
        proto_tree_add_item(ccitem_tree, hf_uftp_congctrl_item_destid, tvb, offset, 4, ENC_BIG_ENDIAN);
2026
276
        offset += 4;
2027
276
        proto_tree_add_bitmask(ccitem_tree, tvb, offset, hf_uftp_congctrl_item_flags, ett_uftp_congctrl_item_flags, cc_item_flags, ENC_BIG_ENDIAN);
2028
276
        offset += 1;
2029
276
        proto_tree_add_double(ccitem_tree, hf_uftp_congctrl_item_rtt, tvb, offset, 1, itemrtt);
2030
276
        offset += 1;
2031
276
        proto_tree_add_uint(ccitem_tree, hf_uftp_congctrl_item_rate, tvb, offset, 2, itemrate);
2032
276
        offset += 2;
2033
276
    }
2034
3
}
2035
2036
static void dissect_uftp_ccack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2037
0
{
2038
0
    proto_item *ti = NULL;
2039
0
    proto_tree *ccack_tree = NULL;
2040
0
    unsigned offset = 0, hlen, extlen_total;
2041
0
    uint8_t ext_type;
2042
0
    tvbuff_t *next_tvb;
2043
2044
0
    if (tvb_reported_length(tvb) < CC_ACK_LEN) {
2045
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
2046
0
                            "Invalid length: %d", tvb_reported_length(tvb));
2047
0
        return;
2048
0
    }
2049
2050
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
2051
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < CC_ACK_LEN)) {
2052
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
2053
0
                            "Invalid length, len = %d, hlen = %d",
2054
0
                            tvb_reported_length(tvb), hlen);
2055
0
        return;
2056
0
    }
2057
2058
0
    ti = proto_tree_add_item(tree, hf_uftp_ccack, tvb, offset, -1, ENC_NA);
2059
0
    ccack_tree = proto_item_add_subtree(ti, ett_uftp_ccack);
2060
0
    proto_tree_add_uint_format_value(ccack_tree, hf_uftp_ccack_func, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
2061
0
    offset += 1;
2062
0
    proto_tree_add_item(ccack_tree, hf_uftp_ccack_hlen, tvb, offset, 1, ENC_BIG_ENDIAN);
2063
0
    offset += 1;
2064
0
    proto_tree_add_item(ccack_tree, hf_uftp_ccack_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2065
0
    offset += 2;
2066
2067
0
    extlen_total = hlen - CC_ACK_LEN;
2068
0
    while (extlen_total > 0) {
2069
0
        int parsed = 0;
2070
2071
0
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
2072
0
        ext_type = tvb_get_uint8(tvb, offset);
2073
0
        switch (ext_type) {
2074
0
        case EXT_TFMCC_ACK_INFO:
2075
0
            parsed = dissect_uftp_tfmccack(next_tvb, pinfo, ccack_tree);
2076
0
            break;
2077
0
        }
2078
0
        if (!parsed) break;
2079
0
        extlen_total -= parsed;
2080
0
        offset += parsed;
2081
0
    }
2082
0
}
2083
2084
static void dissect_uftp_encrypted(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2085
0
{
2086
0
    proto_item *ti = NULL;
2087
0
    proto_tree *encrypted_tree = NULL;
2088
0
    unsigned offset = 0;
2089
0
    unsigned sig_len, payload_len;
2090
2091
0
    if (tvb_reported_length(tvb) < ENCRYPTED_LEN) {
2092
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
2093
0
                            "Invalid length: %d", tvb_reported_length(tvb));
2094
0
        return;
2095
0
    }
2096
2097
0
    sig_len = tvb_get_ntohs(tvb, 8);
2098
0
    payload_len = tvb_get_ntohs(tvb, 10);
2099
0
    if (tvb_reported_length(tvb) < ENCRYPTED_LEN + sig_len + payload_len) {
2100
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
2101
0
                            "Invalid length, len = %d, sig=%d, payload=%d",
2102
0
                            tvb_reported_length(tvb), sig_len, payload_len);
2103
0
        return;
2104
0
    }
2105
2106
0
    ti = proto_tree_add_item(tree, hf_uftp_encrypted, tvb, offset, -1, ENC_NA);
2107
0
    encrypted_tree = proto_item_add_subtree(ti, ett_uftp_encrypted);
2108
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_ivctr, tvb, offset, 8, ENC_BIG_ENDIAN);
2109
0
    offset += 8;
2110
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_sig_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2111
0
    offset += 2;
2112
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2113
0
    offset += 2;
2114
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_signature, tvb, offset, sig_len, ENC_NA);
2115
0
    offset += sig_len;
2116
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_payload, tvb, offset, payload_len, ENC_NA);
2117
0
}
2118
2119
static void dissect_uftp_abort(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2120
0
{
2121
0
    proto_item *ti = NULL;
2122
0
    proto_tree *abort_tree = NULL;
2123
0
    unsigned offset = 0, hlen;
2124
2125
0
    if (tvb_reported_length(tvb) < ABORT_LEN) {
2126
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
2127
0
                            "Invalid length: %d", tvb_reported_length(tvb));
2128
0
        return;
2129
0
    }
2130
2131
0
    hlen = tvb_get_uint8(tvb, 1) * 4;
2132
0
    if ((tvb_reported_length(tvb) < hlen) || (hlen < ABORT_LEN)) {
2133
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
2134
0
                            "Invalid length, len = %d, hlen = %d",
2135
0
                            tvb_reported_length(tvb), hlen);
2136
0
        return;
2137
0
    }
2138
2139
0
    ti = proto_tree_add_item(tree, hf_uftp_abort, tvb, offset, -1, ENC_NA);
2140
0
    abort_tree = proto_item_add_subtree(ti, ett_uftp_abort);
2141
0
    proto_tree_add_item(abort_tree, hf_uftp_abort_func, tvb, offset, 1, ENC_BIG_ENDIAN);
2142
0
    offset += 1;
2143
0
    proto_tree_add_uint_format_value(abort_tree, hf_uftp_abort_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
2144
0
    offset += 1;
2145
0
    proto_tree_add_bitmask(abort_tree, tvb, offset, hf_uftp_abort_flags, ett_uftp_abort_flags, abort_flags, ENC_BIG_ENDIAN);
2146
0
    offset += 1;
2147
0
    proto_tree_add_item(abort_tree, hf_uftp_abort_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2148
0
    offset += 1;
2149
0
    proto_tree_add_item(abort_tree, hf_uftp_abort_clientid, tvb, offset, 4, ENC_BIG_ENDIAN);
2150
0
    offset += 4;
2151
0
    proto_tree_add_item(abort_tree, hf_uftp_abort_message, tvb, offset, -1, ENC_ASCII);
2152
0
}
2153
2154
static int dissect_uftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2155
4
{
2156
4
    uint8_t version;
2157
4
    uint8_t mes_type;
2158
4
    uint32_t group_id;
2159
4
    tvbuff_t *next_tvb;
2160
4
    proto_item *ti = NULL;
2161
4
    proto_tree *uftp_tree = NULL;
2162
4
    unsigned offset = 0;
2163
4
    unsigned l_gsize;
2164
4
    double grtt;
2165
2166
4
    if (tvb_reported_length(tvb) < UFTP_LEN + 4) {
2167
0
        return 0;
2168
0
    }
2169
2170
4
    version = tvb_get_uint8(tvb, 0);
2171
4
    mes_type = tvb_get_uint8(tvb, 1);
2172
4
    group_id = tvb_get_ntohl(tvb, 8);
2173
2174
4
    if (version != UFTP_VER_NUM) {
2175
0
        return 0;
2176
0
    }
2177
2178
4
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "UFTP");
2179
    /* Clear out stuff in the info column */
2180
4
    col_clear(pinfo->cinfo,COL_INFO);
2181
4
    col_add_fstr(pinfo->cinfo, COL_INFO, "%-12s",
2182
4
                 val_to_str(pinfo->pool, mes_type, messages, "Unknown (%d)"));
2183
4
    if ((mes_type != HB_REQ) && (mes_type != HB_RESP)) {
2184
4
        col_append_fstr(pinfo->cinfo, COL_INFO, " ID=%08X", group_id);
2185
4
    }
2186
2187
4
    grtt = unquantize_grtt(tvb_get_uint8(tvb, 13));
2188
4
    l_gsize = unquantize_gsize(tvb_get_uint8(tvb, 14));
2189
2190
4
    ti = proto_tree_add_item(tree, proto_uftp, tvb, 0, -1, ENC_NA);
2191
4
    uftp_tree = proto_item_add_subtree(ti, ett_uftp);
2192
4
    proto_tree_add_item(uftp_tree, hf_uftp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2193
4
    offset += 1;
2194
4
    proto_tree_add_item(uftp_tree, hf_uftp_func, tvb, offset, 1, ENC_BIG_ENDIAN);
2195
4
    offset += 1;
2196
4
    proto_tree_add_item(uftp_tree, hf_uftp_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
2197
4
    offset += 2;
2198
4
    proto_tree_add_item(uftp_tree, hf_uftp_src_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2199
4
    offset += 4;
2200
4
    proto_tree_add_item(uftp_tree, hf_uftp_group_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2201
4
    offset += 4;
2202
4
    proto_tree_add_item(uftp_tree, hf_uftp_group_inst, tvb, offset, 1, ENC_BIG_ENDIAN);
2203
4
    offset += 1;
2204
4
    proto_tree_add_double(uftp_tree, hf_uftp_grtt, tvb, offset, 1, grtt);
2205
4
    offset += 1;
2206
4
    proto_tree_add_uint(uftp_tree, hf_uftp_gsize, tvb, offset, 1, l_gsize);
2207
4
    offset += 1;
2208
4
    proto_tree_add_item(uftp_tree, hf_uftp_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2209
4
    offset += 1;
2210
2211
4
    next_tvb = tvb_new_subset_length(tvb, offset, tvb_reported_length(tvb) - UFTP_LEN);
2212
2213
4
    switch (mes_type) {
2214
0
        case ANNOUNCE:
2215
0
            dissect_uftp_announce(next_tvb, pinfo, uftp_tree);
2216
0
            break;
2217
0
        case REGISTER:
2218
0
            dissect_uftp_register(next_tvb, pinfo, uftp_tree);
2219
0
            break;
2220
0
        case CLIENT_KEY:
2221
0
            dissect_uftp_clientkey(next_tvb, pinfo, uftp_tree);
2222
0
            break;
2223
0
        case REG_CONF:
2224
0
            dissect_uftp_regconf(next_tvb, pinfo, uftp_tree);
2225
0
            break;
2226
1
        case KEYINFO:
2227
1
            dissect_uftp_keyinfo(next_tvb, pinfo, uftp_tree);
2228
1
            break;
2229
0
        case KEYINFO_ACK:
2230
0
            dissect_uftp_keyinfoack(next_tvb, pinfo, uftp_tree);
2231
0
            break;
2232
0
        case FILEINFO:
2233
0
            dissect_uftp_fileinfo(next_tvb, pinfo, uftp_tree);
2234
0
            break;
2235
0
        case FILEINFO_ACK:
2236
0
            dissect_uftp_fileinfoack(next_tvb, pinfo, uftp_tree);
2237
0
            break;
2238
0
        case FILESEG:
2239
0
            dissect_uftp_fileseg(next_tvb, pinfo, uftp_tree);
2240
0
            break;
2241
0
        case DONE:
2242
0
            dissect_uftp_done(next_tvb, pinfo, uftp_tree);
2243
0
            break;
2244
0
        case STATUS:
2245
0
            dissect_uftp_status(next_tvb, pinfo, uftp_tree);
2246
0
            break;
2247
0
        case COMPLETE:
2248
0
            dissect_uftp_complete(next_tvb, pinfo, uftp_tree);
2249
0
            break;
2250
0
        case DONE_CONF:
2251
0
            dissect_uftp_doneconf(next_tvb, pinfo, uftp_tree);
2252
0
            break;
2253
0
        case HB_REQ:
2254
0
            dissect_uftp_hbreq(next_tvb, pinfo, uftp_tree);
2255
0
            break;
2256
0
        case HB_RESP:
2257
0
            dissect_uftp_hbresp(next_tvb, pinfo, uftp_tree);
2258
0
            break;
2259
0
        case KEY_REQ:
2260
0
            dissect_uftp_keyreq(next_tvb, pinfo, uftp_tree);
2261
0
            break;
2262
0
        case PROXY_KEY:
2263
0
            dissect_uftp_proxykey(next_tvb, pinfo, uftp_tree);
2264
0
            break;
2265
3
        case CONG_CTRL:
2266
3
            dissect_uftp_congctrl(next_tvb, pinfo, uftp_tree);
2267
3
            break;
2268
0
        case CC_ACK:
2269
0
            dissect_uftp_ccack(next_tvb, pinfo, uftp_tree);
2270
0
            break;
2271
0
        case ENCRYPTED:
2272
0
            dissect_uftp_encrypted(next_tvb, pinfo, uftp_tree);
2273
0
            break;
2274
0
        case ABORT:
2275
0
            dissect_uftp_abort(next_tvb, pinfo, uftp_tree);
2276
0
            break;
2277
0
        default:
2278
0
            proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_func_unknown, tvb, offset,
2279
0
                        "Function unknown: %d", mes_type);
2280
0
            break;
2281
4
    }
2282
2283
4
    return tvb_reported_length(tvb);
2284
4
}
2285
2286
void proto_register_uftp4(void)
2287
16
{
2288
16
    static hf_register_info hf[] = {
2289
16
        { &hf_uftp_version,
2290
16
            { "Protocol Version", "uftp4.version",
2291
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2292
16
        },
2293
16
        { &hf_uftp_func,
2294
16
            { "Type", "uftp4.func",
2295
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2296
16
        },
2297
16
        { &hf_uftp_seq,
2298
16
            { "Sequence Number", "uftp4.seq",
2299
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2300
16
        },
2301
16
        { &hf_uftp_src_id,
2302
16
            { "Source ID", "uftp4.src_id",
2303
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2304
16
        },
2305
16
        { &hf_uftp_group_id,
2306
16
            { "Group ID", "uftp4.group_id",
2307
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2308
16
        },
2309
16
        { &hf_uftp_group_inst,
2310
16
            { "Group Instance ID", "uftp4.group_inst",
2311
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2312
16
        },
2313
16
        { &hf_uftp_grtt,
2314
16
            { "Group Round Trip Time", "uftp4.grtt",
2315
16
            FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2316
16
        },
2317
16
        { &hf_uftp_gsize,
2318
16
            { "Group Size", "uftp4.gsize",
2319
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2320
16
        },
2321
16
        { &hf_uftp_reserved,
2322
16
            { "Reserved", "uftp4.reserved",
2323
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2324
16
        },
2325
16
        { &hf_uftp_destlist,
2326
16
            { "Destination List", "uftp4.destlist",
2327
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2328
16
        },
2329
16
        { &hf_uftp_dest,
2330
16
            { "Destination", "uftp4.dest",
2331
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2332
16
        },
2333
16
        { &hf_uftp_announce,
2334
16
            { "ANNOUNCE", "uftp4.announce",
2335
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2336
16
        },
2337
16
        { &hf_uftp_announce_func,
2338
16
            { "Type", "uftp4.announce.func",
2339
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2340
16
        },
2341
16
        { &hf_uftp_announce_hlen,
2342
16
            { "Header Length", "uftp4.announce.hlen",
2343
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2344
16
        },
2345
16
        { &hf_uftp_announce_flags,
2346
16
            { "Flags", "uftp4.announce.flags",
2347
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2348
16
        },
2349
16
        { &hf_uftp_announce_flags_sync,
2350
16
            { "Sync mode", "uftp4.announce.flags.sync",
2351
16
            FT_BOOLEAN, 8, NULL, FLAG_SYNC_MODE, NULL, HFILL }
2352
16
        },
2353
16
        { &hf_uftp_announce_flags_syncpreview,
2354
16
            { "Sync preview mode", "uftp4.announce.flags.syncpreview",
2355
16
            FT_BOOLEAN, 8, NULL, FLAG_SYNC_PREVIEW, NULL, HFILL }
2356
16
        },
2357
16
        { &hf_uftp_announce_flags_ipv6,
2358
16
            { "IPv6", "uftp4.announce.flags.ipv6",
2359
16
            FT_BOOLEAN, 8, NULL, FLAG_IPV6, NULL, HFILL }
2360
16
        },
2361
16
        { &hf_uftp_announce_flags_reserved,
2362
16
            { "Reserved", "uftp4.announce.flags.reserved",
2363
16
            FT_UINT8, BASE_HEX, NULL, FLAG_ANNOUNCE_RESERVED, NULL, HFILL }
2364
16
        },
2365
16
        { &hf_uftp_announce_robust,
2366
16
            { "Robustness Factor", "uftp4.announce.robust",
2367
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2368
16
        },
2369
16
        { &hf_uftp_announce_cc_type,
2370
16
            { "Congestion Control Type", "uftp4.announce.cc_type",
2371
16
            FT_UINT8, BASE_DEC, VALS(cc_types), 0x0, NULL, HFILL }
2372
16
        },
2373
16
        { &hf_uftp_announce_reserved,
2374
16
            { "Reserved", "uftp4.announce.reserved",
2375
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2376
16
        },
2377
16
        { &hf_uftp_announce_blocksize,
2378
16
            { "Block Size", "uftp4.announce.blocksize",
2379
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2380
16
        },
2381
16
        { &hf_uftp_announce_tstamp,
2382
16
            { "Timestamp", "uftp4.announce.tstamp",
2383
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2384
16
        },
2385
16
        { &hf_uftp_announce_publicmcast_ipv4,
2386
16
            { "Public Multicast Address", "uftp4.announce.publicmcast.ipv4",
2387
16
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2388
16
        },
2389
16
        { &hf_uftp_announce_publicmcast_ipv6,
2390
16
            { "Public Multicast Address", "uftp4.announce.publicmcast.ipv6",
2391
16
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
2392
16
        },
2393
16
        { &hf_uftp_announce_privatemcast_ipv4,
2394
16
            { "Private Multicast Address", "uftp4.announce.privatemcast.ipv4",
2395
16
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2396
16
        },
2397
16
        { &hf_uftp_announce_privatemcast_ipv6,
2398
16
            { "Private Multicast Address", "uftp4.announce.privatemcast.ipv6",
2399
16
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
2400
16
        },
2401
16
        { &hf_uftp_encinfo,
2402
16
            { "EXT_ENC_INFO", "uftp4.encinfo",
2403
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2404
16
        },
2405
16
        { &hf_uftp_encinfo_exttype,
2406
16
            { "Extension Type", "uftp4.encinfo.exttype",
2407
16
            FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2408
16
        },
2409
16
        { &hf_uftp_encinfo_extlen,
2410
16
            { "Extension Length", "uftp4.encinfo.extlen",
2411
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2412
16
        },
2413
16
        { &hf_uftp_encinfo_flags,
2414
16
            { "Flags", "uftp4.encinfo.flags",
2415
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2416
16
        },
2417
16
        { &hf_uftp_encinfo_flags_client_auth,
2418
16
            { "Client Authorization", "uftp4.encinfo.flags.client_auth",
2419
16
            FT_BOOLEAN, 8, NULL, FLAG_CLIENT_AUTH, NULL, HFILL }
2420
16
        },
2421
16
        { &hf_uftp_encinfo_flags_reserved,
2422
16
            { "Reserved", "uftp4.encinfo.flags.reserved",
2423
16
            FT_UINT8, BASE_HEX, NULL, FLAG_ENCINFO_RESERVED, NULL, HFILL }
2424
16
        },
2425
16
        { &hf_uftp_encinfo_keyextype,
2426
16
            { "Key Exchange Type", "uftp4.encinfo.keyextype",
2427
16
            FT_UINT8, BASE_DEC, VALS(keyexchange_types), 0xF0, NULL, HFILL }
2428
16
        },
2429
16
        { &hf_uftp_encinfo_sigtype,
2430
16
            { "Signature Type", "uftp4.encinfo.sigtype",
2431
16
            FT_UINT8, BASE_DEC, VALS(signature_types), 0x0F, NULL, HFILL }
2432
16
        },
2433
16
        { &hf_uftp_encinfo_keytype,
2434
16
            { "Key Type", "uftp4.encinfo.keytype",
2435
16
            FT_UINT8, BASE_DEC, VALS(key_types), 0x0, NULL, HFILL }
2436
16
        },
2437
16
        { &hf_uftp_encinfo_hashtype,
2438
16
            { "Hash Type", "uftp4.encinfo.hashtype",
2439
16
            FT_UINT8, BASE_DEC, VALS(hash_types), 0x0, NULL, HFILL }
2440
16
        },
2441
16
        { &hf_uftp_encinfo_keylen,
2442
16
            { "Public Key Length", "uftp4.encinfo.keylen",
2443
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2444
16
        },
2445
16
        { &hf_uftp_encinfo_dhlen,
2446
16
            { "Diffie-Hellman Key Length", "uftp4.encinfo.dhlen",
2447
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2448
16
        },
2449
16
        { &hf_uftp_encinfo_siglen,
2450
16
            { "Signature Length", "uftp4.encinfo.siglen",
2451
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2452
16
        },
2453
16
        { &hf_uftp_encinfo_rand1,
2454
16
            { "Server Random Number", "uftp4.encinfo.rand1",
2455
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2456
16
        },
2457
16
        { &hf_uftp_encinfo_keyblob,
2458
16
            { "Public Key Blob", "uftp4.encinfo.keyblob",
2459
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2460
16
        },
2461
16
        { &hf_uftp_encinfo_dhblob,
2462
16
            { "Diffie-Hellman Key Blob", "uftp4.encinfo.dhblob",
2463
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2464
16
        },
2465
16
        { &hf_uftp_encinfo_sig,
2466
16
            { "Signature", "uftp4.encinfo.sig",
2467
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2468
16
        },
2469
16
        { &hf_uftp_rsablob_blobtype,
2470
16
            { "Keyblob Type", "uftp4.rsablob.blobtype",
2471
16
            FT_UINT8, BASE_DEC, VALS(keyblob_types), 0x0, NULL, HFILL }
2472
16
        },
2473
16
        { &hf_uftp_rsablob_reserved,
2474
16
            { "Reserved", "uftp4.rsablob.reserved",
2475
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2476
16
        },
2477
16
        { &hf_uftp_rsablob_modlen,
2478
16
            { "Modulus Length", "uftp4.rsablob.modlen",
2479
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2480
16
        },
2481
16
        { &hf_uftp_rsablob_exponent,
2482
16
            { "Exponent", "uftp4.rsablob.exponent",
2483
16
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2484
16
        },
2485
16
        { &hf_uftp_rsablob_modulus,
2486
16
            { "Modulus", "uftp4.rsablob.modulus",
2487
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2488
16
        },
2489
16
        { &hf_uftp_ecblob_blobtype,
2490
16
            { "Keyblob Type", "uftp4.ecblob.blobtype",
2491
16
            FT_UINT8, BASE_DEC, VALS(keyblob_types), 0x0, NULL, HFILL }
2492
16
        },
2493
16
        { &hf_uftp_ecblob_curve,
2494
16
            { "Curve", "uftp4.ecblob.curve",
2495
16
            FT_UINT8, BASE_DEC, VALS(curves), 0x0, NULL, HFILL }
2496
16
        },
2497
16
        { &hf_uftp_ecblob_keylen,
2498
16
            { "Key Length", "uftp4.ecblob.keylen",
2499
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2500
16
        },
2501
16
        { &hf_uftp_ecblob_key,
2502
16
            { "Key", "uftp4.ecblob.key",
2503
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2504
16
        },
2505
16
        { &hf_uftp_register,
2506
16
            { "REGISTER", "uftp4.register",
2507
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2508
16
        },
2509
16
        { &hf_uftp_register_func,
2510
16
            { "Type", "uftp4.register.func",
2511
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2512
16
        },
2513
16
        { &hf_uftp_register_hlen,
2514
16
            { "Header Length", "uftp4.register.hlen",
2515
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2516
16
        },
2517
16
        { &hf_uftp_register_keyinfo_len,
2518
16
            { "Key Info Length", "uftp4.register.keyinfo_len",
2519
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2520
16
        },
2521
16
        { &hf_uftp_register_tstamp,
2522
16
            { "Timestamp", "uftp4.register.tstamp",
2523
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2524
16
        },
2525
16
        { &hf_uftp_register_rand2,
2526
16
            { "Client Random Number", "uftp4.register.rand2",
2527
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2528
16
        },
2529
16
        { &hf_uftp_register_keyinfo,
2530
16
            { "Key Info", "uftp4.register.keyinfo",
2531
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2532
16
        },
2533
16
        { &hf_uftp_clientkey,
2534
16
            { "CLIENT_KEY", "uftp4.clientkey",
2535
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2536
16
        },
2537
16
        { &hf_uftp_clientkey_func,
2538
16
            { "Type", "uftp4.clientkey.func",
2539
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2540
16
        },
2541
16
        { &hf_uftp_clientkey_hlen,
2542
16
            { "Header Length", "uftp4.clientkey.hlen",
2543
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2544
16
        },
2545
16
        { &hf_uftp_clientkey_reserved,
2546
16
            { "Reserved", "uftp4.clientkey.reserved",
2547
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2548
16
        },
2549
16
        { &hf_uftp_clientkey_bloblen,
2550
16
            { "Keyblob Length", "uftp4.clientkey.bloblen",
2551
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2552
16
        },
2553
16
        { &hf_uftp_clientkey_siglen,
2554
16
            { "Signature Length", "uftp4.clientkey.siglen",
2555
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2556
16
        },
2557
16
        { &hf_uftp_clientkey_keyblob,
2558
16
            { "Public Key Blob", "uftp4.clientkey.keyblob",
2559
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2560
16
        },
2561
16
        { &hf_uftp_clientkey_verify,
2562
16
            { "Signature", "uftp4.clientkey.verify",
2563
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2564
16
        },
2565
16
        { &hf_uftp_regconf,
2566
16
            { "REG_CONF", "uftp4.regconf",
2567
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2568
16
        },
2569
16
        { &hf_uftp_regconf_func,
2570
16
            { "Type", "uftp4.regconf.func",
2571
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2572
16
        },
2573
16
        { &hf_uftp_regconf_hlen,
2574
16
            { "Header Length", "uftp4.regconf.hlen",
2575
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2576
16
        },
2577
16
        { &hf_uftp_regconf_reserved,
2578
16
            { "Reserved", "uftp4.regconf.reserved",
2579
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2580
16
        },
2581
16
        { &hf_uftp_keyinfo,
2582
16
            { "KEYINFO", "uftp4.keyinfo",
2583
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2584
16
        },
2585
16
        { &hf_uftp_keyinfo_func,
2586
16
            { "Type", "uftp4.keyinfo.func",
2587
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2588
16
        },
2589
16
        { &hf_uftp_keyinfo_hlen,
2590
16
            { "Header Length", "uftp4.keyinfo.hlen",
2591
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2592
16
        },
2593
16
        { &hf_uftp_keyinfo_reserved,
2594
16
            { "Reserved", "uftp4.keyinfo.reserved",
2595
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2596
16
        },
2597
16
        { &hf_uftp_keyinfo_ivctr,
2598
16
            { "IV Counter", "uftp4.keyinfo.ivctr",
2599
16
            FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
2600
16
        },
2601
16
        { &hf_uftp_keyinfo_destkey,
2602
16
            { "Destination Key", "uftp4.keyinfo.destkey",
2603
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2604
16
        },
2605
16
        { &hf_uftp_keyinfo_destid,
2606
16
            { "Destination ID", "uftp4.keyinfo.destid",
2607
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2608
16
        },
2609
16
        { &hf_uftp_keyinfo_groupmaster,
2610
16
            { "Encrypted Group Master", "uftp4.keyinfo.groupmaster",
2611
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2612
16
        },
2613
16
        { &hf_uftp_keyinfoack,
2614
16
            { "KEYINFO_ACK", "uftp4.keyinfoack",
2615
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2616
16
        },
2617
16
        { &hf_uftp_keyinfoack_func,
2618
16
            { "Type", "uftp4.keyinfoack.func",
2619
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2620
16
        },
2621
16
        { &hf_uftp_keyinfoack_hlen,
2622
16
            { "Header Length", "uftp4.keyinfoack.hlen",
2623
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2624
16
        },
2625
16
        { &hf_uftp_keyinfoack_reserved,
2626
16
            { "Reserved", "uftp4.keyinfoack.reserved",
2627
16
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2628
16
        },
2629
16
        { &hf_uftp_keyinfoack_verify_data,
2630
16
            { "Verify Data", "uftp4.keyinfoack.verify_data",
2631
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2632
16
        },
2633
16
        { &hf_uftp_fileinfo,
2634
16
            { "FILEINFO", "uftp4.fileinfo",
2635
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2636
16
        },
2637
16
        { &hf_uftp_fileinfo_func,
2638
16
            { "Type", "uftp4.fileinfo.func",
2639
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2640
16
        },
2641
16
        { &hf_uftp_fileinfo_hlen,
2642
16
            { "Header Length", "uftp4.fileinfo.hlen",
2643
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2644
16
        },
2645
16
        { &hf_uftp_fileinfo_file_id,
2646
16
            { "File ID", "uftp4.fileinfo.file_id",
2647
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2648
16
        },
2649
16
        { &hf_uftp_fileinfo_ftype,
2650
16
            { "File Type", "uftp4.fileinfo.ftype",
2651
16
            FT_UINT8, BASE_DEC, VALS(file_types), 0x0, NULL, HFILL }
2652
16
        },
2653
16
        { &hf_uftp_fileinfo_reserved,
2654
16
            { "Reserved", "uftp4.fileinfo.reserved",
2655
16
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2656
16
        },
2657
16
        { &hf_uftp_fileinfo_namelen,
2658
16
            { "Name Length", "uftp4.fileinfo.namelen",
2659
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2660
16
        },
2661
16
        { &hf_uftp_fileinfo_linklen,
2662
16
            { "Link Length", "uftp4.fileinfo.linklen",
2663
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2664
16
        },
2665
16
        { &hf_uftp_fileinfo_fsize,
2666
16
            { "File Size", "uftp4.fileinfo.fsize",
2667
16
            FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
2668
16
        },
2669
16
        { &hf_uftp_fileinfo_ftstamp,
2670
16
            { "File Timestamp", "uftp4.fileinfo.ftstamp",
2671
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2672
16
        },
2673
16
        { &hf_uftp_fileinfo_tstamp,
2674
16
            { "Timestamp", "uftp4.fileinfo.tstamp",
2675
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2676
16
        },
2677
16
        { &hf_uftp_fileinfo_name,
2678
16
            { "File Name", "uftp4.fileinfo.name",
2679
16
            FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2680
16
        },
2681
16
        { &hf_uftp_fileinfo_link,
2682
16
            { "Link Name", "uftp4.fileinfo.link",
2683
16
            FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2684
16
        },
2685
16
        { &hf_uftp_fileinfoack,
2686
16
            { "FILEINFO_ACK", "uftp4.fileinfoack",
2687
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2688
16
        },
2689
16
        { &hf_uftp_fileinfoack_func,
2690
16
            { "Type", "uftp4.fileinfoack.func",
2691
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2692
16
        },
2693
16
        { &hf_uftp_fileinfoack_hlen,
2694
16
            { "Header Length", "uftp4.fileinfoack.hlen",
2695
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2696
16
        },
2697
16
        { &hf_uftp_fileinfoack_file_id,
2698
16
            { "File ID", "uftp4.fileinfoack.file_id",
2699
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2700
16
        },
2701
16
        { &hf_uftp_fileinfoack_flags,
2702
16
            { "Flags", "uftp4.fileinfoack.flags",
2703
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2704
16
        },
2705
16
        { &hf_uftp_fileinfoack_flags_partial,
2706
16
            { "Partial", "uftp4.fileinfoack.flags.partial",
2707
16
            FT_BOOLEAN, 8, NULL, FLAG_PARTIAL, NULL, HFILL }
2708
16
        },
2709
16
        { &hf_uftp_fileinfoack_flags_reserved,
2710
16
            { "Reserved", "uftp4.fileinfoack.flags.reserved",
2711
16
            FT_UINT8, BASE_HEX, NULL, FLAG_FILEINFOACK_RESERVED, NULL, HFILL }
2712
16
        },
2713
16
        { &hf_uftp_fileinfoack_reserved,
2714
16
            { "Reserved", "uftp4.fileinfoack.reserved",
2715
16
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2716
16
        },
2717
16
        { &hf_uftp_fileinfoack_tstamp,
2718
16
            { "Timestamp", "uftp4.fileinfoack.tstamp",
2719
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2720
16
        },
2721
16
        { &hf_uftp_fileseg,
2722
16
            { "FILESEG", "uftp4.fileseg",
2723
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2724
16
        },
2725
16
        { &hf_uftp_fileseg_func,
2726
16
            { "Type", "uftp4.fileseg.func",
2727
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2728
16
        },
2729
16
        { &hf_uftp_fileseg_hlen,
2730
16
            { "Header Length", "uftp4.fileseg.hlen",
2731
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2732
16
        },
2733
16
        { &hf_uftp_fileseg_file_id,
2734
16
            { "File ID", "uftp4.fileseg.file_id",
2735
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2736
16
        },
2737
16
        { &hf_uftp_fileseg_section,
2738
16
            { "Section", "uftp4.fileseg.section",
2739
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2740
16
        },
2741
16
        { &hf_uftp_fileseg_sec_block,
2742
16
            { "Block", "uftp4.fileseg.sec_block",
2743
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2744
16
        },
2745
16
        { &hf_uftp_tfmccdata,
2746
16
            { "EXT_TFMCC_DATA_INFO", "uftp4.tfmccdata",
2747
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2748
16
        },
2749
16
        { &hf_uftp_tfmccdata_exttype,
2750
16
            { "Extension Type", "uftp4.tfmccdata.exttype",
2751
16
            FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2752
16
        },
2753
16
        { &hf_uftp_tfmccdata_extlen,
2754
16
            { "Extension Length", "uftp4.tfmccdata.extlen",
2755
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2756
16
        },
2757
16
        { &hf_uftp_tfmccdata_send_rate,
2758
16
            { "Send Rate", "uftp4.tfmccdata.send_rate",
2759
16
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2760
16
        },
2761
16
        { &hf_uftp_tfmccdata_cc_seq,
2762
16
            { "CC Sequence Number", "uftp4.tfmccdata.cc_seq",
2763
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2764
16
        },
2765
16
        { &hf_uftp_tfmccdata_cc_rate,
2766
16
            { "Rate", "uftp4.tfmccdata.cc_rate",
2767
16
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2768
16
        },
2769
16
        { &hf_uftp_fileseg_data,
2770
16
            { "Data", "uftp4.fileseg.data",
2771
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2772
16
        },
2773
16
        { &hf_uftp_done,
2774
16
            { "DONE", "uftp4.done",
2775
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2776
16
        },
2777
16
        { &hf_uftp_done_func,
2778
16
            { "Type", "uftp4.done.func",
2779
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2780
16
        },
2781
16
        { &hf_uftp_done_hlen,
2782
16
            { "Header Length", "uftp4.done.hlen",
2783
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2784
16
        },
2785
16
        { &hf_uftp_done_file_id,
2786
16
            { "File ID", "uftp4.done.file_id",
2787
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2788
16
        },
2789
16
        { &hf_uftp_done_section,
2790
16
            { "Section", "uftp4.done.section",
2791
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2792
16
        },
2793
16
        { &hf_uftp_done_reserved,
2794
16
            { "Reserved", "uftp4.done.reserved",
2795
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2796
16
        },
2797
16
        { &hf_uftp_status,
2798
16
            { "STATUS", "uftp4.status",
2799
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2800
16
        },
2801
16
        { &hf_uftp_status_func,
2802
16
            { "Type", "uftp4.status.func",
2803
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2804
16
        },
2805
16
        { &hf_uftp_status_hlen,
2806
16
            { "Header Length", "uftp4.status.hlen",
2807
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2808
16
        },
2809
16
        { &hf_uftp_status_file_id,
2810
16
            { "File ID", "uftp4.status.file_id",
2811
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2812
16
        },
2813
16
        { &hf_uftp_status_section,
2814
16
            { "Section", "uftp4.status.section",
2815
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2816
16
        },
2817
16
        { &hf_uftp_status_reserved,
2818
16
            { "Reserved", "uftp4.status.reserved",
2819
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2820
16
        },
2821
16
        { &hf_uftp_status_naks,
2822
16
            { "NAKs", "uftp4.status.naks",
2823
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2824
16
        },
2825
16
        { &hf_uftp_complete,
2826
16
            { "COMPLETE", "uftp4.complete",
2827
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2828
16
        },
2829
16
        { &hf_uftp_complete_func,
2830
16
            { "Type", "uftp4.complete.func",
2831
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2832
16
        },
2833
16
        { &hf_uftp_complete_hlen,
2834
16
            { "Header Length", "uftp4.complete.hlen",
2835
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2836
16
        },
2837
16
        { &hf_uftp_complete_file_id,
2838
16
            { "File ID", "uftp4.complete.file_id",
2839
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2840
16
        },
2841
16
        { &hf_uftp_complete_status,
2842
16
            { "Completion Status", "uftp4.complete.status",
2843
16
            FT_UINT8, BASE_DEC, VALS(comp_status), 0x0, NULL, HFILL }
2844
16
        },
2845
16
        { &hf_uftp_complete_reserved,
2846
16
            { "Reserved", "uftp4.complete.reserved",
2847
16
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2848
16
        },
2849
16
        { &hf_uftp_freespace,
2850
16
            { "EXT_FREESPACE_INFO", "uftp4.freespace",
2851
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2852
16
        },
2853
16
        { &hf_uftp_freespace_exttype,
2854
16
            { "Extension Type", "uftp4.freespace.exttype",
2855
16
            FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2856
16
        },
2857
16
        { &hf_uftp_freespace_extlen,
2858
16
            { "Extension Length", "uftp4.freespace.extlen",
2859
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2860
16
        },
2861
16
        { &hf_uftp_freespace_reserved,
2862
16
            { "Reserved", "uftp4.freespace.reserved",
2863
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2864
16
        },
2865
16
        { &hf_uftp_freespace_freespace,
2866
16
            { "Free Space", "uftp4.freespace.freespace",
2867
16
            FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
2868
16
        },
2869
16
        { &hf_uftp_doneconf,
2870
16
            { "DONE_CONF", "uftp4.doneconf",
2871
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2872
16
        },
2873
16
        { &hf_uftp_doneconf_func,
2874
16
            { "Type", "uftp4.doneconf.func",
2875
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2876
16
        },
2877
16
        { &hf_uftp_doneconf_hlen,
2878
16
            { "Header Length", "uftp4.doneconf.hlen",
2879
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2880
16
        },
2881
16
        { &hf_uftp_doneconf_reserved,
2882
16
            { "Reserved", "uftp4.doneconf.reserved",
2883
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2884
16
        },
2885
16
        { &hf_uftp_hbreq,
2886
16
            { "HB_REQ", "uftp4.hbreq",
2887
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2888
16
        },
2889
16
        { &hf_uftp_hbreq_func,
2890
16
            { "Type", "uftp4.hbreq.func",
2891
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2892
16
        },
2893
16
        { &hf_uftp_hbreq_hlen,
2894
16
            { "Header Length", "uftp4.hbreq.hlen",
2895
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2896
16
        },
2897
16
        { &hf_uftp_hbreq_reserved,
2898
16
            { "Reserved", "uftp4.hbreq.reserved",
2899
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2900
16
        },
2901
16
        { &hf_uftp_hbreq_bloblen,
2902
16
            { "Keyblob Length", "uftp4.hbreq.bloblen",
2903
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2904
16
        },
2905
16
        { &hf_uftp_hbreq_siglen,
2906
16
            { "Signature Length", "uftp4.hbreq.siglen",
2907
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2908
16
        },
2909
16
        { &hf_uftp_hbreq_nonce,
2910
16
            { "Nonce", "uftp4.hbreq.nonce",
2911
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2912
16
        },
2913
16
        { &hf_uftp_hbreq_keyblob,
2914
16
            { "Public Key Blob", "uftp4.hbreq.keyblob",
2915
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2916
16
        },
2917
16
        { &hf_uftp_hbreq_verify,
2918
16
            { "Signature", "uftp4.hbreq.verify",
2919
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2920
16
        },
2921
16
        { &hf_uftp_hbresp,
2922
16
            { "HB_RESP", "uftp4.hbresp",
2923
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2924
16
        },
2925
16
        { &hf_uftp_hbresp_func,
2926
16
            { "Type", "uftp4.hbresp.func",
2927
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2928
16
        },
2929
16
        { &hf_uftp_hbresp_hlen,
2930
16
            { "Header Length", "uftp4.hbresp.hlen",
2931
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2932
16
        },
2933
16
        { &hf_uftp_hbresp_authenticated,
2934
16
            { "Authenticated", "uftp4.hbresp.authenticated",
2935
16
            FT_UINT8, BASE_DEC, VALS(hb_auth_types), 0x0, NULL, HFILL }
2936
16
        },
2937
16
        { &hf_uftp_hbresp_reserved,
2938
16
            { "Reserved", "uftp4.hbresp.reserved",
2939
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2940
16
        },
2941
16
        { &hf_uftp_hbresp_nonce,
2942
16
            { "Nonce", "uftp4.hbresp.nonce",
2943
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2944
16
        },
2945
16
        { &hf_uftp_keyreq,
2946
16
            { "KEY_REQ", "uftp4.keyreq",
2947
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2948
16
        },
2949
16
        { &hf_uftp_keyreq_func,
2950
16
            { "Type", "uftp4.keyreq.func",
2951
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2952
16
        },
2953
16
        { &hf_uftp_keyreq_hlen,
2954
16
            { "Header Length", "uftp4.keyreq.hlen",
2955
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2956
16
        },
2957
16
        { &hf_uftp_keyreq_reserved,
2958
16
            { "Reserved", "uftp4.keyreq.reserved",
2959
16
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2960
16
        },
2961
16
        { &hf_uftp_proxykey,
2962
16
            { "PROXY_KEY", "uftp4.proxykey",
2963
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2964
16
        },
2965
16
        { &hf_uftp_proxykey_func,
2966
16
            { "Type", "uftp4.proxykey.func",
2967
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2968
16
        },
2969
16
        { &hf_uftp_proxykey_hlen,
2970
16
            { "Header Length", "uftp4.proxykey.hlen",
2971
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2972
16
        },
2973
16
        { &hf_uftp_proxykey_bloblen,
2974
16
            { "Keyblob Length", "uftp4.proxykey.bloblen",
2975
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2976
16
        },
2977
16
        { &hf_uftp_proxykey_dhlen,
2978
16
            { "Diffie-Hellman Keyblob Length", "uftp4.proxykey.dhlen",
2979
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2980
16
        },
2981
16
        { &hf_uftp_proxykey_siglen,
2982
16
            { "Signature Length", "uftp4.proxykey.siglen",
2983
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2984
16
        },
2985
16
        { &hf_uftp_proxykey_nonce,
2986
16
            { "Nonce", "uftp4.proxykey.nonce",
2987
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2988
16
        },
2989
16
        { &hf_uftp_proxykey_keyblob,
2990
16
            { "Public Key Blob", "uftp4.proxykey.keyblob",
2991
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2992
16
        },
2993
16
        { &hf_uftp_proxykey_dhblob,
2994
16
            { "Diffie-Hellman Key Blob", "uftp4.proxykey.dhblob",
2995
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2996
16
        },
2997
16
        { &hf_uftp_proxykey_verify,
2998
16
            { "Signature", "uftp4.proxykey.verify",
2999
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3000
16
        },
3001
16
        { &hf_uftp_congctrl,
3002
16
            { "CONG_CTRL", "uftp4.congctrl",
3003
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3004
16
        },
3005
16
        { &hf_uftp_congctrl_func,
3006
16
            { "Type", "uftp4.congctrl.func",
3007
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3008
16
        },
3009
16
        { &hf_uftp_congctrl_hlen,
3010
16
            { "Header Length", "uftp4.congctrl.hlen",
3011
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3012
16
        },
3013
16
        { &hf_uftp_congctrl_reserved,
3014
16
            { "Reserved", "uftp4.congctrl.reserved",
3015
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
3016
16
        },
3017
16
        { &hf_uftp_congctrl_cc_seq,
3018
16
            { "CC Sequence", "uftp4.congctrl.cc_seq",
3019
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3020
16
        },
3021
16
        { &hf_uftp_congctrl_cc_rate,
3022
16
            { "Rate", "uftp4.congctrl.cc_rate",
3023
16
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3024
16
        },
3025
16
        { &hf_uftp_congctrl_tstamp,
3026
16
            { "Timestamp", "uftp4.congctrl.tstamp",
3027
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
3028
16
        },
3029
16
        { &hf_uftp_congctrl_cclist,
3030
16
            { "Congestion Control List", "uftp4.congctrl.cclist",
3031
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3032
16
        },
3033
16
        { &hf_uftp_congctrl_item,
3034
16
            { "Destination", "uftp4.congctrl.item",
3035
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3036
16
        },
3037
16
        { &hf_uftp_congctrl_item_destid,
3038
16
            { "Destination ID", "uftp4.congctrl.item.destid",
3039
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3040
16
        },
3041
16
        { &hf_uftp_congctrl_item_flags,
3042
16
            { "Flags", "uftp4.congctrl.item.flags",
3043
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3044
16
        },
3045
16
        { &hf_uftp_congctrl_item_flags_clr,
3046
16
            { "CLR", "uftp4.congctrl.item.flags.clr",
3047
16
            FT_BOOLEAN, 8, NULL, FLAG_CC_CLR, NULL, HFILL }
3048
16
        },
3049
16
        { &hf_uftp_congctrl_item_flags_rtt,
3050
16
            { "RTT", "uftp4.congctrl.item.flags.rtt",
3051
16
            FT_BOOLEAN, 8, NULL, FLAG_CC_RTT, NULL, HFILL }
3052
16
        },
3053
16
        { &hf_uftp_congctrl_item_flags_start,
3054
16
            { "Slowstart", "uftp4.congctrl.item.flags.start",
3055
16
            FT_BOOLEAN, 8, NULL, FLAG_CC_START, NULL, HFILL }
3056
16
        },
3057
16
        { &hf_uftp_congctrl_item_flags_leave,
3058
16
            { "Leave", "uftp4.congctrl.item.flags.leave",
3059
16
            FT_BOOLEAN, 8, NULL, FLAG_CC_LEAVE, NULL, HFILL }
3060
16
        },
3061
16
        { &hf_uftp_congctrl_item_flags_reserved,
3062
16
            { "Reserved", "uftp4.congctrl.item.flags.reserved",
3063
16
            FT_UINT8, BASE_HEX, NULL, FLAG_CC_RESERVED, NULL, HFILL }
3064
16
        },
3065
16
        { &hf_uftp_congctrl_item_rtt,
3066
16
            { "Round Trip Time", "uftp4.congctrl.item.rtt",
3067
16
            FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3068
16
        },
3069
16
        { &hf_uftp_congctrl_item_rate,
3070
16
            { "Rate", "uftp4.congctrl.item.rate",
3071
16
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3072
16
        },
3073
16
        { &hf_uftp_ccack,
3074
16
            { "CC_ACK", "uftp4.ccack",
3075
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3076
16
        },
3077
16
        { &hf_uftp_ccack_func,
3078
16
            { "Type", "uftp4.ccack.func",
3079
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3080
16
        },
3081
16
        { &hf_uftp_ccack_hlen,
3082
16
            { "Header Length", "uftp4.ccack.hlen",
3083
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3084
16
        },
3085
16
        { &hf_uftp_ccack_reserved,
3086
16
            { "Reserved", "uftp4.ccack.reserved",
3087
16
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
3088
16
        },
3089
16
        { &hf_uftp_tfmccack,
3090
16
            { "EXT_TFMCC_ACK_INFO", "uftp4.tfmccack",
3091
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3092
16
        },
3093
16
        { &hf_uftp_tfmccack_exttype,
3094
16
            { "Extension Type", "uftp4.tfmccack.exttype",
3095
16
            FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
3096
16
        },
3097
16
        { &hf_uftp_tfmccack_extlen,
3098
16
            { "Extension Length", "uftp4.tfmccack.extlen",
3099
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3100
16
        },
3101
16
        { &hf_uftp_tfmccack_flags,
3102
16
            { "Flags", "uftp4.tfmccack.flags",
3103
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3104
16
        },
3105
16
        { &hf_uftp_tfmccack_flags_clr,
3106
16
            { "CLR", "uftp4.tfmccack.flags.clr",
3107
16
            FT_BOOLEAN, 8, NULL, FLAG_CC_CLR, NULL, HFILL }
3108
16
        },
3109
16
        { &hf_uftp_tfmccack_flags_rtt,
3110
16
            { "RTT", "uftp4.tfmccack.flags.rtt",
3111
16
            FT_BOOLEAN, 8, NULL, FLAG_CC_RTT, NULL, HFILL }
3112
16
        },
3113
16
        { &hf_uftp_tfmccack_flags_start,
3114
16
            { "Slowstart", "uftp4.tfmccack.flags.start",
3115
16
            FT_BOOLEAN, 8, NULL, FLAG_CC_START, NULL, HFILL }
3116
16
        },
3117
16
        { &hf_uftp_tfmccack_flags_leave,
3118
16
            { "Leave", "uftp4.tfmccack.flags.leave",
3119
16
            FT_BOOLEAN, 8, NULL, FLAG_CC_LEAVE, NULL, HFILL }
3120
16
        },
3121
16
        { &hf_uftp_tfmccack_flags_reserved,
3122
16
            { "Reserved", "uftp4.tfmccack.flags.reserved",
3123
16
            FT_UINT8, BASE_HEX, NULL, FLAG_CC_RESERVED, NULL, HFILL }
3124
16
        },
3125
16
        { &hf_uftp_tfmccack_reserved,
3126
16
            { "Reserved", "uftp4.tfmccack.reserved",
3127
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3128
16
        },
3129
16
        { &hf_uftp_tfmccack_cc_seq,
3130
16
            { "CC Sequence Number", "uftp4.tfmccack.cc_seq",
3131
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3132
16
        },
3133
16
        { &hf_uftp_tfmccack_cc_rate,
3134
16
            { "Rate", "uftp4.tfmccack.cc_rate",
3135
16
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3136
16
        },
3137
16
        { &hf_uftp_tfmccack_client_id,
3138
16
            { "Client ID", "uftp4.tfmccack.client_id",
3139
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3140
16
        },
3141
16
        { &hf_uftp_tfmccack_tstamp,
3142
16
            { "Timestamp", "uftp4.tfmccack.tstamp",
3143
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
3144
16
        },
3145
16
        { &hf_uftp_encrypted,
3146
16
            { "ENCRYPTED", "uftp4.encrypted",
3147
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3148
16
        },
3149
16
        { &hf_uftp_encrypted_ivctr,
3150
16
            { "IV Counter", "uftp4.encrypted.ivctr",
3151
16
            FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
3152
16
        },
3153
16
        { &hf_uftp_encrypted_sig_len,
3154
16
            { "Signature Length", "uftp4.encrypted.sig_len",
3155
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3156
16
        },
3157
16
        { &hf_uftp_encrypted_payload_len,
3158
16
            { "Payload Length", "uftp4.encrypted.payload_len",
3159
16
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3160
16
        },
3161
16
        { &hf_uftp_encrypted_signature,
3162
16
            { "Signature", "uftp4.encrypted.signature",
3163
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3164
16
        },
3165
16
        { &hf_uftp_encrypted_payload,
3166
16
            { "Encrypted Payload", "uftp4.encrypted.payload",
3167
16
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3168
16
        },
3169
16
        { &hf_uftp_abort,
3170
16
            { "ABORT", "uftp4.abort",
3171
16
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3172
16
        },
3173
16
        { &hf_uftp_abort_func,
3174
16
            { "Type", "uftp4.abort.func",
3175
16
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3176
16
        },
3177
16
        { &hf_uftp_abort_hlen,
3178
16
            { "Header Length", "uftp4.abort.hlen",
3179
16
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3180
16
        },
3181
16
        { &hf_uftp_abort_flags,
3182
16
            { "Flags", "uftp4.abort.flags",
3183
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3184
16
        },
3185
16
        { &hf_uftp_abort_flags_curfile,
3186
16
            { "Current file", "uftp4.abort.flags.curfile",
3187
16
            FT_BOOLEAN, 8, NULL, FLAG_CURRENT_FILE, NULL, HFILL }
3188
16
        },
3189
16
        { &hf_uftp_abort_flags_reserved,
3190
16
            { "Reserved", "uftp4.abort.flags.reserved",
3191
16
            FT_UINT8, BASE_HEX, NULL, FLAG_ABORT_RESERVED, NULL, HFILL }
3192
16
        },
3193
16
        { &hf_uftp_abort_reserved,
3194
16
            { "Reserved", "uftp4.abort.reserved",
3195
16
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3196
16
        },
3197
16
        { &hf_uftp_abort_clientid,
3198
16
            { "Client ID", "uftp4.abort.clientid",
3199
16
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3200
16
        },
3201
16
        { &hf_uftp_abort_message,
3202
16
            { "Message", "uftp4.abort.message",
3203
16
            FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
3204
16
        }
3205
16
    };
3206
3207
    /* Setup protocol subtree array */
3208
16
    static int *ett[] = {
3209
16
        &ett_uftp,
3210
16
        &ett_uftp_announce,
3211
16
        &ett_uftp_encinfo,
3212
16
        &ett_uftp_register,
3213
16
        &ett_uftp_clientkey,
3214
16
        &ett_uftp_regconf,
3215
16
        &ett_uftp_keyinfo,
3216
16
        &ett_uftp_keyinfo_destkey,
3217
16
        &ett_uftp_keyinfoack,
3218
16
        &ett_uftp_fileinfo,
3219
16
        &ett_uftp_fileinfoack,
3220
16
        &ett_uftp_fileseg,
3221
16
        &ett_uftp_tfmccdata,
3222
16
        &ett_uftp_done,
3223
16
        &ett_uftp_status,
3224
16
        &ett_uftp_complete,
3225
16
        &ett_uftp_freespace,
3226
16
        &ett_uftp_doneconf,
3227
16
        &ett_uftp_hbreq,
3228
16
        &ett_uftp_hbresp,
3229
16
        &ett_uftp_keyreq,
3230
16
        &ett_uftp_proxykey,
3231
16
        &ett_uftp_congctrl,
3232
16
        &ett_uftp_congctrl_cclist,
3233
16
        &ett_uftp_congctrl_item,
3234
16
        &ett_uftp_ccack,
3235
16
        &ett_uftp_tfmccack,
3236
16
        &ett_uftp_encrypted,
3237
16
        &ett_uftp_abort,
3238
16
        &ett_uftp_announce_flags,
3239
16
        &ett_uftp_encinfo_flags,
3240
16
        &ett_uftp_fileinfoack_flags,
3241
16
        &ett_uftp_abort_flags,
3242
16
        &ett_uftp_congctrl_item_flags,
3243
16
        &ett_uftp_tfmccack_flags,
3244
16
        &ett_uftp_destlist,
3245
16
        &ett_uftp_rsablob,
3246
16
        &ett_uftp_ecblob
3247
16
    };
3248
3249
16
    static ei_register_info ei[] = {
3250
16
        { &ei_uftp_length_invalid, { "uftp4.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }},
3251
16
        { &ei_uftp_func_unknown, { "uftp4.func.invalid", PI_MALFORMED, PI_ERROR, "Unknown function", EXPFILL }}
3252
16
    };
3253
3254
16
    expert_module_t* expert_uftp;
3255
3256
16
    proto_uftp = proto_register_protocol("UDP based FTP w/ multicast V4",
3257
16
        "UFTP4", "uftp4");
3258
16
    proto_register_field_array(proto_uftp, hf, array_length(hf));
3259
16
    proto_register_subtree_array(ett, array_length(ett));
3260
16
    register_dissector("uftp4", dissect_uftp, proto_uftp);
3261
16
    expert_uftp = expert_register_protocol(proto_uftp);
3262
16
    expert_register_field_array(expert_uftp, ei, array_length(ei));
3263
16
}
3264
3265
/*
3266
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
3267
 *
3268
 * Local variables:
3269
 * c-basic-offset: 4
3270
 * tab-width: 8
3271
 * indent-tabs-mode: nil
3272
 * End:
3273
 *
3274
 * vi: set shiftwidth=4 tabstop=8 expandtab:
3275
 * :indentSize=4:tabSize=8:noTabs=true:
3276
 */