Coverage Report

Created: 2026-01-02 06:13

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
129
#define UFTP_VER_NUM 0x40
19
20
14
#define ANNOUNCE       1
21
4
#define REGISTER       2
22
0
#define CLIENT_KEY     3
23
8
#define REG_CONF       4
24
6
#define KEYINFO        5
25
2
#define KEYINFO_ACK    6
26
11
#define FILEINFO       7
27
11
#define FILEINFO_ACK   8
28
2
#define FILESEG        9
29
8
#define DONE          10
30
1
#define STATUS        11
31
10
#define COMPLETE      12
32
10
#define DONE_CONF     13
33
129
#define HB_REQ        14
34
134
#define HB_RESP       15
35
0
#define KEY_REQ       16
36
0
#define PROXY_KEY     17
37
1
#define ENCRYPTED     18
38
0
#define ABORT         19
39
34
#define CONG_CTRL     20
40
1
#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
1
#define EXT_ENC_INFO        1
112
1
#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
14
#define FLAG_SYNC_MODE      0x01
122
14
#define FLAG_SYNC_PREVIEW   0x02
123
24
#define FLAG_IPV6           0x04
124
14
#define FLAG_ANNOUNCE_RESERVED 0xF8
125
126
14
#define FLAG_CLIENT_AUTH    0x01
127
14
#define FLAG_ENCINFO_RESERVED 0xFE
128
129
14
#define FLAG_PARTIAL        0x01
130
14
#define FLAG_FILEINFOACK_RESERVED 0xFE
131
132
14
#define FLAG_CURRENT_FILE   0x01
133
14
#define FLAG_ABORT_RESERVED 0xFE
134
135
28
#define FLAG_CC_CLR         0x01
136
28
#define FLAG_CC_RTT         0x02
137
28
#define FLAG_CC_START       0x04
138
28
#define FLAG_CC_LEAVE       0x08
139
28
#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
2
#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
259
#define UFTP_LEN 16
180
24
#define ANNOUNCE_LEN 16
181
2
#define ENC_INFO_LEN 44
182
6
#define REGISTER_LEN 44
183
0
#define CLIENT_KEY_LEN 8
184
15
#define REG_CONF_LEN 4
185
12
#define KEYINFO_LEN 12
186
28
#define DESTKEY_LEN 52
187
3
#define KEYINFO_ACK_LEN 16
188
20
#define FILEINFO_LEN 28
189
21
#define FILEINFO_ACK_LEN 16
190
4
#define FILESEG_LEN 8
191
4
#define TFMCC_DATA_LEN 8
192
15
#define DONE_LEN 8
193
2
#define STATUS_LEN 8
194
27
#define COMPLETE_LEN 8
195
0
#define FREESPACE_LEN 12
196
19
#define DONE_CONF_LEN 4
197
0
#define HB_REQ_LEN 12
198
7
#define HB_RESP_LEN 8
199
0
#define KEY_REQ_LEN 4
200
0
#define PROXY_KEY_LEN 12
201
2
#define ENCRYPTED_LEN 12
202
0
#define ABORT_LEN 308
203
65
#define CONG_CTRL_LEN 16
204
739
#define CC_ITEM_LEN 8
205
3
#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
287
#define RTT_MIN 1.0e-6
732
522
#define RTT_MAX 1000.0
733
734
static double unquantize_grtt(uint8_t rtt)
735
809
{
736
809
    return ((rtt <= 31) ?
737
287
            (((double)(rtt + 1)) * (double)RTT_MIN) :
738
809
            (RTT_MAX / exp(((double)(255 - rtt)) / (double)13.0)));
739
809
}
740
741
static unsigned unquantize_gsize(uint8_t size)
742
129
{
743
129
    int E, i;
744
129
    double rval;
745
746
129
    E = size & 0x7;
747
129
    rval =  (size >> 3) * (10.0 / 32.0);
748
389
    for (i = 0; i < E; i++) {
749
260
        rval *= 10;
750
260
    }
751
752
129
    return (unsigned)(rval + 0.5);
753
129
}
754
755
static unsigned unquantize_rate(uint16_t rate)
756
712
{
757
712
    int E, i;
758
712
    double rval;
759
760
712
    E = rate & 0xF;
761
712
    rval = (rate >> 4) * (10.0 / 4096.0);
762
4.85k
    for (i = 0; i < E; i++) {
763
4.14k
        rval *= 10;
764
4.14k
    }
765
766
712
    return (unsigned)rval;
767
712
}
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
    int offset = 0, modlen;
774
775
0
    if (tvb_reported_length(tvb) < RSA_BLOB_LEN) {
776
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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 ((int)tvb_reported_length(tvb) < modlen + RSA_BLOB_LEN) {
783
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
    int offset = 0, keylen;
808
809
0
    if (tvb_reported_length(tvb) < EC_BLOB_LEN) {
810
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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 ((int)tvb_reported_length(tvb) < keylen + EC_BLOB_LEN) {
817
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
1
{
837
1
    proto_item *ti = NULL;
838
1
    proto_tree *encinfo_tree = NULL;
839
1
    int offset = 0, hlen, keylen, dhlen, siglen;
840
1
    int8_t blobtype;
841
1
    tvbuff_t *next_tvb;
842
843
1
    if (tvb_reported_length(tvb) < ENC_INFO_LEN) {
844
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
845
0
                            "Invalid length: %d", tvb_reported_length(tvb));
846
0
        return 0;
847
0
    }
848
849
1
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
850
1
    keylen = (int)tvb_get_ntohs(tvb, 6);
851
1
    dhlen = (int)tvb_get_ntohs(tvb, 8);
852
1
    siglen = (int)tvb_get_ntohs(tvb, 10);
853
1
    if (((int)tvb_reported_length(tvb) < hlen) ||
854
1
            (hlen < ENC_INFO_LEN + keylen + dhlen + siglen)) {
855
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
856
1
                            "Invalid length, len = %d, hlen = %d, "
857
1
                            "keylen = %d, dhlen = %d, siglen = %d",
858
1
                            tvb_reported_length(tvb), hlen, keylen, dhlen, siglen);
859
1
        return 0;
860
1
    }
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
14
{
924
14
    proto_item *ti = NULL;
925
14
    proto_item *destlist = NULL;
926
14
    proto_tree *announce_tree = NULL;
927
14
    proto_tree *destlist_tree = NULL;
928
14
    int offset = 0;
929
14
    int hlen, iplen, destcount, idx, extlen_total;
930
14
    uint8_t flags, ext_type;
931
14
    tvbuff_t *next_tvb;
932
933
14
    if (tvb_reported_length(tvb) < ANNOUNCE_LEN) {
934
3
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
935
3
                            "Invalid length: %d", tvb_reported_length(tvb));
936
3
        return;
937
3
    }
938
939
11
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
940
11
    if ((int)tvb_reported_length(tvb) < hlen) {
941
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
942
1
                            "Invalid length, len = %d, hlen = %d",
943
1
                            tvb_reported_length(tvb), hlen);
944
1
        return;
945
1
    }
946
947
10
    flags = tvb_get_uint8(tvb, 2);
948
949
10
    ti = proto_tree_add_item(tree, hf_uftp_announce, tvb, offset, -1, ENC_NA);
950
10
    announce_tree = proto_item_add_subtree(ti, ett_uftp_announce);
951
10
    proto_tree_add_item(announce_tree, hf_uftp_announce_func, tvb, offset, 1, ENC_BIG_ENDIAN);
952
10
    offset += 1;
953
10
    proto_tree_add_uint_format_value(announce_tree, hf_uftp_announce_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
954
10
    offset += 1;
955
10
    proto_tree_add_bitmask(announce_tree, tvb, offset, hf_uftp_announce_flags, ett_uftp_announce_flags, announce_flags, ENC_BIG_ENDIAN);
956
10
    offset += 1;
957
10
    proto_tree_add_item(announce_tree, hf_uftp_announce_robust, tvb, offset, 1, ENC_BIG_ENDIAN);
958
10
    offset += 1;
959
10
    proto_tree_add_item(announce_tree, hf_uftp_announce_cc_type, tvb, offset, 1, ENC_BIG_ENDIAN);
960
10
    offset += 1;
961
10
    proto_tree_add_item(announce_tree, hf_uftp_announce_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
962
10
    offset += 1;
963
10
    proto_tree_add_item(announce_tree, hf_uftp_announce_blocksize, tvb, offset, 2, ENC_BIG_ENDIAN);
964
10
    offset += 2;
965
10
    proto_tree_add_item(announce_tree, hf_uftp_announce_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
966
10
    offset += 8;
967
10
    if (flags & FLAG_IPV6) {
968
3
        iplen = 16;
969
3
        proto_tree_add_item(announce_tree, hf_uftp_announce_publicmcast_ipv6, tvb, offset, iplen, ENC_NA);
970
3
        offset += iplen;
971
3
        proto_tree_add_item(announce_tree, hf_uftp_announce_privatemcast_ipv6, tvb, offset, iplen, ENC_NA);
972
3
        offset += iplen;
973
7
    } else {
974
7
        iplen = 4;
975
7
        proto_tree_add_item(announce_tree, hf_uftp_announce_publicmcast_ipv4, tvb, offset, iplen, ENC_BIG_ENDIAN);
976
7
        offset += iplen;
977
7
        proto_tree_add_item(announce_tree, hf_uftp_announce_privatemcast_ipv4, tvb, offset, iplen, ENC_BIG_ENDIAN);
978
7
        offset += iplen;
979
7
    }
980
981
10
    extlen_total = hlen - (ANNOUNCE_LEN + ( 2 * iplen));
982
10
    while (extlen_total > 0) {
983
7
        int parsed = 0;
984
985
7
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
986
7
        ext_type = tvb_get_uint8(tvb, offset);
987
7
        switch (ext_type) {
988
1
        case EXT_ENC_INFO:
989
1
            parsed = dissect_uftp_encinfo(next_tvb, pinfo, announce_tree);
990
1
            break;
991
7
        }
992
7
        if (!parsed) break;
993
0
        extlen_total -= parsed;
994
0
        offset += parsed;
995
0
    }
996
997
10
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
998
10
    offset = hlen;
999
10
    if (destcount > 0) {
1000
8
        destlist = proto_tree_add_item(announce_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1001
8
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1002
8
    }
1003
264
    for (idx = 0; idx < destcount; idx++) {
1004
254
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1005
254
        offset += 4;
1006
254
    }
1007
10
}
1008
1009
static void dissect_uftp_register(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1010
4
{
1011
4
    proto_item *ti = NULL;
1012
4
    proto_item *destlist = NULL;
1013
4
    proto_tree *register_tree = NULL;
1014
4
    proto_tree *destlist_tree = NULL;
1015
4
    int offset = 0, hlen;
1016
4
    uint16_t destcount, keylen, idx;
1017
1018
4
    if (tvb_reported_length(tvb) < REGISTER_LEN) {
1019
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1020
1
                            "Invalid length: %d", tvb_reported_length(tvb));
1021
1
        return;
1022
1
    }
1023
1024
3
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1025
3
    keylen = tvb_get_ntohs(tvb, 2);
1026
3
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < REGISTER_LEN + keylen)) {
1027
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1028
2
                            "Invalid length, len = %d, hlen = %d, keylen = %d",
1029
2
                            tvb_reported_length(tvb), hlen, keylen);
1030
2
        return;
1031
2
    }
1032
1033
1
    ti = proto_tree_add_item(tree, hf_uftp_register, tvb, offset, -1, ENC_NA);
1034
1
    register_tree = proto_item_add_subtree(ti, ett_uftp_register);
1035
1
    proto_tree_add_item(register_tree, hf_uftp_register_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1036
1
    offset += 1;
1037
1
    proto_tree_add_uint_format_value(register_tree, hf_uftp_register_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1038
1
    offset += 1;
1039
1
    proto_tree_add_item(register_tree, hf_uftp_register_keyinfo_len, tvb, offset, 2, ENC_BIG_ENDIAN);
1040
1
    offset += 2;
1041
1
    proto_tree_add_item(register_tree, hf_uftp_register_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
1042
1
    offset += 8;
1043
1
    proto_tree_add_item(register_tree, hf_uftp_register_rand2, tvb, offset, RAND_LEN, ENC_NA);
1044
1
    offset += RAND_LEN;
1045
1
    if (keylen > 0) {
1046
0
        proto_tree_add_item(register_tree, hf_uftp_register_keyinfo, tvb, offset, keylen, ENC_NA);
1047
0
    }
1048
1049
1
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1050
1
    offset = hlen;
1051
1
    if (destcount > 0) {
1052
1
        destlist = proto_tree_add_item(register_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1053
1
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1054
1
    }
1055
6
    for (idx = 0; idx < destcount; idx++) {
1056
5
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1057
5
        offset += 4;
1058
5
    }
1059
1
}
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
    int offset = 0, hlen;
1066
0
    uint16_t 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(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1072
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1073
0
        return;
1074
0
    }
1075
1076
0
    hlen = (int)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 (((int)tvb_reported_length(tvb) < hlen) || (hlen < CLIENT_KEY_LEN + keylen + verifylen)) {
1080
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
8
{
1120
8
    proto_item *ti = NULL;
1121
8
    proto_item *destlist = NULL;
1122
8
    proto_tree *regconf_tree = NULL;
1123
8
    proto_tree *destlist_tree = NULL;
1124
8
    int offset = 0, hlen;
1125
8
    uint16_t destcount, idx;
1126
1127
8
    if (tvb_reported_length(tvb) < REG_CONF_LEN) {
1128
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1129
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1130
0
        return;
1131
0
    }
1132
1133
8
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1134
8
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < REG_CONF_LEN)) {
1135
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1136
2
                            "Invalid length, len = %d, hlen = %d",
1137
2
                            tvb_reported_length(tvb), hlen);
1138
2
        return;
1139
2
    }
1140
1141
6
    ti = proto_tree_add_item(tree, hf_uftp_regconf, tvb, offset, -1, ENC_NA);
1142
6
    regconf_tree = proto_item_add_subtree(ti, ett_uftp_regconf);
1143
6
    proto_tree_add_item(regconf_tree, hf_uftp_regconf_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1144
6
    offset += 1;
1145
6
    proto_tree_add_uint_format_value(regconf_tree, hf_uftp_regconf_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1146
6
    offset += 1;
1147
6
    proto_tree_add_item(regconf_tree, hf_uftp_regconf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1148
1149
6
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1150
6
    offset = hlen;
1151
6
    if (destcount > 0) {
1152
5
        destlist = proto_tree_add_item(regconf_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1153
5
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1154
5
    }
1155
76
    for (idx = 0; idx < destcount; idx++) {
1156
70
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1157
70
        offset += 4;
1158
70
    }
1159
6
}
1160
1161
static void dissect_uftp_keyinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1162
6
{
1163
6
    proto_item *ti = NULL;
1164
6
    proto_item *destlist = NULL;
1165
6
    proto_item *destkey = NULL;
1166
6
    proto_tree *keyinfo_tree = NULL;
1167
6
    proto_tree *destlist_tree = NULL;
1168
6
    proto_tree *destkey_tree = NULL;
1169
6
    int offset = 0, hlen;
1170
6
    uint8_t destcount, idx;
1171
1172
6
    if (tvb_reported_length(tvb) < KEYINFO_LEN) {
1173
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1174
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1175
0
        return;
1176
0
    }
1177
1178
6
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1179
6
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < KEYINFO_LEN)) {
1180
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1181
1
                            "Invalid length, len = %d, hlen = %d",
1182
1
                            tvb_reported_length(tvb), hlen);
1183
1
        return;
1184
1
    }
1185
1186
5
    ti = proto_tree_add_item(tree, hf_uftp_keyinfo, tvb, offset, -1, ENC_NA);
1187
5
    keyinfo_tree = proto_item_add_subtree(ti, ett_uftp_keyinfo);
1188
5
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1189
5
    offset += 1;
1190
5
    proto_tree_add_uint_format_value(keyinfo_tree, hf_uftp_keyinfo_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1191
5
    offset += 1;
1192
5
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1193
5
    offset += 2;
1194
5
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_ivctr, tvb, offset, 8, ENC_BIG_ENDIAN);
1195
1196
5
    destcount = (tvb_reported_length(tvb) - hlen) / DESTKEY_LEN;
1197
5
    offset = hlen;
1198
5
    if (destcount > 0) {
1199
4
        destlist = proto_tree_add_item(keyinfo_tree, hf_uftp_destlist, tvb, offset, destcount * DESTKEY_LEN, ENC_NA);
1200
4
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1201
4
    }
1202
24
    for (idx = 0; idx < destcount; idx++) {
1203
19
        destkey = proto_tree_add_item(destlist_tree, hf_uftp_keyinfo_destkey, tvb, offset, DESTKEY_LEN, ENC_NA);
1204
19
        destkey_tree = proto_item_add_subtree(destkey, ett_uftp_keyinfo_destkey);
1205
19
        proto_tree_add_item(destkey_tree, hf_uftp_keyinfo_destid, tvb, offset, 4, ENC_BIG_ENDIAN);
1206
19
        offset += 4;
1207
19
        proto_tree_add_item(destkey_tree, hf_uftp_keyinfo_groupmaster, tvb, offset, 48, ENC_NA);
1208
19
        offset += 48;
1209
19
    }
1210
5
}
1211
1212
static void dissect_uftp_keyinfoack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1213
2
{
1214
2
    proto_item *ti = NULL;
1215
2
    proto_tree *keyinfoack_tree = NULL;
1216
2
    int offset = 0, hlen;
1217
1218
2
    if (tvb_reported_length(tvb) < KEYINFO_ACK_LEN) {
1219
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1220
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1221
0
        return;
1222
0
    }
1223
1224
2
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1225
2
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < KEYINFO_ACK_LEN)) {
1226
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1227
2
                            "Invalid length, len = %d, hlen = %d",
1228
2
                            tvb_reported_length(tvb), hlen);
1229
2
        return;
1230
2
    }
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
11
{
1245
11
    proto_item *ti = NULL;
1246
11
    proto_item *destlist = NULL;
1247
11
    proto_tree *fileinfo_tree = NULL;
1248
11
    proto_tree *destlist_tree = NULL;
1249
11
    int offset = 0, hlen;
1250
11
    uint16_t file_id, destcount, idx, namelen, linklen;
1251
1252
11
    if (tvb_reported_length(tvb) < FILEINFO_LEN) {
1253
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1254
1
                            "Invalid length: %d", tvb_reported_length(tvb));
1255
1
        return;
1256
1
    }
1257
1258
10
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1259
10
    namelen = tvb_get_uint8(tvb, 8) * 4;
1260
10
    linklen = tvb_get_uint8(tvb, 9) * 4;
1261
10
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < FILEINFO_LEN + namelen + linklen)) {
1262
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1263
2
                            "Invalid length, len = %d, hlen = %d, namelen = %d, linklen = %d",
1264
2
                            tvb_reported_length(tvb), hlen, namelen, linklen);
1265
2
        return;
1266
2
    }
