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