1267
1268
8
    file_id = tvb_get_ntohs(tvb, 2);
1269
8
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1270
1271
8
    ti = proto_tree_add_item(tree, hf_uftp_fileinfo, tvb, offset, -1, ENC_NA);
1272
8
    fileinfo_tree = proto_item_add_subtree(ti, ett_uftp_fileinfo);
1273
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1274
8
    offset += 1;
1275
8
    proto_tree_add_uint_format_value(fileinfo_tree, hf_uftp_fileinfo_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1276
8
    offset += 1;
1277
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1278
8
    offset += 2;
1279
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftype, tvb, offset, 1, ENC_BIG_ENDIAN);
1280
8
    offset += 1;
1281
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1282
8
    offset += 3;
1283
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_namelen, tvb, offset, 1, ENC_BIG_ENDIAN);
1284
8
    offset += 1;
1285
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_linklen, tvb, offset, 1, ENC_BIG_ENDIAN);
1286
8
    offset += 1;
1287
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_fsize, tvb, offset, 6, ENC_BIG_ENDIAN);
1288
8
    offset += 6;
1289
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftstamp, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
1290
8
    offset += 4;
1291
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
1292
8
    offset += 8;
1293
8
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_name, tvb, offset, namelen, ENC_ASCII);
1294
8
    offset += namelen;
1295
8
    if (linklen > 0) {
1296
1
        proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_link, tvb, offset, linklen, ENC_ASCII);
1297
1
    }
1298
1299
8
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1300
8
    offset = hlen;
1301
8
    if (destcount > 0) {
1302
7
        destlist = proto_tree_add_item(fileinfo_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1303
7
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1304
7
    }
1305
259
    for (idx = 0; idx < destcount; idx++) {
1306
251
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1307
251
        offset += 4;
1308
251
    }
1309
8
}
1310
1311
static void dissect_uftp_fileinfoack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1312
11
{
1313
11
    proto_item *ti = NULL;
1314
11
    proto_item *destlist = NULL;
1315
11
    proto_tree *fileinfoack_tree = NULL;
1316
11
    proto_tree *destlist_tree = NULL;
1317
11
    int offset = 0, hlen;
1318
11
    uint16_t file_id, destcount, idx;
1319
1320
11
    if (tvb_reported_length(tvb) < FILEINFO_ACK_LEN) {
1321
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1322
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1323
0
        return;
1324
0
    }
1325
1326
11
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1327
11
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < FILEINFO_ACK_LEN)) {
1328
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1329
2
                            "Invalid length, len = %d, hlen = %d",
1330
2
                            tvb_reported_length(tvb), hlen);
1331
2
        return;
1332
2
    }
1333
1334
9
    file_id = tvb_get_ntohs(tvb, 2);
1335
9
    if (file_id > 0) {
1336
9
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1337
9
    }
1338
1339
9
    ti = proto_tree_add_item(tree, hf_uftp_fileinfoack, tvb, offset, -1, ENC_NA);
1340
9
    fileinfoack_tree = proto_item_add_subtree(ti, ett_uftp_fileinfoack);
1341
9
    proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1342
9
    offset += 1;
1343
9
    proto_tree_add_uint_format_value(fileinfoack_tree, hf_uftp_fileinfoack_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1344
9
    offset += 1;
1345
9
    proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1346
9
    offset += 2;
1347
9
    proto_tree_add_bitmask(fileinfoack_tree, tvb, offset, hf_uftp_fileinfoack_flags, ett_uftp_fileinfoack_flags, fileinfoack_flags, ENC_BIG_ENDIAN);
1348
9
    offset += 1;
1349
9
    proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1350
9
    offset += 3;
1351
9
    proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
1352
1353
9
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1354
9
    offset = hlen;
1355
9
    if (destcount > 0) {
1356
8
        destlist = proto_tree_add_item(fileinfoack_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1357
8
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1358
8
    }
1359
237
    for (idx = 0; idx < destcount; idx++) {
1360
228
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1361
228
        offset += 4;
1362
228
    }
1363
9
}
1364
1365
static int dissect_uftp_tfmccdata(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1366
1
{
1367
1
    proto_item *ti = NULL;
1368
1
    proto_tree *tfmccdata_tree = NULL;
1369
1
    int offset = 0, hlen;
1370
1
    unsigned rate, srate;
1371
1372
1
    if (tvb_reported_length(tvb) < TFMCC_DATA_LEN) {
1373
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1374
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1375
0
        return 0;
1376
0
    }
1377
1378
1
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1379
1
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < TFMCC_DATA_LEN)) {
1380
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1381
0
                            "Invalid length, len = %d, hlen = %d",
1382
0
                            tvb_reported_length(tvb), hlen);
1383
0
        return 0;
1384
0
    }
1385
1386
1
    rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
1387
1
    srate = unquantize_rate(tvb_get_ntohs(tvb, 2));
1388
1389
1
    ti = proto_tree_add_item(tree, hf_uftp_tfmccdata, tvb, offset, TFMCC_DATA_LEN, ENC_NA);
1390
1
    tfmccdata_tree = proto_item_add_subtree(ti, ett_uftp_tfmccdata);
1391
1
    proto_tree_add_item(tfmccdata_tree, hf_uftp_tfmccdata_exttype, tvb, offset, 1, ENC_BIG_ENDIAN);
1392
1
    offset += 1;
1393
1
    proto_tree_add_uint_format_value(tfmccdata_tree, hf_uftp_tfmccdata_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1394
1
    offset += 1;
1395
1
    proto_tree_add_uint(tfmccdata_tree, hf_uftp_tfmccdata_send_rate, tvb, offset, 2, srate);
1396
1
    offset += 2;
1397
1
    proto_tree_add_item(tfmccdata_tree, hf_uftp_tfmccdata_cc_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
1398
1
    offset += 2;
1399
1
    proto_tree_add_uint(tfmccdata_tree, hf_uftp_tfmccdata_cc_rate, tvb, offset, 2, rate);
1400
1401
1
    return TFMCC_DATA_LEN;
1402
1
}
1403
1404
static void dissect_uftp_fileseg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1405
2
{
1406
2
    proto_item *ti = NULL;
1407
2
    proto_tree *fileseg_tree = NULL;
1408
2
    int offset = 0, hlen, extlen_total;
1409
2
    uint16_t file_id, section, sec_block;
1410
2
    uint8_t ext_type;
1411
2
    tvbuff_t *next_tvb;
1412
1413
2
    if (tvb_reported_length(tvb) < FILESEG_LEN) {
1414
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1415
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1416
0
        return;
1417
0
    }
1418
1419
2
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1420
2
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < FILESEG_LEN)) {
1421
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1422
1
                            "Invalid length, len = %d, hlen = %d",
1423
1
                            tvb_reported_length(tvb), hlen);
1424
1
        return;
1425
1
    }
1426
1427
1
    file_id = tvb_get_ntohs(tvb, 2);
1428
1
    section = tvb_get_ntohs(tvb, 4);
1429
1
    sec_block = tvb_get_ntohs(tvb, 6);
1430
1
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Section=%d  Block=%d",
1431
1
                    file_id, section, sec_block);
1432
1433
1
    ti = proto_tree_add_item(tree, hf_uftp_fileseg, tvb, offset, -1, ENC_NA);
1434
1
    fileseg_tree = proto_item_add_subtree(ti, ett_uftp_fileseg);
1435
1
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1436
1
    offset += 1;
1437
1
    proto_tree_add_uint_format_value(fileseg_tree, hf_uftp_fileseg_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1438
1
    offset += 1;
1439
1
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1440
1
    offset += 2;
1441
1
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_section, tvb, offset, 2, ENC_BIG_ENDIAN);
1442
1
    offset += 2;
1443
1
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_sec_block, tvb, offset, 2, ENC_BIG_ENDIAN);
1444
1
    offset += 2;
1445
1446
1
    extlen_total = hlen - FILESEG_LEN;
1447
2
    while (extlen_total > 0) {
1448
2
        int parsed = 0;
1449
1450
2
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1451
2
        ext_type = tvb_get_uint8(tvb, offset);
1452
2
        switch (ext_type) {
1453
1
        case EXT_TFMCC_DATA_INFO:
1454
1
            parsed = dissect_uftp_tfmccdata(next_tvb, pinfo, fileseg_tree);
1455
1
            break;
1456
2
        }
1457
2
        if (!parsed) break;
1458
1
        extlen_total -= parsed;
1459
1
        offset += parsed;
1460
1
    }
1461
1462
1
    offset = hlen;
1463
1
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_data, tvb, offset, -1, ENC_NA);
1464
1
}
1465
1466
static void dissect_uftp_done(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1467
8
{
1468
8
    proto_item *ti = NULL;
1469
8
    proto_item *destlist = NULL;
1470
8
    proto_tree *done_tree = NULL;
1471
8
    proto_tree *destlist_tree = NULL;
1472
8
    int offset = 0, hlen;
1473
8
    uint16_t file_id, section, destcount, idx;
1474
1475
8
    if (tvb_reported_length(tvb) < DONE_LEN) {
1476
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1477
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1478
0
        return;
1479
0
    }
1480
1481
8
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1482
8
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < DONE_LEN)) {
1483
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1484
2
                            "Invalid length, len = %d, hlen = %d",
1485
2
                            tvb_reported_length(tvb), hlen);
1486
2
        return;
1487
2
    }
1488
1489
6
    file_id = tvb_get_ntohs(tvb, 2);
1490
6
    section = tvb_get_ntohs(tvb, 6);
1491
6
    if (file_id > 0) {
1492
5
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Section=%d",
1493
5
                        file_id, section);
1494
5
    }
1495
1496
6
    ti = proto_tree_add_item(tree, hf_uftp_done, tvb, offset, -1, ENC_NA);
1497
6
    done_tree = proto_item_add_subtree(ti, ett_uftp_done);
1498
6
    proto_tree_add_item(done_tree, hf_uftp_done_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1499
6
    offset += 1;
1500
6
    proto_tree_add_uint_format_value(done_tree, hf_uftp_done_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1501
6
    offset += 1;
1502
6
    proto_tree_add_item(done_tree, hf_uftp_done_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1503
6
    offset += 2;
1504
6
    proto_tree_add_item(done_tree, hf_uftp_done_section, tvb, offset, 2, ENC_BIG_ENDIAN);
1505
6
    offset += 2;
1506
6
    proto_tree_add_item(done_tree, hf_uftp_done_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1507
1508
6
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1509
6
    offset = hlen;
1510
6
    if (destcount > 0) {
1511
5
        destlist = proto_tree_add_item(done_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1512
5
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1513
5
    }
1514
94
    for (idx = 0; idx < destcount; idx++) {
1515
88
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1516
88
        offset += 4;
1517
88
    }
1518
6
}
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
    int 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(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1529
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1530
0
        return 0;
1531
0
    }
1532
1533
0
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1534
0
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < TFMCC_ACK_LEN)) {
1535
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
1
{
1566
1
    proto_item *ti = NULL;
1567
1
    proto_tree *status_tree = NULL;
1568
1
    int offset = 0, hlen, extlen_total;
1569
1
    uint16_t file_id, section;
1570
1
    uint8_t ext_type;
1571
1
    tvbuff_t *next_tvb;
1572
1573
1
    if (tvb_reported_length(tvb) < STATUS_LEN) {
1574
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1575
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1576
0
        return;
1577
0
    }
1578
1579
1
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1580
1
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < STATUS_LEN)) {
1581
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1582
1
                            "Invalid length, len = %d, hlen = %d",
1583
1
                            tvb_reported_length(tvb), hlen);
1584
1
        return;
1585
1
    }
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
    int offset = 0, hlen;
1630
1631
0
    if (tvb_reported_length(tvb) < FREESPACE_LEN) {
1632
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1633
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1634
0
        return 0;
1635
0
    }
1636
1637
0
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1638
0
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < FREESPACE_LEN)) {
1639
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
10
{
1660
10
    proto_item *ti = NULL;
1661
10
    proto_item *destlist = NULL;
1662
10
    proto_tree *complete_tree = NULL;
1663
10
    proto_tree *destlist_tree = NULL;
1664
10
    int offset = 0, hlen, extlen_total;
1665
10
    uint16_t file_id, destcount, idx;
1666
10
    uint8_t ext_type;
1667
10
    tvbuff_t *next_tvb;
1668
1669
10
    if (tvb_reported_length(tvb) < COMPLETE_LEN) {
1670
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1671
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1672
0
        return;
1673
0
    }
1674
1675
10
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1676
10
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < COMPLETE_LEN)) {
1677
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1678
2
                            "Invalid length, len = %d, hlen = %d",
1679
2
                            tvb_reported_length(tvb), hlen);
1680
2
        return;
1681
2
    }
1682
1683
8
    file_id = tvb_get_ntohs(tvb, 2);
1684
8
    if (file_id > 0) {
1685
4
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1686
4
    }
1687
1688
8
    ti = proto_tree_add_item(tree, hf_uftp_complete, tvb, offset, -1, ENC_NA);
1689
8
    complete_tree = proto_item_add_subtree(ti, ett_uftp_complete);
1690
8
    proto_tree_add_item(complete_tree, hf_uftp_complete_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1691
8
    offset += 1;
1692
8
    proto_tree_add_uint_format_value(complete_tree, hf_uftp_complete_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1693
8
    offset += 1;
1694
8
    proto_tree_add_item(complete_tree, hf_uftp_complete_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1695
8
    offset += 2;
1696
8
    proto_tree_add_item(complete_tree, hf_uftp_complete_status, tvb, offset, 1, ENC_BIG_ENDIAN);
1697
8
    offset += 1;
1698
8
    proto_tree_add_item(complete_tree, hf_uftp_complete_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1699
8
    offset += 3;
1700
1701
8
    extlen_total = hlen - COMPLETE_LEN;
1702
8
    while (extlen_total > 0) {
1703
8
        int parsed = 0;
1704
1705
8
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1706
8
        ext_type = tvb_get_uint8(tvb, offset);
1707
8
        switch (ext_type) {
1708
0
        case EXT_FREESPACE_INFO:
1709
0
            parsed = dissect_uftp_freespace(next_tvb, pinfo, complete_tree);
1710
0
            break;
1711
8
        }
1712
8
        if (!parsed) break;
1713
0
        extlen_total -= parsed;
1714
0
        offset += parsed;
1715
0
    }
1716
1717
8
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1718
8
    offset = hlen;
1719
8
    if (destcount > 0) {
1720
7
        destlist = proto_tree_add_item(complete_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1721
7
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1722
7
    }
1723
90
    for (idx = 0; idx < destcount; idx++) {
1724
82
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1725
82
        offset += 4;
1726
82
    }
1727
8
}
1728
1729
static void dissect_uftp_doneconf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1730
10
{
1731
10
    proto_item *ti = NULL;
1732
10
    proto_item *destlist = NULL;
1733
10
    proto_tree *doneconf_tree = NULL;
1734
10
    proto_tree *destlist_tree = NULL;
1735
10
    int offset = 0, hlen;
1736
10
    uint16_t destcount, idx;
1737
1738
10
    if (tvb_reported_length(tvb) < DONE_CONF_LEN) {
1739
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1740
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1741
0
        return;
1742
0
    }
1743
1744
10
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1745
10
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < DONE_CONF_LEN)) {
1746
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1747
2
                            "Invalid length, len = %d, hlen = %d",
1748
2
                            tvb_reported_length(tvb), hlen);
1749
2
        return;
1750
2
    }
1751
1752
8
    ti = proto_tree_add_item(tree, hf_uftp_doneconf, tvb, offset, -1, ENC_NA);
1753
8
    doneconf_tree = proto_item_add_subtree(ti, ett_uftp_doneconf);
1754
8
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1755
8
    offset += 1;
1756
8
    proto_tree_add_uint_format_value(doneconf_tree, hf_uftp_doneconf_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1757
8
    offset += 1;
1758
8
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1759
1760
8
    destcount = (tvb_reported_length(tvb) - hlen) / 4;
1761
8
    offset = hlen;
1762
8
    if (destcount > 0) {
1763
7
        destlist = proto_tree_add_item(doneconf_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1764
7
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1765
7
    }
1766
104
    for (idx = 0; idx < destcount; idx++) {
1767
96
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1768
96
        offset += 4;
1769
96
    }
1770
8
}
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
    int offset = 0, hlen;
1777
0
    uint16_t 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(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1783
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1784
0
        return;
1785
0
    }
1786
1787
0
    hlen = (int)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 (((int)tvb_reported_length(tvb) < hlen) || (hlen < HB_REQ_LEN + keylen + siglen)) {
1791
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
5
{
1833
5
    proto_item *ti = NULL;
1834
5
    proto_tree *hbresp_tree = NULL;
1835
5
    int offset = 0, hlen;
1836
1837
5
    if (tvb_reported_length(tvb) < HB_RESP_LEN) {
1838
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1839
1
                            "Invalid length: %d", tvb_reported_length(tvb));
1840
1
        return;
1841
1
    }
1842
1843
4
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1844
4
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < HB_RESP_LEN)) {
1845
3
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1846
3
                            "Invalid length, len = %d, hlen = %d",
1847
3
                            tvb_reported_length(tvb), hlen);
1848
3
        return;
1849
3
    }
1850
1851
1
    ti = proto_tree_add_item(tree, hf_uftp_hbresp, tvb, offset, -1, ENC_NA);
1852
1
    hbresp_tree = proto_item_add_subtree(ti, ett_uftp_hbresp);
1853
1
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1854
1
    offset += 1;
1855
1
    proto_tree_add_uint_format_value(hbresp_tree, hf_uftp_hbresp_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1856
1
    offset += 1;
1857
1
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_authenticated, tvb, offset, 1, ENC_BIG_ENDIAN);
1858
1
    offset += 1;
1859
1
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1860
1
    offset += 1;
1861
1
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1862
1
}
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
    int offset = 0, hlen;
1869
1870
0
    if (tvb_reported_length(tvb) < KEY_REQ_LEN) {
1871
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1872
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1873
0
        return;
1874
0
    }
1875
1876
0
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1877
0
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < KEY_REQ_LEN)) {
1878
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
    int offset = 0, hlen;
1898
0
    uint16_t 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(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1904
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1905
0
        return;
1906
0
    }
1907
1908
0
    hlen = (int)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 (((int)tvb_reported_length(tvb) < hlen) ||
1913
0
            (hlen < PROXY_KEY_LEN + keylen + dhlen + siglen)) {
1914
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
34
{
1971
34
    proto_item *ti = NULL;
1972
34
    proto_item *cclist = NULL;
1973
34
    proto_item *ccitem = NULL;
1974
34
    proto_tree *congctrl_tree = NULL;
1975
34
    proto_tree *cclist_tree = NULL;
1976
34
    proto_tree *ccitem_tree = NULL;
1977
34
    int offset = 0, hlen;
1978
34
    unsigned rate;
1979
34
    uint8_t itemcount, idx;
1980
1981
34
    if (tvb_reported_length(tvb) < CONG_CTRL_LEN) {
1982
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1983
2
                            "Invalid length: %d", tvb_reported_length(tvb));
1984
2
        return;
1985
2
    }
1986
1987
32
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1988
32
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < CONG_CTRL_LEN)) {
1989
2
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1990
2
                            "Invalid length, len = %d, hlen = %d",
1991
2
                            tvb_reported_length(tvb), hlen);
1992
2
        return;
1993
2
    }
1994
1995
30
    rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
1996
1997
30
    ti = proto_tree_add_item(tree, hf_uftp_congctrl, tvb, offset, -1, ENC_NA);
1998
30
    congctrl_tree = proto_item_add_subtree(ti, ett_uftp_congctrl);
1999
30
    proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_func, tvb, offset, 1, ENC_BIG_ENDIAN);
2000
30
    offset += 1;
2001
30
    proto_tree_add_uint_format_value(congctrl_tree, hf_uftp_congctrl_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
2002
30
    offset += 1;
2003
30
    proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2004
30
    offset += 2;
2005
30
    proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_cc_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
2006
30
    offset += 2;
2007
30
    proto_tree_add_uint(congctrl_tree, hf_uftp_congctrl_cc_rate, tvb, offset, 2, rate);
2008
30
    offset += 2;
2009
30
    proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS|ENC_BIG_ENDIAN);
2010
2011
30
    itemcount = (tvb_reported_length(tvb) - hlen) / CC_ITEM_LEN;
2012
30
    offset = hlen;
2013
30
    if (itemcount > 0) {
2014
29
        cclist = proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_cclist, tvb, offset, itemcount * CC_ITEM_LEN, ENC_NA);
2015
29
        cclist_tree = proto_item_add_subtree(cclist, ett_uftp_congctrl_cclist);
2016
29
    }
2017
710
    for (idx = 0; idx < itemcount; idx++) {
2018
680
        unsigned itemrate;
2019
680
        double itemrtt;
2020
680
        itemrtt = unquantize_grtt(tvb_get_uint8(tvb, offset + 5));
2021
680
        itemrate = unquantize_rate(tvb_get_ntohs(tvb, offset + 6));
2022
2023
680
        ccitem = proto_tree_add_item(cclist_tree, hf_uftp_congctrl_item, tvb, offset, CC_ITEM_LEN, ENC_NA);
2024
680
        ccitem_tree = proto_item_add_subtree(ccitem, ett_uftp_congctrl_item);
2025
680
        proto_tree_add_item(ccitem_tree, hf_uftp_congctrl_item_destid, tvb, offset, 4, ENC_BIG_ENDIAN);
2026
680
        offset += 4;
2027
680
        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
680
        offset += 1;
2029
680
        proto_tree_add_double(ccitem_tree, hf_uftp_congctrl_item_rtt, tvb, offset, 1, itemrtt);
2030
680
        offset += 1;
2031
680
        proto_tree_add_uint(ccitem_tree, hf_uftp_congctrl_item_rate, tvb, offset, 2, itemrate);
2032
680
        offset += 2;
2033
680
    }
2034
30
}
2035
2036
static void dissect_uftp_ccack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2037
1
{
2038
1
    proto_item *ti = NULL;
2039
1
    proto_tree *ccack_tree = NULL;
2040
1
    int offset = 0, hlen, extlen_total;
2041
1
    uint8_t ext_type;
2042
1
    tvbuff_t *next_tvb;
2043
2044
1
    if (tvb_reported_length(tvb) < CC_ACK_LEN) {
2045
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2046
0
                            "Invalid length: %d", tvb_reported_length(tvb));
2047
0
        return;
2048
0
    }
2049
2050
1
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
2051
1
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < CC_ACK_LEN)) {
2052
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2053
0
                            "Invalid length, len = %d, hlen = %d",
2054
0
                            tvb_reported_length(tvb), hlen);
2055
0
        return;
2056
0
    }
2057
2058
1
    ti = proto_tree_add_item(tree, hf_uftp_ccack, tvb, offset, -1, ENC_NA);
2059
1
    ccack_tree = proto_item_add_subtree(ti, ett_uftp_ccack);
2060
1
    proto_tree_add_uint_format_value(ccack_tree, hf_uftp_ccack_func, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
2061
1
    offset += 1;
2062
1
    proto_tree_add_item(ccack_tree, hf_uftp_ccack_hlen, tvb, offset, 1, ENC_BIG_ENDIAN);
2063
1
    offset += 1;
2064
1
    proto_tree_add_item(ccack_tree, hf_uftp_ccack_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2065
1
    offset += 2;
2066
2067
1
    extlen_total = hlen - CC_ACK_LEN;
2068
1
    while (extlen_total > 0) {
2069
1
        int parsed = 0;
2070
2071
1
        next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
2072
1
        ext_type = tvb_get_uint8(tvb, offset);
2073
1
        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
1
        }
2078
1
        if (!parsed) break;
2079
0
        extlen_total -= parsed;
2080
0
        offset += parsed;
2081
0
    }
2082
1
}
2083
2084
static void dissect_uftp_encrypted(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2085
1
{
2086
1
    proto_item *ti = NULL;
2087
1
    proto_tree *encrypted_tree = NULL;
2088
1
    int offset = 0;
2089
1
    uint16_t sig_len, payload_len;
2090
2091
1
    if (tvb_reported_length(tvb) < ENCRYPTED_LEN) {
2092
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2093
0
                            "Invalid length: %d", tvb_reported_length(tvb));
2094
0
        return;
2095
0
    }
2096
2097
1
    sig_len = tvb_get_ntohs(tvb, 8);
2098
1
    payload_len = tvb_get_ntohs(tvb, 10);
2099
1
    if ((int)tvb_reported_length(tvb) < ENCRYPTED_LEN + sig_len + payload_len) {
2100
1
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2101
1
                            "Invalid length, len = %d, sig=%d, payload=%d",
2102
1
                            tvb_reported_length(tvb), sig_len, payload_len);
2103
1
        return;
2104
1
    }
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
    int offset = 0, hlen;
2124
2125
0
    if (tvb_reported_length(tvb) < ABORT_LEN) {
2126
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2127
0
                            "Invalid length: %d", tvb_reported_length(tvb));
2128
0
        return;
2129
0
    }
2130
2131
0
    hlen = (int)tvb_get_uint8(tvb, 1) * 4;
2132
0
    if (((int)tvb_reported_length(tvb) < hlen) || (hlen < ABORT_LEN)) {
2133
0
        proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
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
130
{
2156
130
    uint8_t version;
2157
130
    uint8_t mes_type;
2158
130
    uint32_t group_id;
2159
130
    tvbuff_t *next_tvb;
2160
130
    proto_item *ti = NULL;
2161
130
    proto_tree *uftp_tree = NULL;
2162
130
    int offset = 0;
2163
130
    unsigned l_gsize;
2164
130
    double grtt;
2165
2166
130
    if (tvb_reported_length(tvb) < UFTP_LEN + 4) {
2167
1
        return 0;
2168
1
    }
2169
2170
129
    version = tvb_get_uint8(tvb, 0);
2171
129
    mes_type = tvb_get_uint8(tvb, 1);
2172
129
    group_id = tvb_get_ntohl(tvb, 8);
2173
2174
129
    if (version != UFTP_VER_NUM) {
2175
0
        return 0;
2176
0
    }
2177
2178
129
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "UFTP");
2179
    /* Clear out stuff in the info column */
2180
129
    col_clear(pinfo->cinfo,COL_INFO);
2181
129
    col_add_fstr(pinfo->cinfo, COL_INFO, "%-12s",
2182
129
                 val_to_str(pinfo->pool, mes_type, messages, "Unknown (%d)"));
2183
129
    if ((mes_type != HB_REQ) && (mes_type != HB_RESP)) {
2184
124
        col_append_fstr(pinfo->cinfo, COL_INFO, " ID=%08X", group_id);
2185
124
    }
2186
2187
129
    grtt = unquantize_grtt(tvb_get_uint8(tvb, 13));
2188
129
    l_gsize = unquantize_gsize(tvb_get_uint8(tvb, 14));
2189
2190
129
    ti = proto_tree_add_item(tree, proto_uftp, tvb, 0, -1, ENC_NA);
2191
129
    uftp_tree = proto_item_add_subtree(ti, ett_uftp);
2192
129
    proto_tree_add_item(uftp_tree, hf_uftp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2193
129
    offset += 1;
2194
129
    proto_tree_add_item(uftp_tree, hf_uftp_func, tvb, offset, 1, ENC_BIG_ENDIAN);
2195
129
    offset += 1;
2196
129
    proto_tree_add_item(uftp_tree, hf_uftp_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
2197
129
    offset += 2;
2198
129
    proto_tree_add_item(uftp_tree, hf_uftp_src_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2199
129
    offset += 4;
2200
129
    proto_tree_add_item(uftp_tree, hf_uftp_group_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2201
129
    offset += 4;
2202
129
    proto_tree_add_item(uftp_tree, hf_uftp_group_inst, tvb, offset, 1, ENC_BIG_ENDIAN);
2203
129
    offset += 1;
2204
129
    proto_tree_add_double(uftp_tree, hf_uftp_grtt, tvb, offset, 1, grtt);
2205
129
    offset += 1;
2206
129
    proto_tree_add_uint(uftp_tree, hf_uftp_gsize, tvb, offset, 1, l_gsize);
2207
129
    offset += 1;
2208
129
    proto_tree_add_item(uftp_tree, hf_uftp_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2209
129
    offset += 1;
2210
2211
129
    next_tvb = tvb_new_subset_length(tvb, offset, tvb_reported_length(tvb) - UFTP_LEN);
2212
2213
129
    switch (mes_type) {
2214
14
        case ANNOUNCE:
2215
14
            dissect_uftp_announce(next_tvb, pinfo, uftp_tree);
2216
14
            break;
2217
4
        case REGISTER:
2218
4
            dissect_uftp_register(next_tvb, pinfo, uftp_tree);
2219
4
            break;
2220
0
        case CLIENT_KEY:
2221
0
            dissect_uftp_clientkey(next_tvb, pinfo, uftp_tree);
2222
0
            break;
2223
8
        case REG_CONF:
2224
8
            dissect_uftp_regconf(next_tvb, pinfo, uftp_tree);
2225
8
            break;
2226
6
        case KEYINFO:
2227
6
            dissect_uftp_keyinfo(next_tvb, pinfo, uftp_tree);
2228
6
            break;
2229
2
        case KEYINFO_ACK:
2230
2
            dissect_uftp_keyinfoack(next_tvb, pinfo, uftp_tree);
2231
2
            break;
2232
11
        case FILEINFO:
2233
11
            dissect_uftp_fileinfo(next_tvb, pinfo, uftp_tree);
2234
11
            break;
2235
11
        case FILEINFO_ACK:
2236
11
            dissect_uftp_fileinfoack(next_tvb, pinfo, uftp_tree);
2237
11
            break;
2238
2
        case FILESEG:
2239
2
            dissect_uftp_fileseg(next_tvb, pinfo, uftp_tree);
2240
2
            break;
2241
8
        case DONE:
2242
8
            dissect_uftp_done(next_tvb, pinfo, uftp_tree);
2243
8
            break;
2244
1
        case STATUS:
2245
1
            dissect_uftp_status(next_tvb, pinfo, uftp_tree);
2246
1
            break;
2247
10
        case COMPLETE:
2248
10
            dissect_uftp_complete(next_tvb, pinfo, uftp_tree);
2249
10
            break;
2250
10
        case DONE_CONF:
2251
10
            dissect_uftp_doneconf(next_tvb, pinfo, uftp_tree);
2252
10
            break;
2253
0
        case HB_REQ:
2254
0
            dissect_uftp_hbreq(next_tvb, pinfo, uftp_tree);
2255
0
            break;
2256
5
        case HB_RESP:
2257
5
            dissect_uftp_hbresp(next_tvb, pinfo, uftp_tree);
2258
5
            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
34
        case CONG_CTRL:
2266
34
            dissect_uftp_congctrl(next_tvb, pinfo, uftp_tree);
2267
34
            break;
2268
1
        case CC_ACK:
2269
1
            dissect_uftp_ccack(next_tvb, pinfo, uftp_tree);
2270
1
            break;
2271
1
        case ENCRYPTED:
2272
1
            dissect_uftp_encrypted(next_tvb, pinfo, uftp_tree);
2273
1
            break;
2274
0
        case ABORT:
2275
0
            dissect_uftp_abort(next_tvb, pinfo, uftp_tree);
2276
0
            break;
2277
1
        default:
2278
1
            proto_tree_add_expert_format(tree, pinfo, &ei_uftp_func_unknown, tvb, offset, -1,
2279
1
                        "Function unknown: %d", mes_type);
2280
1
            break;
2281
129
    }
2282
2283
128
    return tvb_reported_length(tvb);
2284
129
}
2285
2286
void proto_register_uftp4(void)
2287
14
{
2288
14
    static hf_register_info hf[] = {
2289
14
        { &hf_uftp_version,
2290
14
            { "Protocol Version", "uftp4.version",
2291
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2292
14
        },
2293
14
        { &hf_uftp_func,
2294
14
            { "Type", "uftp4.func",
2295
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2296
14
        },
2297
14
        { &hf_uftp_seq,
2298
14
            { "Sequence Number", "uftp4.seq",
2299
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2300
14
        },
2301
14
        { &hf_uftp_src_id,
2302
14
            { "Source ID", "uftp4.src_id",
2303
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2304
14
        },
2305
14
        { &hf_uftp_group_id,
2306
14
            { "Group ID", "uftp4.group_id",
2307
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2308
14
        },
2309
14
        { &hf_uftp_group_inst,
2310
14
            { "Group Instance ID", "uftp4.group_inst",
2311
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2312
14
        },
2313
14
        { &hf_uftp_grtt,
2314
14
            { "Group Round Trip Time", "uftp4.grtt",
2315
14
            FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2316
14
        },
2317
14
        { &hf_uftp_gsize,
2318
14
            { "Group Size", "uftp4.gsize",
2319
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2320
14
        },
2321
14
        { &hf_uftp_reserved,
2322
14
            { "Reserved", "uftp4.reserved",
2323
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2324
14
        },
2325
14
        { &hf_uftp_destlist,
2326
14
            { "Destination List", "uftp4.destlist",
2327
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2328
14
        },
2329
14
        { &hf_uftp_dest,
2330
14
            { "Destination", "uftp4.dest",
2331
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2332
14
        },
2333
14
        { &hf_uftp_announce,
2334
14
            { "ANNOUNCE", "uftp4.announce",
2335
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2336
14
        },
2337
14
        { &hf_uftp_announce_func,
2338
14
            { "Type", "uftp4.announce.func",
2339
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2340
14
        },
2341
14
        { &hf_uftp_announce_hlen,
2342
14
            { "Header Length", "uftp4.announce.hlen",
2343
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2344
14
        },
2345
14
        { &hf_uftp_announce_flags,
2346
14
            { "Flags", "uftp4.announce.flags",
2347
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2348
14
        },
2349
14
        { &hf_uftp_announce_flags_sync,
2350
14
            { "Sync mode", "uftp4.announce.flags.sync",
2351
14
            FT_BOOLEAN, 8, NULL, FLAG_SYNC_MODE, NULL, HFILL }
2352
14
        },
2353
14
        { &hf_uftp_announce_flags_syncpreview,
2354
14
            { "Sync preview mode", "uftp4.announce.flags.syncpreview",
2355
14
            FT_BOOLEAN, 8, NULL, FLAG_SYNC_PREVIEW, NULL, HFILL }
2356
14
        },
2357
14
        { &hf_uftp_announce_flags_ipv6,
2358
14
            { "IPv6", "uftp4.announce.flags.ipv6",
2359
14
            FT_BOOLEAN, 8, NULL, FLAG_IPV6, NULL, HFILL }
2360
14
        },
2361
14
        { &hf_uftp_announce_flags_reserved,
2362
14
            { "Reserved", "uftp4.announce.flags.reserved",
2363
14
            FT_UINT8, BASE_HEX, NULL, FLAG_ANNOUNCE_RESERVED, NULL, HFILL }
2364
14
        },
2365
14
        { &hf_uftp_announce_robust,
2366
14
            { "Robustness Factor", "uftp4.announce.robust",
2367
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2368
14
        },
2369
14
        { &hf_uftp_announce_cc_type,
2370
14
            { "Congestion Control Type", "uftp4.announce.cc_type",
2371
14
            FT_UINT8, BASE_DEC, VALS(cc_types), 0x0, NULL, HFILL }
2372
14
        },
2373
14
        { &hf_uftp_announce_reserved,
2374
14
            { "Reserved", "uftp4.announce.reserved",
2375
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2376
14
        },
2377
14
        { &hf_uftp_announce_blocksize,
2378
14
            { "Block Size", "uftp4.announce.blocksize",
2379
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2380
14
        },
2381
14
        { &hf_uftp_announce_tstamp,
2382
14
            { "Timestamp", "uftp4.announce.tstamp",
2383
14
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2384
14
        },
2385
14
        { &hf_uftp_announce_publicmcast_ipv4,
2386
14
            { "Public Multicast Address", "uftp4.announce.publicmcast.ipv4",
2387
14
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2388
14
        },
2389
14
        { &hf_uftp_announce_publicmcast_ipv6,
2390
14
            { "Public Multicast Address", "uftp4.announce.publicmcast.ipv6",
2391
14
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
2392
14
        },
2393
14
        { &hf_uftp_announce_privatemcast_ipv4,
2394
14
            { "Private Multicast Address", "uftp4.announce.privatemcast.ipv4",
2395
14
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2396
14
        },
2397
14
        { &hf_uftp_announce_privatemcast_ipv6,
2398
14
            { "Private Multicast Address", "uftp4.announce.privatemcast.ipv6",
2399
14
            FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
2400
14
        },
2401
14
        { &hf_uftp_encinfo,
2402
14
            { "EXT_ENC_INFO", "uftp4.encinfo",
2403
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2404
14
        },
2405
14
        { &hf_uftp_encinfo_exttype,
2406
14
            { "Extension Type", "uftp4.encinfo.exttype",
2407
14
            FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2408
14
        },
2409
14
        { &hf_uftp_encinfo_extlen,
2410
14
            { "Extension Length", "uftp4.encinfo.extlen",
2411
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2412
14
        },
2413
14
        { &hf_uftp_encinfo_flags,
2414
14
            { "Flags", "uftp4.encinfo.flags",
2415
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2416
14
        },
2417
14
        { &hf_uftp_encinfo_flags_client_auth,
2418
14
            { "Client Authorization", "uftp4.encinfo.flags.client_auth",
2419
14
            FT_BOOLEAN, 8, NULL, FLAG_CLIENT_AUTH, NULL, HFILL }
2420
14
        },
2421
14
        { &hf_uftp_encinfo_flags_reserved,
2422
14
            { "Reserved", "uftp4.encinfo.flags.reserved",
2423
14
            FT_UINT8, BASE_HEX, NULL, FLAG_ENCINFO_RESERVED, NULL, HFILL }
2424
14
        },
2425
14
        { &hf_uftp_encinfo_keyextype,
2426
14
            { "Key Exchange Type", "uftp4.encinfo.keyextype",
2427
14
            FT_UINT8, BASE_DEC, VALS(keyexchange_types), 0xF0, NULL, HFILL }
2428
14
        },
2429
14
        { &hf_uftp_encinfo_sigtype,
2430
14
            { "Signature Type", "uftp4.encinfo.sigtype",
2431
14
            FT_UINT8, BASE_DEC, VALS(signature_types), 0x0F, NULL, HFILL }
2432
14
        },
2433
14
        { &hf_uftp_encinfo_keytype,
2434
14
            { "Key Type", "uftp4.encinfo.keytype",
2435
14
            FT_UINT8, BASE_DEC, VALS(key_types), 0x0, NULL, HFILL }
2436
14
        },
2437
14
        { &hf_uftp_encinfo_hashtype,
2438
14
            { "Hash Type", "uftp4.encinfo.hashtype",
2439
14
            FT_UINT8, BASE_DEC, VALS(hash_types), 0x0, NULL, HFILL }
2440
14
        },
2441
14
        { &hf_uftp_encinfo_keylen,
2442
14
            { "Public Key Length", "uftp4.encinfo.keylen",
2443
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2444
14
        },
2445
14
        { &hf_uftp_encinfo_dhlen,
2446
14
            { "Diffie-Hellman Key Length", "uftp4.encinfo.dhlen",
2447
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2448
14
        },
2449
14
        { &hf_uftp_encinfo_siglen,
2450
14
            { "Signature Length", "uftp4.encinfo.siglen",
2451
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2452
14
        },
2453
14
        { &hf_uftp_encinfo_rand1,
2454
14
            { "Server Random Number", "uftp4.encinfo.rand1",
2455
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2456
14
        },
2457
14
        { &hf_uftp_encinfo_keyblob,
2458
14
            { "Public Key Blob", "uftp4.encinfo.keyblob",
2459
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2460
14
        },
2461
14
        { &hf_uftp_encinfo_dhblob,
2462
14
            { "Diffie-Hellman Key Blob", "uftp4.encinfo.dhblob",
2463
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2464
14
        },
2465
14
        { &hf_uftp_encinfo_sig,
2466
14
            { "Signature", "uftp4.encinfo.sig",
2467
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2468
14
        },
2469
14
        { &hf_uftp_rsablob_blobtype,
2470
14
            { "Keyblob Type", "uftp4.rsablob.blobtype",
2471
14
            FT_UINT8, BASE_DEC, VALS(keyblob_types), 0x0, NULL, HFILL }
2472
14
        },
2473
14
        { &hf_uftp_rsablob_reserved,
2474
14
            { "Reserved", "uftp4.rsablob.reserved",
2475
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2476
14
        },
2477
14
        { &hf_uftp_rsablob_modlen,
2478
14
            { "Modulus Length", "uftp4.rsablob.modlen",
2479
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2480
14
        },
2481
14
        { &hf_uftp_rsablob_exponent,
2482
14
            { "Exponent", "uftp4.rsablob.exponent",
2483
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2484
14
        },
2485
14
        { &hf_uftp_rsablob_modulus,
2486
14
            { "Modulus", "uftp4.rsablob.modulus",
2487
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2488
14
        },
2489
14
        { &hf_uftp_ecblob_blobtype,
2490
14
            { "Keyblob Type", "uftp4.ecblob.blobtype",
2491
14
            FT_UINT8, BASE_DEC, VALS(keyblob_types), 0x0, NULL, HFILL }
2492
14
        },
2493
14
        { &hf_uftp_ecblob_curve,
2494
14
            { "Curve", "uftp4.ecblob.curve",
2495
14
            FT_UINT8, BASE_DEC, VALS(curves), 0x0, NULL, HFILL }
2496
14
        },
2497
14
        { &hf_uftp_ecblob_keylen,
2498
14
            { "Key Length", "uftp4.ecblob.keylen",
2499
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2500
14
        },
2501
14
        { &hf_uftp_ecblob_key,
2502
14
            { "Key", "uftp4.ecblob.key",
2503
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2504
14
        },
2505
14
        { &hf_uftp_register,
2506
14
            { "REGISTER", "uftp4.register",
2507
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2508
14
        },
2509
14
        { &hf_uftp_register_func,
2510
14
            { "Type", "uftp4.register.func",
2511
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2512
14
        },
2513
14
        { &hf_uftp_register_hlen,
2514
14
            { "Header Length", "uftp4.register.hlen",
2515
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2516
14
        },
2517
14
        { &hf_uftp_register_keyinfo_len,
2518
14
            { "Key Info Length", "uftp4.register.keyinfo_len",
2519
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2520
14
        },
2521
14
        { &hf_uftp_register_tstamp,
2522
14
            { "Timestamp", "uftp4.register.tstamp",
2523
14
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2524
14
        },
2525
14
        { &hf_uftp_register_rand2,
2526
14
            { "Client Random Number", "uftp4.register.rand2",
2527
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2528
14
        },
2529
14
        { &hf_uftp_register_keyinfo,
2530
14
            { "Key Info", "uftp4.register.keyinfo",
2531
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2532
14
        },
2533
14
        { &hf_uftp_clientkey,
2534
14
            { "CLIENT_KEY", "uftp4.clientkey",
2535
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2536
14
        },
2537
14
        { &hf_uftp_clientkey_func,
2538
14
            { "Type", "uftp4.clientkey.func",
2539
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2540
14
        },
2541
14
        { &hf_uftp_clientkey_hlen,
2542
14
            { "Header Length", "uftp4.clientkey.hlen",
2543
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2544
14
        },
2545
14
        { &hf_uftp_clientkey_reserved,
2546
14
            { "Reserved", "uftp4.clientkey.reserved",
2547
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2548
14
        },
2549
14
        { &hf_uftp_clientkey_bloblen,
2550
14
            { "Keyblob Length", "uftp4.clientkey.bloblen",
2551
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2552
14
        },
2553
14
        { &hf_uftp_clientkey_siglen,
2554
14
            { "Signature Length", "uftp4.clientkey.siglen",
2555
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2556
14
        },
2557
14
        { &hf_uftp_clientkey_keyblob,
2558
14
            { "Public Key Blob", "uftp4.clientkey.keyblob",
2559
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2560
14
        },
2561
14
        { &hf_uftp_clientkey_verify,
2562
14
            { "Signature", "uftp4.clientkey.verify",
2563
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2564
14
        },
2565
14
        { &hf_uftp_regconf,
2566
14
            { "REG_CONF", "uftp4.regconf",
2567
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2568
14
        },
2569
14
        { &hf_uftp_regconf_func,
2570
14
            { "Type", "uftp4.regconf.func",
2571
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2572
14
        },
2573
14
        { &hf_uftp_regconf_hlen,
2574
14
            { "Header Length", "uftp4.regconf.hlen",
2575
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2576
14
        },
2577
14
        { &hf_uftp_regconf_reserved,
2578
14
            { "Reserved", "uftp4.regconf.reserved",
2579
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2580
14
        },
2581
14
        { &hf_uftp_keyinfo,
2582
14
            { "KEYINFO", "uftp4.keyinfo",
2583
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2584
14
        },
2585
14
        { &hf_uftp_keyinfo_func,
2586
14
            { "Type", "uftp4.keyinfo.func",
2587
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2588
14
        },
2589
14
        { &hf_uftp_keyinfo_hlen,
2590
14
            { "Header Length", "uftp4.keyinfo.hlen",
2591
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2592
14
        },
2593
14
        { &hf_uftp_keyinfo_reserved,
2594
14
            { "Reserved", "uftp4.keyinfo.reserved",
2595
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2596
14
        },
2597
14
        { &hf_uftp_keyinfo_ivctr,
2598
14
            { "IV Counter", "uftp4.keyinfo.ivctr",
2599
14
            FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
2600
14
        },
2601
14
        { &hf_uftp_keyinfo_destkey,
2602
14
            { "Destination Key", "uftp4.keyinfo.destkey",
2603
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2604
14
        },
2605
14
        { &hf_uftp_keyinfo_destid,
2606
14
            { "Destination ID", "uftp4.keyinfo.destid",
2607
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2608
14
        },
2609
14
        { &hf_uftp_keyinfo_groupmaster,
2610
14
            { "Encrypted Group Master", "uftp4.keyinfo.groupmaster",
2611
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2612
14
        },
2613
14
        { &hf_uftp_keyinfoack,
2614
14
            { "KEYINFO_ACK", "uftp4.keyinfoack",
2615
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2616
14
        },
2617
14
        { &hf_uftp_keyinfoack_func,
2618
14
            { "Type", "uftp4.keyinfoack.func",
2619
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2620
14
        },
2621
14
        { &hf_uftp_keyinfoack_hlen,
2622
14
            { "Header Length", "uftp4.keyinfoack.hlen",
2623
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2624
14
        },
2625
14
        { &hf_uftp_keyinfoack_reserved,
2626
14
            { "Reserved", "uftp4.keyinfoack.reserved",
2627
14
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2628
14
        },
2629
14
        { &hf_uftp_keyinfoack_verify_data,
2630
14
            { "Verify Data", "uftp4.keyinfoack.verify_data",
2631
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2632
14
        },
2633
14
        { &hf_uftp_fileinfo,
2634
14
            { "FILEINFO", "uftp4.fileinfo",
2635
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2636
14
        },
2637
14
        { &hf_uftp_fileinfo_func,
2638
14
            { "Type", "uftp4.fileinfo.func",
2639
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2640
14
        },
2641
14
        { &hf_uftp_fileinfo_hlen,
2642
14
            { "Header Length", "uftp4.fileinfo.hlen",
2643
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2644
14
        },
2645
14
        { &hf_uftp_fileinfo_file_id,
2646
14
            { "File ID", "uftp4.fileinfo.file_id",
2647
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2648
14
        },
2649
14
        { &hf_uftp_fileinfo_ftype,
2650
14
            { "File Type", "uftp4.fileinfo.ftype",
2651
14
            FT_UINT8, BASE_DEC, VALS(file_types), 0x0, NULL, HFILL }
2652
14
        },
2653
14
        { &hf_uftp_fileinfo_reserved,
2654
14
            { "Reserved", "uftp4.fileinfo.reserved",
2655
14
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2656
14
        },
2657
14
        { &hf_uftp_fileinfo_namelen,
2658
14
            { "Name Length", "uftp4.fileinfo.namelen",
2659
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2660
14
        },
2661
14
        { &hf_uftp_fileinfo_linklen,
2662
14
            { "Link Length", "uftp4.fileinfo.linklen",
2663
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2664
14
        },
2665
14
        { &hf_uftp_fileinfo_fsize,
2666
14
            { "File Size", "uftp4.fileinfo.fsize",
2667
14
            FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
2668
14
        },
2669
14
        { &hf_uftp_fileinfo_ftstamp,
2670
14
            { "File Timestamp", "uftp4.fileinfo.ftstamp",
2671
14
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2672
14
        },
2673
14
        { &hf_uftp_fileinfo_tstamp,
2674
14
            { "Timestamp", "uftp4.fileinfo.tstamp",
2675
14
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2676
14
        },
2677
14
        { &hf_uftp_fileinfo_name,
2678
14
            { "File Name", "uftp4.fileinfo.name",
2679
14
            FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2680
14
        },
2681
14
        { &hf_uftp_fileinfo_link,
2682
14
            { "Link Name", "uftp4.fileinfo.link",
2683
14
            FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2684
14
        },
2685
14
        { &hf_uftp_fileinfoack,
2686
14
            { "FILEINFO_ACK", "uftp4.fileinfoack",
2687
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2688
14
        },
2689
14
        { &hf_uftp_fileinfoack_func,
2690
14
            { "Type", "uftp4.fileinfoack.func",
2691
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2692
14
        },
2693
14
        { &hf_uftp_fileinfoack_hlen,
2694
14
            { "Header Length", "uftp4.fileinfoack.hlen",
2695
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2696
14
        },
2697
14
        { &hf_uftp_fileinfoack_file_id,
2698
14
            { "File ID", "uftp4.fileinfoack.file_id",
2699
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2700
14
        },
2701
14
        { &hf_uftp_fileinfoack_flags,
2702
14
            { "Flags", "uftp4.fileinfoack.flags",
2703
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2704
14
        },
2705
14
        { &hf_uftp_fileinfoack_flags_partial,
2706
14
            { "Partial", "uftp4.fileinfoack.flags.partial",
2707
14
            FT_BOOLEAN, 8, NULL, FLAG_PARTIAL, NULL, HFILL }
2708
14
        },
2709
14
        { &hf_uftp_fileinfoack_flags_reserved,
2710
14
            { "Reserved", "uftp4.fileinfoack.flags.reserved",
2711
14
            FT_UINT8, BASE_HEX, NULL, FLAG_FILEINFOACK_RESERVED, NULL, HFILL }
2712
14
        },
2713
14
        { &hf_uftp_fileinfoack_reserved,
2714
14
            { "Reserved", "uftp4.fileinfoack.reserved",
2715
14
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2716
14
        },
2717
14
        { &hf_uftp_fileinfoack_tstamp,
2718
14
            { "Timestamp", "uftp4.fileinfoack.tstamp",
2719
14
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2720
14
        },
2721
14
        { &hf_uftp_fileseg,
2722
14
            { "FILESEG", "uftp4.fileseg",
2723
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2724
14
        },
2725
14
        { &hf_uftp_fileseg_func,
2726
14
            { "Type", "uftp4.fileseg.func",
2727
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2728
14
        },
2729
14
        { &hf_uftp_fileseg_hlen,
2730
14
            { "Header Length", "uftp4.fileseg.hlen",
2731
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2732
14
        },
2733
14
        { &hf_uftp_fileseg_file_id,
2734
14
            { "File ID", "uftp4.fileseg.file_id",
2735
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2736
14
        },
2737
14
        { &hf_uftp_fileseg_section,
2738
14
            { "Section", "uftp4.fileseg.section",
2739
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2740
14
        },
2741
14
        { &hf_uftp_fileseg_sec_block,
2742
14
            { "Block", "uftp4.fileseg.sec_block",
2743
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2744
14
        },
2745
14
        { &hf_uftp_tfmccdata,
2746
14
            { "EXT_TFMCC_DATA_INFO", "uftp4.tfmccdata",
2747
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2748
14
        },
2749
14
        { &hf_uftp_tfmccdata_exttype,
2750
14
            { "Extension Type", "uftp4.tfmccdata.exttype",
2751
14
            FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2752
14
        },
2753
14
        { &hf_uftp_tfmccdata_extlen,
2754
14
            { "Extension Length", "uftp4.tfmccdata.extlen",
2755
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2756
14
        },
2757
14
        { &hf_uftp_tfmccdata_send_rate,
2758
14
            { "Send Rate", "uftp4.tfmccdata.send_rate",
2759
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2760
14
        },
2761
14
        { &hf_uftp_tfmccdata_cc_seq,
2762
14
            { "CC Sequence Number", "uftp4.tfmccdata.cc_seq",
2763
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2764
14
        },
2765
14
        { &hf_uftp_tfmccdata_cc_rate,
2766
14
            { "Rate", "uftp4.tfmccdata.cc_rate",
2767
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2768
14
        },
2769
14
        { &hf_uftp_fileseg_data,
2770
14
            { "Data", "uftp4.fileseg.data",
2771
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2772
14
        },
2773
14
        { &hf_uftp_done,
2774
14
            { "DONE", "uftp4.done",
2775
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2776
14
        },
2777
14
        { &hf_uftp_done_func,
2778
14
            { "Type", "uftp4.done.func",
2779
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2780
14
        },
2781
14
        { &hf_uftp_done_hlen,
2782
14
            { "Header Length", "uftp4.done.hlen",
2783
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2784
14
        },
2785
14
        { &hf_uftp_done_file_id,
2786
14
            { "File ID", "uftp4.done.file_id",
2787
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2788
14
        },
2789
14
        { &hf_uftp_done_section,
2790
14
            { "Section", "uftp4.done.section",
2791
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2792
14
        },
2793
14
        { &hf_uftp_done_reserved,
2794
14
            { "Reserved", "uftp4.done.reserved",
2795
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2796
14
        },
2797
14
        { &hf_uftp_status,
2798
14
            { "STATUS", "uftp4.status",
2799
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2800
14
        },
2801
14
        { &hf_uftp_status_func,
2802
14
            { "Type", "uftp4.status.func",
2803
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2804
14
        },
2805
14
        { &hf_uftp_status_hlen,
2806
14
            { "Header Length", "uftp4.status.hlen",
2807
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2808
14
        },
2809
14
        { &hf_uftp_status_file_id,
2810
14
            { "File ID", "uftp4.status.file_id",
2811
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2812
14
        },
2813
14
        { &hf_uftp_status_section,
2814
14
            { "Section", "uftp4.status.section",
2815
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2816
14
        },
2817
14
        { &hf_uftp_status_reserved,
2818
14
            { "Reserved", "uftp4.status.reserved",
2819
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2820
14
        },
2821
14
        { &hf_uftp_status_naks,
2822
14
            { "NAKs", "uftp4.status.naks",
2823
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2824
14
        },
2825
14
        { &hf_uftp_complete,
2826
14
            { "COMPLETE", "uftp4.complete",
2827
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2828
14
        },
2829
14
        { &hf_uftp_complete_func,
2830
14
            { "Type", "uftp4.complete.func",
2831
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2832
14
        },
2833
14
        { &hf_uftp_complete_hlen,
2834
14
            { "Header Length", "uftp4.complete.hlen",
2835
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2836
14
        },
2837
14
        { &hf_uftp_complete_file_id,
2838
14
            { "File ID", "uftp4.complete.file_id",
2839
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2840
14
        },
2841
14
        { &hf_uftp_complete_status,
2842
14
            { "Completion Status", "uftp4.complete.status",
2843
14
            FT_UINT8, BASE_DEC, VALS(comp_status), 0x0, NULL, HFILL }
2844
14
        },
2845
14
        { &hf_uftp_complete_reserved,
2846
14
            { "Reserved", "uftp4.complete.reserved",
2847
14
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2848
14
        },
2849
14
        { &hf_uftp_freespace,
2850
14
            { "EXT_FREESPACE_INFO", "uftp4.freespace",
2851
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2852
14
        },
2853
14
        { &hf_uftp_freespace_exttype,
2854
14
            { "Extension Type", "uftp4.freespace.exttype",
2855
14
            FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2856
14
        },
2857
14
        { &hf_uftp_freespace_extlen,
2858
14
            { "Extension Length", "uftp4.freespace.extlen",
2859
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2860
14
        },
2861
14
        { &hf_uftp_freespace_reserved,
2862
14
            { "Reserved", "uftp4.freespace.reserved",
2863
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2864
14
        },
2865
14
        { &hf_uftp_freespace_freespace,
2866
14
            { "Free Space", "uftp4.freespace.freespace",
2867
14
            FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
2868
14
        },
2869
14
        { &hf_uftp_doneconf,
2870
14
            { "DONE_CONF", "uftp4.doneconf",
2871
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2872
14
        },
2873
14
        { &hf_uftp_doneconf_func,
2874
14
            { "Type", "uftp4.doneconf.func",
2875
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2876
14
        },
2877
14
        { &hf_uftp_doneconf_hlen,
2878
14
            { "Header Length", "uftp4.doneconf.hlen",
2879
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2880
14
        },
2881
14
        { &hf_uftp_doneconf_reserved,
2882
14
            { "Reserved", "uftp4.doneconf.reserved",
2883
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2884
14
        },
2885
14
        { &hf_uftp_hbreq,
2886
14
            { "HB_REQ", "uftp4.hbreq",
2887
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2888
14
        },
2889
14
        { &hf_uftp_hbreq_func,
2890
14
            { "Type", "uftp4.hbreq.func",
2891
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2892
14
        },
2893
14
        { &hf_uftp_hbreq_hlen,
2894
14
            { "Header Length", "uftp4.hbreq.hlen",
2895
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2896
14
        },
2897
14
        { &hf_uftp_hbreq_reserved,
2898
14
            { "Reserved", "uftp4.hbreq.reserved",
2899
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2900
14
        },
2901
14
        { &hf_uftp_hbreq_bloblen,
2902
14
            { "Keyblob Length", "uftp4.hbreq.bloblen",
2903
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2904
14
        },
2905
14
        { &hf_uftp_hbreq_siglen,
2906
14
            { "Signature Length", "uftp4.hbreq.siglen",
2907
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2908
14
        },
2909
14
        { &hf_uftp_hbreq_nonce,
2910
14
            { "Nonce", "uftp4.hbreq.nonce",
2911
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2912
14
        },
2913
14
        { &hf_uftp_hbreq_keyblob,
2914
14
            { "Public Key Blob", "uftp4.hbreq.keyblob",
2915
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2916
14
        },
2917
14
        { &hf_uftp_hbreq_verify,
2918
14
            { "Signature", "uftp4.hbreq.verify",
2919
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2920
14
        },
2921
14
        { &hf_uftp_hbresp,
2922
14
            { "HB_RESP", "uftp4.hbresp",
2923
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2924
14
        },
2925
14
        { &hf_uftp_hbresp_func,
2926
14
            { "Type", "uftp4.hbresp.func",
2927
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2928
14
        },
2929
14
        { &hf_uftp_hbresp_hlen,
2930
14
            { "Header Length", "uftp4.hbresp.hlen",
2931
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2932
14
        },
2933
14
        { &hf_uftp_hbresp_authenticated,
2934
14
            { "Authenticated", "uftp4.hbresp.authenticated",
2935
14
            FT_UINT8, BASE_DEC, VALS(hb_auth_types), 0x0, NULL, HFILL }
2936
14
        },
2937
14
        { &hf_uftp_hbresp_reserved,
2938
14
            { "Reserved", "uftp4.hbresp.reserved",
2939
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2940
14
        },
2941
14
        { &hf_uftp_hbresp_nonce,
2942
14
            { "Nonce", "uftp4.hbresp.nonce",
2943
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2944
14
        },
2945
14
        { &hf_uftp_keyreq,
2946
14
            { "KEY_REQ", "uftp4.keyreq",
2947
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2948
14
        },
2949
14
        { &hf_uftp_keyreq_func,
2950
14
            { "Type", "uftp4.keyreq.func",
2951
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2952
14
        },
2953
14
        { &hf_uftp_keyreq_hlen,
2954
14
            { "Header Length", "uftp4.keyreq.hlen",
2955
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2956
14
        },
2957
14
        { &hf_uftp_keyreq_reserved,
2958
14
            { "Reserved", "uftp4.keyreq.reserved",
2959
14
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2960
14
        },
2961
14
        { &hf_uftp_proxykey,
2962
14
            { "PROXY_KEY", "uftp4.proxykey",
2963
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2964
14
        },
2965
14
        { &hf_uftp_proxykey_func,
2966
14
            { "Type", "uftp4.proxykey.func",
2967
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2968
14
        },
2969
14
        { &hf_uftp_proxykey_hlen,
2970
14
            { "Header Length", "uftp4.proxykey.hlen",
2971
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2972
14
        },
2973
14
        { &hf_uftp_proxykey_bloblen,
2974
14
            { "Keyblob Length", "uftp4.proxykey.bloblen",
2975
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2976
14
        },
2977
14
        { &hf_uftp_proxykey_dhlen,
2978
14
            { "Diffie-Hellman Keyblob Length", "uftp4.proxykey.dhlen",
2979
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2980
14
        },
2981
14
        { &hf_uftp_proxykey_siglen,
2982
14
            { "Signature Length", "uftp4.proxykey.siglen",
2983
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2984
14
        },
2985
14
        { &hf_uftp_proxykey_nonce,
2986
14
            { "Nonce", "uftp4.proxykey.nonce",
2987
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2988
14
        },
2989
14
        { &hf_uftp_proxykey_keyblob,
2990
14
            { "Public Key Blob", "uftp4.proxykey.keyblob",
2991
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2992
14
        },
2993
14
        { &hf_uftp_proxykey_dhblob,
2994
14
            { "Diffie-Hellman Key Blob", "uftp4.proxykey.dhblob",
2995
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2996
14
        },
2997
14
        { &hf_uftp_proxykey_verify,
2998
14
            { "Signature", "uftp4.proxykey.verify",
2999
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3000
14
        },
3001
14
        { &hf_uftp_congctrl,
3002
14
            { "CONG_CTRL", "uftp4.congctrl",
3003
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3004
14
        },
3005
14
        { &hf_uftp_congctrl_func,
3006
14
            { "Type", "uftp4.congctrl.func",
3007
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3008
14
        },
3009
14
        { &hf_uftp_congctrl_hlen,
3010
14
            { "Header Length", "uftp4.congctrl.hlen",
3011
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3012
14
        },
3013
14
        { &hf_uftp_congctrl_reserved,
3014
14
            { "Reserved", "uftp4.congctrl.reserved",
3015
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
3016
14
        },
3017
14
        { &hf_uftp_congctrl_cc_seq,
3018
14
            { "CC Sequence", "uftp4.congctrl.cc_seq",
3019
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3020
14
        },
3021
14
        { &hf_uftp_congctrl_cc_rate,
3022
14
            { "Rate", "uftp4.congctrl.cc_rate",
3023
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3024
14
        },
3025
14
        { &hf_uftp_congctrl_tstamp,
3026
14
            { "Timestamp", "uftp4.congctrl.tstamp",
3027
14
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
3028
14
        },
3029
14
        { &hf_uftp_congctrl_cclist,
3030
14
            { "Congestion Control List", "uftp4.congctrl.cclist",
3031
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3032
14
        },
3033
14
        { &hf_uftp_congctrl_item,
3034
14
            { "Destination", "uftp4.congctrl.item",
3035
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3036
14
        },
3037
14
        { &hf_uftp_congctrl_item_destid,
3038
14
            { "Destination ID", "uftp4.congctrl.item.destid",
3039
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3040
14
        },
3041
14
        { &hf_uftp_congctrl_item_flags,
3042
14
            { "Flags", "uftp4.congctrl.item.flags",
3043
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3044
14
        },
3045
14
        { &hf_uftp_congctrl_item_flags_clr,
3046
14
            { "CLR", "uftp4.congctrl.item.flags.clr",
3047
14
            FT_BOOLEAN, 8, NULL, FLAG_CC_CLR, NULL, HFILL }
3048
14
        },
3049
14
        { &hf_uftp_congctrl_item_flags_rtt,
3050
14
            { "RTT", "uftp4.congctrl.item.flags.rtt",
3051
14
            FT_BOOLEAN, 8, NULL, FLAG_CC_RTT, NULL, HFILL }
3052
14
        },
3053
14
        { &hf_uftp_congctrl_item_flags_start,
3054
14
            { "Slowstart", "uftp4.congctrl.item.flags.start",
3055
14
            FT_BOOLEAN, 8, NULL, FLAG_CC_START, NULL, HFILL }
3056
14
        },
3057
14
        { &hf_uftp_congctrl_item_flags_leave,
3058
14
            { "Leave", "uftp4.congctrl.item.flags.leave",
3059
14
            FT_BOOLEAN, 8, NULL, FLAG_CC_LEAVE, NULL, HFILL }
3060
14
        },
3061
14
        { &hf_uftp_congctrl_item_flags_reserved,
3062
14
            { "Reserved", "uftp4.congctrl.item.flags.reserved",
3063
14
            FT_UINT8, BASE_HEX, NULL, FLAG_CC_RESERVED, NULL, HFILL }
3064
14
        },
3065
14
        { &hf_uftp_congctrl_item_rtt,
3066
14
            { "Round Trip Time", "uftp4.congctrl.item.rtt",
3067
14
            FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3068
14
        },
3069
14
        { &hf_uftp_congctrl_item_rate,
3070
14
            { "Rate", "uftp4.congctrl.item.rate",
3071
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3072
14
        },
3073
14
        { &hf_uftp_ccack,
3074
14
            { "CC_ACK", "uftp4.ccack",
3075
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3076
14
        },
3077
14
        { &hf_uftp_ccack_func,
3078
14
            { "Type", "uftp4.ccack.func",
3079
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3080
14
        },
3081
14
        { &hf_uftp_ccack_hlen,
3082
14
            { "Header Length", "uftp4.ccack.hlen",
3083
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3084
14
        },
3085
14
        { &hf_uftp_ccack_reserved,
3086
14
            { "Reserved", "uftp4.ccack.reserved",
3087
14
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
3088
14
        },
3089
14
        { &hf_uftp_tfmccack,
3090
14
            { "EXT_TFMCC_ACK_INFO", "uftp4.tfmccack",
3091
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3092
14
        },
3093
14
        { &hf_uftp_tfmccack_exttype,
3094
14
            { "Extension Type", "uftp4.tfmccack.exttype",
3095
14
            FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
3096
14
        },
3097
14
        { &hf_uftp_tfmccack_extlen,
3098
14
            { "Extension Length", "uftp4.tfmccack.extlen",
3099
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3100
14
        },
3101
14
        { &hf_uftp_tfmccack_flags,
3102
14
            { "Flags", "uftp4.tfmccack.flags",
3103
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3104
14
        },
3105
14
        { &hf_uftp_tfmccack_flags_clr,
3106
14
            { "CLR", "uftp4.tfmccack.flags.clr",
3107
14
            FT_BOOLEAN, 8, NULL, FLAG_CC_CLR, NULL, HFILL }
3108
14
        },
3109
14
        { &hf_uftp_tfmccack_flags_rtt,
3110
14
            { "RTT", "uftp4.tfmccack.flags.rtt",
3111
14
            FT_BOOLEAN, 8, NULL, FLAG_CC_RTT, NULL, HFILL }
3112
14
        },
3113
14
        { &hf_uftp_tfmccack_flags_start,
3114
14
            { "Slowstart", "uftp4.tfmccack.flags.start",
3115
14
            FT_BOOLEAN, 8, NULL, FLAG_CC_START, NULL, HFILL }
3116
14
        },
3117
14
        { &hf_uftp_tfmccack_flags_leave,
3118
14
            { "Leave", "uftp4.tfmccack.flags.leave",
3119
14
            FT_BOOLEAN, 8, NULL, FLAG_CC_LEAVE, NULL, HFILL }
3120
14
        },
3121
14
        { &hf_uftp_tfmccack_flags_reserved,
3122
14
            { "Reserved", "uftp4.tfmccack.flags.reserved",
3123
14
            FT_UINT8, BASE_HEX, NULL, FLAG_CC_RESERVED, NULL, HFILL }
3124
14
        },
3125
14
        { &hf_uftp_tfmccack_reserved,
3126
14
            { "Reserved", "uftp4.tfmccack.reserved",
3127
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3128
14
        },
3129
14
        { &hf_uftp_tfmccack_cc_seq,
3130
14
            { "CC Sequence Number", "uftp4.tfmccack.cc_seq",
3131
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3132
14
        },
3133
14
        { &hf_uftp_tfmccack_cc_rate,
3134
14
            { "Rate", "uftp4.tfmccack.cc_rate",
3135
14
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3136
14
        },
3137
14
        { &hf_uftp_tfmccack_client_id,
3138
14
            { "Client ID", "uftp4.tfmccack.client_id",
3139
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3140
14
        },
3141
14
        { &hf_uftp_tfmccack_tstamp,
3142
14
            { "Timestamp", "uftp4.tfmccack.tstamp",
3143
14
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
3144
14
        },
3145
14
        { &hf_uftp_encrypted,
3146
14
            { "ENCRYPTED", "uftp4.encrypted",
3147
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3148
14
        },
3149
14
        { &hf_uftp_encrypted_ivctr,
3150
14
            { "IV Counter", "uftp4.encrypted.ivctr",
3151
14
            FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
3152
14
        },
3153
14
        { &hf_uftp_encrypted_sig_len,
3154
14
            { "Signature Length", "uftp4.encrypted.sig_len",
3155
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3156
14
        },
3157
14
        { &hf_uftp_encrypted_payload_len,
3158
14
            { "Payload Length", "uftp4.encrypted.payload_len",
3159
14
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3160
14
        },
3161
14
        { &hf_uftp_encrypted_signature,
3162
14
            { "Signature", "uftp4.encrypted.signature",
3163
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3164
14
        },
3165
14
        { &hf_uftp_encrypted_payload,
3166
14
            { "Encrypted Payload", "uftp4.encrypted.payload",
3167
14
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3168
14
        },
3169
14
        { &hf_uftp_abort,
3170
14
            { "ABORT", "uftp4.abort",
3171
14
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3172
14
        },
3173
14
        { &hf_uftp_abort_func,
3174
14
            { "Type", "uftp4.abort.func",
3175
14
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3176
14
        },
3177
14
        { &hf_uftp_abort_hlen,
3178
14
            { "Header Length", "uftp4.abort.hlen",
3179
14
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3180
14
        },
3181
14
        { &hf_uftp_abort_flags,
3182
14
            { "Flags", "uftp4.abort.flags",
3183
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3184
14
        },
3185
14
        { &hf_uftp_abort_flags_curfile,
3186
14
            { "Current file", "uftp4.abort.flags.curfile",
3187
14
            FT_BOOLEAN, 8, NULL, FLAG_CURRENT_FILE, NULL, HFILL }
3188
14
        },
3189
14
        { &hf_uftp_abort_flags_reserved,
3190
14
            { "Reserved", "uftp4.abort.flags.reserved",
3191
14
            FT_UINT8, BASE_HEX, NULL, FLAG_ABORT_RESERVED, NULL, HFILL }
3192
14
        },
3193
14
        { &hf_uftp_abort_reserved,
3194
14
            { "Reserved", "uftp4.abort.reserved",
3195
14
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3196
14
        },
3197
14
        { &hf_uftp_abort_clientid,
3198
14
            { "Client ID", "uftp4.abort.clientid",
3199
14
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3200
14
        },
3201
14
        { &hf_uftp_abort_message,
3202
14
            { "Message", "uftp4.abort.message",
3203
14
            FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
3204
14
        }
3205
14
    };
3206
3207
    /* Setup protocol subtree array */
3208
14
    static int *ett[] = {
3209
14
        &ett_uftp,
3210
14
        &ett_uftp_announce,
3211
14
        &ett_uftp_encinfo,
3212
14
        &ett_uftp_register,
3213
14
        &ett_uftp_clientkey,
3214
14
        &ett_uftp_regconf,
3215
14
        &ett_uftp_keyinfo,
3216
14
        &ett_uftp_keyinfo_destkey,
3217
14
        &ett_uftp_keyinfoack,
3218
14
        &ett_uftp_fileinfo,
3219
14
        &ett_uftp_fileinfoack,
3220
14
        &ett_uftp_fileseg,
3221
14
        &ett_uftp_tfmccdata,
3222
14
        &ett_uftp_done,
3223
14
        &ett_uftp_status,
3224
14
        &ett_uftp_complete,
3225
14
        &ett_uftp_freespace,
3226
14
        &ett_uftp_doneconf,
3227
14
        &ett_uftp_hbreq,
3228
14
        &ett_uftp_hbresp,
3229
14
        &ett_uftp_keyreq,
3230
14
        &ett_uftp_proxykey,
3231
14
        &ett_uftp_congctrl,
3232
14
        &ett_uftp_congctrl_cclist,
3233
14
        &ett_uftp_congctrl_item,
3234
14
        &ett_uftp_ccack,
3235
14
        &ett_uftp_tfmccack,
3236
14
        &ett_uftp_encrypted,
3237
14
        &ett_uftp_abort,
3238
14
        &ett_uftp_announce_flags,
3239
14
        &ett_uftp_encinfo_flags,
3240
14
        &ett_uftp_fileinfoack_flags,
3241
14
        &ett_uftp_abort_flags,
3242
14
        &ett_uftp_congctrl_item_flags,
3243
14
        &ett_uftp_tfmccack_flags,
3244
14
        &ett_uftp_destlist,
3245
14
        &ett_uftp_rsablob,
3246
14
        &ett_uftp_ecblob
3247
14
    };
3248
3249
14
    static ei_register_info ei[] = {
3250
14
        { &ei_uftp_length_invalid, { "uftp4.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }},
3251
14
        { &ei_uftp_func_unknown, { "uftp4.func.invalid", PI_MALFORMED, PI_ERROR, "Unknown function", EXPFILL }}
3252
14
    };
3253
3254
14
    expert_module_t* expert_uftp;
3255
3256
14
    proto_uftp = proto_register_protocol("UDP based FTP w/ multicast V4",
3257
14
        "UFTP4", "uftp4");
3258
14
    proto_register_field_array(proto_uftp, hf, array_length(hf));
3259
14
    proto_register_subtree_array(ett, array_length(ett));
3260
14
    register_dissector("uftp4", dissect_uftp, proto_uftp);
3261
14
    expert_uftp = expert_register_protocol(proto_uftp);
3262
14
    expert_register_field_array(expert_uftp, ei, array_length(ei));
3263
14
}
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
 */