epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-uftp4.c
blobf3fa3185ce48dda0dbe34f6d6eea4ae99dfee298
1 /* packet-uftp4.c
2 * Routines for UFTP version 4 packet dissection
3 * Copyright Dennis Bush <bush@tcnj.edu>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #include "config.h"
14 #include <epan/packet.h>
15 #include <epan/expert.h>
16 #include <math.h>
18 #define UFTP_VER_NUM 0x40
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
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
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
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
65 #define SIG_NONE 0
66 #define SIG_HMAC 1
67 #define SIG_KEYEX 2
68 #define SIG_AUTHENC 3
70 #define KEYEX_NONE 0
71 #define KEYEX_RSA 1
72 #define KEYEX_ECDH_RSA 2
73 #define KEYEX_ECDH_ECDSA 3
75 #define KEYBLOB_RSA 1
76 #define KEYBLOB_EC 2
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
106 #define CC_NONE 0
107 #define CC_UFTP3 1
108 #define CC_TFMCC 2
109 #define CC_PGMCC 3
111 #define EXT_ENC_INFO 1
112 #define EXT_TFMCC_DATA_INFO 2
113 #define EXT_TFMCC_ACK_INFO 3
115 #define EXT_PGMCC_DATA_INFO 4
116 #define EXT_PGMCC_NAK_INFO 5
117 #define EXT_PGMCC_ACK_INFO 6
119 #define EXT_FREESPACE_INFO 7
121 #define FLAG_SYNC_MODE 0x01
122 #define FLAG_SYNC_PREVIEW 0x02
123 #define FLAG_IPV6 0x04
124 #define FLAG_ANNOUNCE_RESERVED 0xF8
126 #define FLAG_CLIENT_AUTH 0x01
127 #define FLAG_ENCINFO_RESERVED 0xFE
129 #define FLAG_PARTIAL 0x01
130 #define FLAG_FILEINFOACK_RESERVED 0xFE
132 #define FLAG_CURRENT_FILE 0x01
133 #define FLAG_ABORT_RESERVED 0xFE
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
141 #define COMP_STAT_NORMAL 0
142 #define COMP_STAT_SKIPPED 1
143 #define COMP_STAT_OVERWRITE 2
144 #define COMP_STAT_REJECTED 3
146 #define HB_AUTH_FAILED 0
147 #define HB_AUTH_OK 1
148 #define HB_AUTH_CHALLENGE 2
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
158 #define DESTNAME_LEN 80
159 #define IFNAME_LEN 25
160 #define MAX_INTERFACES 100
161 #define IPSTR_LEN 16
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 */
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
210 void proto_register_uftp4(void);
212 static int proto_uftp;
214 /* main header and common fields */
215 static int hf_uftp_version;
216 static int hf_uftp_func;
217 static int hf_uftp_seq;
218 static int hf_uftp_src_id;
219 static int hf_uftp_group_id;
220 static int hf_uftp_group_inst;
221 static int hf_uftp_grtt;
222 static int hf_uftp_gsize;
223 static int hf_uftp_reserved;
225 static int hf_uftp_destlist;
226 static int hf_uftp_dest;
228 /* ANNOUNCE fields */
229 static int hf_uftp_announce;
230 static int hf_uftp_announce_func;
231 static int hf_uftp_announce_hlen;
232 static int hf_uftp_announce_flags;
233 static int hf_uftp_announce_flags_sync;
234 static int hf_uftp_announce_flags_syncpreview;
235 static int hf_uftp_announce_flags_ipv6;
236 static int hf_uftp_announce_flags_reserved;
237 static int hf_uftp_announce_robust;
238 static int hf_uftp_announce_cc_type;
239 static int hf_uftp_announce_reserved;
240 static int hf_uftp_announce_blocksize;
241 static int hf_uftp_announce_tstamp;
242 static int hf_uftp_announce_publicmcast_ipv4;
243 static int hf_uftp_announce_publicmcast_ipv6;
244 static int hf_uftp_announce_privatemcast_ipv4;
245 static int hf_uftp_announce_privatemcast_ipv6;
247 /* EXT_ENC_INFO fields */
248 static int hf_uftp_encinfo;
249 static int hf_uftp_encinfo_exttype;
250 static int hf_uftp_encinfo_extlen;
251 static int hf_uftp_encinfo_flags;
252 static int hf_uftp_encinfo_flags_client_auth;
253 static int hf_uftp_encinfo_flags_reserved;
254 static int hf_uftp_encinfo_keyextype;
255 static int hf_uftp_encinfo_sigtype;
256 static int hf_uftp_encinfo_keytype;
257 static int hf_uftp_encinfo_hashtype;
258 static int hf_uftp_encinfo_keylen;
259 static int hf_uftp_encinfo_dhlen;
260 static int hf_uftp_encinfo_siglen;
261 static int hf_uftp_encinfo_rand1;
262 static int hf_uftp_encinfo_keyblob;
263 static int hf_uftp_encinfo_dhblob;
264 static int hf_uftp_encinfo_sig;
266 /* rsa_blob_t fields */
267 static int hf_uftp_rsablob_blobtype;
268 static int hf_uftp_rsablob_reserved;
269 static int hf_uftp_rsablob_modlen;
270 static int hf_uftp_rsablob_exponent;
271 static int hf_uftp_rsablob_modulus;
273 /* ec_blob_t fields */
274 static int hf_uftp_ecblob_blobtype;
275 static int hf_uftp_ecblob_curve;
276 static int hf_uftp_ecblob_keylen;
277 static int hf_uftp_ecblob_key;
279 /* REGISTER fields */
280 static int hf_uftp_register;
281 static int hf_uftp_register_func;
282 static int hf_uftp_register_hlen;
283 static int hf_uftp_register_keyinfo_len;
284 static int hf_uftp_register_tstamp;
285 static int hf_uftp_register_rand2;
286 static int hf_uftp_register_keyinfo;
288 /* CLIENT_KEY fields */
289 static int hf_uftp_clientkey;
290 static int hf_uftp_clientkey_func;
291 static int hf_uftp_clientkey_hlen;
292 static int hf_uftp_clientkey_reserved;
293 static int hf_uftp_clientkey_bloblen;
294 static int hf_uftp_clientkey_siglen;
295 static int hf_uftp_clientkey_keyblob;
296 static int hf_uftp_clientkey_verify;
298 /* REG_CONF fields */
299 static int hf_uftp_regconf;
300 static int hf_uftp_regconf_func;
301 static int hf_uftp_regconf_hlen;
302 static int hf_uftp_regconf_reserved;
304 /* KEYINFO fields */
305 static int hf_uftp_keyinfo;
306 static int hf_uftp_keyinfo_func;
307 static int hf_uftp_keyinfo_hlen;
308 static int hf_uftp_keyinfo_reserved;
309 static int hf_uftp_keyinfo_ivctr;
310 static int hf_uftp_keyinfo_destkey;
311 static int hf_uftp_keyinfo_destid;
312 static int hf_uftp_keyinfo_groupmaster;
314 /* KEYINFO_ACK fields */
315 static int hf_uftp_keyinfoack;
316 static int hf_uftp_keyinfoack_func;
317 static int hf_uftp_keyinfoack_hlen;
318 static int hf_uftp_keyinfoack_reserved;
319 static int hf_uftp_keyinfoack_verify_data;
321 /* FILEINFO fields */
322 static int hf_uftp_fileinfo;
323 static int hf_uftp_fileinfo_func;
324 static int hf_uftp_fileinfo_hlen;
325 static int hf_uftp_fileinfo_file_id;
326 static int hf_uftp_fileinfo_ftype;
327 static int hf_uftp_fileinfo_reserved;
328 static int hf_uftp_fileinfo_namelen;
329 static int hf_uftp_fileinfo_linklen;
330 static int hf_uftp_fileinfo_fsize;
331 static int hf_uftp_fileinfo_ftstamp;
332 static int hf_uftp_fileinfo_tstamp;
333 static int hf_uftp_fileinfo_name;
334 static int hf_uftp_fileinfo_link;
336 /* FILEINFO_ACK fields */
337 static int hf_uftp_fileinfoack;
338 static int hf_uftp_fileinfoack_func;
339 static int hf_uftp_fileinfoack_hlen;
340 static int hf_uftp_fileinfoack_file_id;
341 static int hf_uftp_fileinfoack_flags;
342 static int hf_uftp_fileinfoack_flags_partial;
343 static int hf_uftp_fileinfoack_flags_reserved;
344 static int hf_uftp_fileinfoack_reserved;
345 static int hf_uftp_fileinfoack_tstamp;
347 /* FILESEG fields */
348 static int hf_uftp_fileseg;
349 static int hf_uftp_fileseg_func;
350 static int hf_uftp_fileseg_hlen;
351 static int hf_uftp_fileseg_file_id;
352 static int hf_uftp_fileseg_section;
353 static int hf_uftp_fileseg_sec_block;
354 static int hf_uftp_fileseg_data;
356 /* EXT_TFMCC_DATA_INFO fields */
357 static int hf_uftp_tfmccdata;
358 static int hf_uftp_tfmccdata_exttype;
359 static int hf_uftp_tfmccdata_extlen;
360 static int hf_uftp_tfmccdata_send_rate;
361 static int hf_uftp_tfmccdata_cc_seq;
362 static int hf_uftp_tfmccdata_cc_rate;
364 /* DONE fields */
365 static int hf_uftp_done;
366 static int hf_uftp_done_func;
367 static int hf_uftp_done_hlen;
368 static int hf_uftp_done_file_id;
369 static int hf_uftp_done_section;
370 static int hf_uftp_done_reserved;
372 /* STATUS fields */
373 static int hf_uftp_status;
374 static int hf_uftp_status_func;
375 static int hf_uftp_status_hlen;
376 static int hf_uftp_status_file_id;
377 static int hf_uftp_status_section;
378 static int hf_uftp_status_reserved;
379 static int hf_uftp_status_naks;
381 /* COMPLETE fields */
382 static int hf_uftp_complete;
383 static int hf_uftp_complete_func;
384 static int hf_uftp_complete_hlen;
385 static int hf_uftp_complete_file_id;
386 static int hf_uftp_complete_status;
387 static int hf_uftp_complete_reserved;
389 /* EXT_FREESPACE_INFO fields */
390 static int hf_uftp_freespace;
391 static int hf_uftp_freespace_exttype;
392 static int hf_uftp_freespace_extlen;
393 static int hf_uftp_freespace_reserved;
394 static int hf_uftp_freespace_freespace;
396 /* DONE_CONF fields */
397 static int hf_uftp_doneconf;
398 static int hf_uftp_doneconf_func;
399 static int hf_uftp_doneconf_hlen;
400 static int hf_uftp_doneconf_reserved;
402 /* HB_REQ fields */
403 static int hf_uftp_hbreq;
404 static int hf_uftp_hbreq_func;
405 static int hf_uftp_hbreq_hlen;
406 static int hf_uftp_hbreq_reserved;
407 static int hf_uftp_hbreq_bloblen;
408 static int hf_uftp_hbreq_siglen;
409 static int hf_uftp_hbreq_nonce;
410 static int hf_uftp_hbreq_keyblob;
411 static int hf_uftp_hbreq_verify;
413 /* HB_RESP fields */
414 static int hf_uftp_hbresp;
415 static int hf_uftp_hbresp_func;
416 static int hf_uftp_hbresp_hlen;
417 static int hf_uftp_hbresp_authenticated;
418 static int hf_uftp_hbresp_reserved;
419 static int hf_uftp_hbresp_nonce;
421 /* KEY_REQ fields */
422 static int hf_uftp_keyreq;
423 static int hf_uftp_keyreq_func;
424 static int hf_uftp_keyreq_hlen;
425 static int hf_uftp_keyreq_reserved;
427 /* PROXY_KEY fields */
428 static int hf_uftp_proxykey;
429 static int hf_uftp_proxykey_func;
430 static int hf_uftp_proxykey_hlen;
431 static int hf_uftp_proxykey_bloblen;
432 static int hf_uftp_proxykey_dhlen;
433 static int hf_uftp_proxykey_siglen;
434 static int hf_uftp_proxykey_nonce;
435 static int hf_uftp_proxykey_keyblob;
436 static int hf_uftp_proxykey_dhblob;
437 static int hf_uftp_proxykey_verify;
439 /* CONG_CTRL fields */
440 static int hf_uftp_congctrl;
441 static int hf_uftp_congctrl_func;
442 static int hf_uftp_congctrl_hlen;
443 static int hf_uftp_congctrl_reserved;
444 static int hf_uftp_congctrl_cc_seq;
445 static int hf_uftp_congctrl_cc_rate;
446 static int hf_uftp_congctrl_tstamp;
447 static int hf_uftp_congctrl_cclist;
448 static int hf_uftp_congctrl_item;
449 static int hf_uftp_congctrl_item_destid;
450 static int hf_uftp_congctrl_item_flags;
451 static int hf_uftp_congctrl_item_flags_clr;
452 static int hf_uftp_congctrl_item_flags_rtt;
453 static int hf_uftp_congctrl_item_flags_start;
454 static int hf_uftp_congctrl_item_flags_leave;
455 static int hf_uftp_congctrl_item_flags_reserved;
456 static int hf_uftp_congctrl_item_rtt;
457 static int hf_uftp_congctrl_item_rate;
459 /* CC_ACK fields */
460 static int hf_uftp_ccack;
461 static int hf_uftp_ccack_func;
462 static int hf_uftp_ccack_hlen;
463 static int hf_uftp_ccack_reserved;
465 /* EXT_TFMCC_ACK_INFO fields */
466 static int hf_uftp_tfmccack;
467 static int hf_uftp_tfmccack_exttype;
468 static int hf_uftp_tfmccack_extlen;
469 static int hf_uftp_tfmccack_flags;
470 static int hf_uftp_tfmccack_flags_clr;
471 static int hf_uftp_tfmccack_flags_rtt;
472 static int hf_uftp_tfmccack_flags_start;
473 static int hf_uftp_tfmccack_flags_leave;
474 static int hf_uftp_tfmccack_flags_reserved;
475 static int hf_uftp_tfmccack_reserved;
476 static int hf_uftp_tfmccack_cc_seq;
477 static int hf_uftp_tfmccack_cc_rate;
478 static int hf_uftp_tfmccack_client_id;
479 static int hf_uftp_tfmccack_tstamp;
481 /* ENCRYPTED fields */
482 static int hf_uftp_encrypted;
483 static int hf_uftp_encrypted_ivctr;
484 static int hf_uftp_encrypted_sig_len;
485 static int hf_uftp_encrypted_payload_len;
486 static int hf_uftp_encrypted_signature;
487 static int hf_uftp_encrypted_payload;
489 /* ABORT fields */
490 static int hf_uftp_abort;
491 static int hf_uftp_abort_func;
492 static int hf_uftp_abort_hlen;
493 static int hf_uftp_abort_flags;
494 static int hf_uftp_abort_flags_curfile;
495 static int hf_uftp_abort_flags_reserved;
496 static int hf_uftp_abort_reserved;
497 static int hf_uftp_abort_clientid;
498 static int hf_uftp_abort_message;
500 static int ett_uftp;
501 static int ett_uftp_announce;
502 static int ett_uftp_register;
503 static int ett_uftp_clientkey;
504 static int ett_uftp_regconf;
505 static int ett_uftp_keyinfo;
506 static int ett_uftp_keyinfoack;
507 static int ett_uftp_fileinfo;
508 static int ett_uftp_fileinfoack;
509 static int ett_uftp_fileseg;
510 static int ett_uftp_done;
511 static int ett_uftp_status;
512 static int ett_uftp_complete;
513 static int ett_uftp_doneconf;
514 static int ett_uftp_hbreq;
515 static int ett_uftp_hbresp;
516 static int ett_uftp_keyreq;
517 static int ett_uftp_proxykey;
518 static int ett_uftp_congctrl;
519 static int ett_uftp_ccack;
520 static int ett_uftp_encrypted;
521 static int ett_uftp_abort;
523 static int ett_uftp_announce_flags;
524 static int ett_uftp_encinfo;
525 static int ett_uftp_encinfo_flags;
526 static int ett_uftp_keyinfo_destkey;
527 static int ett_uftp_fileinfoack_flags;
528 static int ett_uftp_congctrl_cclist;
529 static int ett_uftp_congctrl_item;
530 static int ett_uftp_congctrl_item_flags;
531 static int ett_uftp_tfmccdata;
532 static int ett_uftp_tfmccack;
533 static int ett_uftp_tfmccack_flags;
534 static int ett_uftp_freespace;
535 static int ett_uftp_abort_flags;
537 static int ett_uftp_destlist;
538 static int ett_uftp_rsablob;
539 static int ett_uftp_ecblob;
541 static expert_field ei_uftp_length_invalid;
542 static expert_field ei_uftp_func_unknown;
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 }
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 }
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 }
588 static const value_string keyblob_types[] = {
589 { KEYBLOB_RSA, "RSA" },
590 { KEYBLOB_EC, "EC" },
591 { 0, NULL }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
679 static int * const announce_flags[] = {
680 &hf_uftp_announce_flags_sync,
681 &hf_uftp_announce_flags_syncpreview,
682 &hf_uftp_announce_flags_ipv6,
683 &hf_uftp_announce_flags_reserved,
684 NULL
687 static int * const encinfo_flags[] = {
688 &hf_uftp_encinfo_flags_client_auth,
689 &hf_uftp_encinfo_flags_reserved,
690 NULL
693 static int * const fileinfoack_flags[] = {
694 &hf_uftp_fileinfoack_flags_partial,
695 &hf_uftp_fileinfoack_flags_reserved,
696 NULL
699 static int * const abort_flags[] = {
700 &hf_uftp_abort_flags_curfile,
701 &hf_uftp_abort_flags_reserved,
702 NULL
705 static int * const cc_item_flags[] = {
706 &hf_uftp_congctrl_item_flags_clr,
707 &hf_uftp_congctrl_item_flags_rtt,
708 &hf_uftp_congctrl_item_flags_start,
709 &hf_uftp_congctrl_item_flags_leave,
710 &hf_uftp_congctrl_item_flags_reserved,
711 NULL
714 static int * const tfmcc_ack_flags[] = {
715 &hf_uftp_tfmccack_flags_clr,
716 &hf_uftp_tfmccack_flags_rtt,
717 &hf_uftp_tfmccack_flags_start,
718 &hf_uftp_tfmccack_flags_leave,
719 &hf_uftp_tfmccack_flags_reserved,
720 NULL
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 }
731 #define RTT_MIN 1.0e-6
732 #define RTT_MAX 1000.0
734 static double unquantize_grtt(uint8_t rtt)
736 return ((rtt <= 31) ?
737 (((double)(rtt + 1)) * (double)RTT_MIN) :
738 (RTT_MAX / exp(((double)(255 - rtt)) / (double)13.0)));
741 static unsigned unquantize_gsize(uint8_t size)
743 int E, i;
744 double rval;
746 E = size & 0x7;
747 rval = (size >> 3) * (10.0 / 32.0);
748 for (i = 0; i < E; i++) {
749 rval *= 10;
752 return (unsigned)(rval + 0.5);
755 static unsigned unquantize_rate(uint16_t rate)
757 int E, i;
758 double rval;
760 E = rate & 0xF;
761 rval = (rate >> 4) * (10.0 / 4096.0);
762 for (i = 0; i < E; i++) {
763 rval *= 10;
766 return (unsigned)rval;
769 static int dissect_uftp_rsablob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int tree_hf)
771 proto_item *ti = NULL;
772 proto_tree *rsablob_tree = NULL;
773 int offset = 0, modlen;
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;
781 modlen = (int)tvb_get_ntohs(tvb, 2);
782 if ((int)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;
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);
800 return RSA_BLOB_LEN + modlen;
803 static int dissect_uftp_ecblob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int tree_hf)
805 proto_item *ti = NULL;
806 proto_tree *ecblob_tree = NULL;
807 int offset = 0, keylen;
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;
815 keylen = (int)tvb_get_ntohs(tvb, 2);
816 if ((int)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;
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);
832 return EC_BLOB_LEN + keylen;
835 static int dissect_uftp_encinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
837 proto_item *ti = NULL;
838 proto_tree *encinfo_tree = NULL;
839 int offset = 0, hlen, keylen, dhlen, siglen;
840 int8_t blobtype;
841 tvbuff_t *next_tvb;
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;
849 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
850 keylen = (int)tvb_get_ntohs(tvb, 6);
851 dhlen = (int)tvb_get_ntohs(tvb, 8);
852 siglen = (int)tvb_get_ntohs(tvb, 10);
853 if (((int)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;
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_uint_format_value(encinfo_tree, hf_uftp_encinfo_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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 int parsed = 0;
888 next_tvb = tvb_new_subset_length(tvb, offset, keylen);
889 blobtype = tvb_get_uint8(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;
898 offset += parsed;
900 if (dhlen > 0) {
901 int parsed = 0;
903 next_tvb = tvb_new_subset_length(tvb, offset, dhlen);
904 blobtype = tvb_get_uint8(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;
913 offset += parsed;
915 if (siglen > 0) {
916 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_sig, tvb, offset, siglen, ENC_NA);
919 return ENC_INFO_LEN + keylen + dhlen + siglen;
922 static void dissect_uftp_announce(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
924 proto_item *ti = NULL;
925 proto_item *destlist = NULL;
926 proto_tree *announce_tree = NULL;
927 proto_tree *destlist_tree = NULL;
928 int offset = 0;
929 int hlen, iplen, destcount, idx, extlen_total;
930 uint8_t flags, ext_type;
931 tvbuff_t *next_tvb;
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;
939 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
940 if ((int)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;
947 flags = tvb_get_uint8(tvb, 2);
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_uint_format_value(announce_tree, hf_uftp_announce_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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_USECS);
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;
981 extlen_total = hlen - (ANNOUNCE_LEN + ( 2 * iplen));
982 while (extlen_total > 0) {
983 int parsed = 0;
985 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
986 ext_type = tvb_get_uint8(tvb, offset);
987 switch (ext_type) {
988 case EXT_ENC_INFO:
989 parsed = dissect_uftp_encinfo(next_tvb, pinfo, announce_tree);
990 break;
992 if (!parsed) break;
993 extlen_total -= parsed;
994 offset += parsed;
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);
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;
1009 static void dissect_uftp_register(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1011 proto_item *ti = NULL;
1012 proto_item *destlist = NULL;
1013 proto_tree *register_tree = NULL;
1014 proto_tree *destlist_tree = NULL;
1015 int offset = 0, hlen;
1016 uint16_t destcount, keylen, idx;
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;
1024 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1025 keylen = tvb_get_ntohs(tvb, 2);
1026 if (((int)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;
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_uint_format_value(register_tree, hf_uftp_register_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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_USECS);
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);
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);
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;
1061 static void dissect_uftp_clientkey(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1063 proto_item *ti = NULL;
1064 proto_tree *clientkey_tree = NULL;
1065 int offset = 0, hlen;
1066 uint16_t keylen, verifylen;
1067 int8_t blobtype;
1068 tvbuff_t *next_tvb;
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;
1076 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1077 keylen = tvb_get_ntohs(tvb, 4);
1078 verifylen = tvb_get_ntohs(tvb, 6);
1079 if (((int)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;
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_uint_format_value(clientkey_tree, hf_uftp_clientkey_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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 int parsed = 0;
1101 next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1102 blobtype = tvb_get_uint8(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;
1111 offset += parsed;
1113 if (verifylen > 0) {
1114 proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_verify, tvb, offset, verifylen, ENC_NA);
1118 static void dissect_uftp_regconf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1120 proto_item *ti = NULL;
1121 proto_item *destlist = NULL;
1122 proto_tree *regconf_tree = NULL;
1123 proto_tree *destlist_tree = NULL;
1124 int offset = 0, hlen;
1125 uint16_t destcount, idx;
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;
1133 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1134 if (((int)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;
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_uint_format_value(regconf_tree, hf_uftp_regconf_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1146 offset += 1;
1147 proto_tree_add_item(regconf_tree, hf_uftp_regconf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
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);
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;
1161 static void dissect_uftp_keyinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
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 int offset = 0, hlen;
1170 uint8_t destcount, idx;
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;
1178 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1179 if (((int)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;
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_uint_format_value(keyinfo_tree, hf_uftp_keyinfo_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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);
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);
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;
1212 static void dissect_uftp_keyinfoack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1214 proto_item *ti = NULL;
1215 proto_tree *keyinfoack_tree = NULL;
1216 int offset = 0, hlen;
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;
1224 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1225 if (((int)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;
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_uint_format_value(keyinfoack_tree, hf_uftp_keyinfoack_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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);
1243 static void dissect_uftp_fileinfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1245 proto_item *ti = NULL;
1246 proto_item *destlist = NULL;
1247 proto_tree *fileinfo_tree = NULL;
1248 proto_tree *destlist_tree = NULL;
1249 int offset = 0, hlen;
1250 uint16_t file_id, destcount, idx, namelen, linklen;
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;
1258 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1259 namelen = tvb_get_uint8(tvb, 8) * 4;
1260 linklen = tvb_get_uint8(tvb, 9) * 4;
1261 if (((int)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;
1268 file_id = tvb_get_ntohs(tvb, 2);
1269 col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
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_uint_format_value(fileinfo_tree, hf_uftp_fileinfo_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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_TIME_SECS);
1290 offset += 4;
1291 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_tstamp, tvb, offset, 8, ENC_TIME_SECS_USECS);
1292 offset += 8;
1293 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_name, tvb, offset, namelen, ENC_ASCII);
1294 offset += namelen;
1295 if (linklen > 0) {
1296 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_link, tvb, offset, linklen, ENC_ASCII);
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);
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;
1311 static void dissect_uftp_fileinfoack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1313 proto_item *ti = NULL;
1314 proto_item *destlist = NULL;
1315 proto_tree *fileinfoack_tree = NULL;
1316 proto_tree *destlist_tree = NULL;
1317 int offset = 0, hlen;
1318 uint16_t file_id, destcount, idx;
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;
1326 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1327 if (((int)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;
1334 file_id = tvb_get_ntohs(tvb, 2);
1335 if (file_id > 0) {
1336 col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
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_uint_format_value(fileinfoack_tree, hf_uftp_fileinfoack_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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_USECS);
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);
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;
1365 static int dissect_uftp_tfmccdata(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1367 proto_item *ti = NULL;
1368 proto_tree *tfmccdata_tree = NULL;
1369 int offset = 0, hlen;
1370 unsigned rate, srate;
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;
1378 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1379 if (((int)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;
1386 rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
1387 srate = unquantize_rate(tvb_get_ntohs(tvb, 2));
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_uint_format_value(tfmccdata_tree, hf_uftp_tfmccdata_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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);
1401 return TFMCC_DATA_LEN;
1404 static void dissect_uftp_fileseg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1406 proto_item *ti = NULL;
1407 proto_tree *fileseg_tree = NULL;
1408 int offset = 0, hlen, extlen_total;
1409 uint16_t file_id, section, sec_block;
1410 uint8_t ext_type;
1411 tvbuff_t *next_tvb;
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;
1419 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1420 if (((int)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;
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);
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_uint_format_value(fileseg_tree, hf_uftp_fileseg_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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;
1446 extlen_total = hlen - FILESEG_LEN;
1447 while (extlen_total > 0) {
1448 int parsed = 0;
1450 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1451 ext_type = tvb_get_uint8(tvb, offset);
1452 switch (ext_type) {
1453 case EXT_TFMCC_DATA_INFO:
1454 parsed = dissect_uftp_tfmccdata(next_tvb, pinfo, fileseg_tree);
1455 break;
1457 if (!parsed) break;
1458 extlen_total -= parsed;
1459 offset += parsed;
1462 offset = hlen;
1463 proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_data, tvb, offset, -1, ENC_NA);
1466 static void dissect_uftp_done(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1468 proto_item *ti = NULL;
1469 proto_item *destlist = NULL;
1470 proto_tree *done_tree = NULL;
1471 proto_tree *destlist_tree = NULL;
1472 int offset = 0, hlen;
1473 uint16_t file_id, section, destcount, idx;
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;
1481 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1482 if (((int)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;
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);
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_uint_format_value(done_tree, hf_uftp_done_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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);
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);
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;
1520 static int dissect_uftp_tfmccack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1522 proto_item *ti = NULL;
1523 proto_tree *tfmccack_tree = NULL;
1524 int offset = 0, hlen;
1525 unsigned rate;
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;
1533 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1534 if (((int)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;
1541 rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
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_uint_format_value(tfmccack_tree, hf_uftp_tfmccack_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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_USECS);
1561 return TFMCC_ACK_LEN;
1564 static void dissect_uftp_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1566 proto_item *ti = NULL;
1567 proto_tree *status_tree = NULL;
1568 int offset = 0, hlen, extlen_total;
1569 uint16_t file_id, section;
1570 uint8_t ext_type;
1571 tvbuff_t *next_tvb;
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;
1579 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1580 if (((int)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;
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);
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_uint_format_value(status_tree, hf_uftp_status_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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;
1605 extlen_total = hlen - STATUS_LEN;
1606 while (extlen_total > 0) {
1607 int parsed = 0;
1609 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1610 ext_type = tvb_get_uint8(tvb, offset);
1611 switch (ext_type) {
1612 case EXT_TFMCC_ACK_INFO:
1613 parsed = dissect_uftp_tfmccack(next_tvb, pinfo, status_tree);
1614 break;
1616 if (!parsed) break;
1617 extlen_total -= parsed;
1618 offset += parsed;
1621 offset = hlen;
1622 proto_tree_add_item(status_tree, hf_uftp_status_naks, tvb, offset, -1, ENC_NA);
1625 static int dissect_uftp_freespace(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1627 proto_item *ti = NULL;
1628 proto_tree *freespace_tree = NULL;
1629 int offset = 0, hlen;
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;
1637 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1638 if (((int)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;
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_uint_format_value(freespace_tree, hf_uftp_freespace_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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);
1655 return FREESPACE_LEN;
1658 static void dissect_uftp_complete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1660 proto_item *ti = NULL;
1661 proto_item *destlist = NULL;
1662 proto_tree *complete_tree = NULL;
1663 proto_tree *destlist_tree = NULL;
1664 int offset = 0, hlen, extlen_total;
1665 uint16_t file_id, destcount, idx;
1666 uint8_t ext_type;
1667 tvbuff_t *next_tvb;
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;
1675 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1676 if (((int)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;
1683 file_id = tvb_get_ntohs(tvb, 2);
1684 if (file_id > 0) {
1685 col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
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_uint_format_value(complete_tree, hf_uftp_complete_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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, 3, ENC_BIG_ENDIAN);
1699 offset += 3;
1701 extlen_total = hlen - COMPLETE_LEN;
1702 while (extlen_total > 0) {
1703 int parsed = 0;
1705 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1706 ext_type = tvb_get_uint8(tvb, offset);
1707 switch (ext_type) {
1708 case EXT_FREESPACE_INFO:
1709 parsed = dissect_uftp_freespace(next_tvb, pinfo, complete_tree);
1710 break;
1712 if (!parsed) break;
1713 extlen_total -= parsed;
1714 offset += parsed;
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);
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;
1729 static void dissect_uftp_doneconf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1731 proto_item *ti = NULL;
1732 proto_item *destlist = NULL;
1733 proto_tree *doneconf_tree = NULL;
1734 proto_tree *destlist_tree = NULL;
1735 int offset = 0, hlen;
1736 uint16_t destcount, idx;
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;
1744 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1745 if (((int)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;
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_uint_format_value(doneconf_tree, hf_uftp_doneconf_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1757 offset += 1;
1758 proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
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);
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;
1772 static void dissect_uftp_hbreq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1774 proto_item *ti = NULL;
1775 proto_tree *hbreq_tree = NULL;
1776 int offset = 0, hlen;
1777 uint16_t keylen, siglen;
1778 int8_t blobtype;
1779 tvbuff_t *next_tvb;
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;
1787 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1788 keylen = tvb_get_ntohs(tvb, 4);
1789 siglen = tvb_get_ntohs(tvb, 6);
1790 if (((int)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;
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_uint_format_value(hbreq_tree, hf_uftp_hbreq_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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 int parsed = 0;
1814 next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1815 blobtype = tvb_get_uint8(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;
1824 offset += parsed;
1826 if (siglen > 0) {
1827 proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_verify, tvb, offset, siglen, ENC_NA);
1831 static void dissect_uftp_hbresp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1833 proto_item *ti = NULL;
1834 proto_tree *hbresp_tree = NULL;
1835 int offset = 0, hlen;
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;
1843 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1844 if (((int)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;
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_uint_format_value(hbresp_tree, hf_uftp_hbresp_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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);
1864 static void dissect_uftp_keyreq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1866 proto_item *ti = NULL;
1867 proto_tree *keyreq_tree = NULL;
1868 int offset = 0, hlen;
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;
1876 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1877 if (((int)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;
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_uint_format_value(keyreq_tree, hf_uftp_keyreq_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1889 offset += 1;
1890 proto_tree_add_item(keyreq_tree, hf_uftp_keyreq_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1893 static void dissect_uftp_proxykey(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1895 proto_item *ti = NULL;
1896 proto_tree *proxykey_tree = NULL;
1897 int offset = 0, hlen;
1898 uint16_t keylen, dhlen, siglen;
1899 int8_t blobtype;
1900 tvbuff_t *next_tvb;
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;
1908 hlen = (int)tvb_get_uint8(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 (((int)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;
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_uint_format_value(proxykey_tree, hf_uftp_proxykey_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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 int parsed = 0;
1937 next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1938 blobtype = tvb_get_uint8(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;
1947 offset += parsed;
1949 if (dhlen > 0) {
1950 int parsed = 0;
1952 next_tvb = tvb_new_subset_length(tvb, offset, dhlen);
1953 blobtype = tvb_get_uint8(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;
1962 offset += parsed;
1964 if (siglen > 0) {
1965 proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_verify, tvb, offset, siglen, ENC_NA);
1969 static void dissect_uftp_congctrl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
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 int offset = 0, hlen;
1978 unsigned rate;
1979 uint8_t itemcount, idx;
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;
1987 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1988 if (((int)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;
1995 rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
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_uint_format_value(congctrl_tree, hf_uftp_congctrl_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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_USECS);
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);
2017 for (idx = 0; idx < itemcount; idx++) {
2018 unsigned itemrate;
2019 double itemrtt;
2020 itemrtt = unquantize_grtt(tvb_get_uint8(tvb, offset + 5));
2021 itemrate = unquantize_rate(tvb_get_ntohs(tvb, offset + 6));
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;
2036 static void dissect_uftp_ccack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2038 proto_item *ti = NULL;
2039 proto_tree *ccack_tree = NULL;
2040 int offset = 0, hlen, extlen_total;
2041 uint8_t ext_type;
2042 tvbuff_t *next_tvb;
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;
2050 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
2051 if (((int)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;
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_uint_format_value(ccack_tree, hf_uftp_ccack_func, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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;
2067 extlen_total = hlen - CC_ACK_LEN;
2068 while (extlen_total > 0) {
2069 int parsed = 0;
2071 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
2072 ext_type = tvb_get_uint8(tvb, offset);
2073 switch (ext_type) {
2074 case EXT_TFMCC_ACK_INFO:
2075 parsed = dissect_uftp_tfmccack(next_tvb, pinfo, ccack_tree);
2076 break;
2078 if (!parsed) break;
2079 extlen_total -= parsed;
2080 offset += parsed;
2084 static void dissect_uftp_encrypted(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2086 proto_item *ti = NULL;
2087 proto_tree *encrypted_tree = NULL;
2088 int offset = 0;
2089 uint16_t sig_len, payload_len;
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;
2097 sig_len = tvb_get_ntohs(tvb, 8);
2098 payload_len = tvb_get_ntohs(tvb, 10);
2099 if ((int)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;
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);
2119 static void dissect_uftp_abort(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2121 proto_item *ti = NULL;
2122 proto_tree *abort_tree = NULL;
2123 int offset = 0, hlen;
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;
2131 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
2132 if (((int)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;
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_uint_format_value(abort_tree, hf_uftp_abort_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
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);
2154 static int dissect_uftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2156 uint8_t version;
2157 uint8_t mes_type;
2158 uint32_t group_id;
2159 tvbuff_t *next_tvb;
2160 proto_item *ti = NULL;
2161 proto_tree *uftp_tree = NULL;
2162 int offset = 0;
2163 unsigned l_gsize;
2164 double grtt;
2166 if (tvb_reported_length(tvb) < UFTP_LEN + 4) {
2167 return 0;
2170 version = tvb_get_uint8(tvb, 0);
2171 mes_type = tvb_get_uint8(tvb, 1);
2172 group_id = tvb_get_ntohl(tvb, 8);
2174 if (version != UFTP_VER_NUM) {
2175 return 0;
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);
2187 grtt = unquantize_grtt(tvb_get_uint8(tvb, 13));
2188 l_gsize = unquantize_gsize(tvb_get_uint8(tvb, 14));
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;
2211 next_tvb = tvb_new_subset_length(tvb, offset, tvb_reported_length(tvb) - UFTP_LEN);
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;
2283 return tvb_reported_length(tvb);
2286 void proto_register_uftp4(void)
2288 static hf_register_info hf[] = {
2289 { &hf_uftp_version,
2290 { "Protocol Version", "uftp4.version",
2291 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2293 { &hf_uftp_func,
2294 { "Type", "uftp4.func",
2295 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2297 { &hf_uftp_seq,
2298 { "Sequence Number", "uftp4.seq",
2299 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2301 { &hf_uftp_src_id,
2302 { "Source ID", "uftp4.src_id",
2303 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2305 { &hf_uftp_group_id,
2306 { "Group ID", "uftp4.group_id",
2307 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2309 { &hf_uftp_group_inst,
2310 { "Group Instance ID", "uftp4.group_inst",
2311 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2313 { &hf_uftp_grtt,
2314 { "Group Round Trip Time", "uftp4.grtt",
2315 FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2317 { &hf_uftp_gsize,
2318 { "Group Size", "uftp4.gsize",
2319 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2321 { &hf_uftp_reserved,
2322 { "Reserved", "uftp4.reserved",
2323 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2325 { &hf_uftp_destlist,
2326 { "Destination List", "uftp4.destlist",
2327 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2329 { &hf_uftp_dest,
2330 { "Destination", "uftp4.dest",
2331 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2333 { &hf_uftp_announce,
2334 { "ANNOUNCE", "uftp4.announce",
2335 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2337 { &hf_uftp_announce_func,
2338 { "Type", "uftp4.announce.func",
2339 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2341 { &hf_uftp_announce_hlen,
2342 { "Header Length", "uftp4.announce.hlen",
2343 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2345 { &hf_uftp_announce_flags,
2346 { "Flags", "uftp4.announce.flags",
2347 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2349 { &hf_uftp_announce_flags_sync,
2350 { "Sync mode", "uftp4.announce.flags.sync",
2351 FT_BOOLEAN, 8, NULL, FLAG_SYNC_MODE, NULL, HFILL }
2353 { &hf_uftp_announce_flags_syncpreview,
2354 { "Sync preview mode", "uftp4.announce.flags.syncpreview",
2355 FT_BOOLEAN, 8, NULL, FLAG_SYNC_PREVIEW, NULL, HFILL }
2357 { &hf_uftp_announce_flags_ipv6,
2358 { "IPv6", "uftp4.announce.flags.ipv6",
2359 FT_BOOLEAN, 8, NULL, FLAG_IPV6, NULL, HFILL }
2361 { &hf_uftp_announce_flags_reserved,
2362 { "Reserved", "uftp4.announce.flags.reserved",
2363 FT_UINT8, BASE_HEX, NULL, FLAG_ANNOUNCE_RESERVED, NULL, HFILL }
2365 { &hf_uftp_announce_robust,
2366 { "Robustness Factor", "uftp4.announce.robust",
2367 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
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 }
2373 { &hf_uftp_announce_reserved,
2374 { "Reserved", "uftp4.announce.reserved",
2375 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2377 { &hf_uftp_announce_blocksize,
2378 { "Block Size", "uftp4.announce.blocksize",
2379 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2381 { &hf_uftp_announce_tstamp,
2382 { "Timestamp", "uftp4.announce.tstamp",
2383 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2385 { &hf_uftp_announce_publicmcast_ipv4,
2386 { "Public Multicast Address", "uftp4.announce.publicmcast.ipv4",
2387 FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2389 { &hf_uftp_announce_publicmcast_ipv6,
2390 { "Public Multicast Address", "uftp4.announce.publicmcast.ipv6",
2391 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
2393 { &hf_uftp_announce_privatemcast_ipv4,
2394 { "Private Multicast Address", "uftp4.announce.privatemcast.ipv4",
2395 FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2397 { &hf_uftp_announce_privatemcast_ipv6,
2398 { "Private Multicast Address", "uftp4.announce.privatemcast.ipv6",
2399 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
2401 { &hf_uftp_encinfo,
2402 { "EXT_ENC_INFO", "uftp4.encinfo",
2403 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2405 { &hf_uftp_encinfo_exttype,
2406 { "Extension Type", "uftp4.encinfo.exttype",
2407 FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2409 { &hf_uftp_encinfo_extlen,
2410 { "Extension Length", "uftp4.encinfo.extlen",
2411 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2413 { &hf_uftp_encinfo_flags,
2414 { "Flags", "uftp4.encinfo.flags",
2415 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
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 }
2421 { &hf_uftp_encinfo_flags_reserved,
2422 { "Reserved", "uftp4.encinfo.flags.reserved",
2423 FT_UINT8, BASE_HEX, NULL, FLAG_ENCINFO_RESERVED, NULL, HFILL }
2425 { &hf_uftp_encinfo_keyextype,
2426 { "Key Exchange Type", "uftp4.encinfo.keyextype",
2427 FT_UINT8, BASE_DEC, VALS(keyexchange_types), 0xF0, NULL, HFILL }
2429 { &hf_uftp_encinfo_sigtype,
2430 { "Signature Type", "uftp4.encinfo.sigtype",
2431 FT_UINT8, BASE_DEC, VALS(signature_types), 0x0F, NULL, HFILL }
2433 { &hf_uftp_encinfo_keytype,
2434 { "Key Type", "uftp4.encinfo.keytype",
2435 FT_UINT8, BASE_DEC, VALS(key_types), 0x0, NULL, HFILL }
2437 { &hf_uftp_encinfo_hashtype,
2438 { "Hash Type", "uftp4.encinfo.hashtype",
2439 FT_UINT8, BASE_DEC, VALS(hash_types), 0x0, NULL, HFILL }
2441 { &hf_uftp_encinfo_keylen,
2442 { "Public Key Length", "uftp4.encinfo.keylen",
2443 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2445 { &hf_uftp_encinfo_dhlen,
2446 { "Diffie-Hellman Key Length", "uftp4.encinfo.dhlen",
2447 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2449 { &hf_uftp_encinfo_siglen,
2450 { "Signature Length", "uftp4.encinfo.siglen",
2451 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2453 { &hf_uftp_encinfo_rand1,
2454 { "Server Random Number", "uftp4.encinfo.rand1",
2455 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2457 { &hf_uftp_encinfo_keyblob,
2458 { "Public Key Blob", "uftp4.encinfo.keyblob",
2459 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2461 { &hf_uftp_encinfo_dhblob,
2462 { "Diffie-Hellman Key Blob", "uftp4.encinfo.dhblob",
2463 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2465 { &hf_uftp_encinfo_sig,
2466 { "Signature", "uftp4.encinfo.sig",
2467 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2469 { &hf_uftp_rsablob_blobtype,
2470 { "Keyblob Type", "uftp4.rsablob.blobtype",
2471 FT_UINT8, BASE_DEC, VALS(keyblob_types), 0x0, NULL, HFILL }
2473 { &hf_uftp_rsablob_reserved,
2474 { "Reserved", "uftp4.rsablob.reserved",
2475 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2477 { &hf_uftp_rsablob_modlen,
2478 { "Modulus Length", "uftp4.rsablob.modlen",
2479 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2481 { &hf_uftp_rsablob_exponent,
2482 { "Exponent", "uftp4.rsablob.exponent",
2483 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2485 { &hf_uftp_rsablob_modulus,
2486 { "Modulus", "uftp4.rsablob.modulus",
2487 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2489 { &hf_uftp_ecblob_blobtype,
2490 { "Keyblob Type", "uftp4.ecblob.blobtype",
2491 FT_UINT8, BASE_DEC, VALS(keyblob_types), 0x0, NULL, HFILL }
2493 { &hf_uftp_ecblob_curve,
2494 { "Curve", "uftp4.ecblob.curve",
2495 FT_UINT8, BASE_DEC, VALS(curves), 0x0, NULL, HFILL }
2497 { &hf_uftp_ecblob_keylen,
2498 { "Key Length", "uftp4.ecblob.keylen",
2499 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2501 { &hf_uftp_ecblob_key,
2502 { "Key", "uftp4.ecblob.key",
2503 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2505 { &hf_uftp_register,
2506 { "REGISTER", "uftp4.register",
2507 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2509 { &hf_uftp_register_func,
2510 { "Type", "uftp4.register.func",
2511 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2513 { &hf_uftp_register_hlen,
2514 { "Header Length", "uftp4.register.hlen",
2515 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2517 { &hf_uftp_register_keyinfo_len,
2518 { "Key Info Length", "uftp4.register.keyinfo_len",
2519 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2521 { &hf_uftp_register_tstamp,
2522 { "Timestamp", "uftp4.register.tstamp",
2523 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2525 { &hf_uftp_register_rand2,
2526 { "Client Random Number", "uftp4.register.rand2",
2527 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2529 { &hf_uftp_register_keyinfo,
2530 { "Key Info", "uftp4.register.keyinfo",
2531 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2533 { &hf_uftp_clientkey,
2534 { "CLIENT_KEY", "uftp4.clientkey",
2535 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2537 { &hf_uftp_clientkey_func,
2538 { "Type", "uftp4.clientkey.func",
2539 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2541 { &hf_uftp_clientkey_hlen,
2542 { "Header Length", "uftp4.clientkey.hlen",
2543 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2545 { &hf_uftp_clientkey_reserved,
2546 { "Reserved", "uftp4.clientkey.reserved",
2547 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2549 { &hf_uftp_clientkey_bloblen,
2550 { "Keyblob Length", "uftp4.clientkey.bloblen",
2551 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2553 { &hf_uftp_clientkey_siglen,
2554 { "Signature Length", "uftp4.clientkey.siglen",
2555 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2557 { &hf_uftp_clientkey_keyblob,
2558 { "Public Key Blob", "uftp4.clientkey.keyblob",
2559 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2561 { &hf_uftp_clientkey_verify,
2562 { "Signature", "uftp4.clientkey.verify",
2563 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2565 { &hf_uftp_regconf,
2566 { "REG_CONF", "uftp4.regconf",
2567 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2569 { &hf_uftp_regconf_func,
2570 { "Type", "uftp4.regconf.func",
2571 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2573 { &hf_uftp_regconf_hlen,
2574 { "Header Length", "uftp4.regconf.hlen",
2575 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2577 { &hf_uftp_regconf_reserved,
2578 { "Reserved", "uftp4.regconf.reserved",
2579 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2581 { &hf_uftp_keyinfo,
2582 { "KEYINFO", "uftp4.keyinfo",
2583 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2585 { &hf_uftp_keyinfo_func,
2586 { "Type", "uftp4.keyinfo.func",
2587 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2589 { &hf_uftp_keyinfo_hlen,
2590 { "Header Length", "uftp4.keyinfo.hlen",
2591 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2593 { &hf_uftp_keyinfo_reserved,
2594 { "Reserved", "uftp4.keyinfo.reserved",
2595 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2597 { &hf_uftp_keyinfo_ivctr,
2598 { "IV Counter", "uftp4.keyinfo.ivctr",
2599 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
2601 { &hf_uftp_keyinfo_destkey,
2602 { "Destination Key", "uftp4.keyinfo.destkey",
2603 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2605 { &hf_uftp_keyinfo_destid,
2606 { "Destination ID", "uftp4.keyinfo.destid",
2607 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2609 { &hf_uftp_keyinfo_groupmaster,
2610 { "Encrypted Group Master", "uftp4.keyinfo.groupmaster",
2611 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2613 { &hf_uftp_keyinfoack,
2614 { "KEYINFO_ACK", "uftp4.keyinfoack",
2615 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2617 { &hf_uftp_keyinfoack_func,
2618 { "Type", "uftp4.keyinfoack.func",
2619 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2621 { &hf_uftp_keyinfoack_hlen,
2622 { "Header Length", "uftp4.keyinfoack.hlen",
2623 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2625 { &hf_uftp_keyinfoack_reserved,
2626 { "Reserved", "uftp4.keyinfoack.reserved",
2627 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2629 { &hf_uftp_keyinfoack_verify_data,
2630 { "Verify Data", "uftp4.keyinfoack.verify_data",
2631 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2633 { &hf_uftp_fileinfo,
2634 { "FILEINFO", "uftp4.fileinfo",
2635 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2637 { &hf_uftp_fileinfo_func,
2638 { "Type", "uftp4.fileinfo.func",
2639 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2641 { &hf_uftp_fileinfo_hlen,
2642 { "Header Length", "uftp4.fileinfo.hlen",
2643 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2645 { &hf_uftp_fileinfo_file_id,
2646 { "File ID", "uftp4.fileinfo.file_id",
2647 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2649 { &hf_uftp_fileinfo_ftype,
2650 { "File Type", "uftp4.fileinfo.ftype",
2651 FT_UINT8, BASE_DEC, VALS(file_types), 0x0, NULL, HFILL }
2653 { &hf_uftp_fileinfo_reserved,
2654 { "Reserved", "uftp4.fileinfo.reserved",
2655 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2657 { &hf_uftp_fileinfo_namelen,
2658 { "Name Length", "uftp4.fileinfo.namelen",
2659 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2661 { &hf_uftp_fileinfo_linklen,
2662 { "Link Length", "uftp4.fileinfo.linklen",
2663 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2665 { &hf_uftp_fileinfo_fsize,
2666 { "File Size", "uftp4.fileinfo.fsize",
2667 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
2669 { &hf_uftp_fileinfo_ftstamp,
2670 { "File Timestamp", "uftp4.fileinfo.ftstamp",
2671 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2673 { &hf_uftp_fileinfo_tstamp,
2674 { "Timestamp", "uftp4.fileinfo.tstamp",
2675 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2677 { &hf_uftp_fileinfo_name,
2678 { "File Name", "uftp4.fileinfo.name",
2679 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2681 { &hf_uftp_fileinfo_link,
2682 { "Link Name", "uftp4.fileinfo.link",
2683 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2685 { &hf_uftp_fileinfoack,
2686 { "FILEINFO_ACK", "uftp4.fileinfoack",
2687 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2689 { &hf_uftp_fileinfoack_func,
2690 { "Type", "uftp4.fileinfoack.func",
2691 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2693 { &hf_uftp_fileinfoack_hlen,
2694 { "Header Length", "uftp4.fileinfoack.hlen",
2695 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2697 { &hf_uftp_fileinfoack_file_id,
2698 { "File ID", "uftp4.fileinfoack.file_id",
2699 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2701 { &hf_uftp_fileinfoack_flags,
2702 { "Flags", "uftp4.fileinfoack.flags",
2703 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2705 { &hf_uftp_fileinfoack_flags_partial,
2706 { "Partial", "uftp4.fileinfoack.flags.partial",
2707 FT_BOOLEAN, 8, NULL, FLAG_PARTIAL, NULL, HFILL }
2709 { &hf_uftp_fileinfoack_flags_reserved,
2710 { "Reserved", "uftp4.fileinfoack.flags.reserved",
2711 FT_UINT8, BASE_HEX, NULL, FLAG_FILEINFOACK_RESERVED, NULL, HFILL }
2713 { &hf_uftp_fileinfoack_reserved,
2714 { "Reserved", "uftp4.fileinfoack.reserved",
2715 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2717 { &hf_uftp_fileinfoack_tstamp,
2718 { "Timestamp", "uftp4.fileinfoack.tstamp",
2719 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2721 { &hf_uftp_fileseg,
2722 { "FILESEG", "uftp4.fileseg",
2723 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2725 { &hf_uftp_fileseg_func,
2726 { "Type", "uftp4.fileseg.func",
2727 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2729 { &hf_uftp_fileseg_hlen,
2730 { "Header Length", "uftp4.fileseg.hlen",
2731 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2733 { &hf_uftp_fileseg_file_id,
2734 { "File ID", "uftp4.fileseg.file_id",
2735 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2737 { &hf_uftp_fileseg_section,
2738 { "Section", "uftp4.fileseg.section",
2739 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2741 { &hf_uftp_fileseg_sec_block,
2742 { "Block", "uftp4.fileseg.sec_block",
2743 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2745 { &hf_uftp_tfmccdata,
2746 { "EXT_TFMCC_DATA_INFO", "uftp4.tfmccdata",
2747 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2749 { &hf_uftp_tfmccdata_exttype,
2750 { "Extension Type", "uftp4.tfmccdata.exttype",
2751 FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2753 { &hf_uftp_tfmccdata_extlen,
2754 { "Extension Length", "uftp4.tfmccdata.extlen",
2755 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2757 { &hf_uftp_tfmccdata_send_rate,
2758 { "Send Rate", "uftp4.tfmccdata.send_rate",
2759 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2761 { &hf_uftp_tfmccdata_cc_seq,
2762 { "CC Sequence Number", "uftp4.tfmccdata.cc_seq",
2763 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2765 { &hf_uftp_tfmccdata_cc_rate,
2766 { "Rate", "uftp4.tfmccdata.cc_rate",
2767 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2769 { &hf_uftp_fileseg_data,
2770 { "Data", "uftp4.fileseg.data",
2771 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2773 { &hf_uftp_done,
2774 { "DONE", "uftp4.done",
2775 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2777 { &hf_uftp_done_func,
2778 { "Type", "uftp4.done.func",
2779 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2781 { &hf_uftp_done_hlen,
2782 { "Header Length", "uftp4.done.hlen",
2783 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2785 { &hf_uftp_done_file_id,
2786 { "File ID", "uftp4.done.file_id",
2787 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2789 { &hf_uftp_done_section,
2790 { "Section", "uftp4.done.section",
2791 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2793 { &hf_uftp_done_reserved,
2794 { "Reserved", "uftp4.done.reserved",
2795 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2797 { &hf_uftp_status,
2798 { "STATUS", "uftp4.status",
2799 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2801 { &hf_uftp_status_func,
2802 { "Type", "uftp4.status.func",
2803 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2805 { &hf_uftp_status_hlen,
2806 { "Header Length", "uftp4.status.hlen",
2807 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2809 { &hf_uftp_status_file_id,
2810 { "File ID", "uftp4.status.file_id",
2811 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2813 { &hf_uftp_status_section,
2814 { "Section", "uftp4.status.section",
2815 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2817 { &hf_uftp_status_reserved,
2818 { "Reserved", "uftp4.status.reserved",
2819 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2821 { &hf_uftp_status_naks,
2822 { "NAKs", "uftp4.status.naks",
2823 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2825 { &hf_uftp_complete,
2826 { "COMPLETE", "uftp4.complete",
2827 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2829 { &hf_uftp_complete_func,
2830 { "Type", "uftp4.complete.func",
2831 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2833 { &hf_uftp_complete_hlen,
2834 { "Header Length", "uftp4.complete.hlen",
2835 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2837 { &hf_uftp_complete_file_id,
2838 { "File ID", "uftp4.complete.file_id",
2839 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2841 { &hf_uftp_complete_status,
2842 { "Completion Status", "uftp4.complete.status",
2843 FT_UINT8, BASE_DEC, VALS(comp_status), 0x0, NULL, HFILL }
2845 { &hf_uftp_complete_reserved,
2846 { "Reserved", "uftp4.complete.reserved",
2847 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2849 { &hf_uftp_freespace,
2850 { "EXT_FREESPACE_INFO", "uftp4.freespace",
2851 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2853 { &hf_uftp_freespace_exttype,
2854 { "Extension Type", "uftp4.freespace.exttype",
2855 FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2857 { &hf_uftp_freespace_extlen,
2858 { "Extension Length", "uftp4.freespace.extlen",
2859 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2861 { &hf_uftp_freespace_reserved,
2862 { "Reserved", "uftp4.freespace.reserved",
2863 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2865 { &hf_uftp_freespace_freespace,
2866 { "Free Space", "uftp4.freespace.freespace",
2867 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
2869 { &hf_uftp_doneconf,
2870 { "DONE_CONF", "uftp4.doneconf",
2871 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2873 { &hf_uftp_doneconf_func,
2874 { "Type", "uftp4.doneconf.func",
2875 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2877 { &hf_uftp_doneconf_hlen,
2878 { "Header Length", "uftp4.doneconf.hlen",
2879 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2881 { &hf_uftp_doneconf_reserved,
2882 { "Reserved", "uftp4.doneconf.reserved",
2883 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2885 { &hf_uftp_hbreq,
2886 { "HB_REQ", "uftp4.hbreq",
2887 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2889 { &hf_uftp_hbreq_func,
2890 { "Type", "uftp4.hbreq.func",
2891 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2893 { &hf_uftp_hbreq_hlen,
2894 { "Header Length", "uftp4.hbreq.hlen",
2895 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2897 { &hf_uftp_hbreq_reserved,
2898 { "Reserved", "uftp4.hbreq.reserved",
2899 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2901 { &hf_uftp_hbreq_bloblen,
2902 { "Keyblob Length", "uftp4.hbreq.bloblen",
2903 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2905 { &hf_uftp_hbreq_siglen,
2906 { "Signature Length", "uftp4.hbreq.siglen",
2907 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2909 { &hf_uftp_hbreq_nonce,
2910 { "Nonce", "uftp4.hbreq.nonce",
2911 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2913 { &hf_uftp_hbreq_keyblob,
2914 { "Public Key Blob", "uftp4.hbreq.keyblob",
2915 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2917 { &hf_uftp_hbreq_verify,
2918 { "Signature", "uftp4.hbreq.verify",
2919 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2921 { &hf_uftp_hbresp,
2922 { "HB_RESP", "uftp4.hbresp",
2923 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2925 { &hf_uftp_hbresp_func,
2926 { "Type", "uftp4.hbresp.func",
2927 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2929 { &hf_uftp_hbresp_hlen,
2930 { "Header Length", "uftp4.hbresp.hlen",
2931 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2933 { &hf_uftp_hbresp_authenticated,
2934 { "Authenticated", "uftp4.hbresp.authenticated",
2935 FT_UINT8, BASE_DEC, VALS(hb_auth_types), 0x0, NULL, HFILL }
2937 { &hf_uftp_hbresp_reserved,
2938 { "Reserved", "uftp4.hbresp.reserved",
2939 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2941 { &hf_uftp_hbresp_nonce,
2942 { "Nonce", "uftp4.hbresp.nonce",
2943 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2945 { &hf_uftp_keyreq,
2946 { "KEY_REQ", "uftp4.keyreq",
2947 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2949 { &hf_uftp_keyreq_func,
2950 { "Type", "uftp4.keyreq.func",
2951 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2953 { &hf_uftp_keyreq_hlen,
2954 { "Header Length", "uftp4.keyreq.hlen",
2955 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2957 { &hf_uftp_keyreq_reserved,
2958 { "Reserved", "uftp4.keyreq.reserved",
2959 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2961 { &hf_uftp_proxykey,
2962 { "PROXY_KEY", "uftp4.proxykey",
2963 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2965 { &hf_uftp_proxykey_func,
2966 { "Type", "uftp4.proxykey.func",
2967 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2969 { &hf_uftp_proxykey_hlen,
2970 { "Header Length", "uftp4.proxykey.hlen",
2971 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2973 { &hf_uftp_proxykey_bloblen,
2974 { "Keyblob Length", "uftp4.proxykey.bloblen",
2975 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2977 { &hf_uftp_proxykey_dhlen,
2978 { "Diffie-Hellman Keyblob Length", "uftp4.proxykey.dhlen",
2979 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2981 { &hf_uftp_proxykey_siglen,
2982 { "Signature Length", "uftp4.proxykey.siglen",
2983 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2985 { &hf_uftp_proxykey_nonce,
2986 { "Nonce", "uftp4.proxykey.nonce",
2987 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2989 { &hf_uftp_proxykey_keyblob,
2990 { "Public Key Blob", "uftp4.proxykey.keyblob",
2991 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2993 { &hf_uftp_proxykey_dhblob,
2994 { "Diffie-Hellman Key Blob", "uftp4.proxykey.dhblob",
2995 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2997 { &hf_uftp_proxykey_verify,
2998 { "Signature", "uftp4.proxykey.verify",
2999 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3001 { &hf_uftp_congctrl,
3002 { "CONG_CTRL", "uftp4.congctrl",
3003 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3005 { &hf_uftp_congctrl_func,
3006 { "Type", "uftp4.congctrl.func",
3007 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3009 { &hf_uftp_congctrl_hlen,
3010 { "Header Length", "uftp4.congctrl.hlen",
3011 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3013 { &hf_uftp_congctrl_reserved,
3014 { "Reserved", "uftp4.congctrl.reserved",
3015 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
3017 { &hf_uftp_congctrl_cc_seq,
3018 { "CC Sequence", "uftp4.congctrl.cc_seq",
3019 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3021 { &hf_uftp_congctrl_cc_rate,
3022 { "Rate", "uftp4.congctrl.cc_rate",
3023 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3025 { &hf_uftp_congctrl_tstamp,
3026 { "Timestamp", "uftp4.congctrl.tstamp",
3027 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
3029 { &hf_uftp_congctrl_cclist,
3030 { "Congestion Control List", "uftp4.congctrl.cclist",
3031 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3033 { &hf_uftp_congctrl_item,
3034 { "Destination", "uftp4.congctrl.item",
3035 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3037 { &hf_uftp_congctrl_item_destid,
3038 { "Destination ID", "uftp4.congctrl.item.destid",
3039 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3041 { &hf_uftp_congctrl_item_flags,
3042 { "Flags", "uftp4.congctrl.item.flags",
3043 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3045 { &hf_uftp_congctrl_item_flags_clr,
3046 { "CLR", "uftp4.congctrl.item.flags.clr",
3047 FT_BOOLEAN, 8, NULL, FLAG_CC_CLR, NULL, HFILL }
3049 { &hf_uftp_congctrl_item_flags_rtt,
3050 { "RTT", "uftp4.congctrl.item.flags.rtt",
3051 FT_BOOLEAN, 8, NULL, FLAG_CC_RTT, NULL, HFILL }
3053 { &hf_uftp_congctrl_item_flags_start,
3054 { "Slowstart", "uftp4.congctrl.item.flags.start",
3055 FT_BOOLEAN, 8, NULL, FLAG_CC_START, NULL, HFILL }
3057 { &hf_uftp_congctrl_item_flags_leave,
3058 { "Leave", "uftp4.congctrl.item.flags.leave",
3059 FT_BOOLEAN, 8, NULL, FLAG_CC_LEAVE, NULL, HFILL }
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 }
3065 { &hf_uftp_congctrl_item_rtt,
3066 { "Round Trip Time", "uftp4.congctrl.item.rtt",
3067 FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3069 { &hf_uftp_congctrl_item_rate,
3070 { "Rate", "uftp4.congctrl.item.rate",
3071 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3073 { &hf_uftp_ccack,
3074 { "CC_ACK", "uftp4.ccack",
3075 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3077 { &hf_uftp_ccack_func,
3078 { "Type", "uftp4.ccack.func",
3079 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3081 { &hf_uftp_ccack_hlen,
3082 { "Header Length", "uftp4.ccack.hlen",
3083 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3085 { &hf_uftp_ccack_reserved,
3086 { "Reserved", "uftp4.ccack.reserved",
3087 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
3089 { &hf_uftp_tfmccack,
3090 { "EXT_TFMCC_ACK_INFO", "uftp4.tfmccack",
3091 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3093 { &hf_uftp_tfmccack_exttype,
3094 { "Extension Type", "uftp4.tfmccack.exttype",
3095 FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
3097 { &hf_uftp_tfmccack_extlen,
3098 { "Extension Length", "uftp4.tfmccack.extlen",
3099 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3101 { &hf_uftp_tfmccack_flags,
3102 { "Flags", "uftp4.tfmccack.flags",
3103 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3105 { &hf_uftp_tfmccack_flags_clr,
3106 { "CLR", "uftp4.tfmccack.flags.clr",
3107 FT_BOOLEAN, 8, NULL, FLAG_CC_CLR, NULL, HFILL }
3109 { &hf_uftp_tfmccack_flags_rtt,
3110 { "RTT", "uftp4.tfmccack.flags.rtt",
3111 FT_BOOLEAN, 8, NULL, FLAG_CC_RTT, NULL, HFILL }
3113 { &hf_uftp_tfmccack_flags_start,
3114 { "Slowstart", "uftp4.tfmccack.flags.start",
3115 FT_BOOLEAN, 8, NULL, FLAG_CC_START, NULL, HFILL }
3117 { &hf_uftp_tfmccack_flags_leave,
3118 { "Leave", "uftp4.tfmccack.flags.leave",
3119 FT_BOOLEAN, 8, NULL, FLAG_CC_LEAVE, NULL, HFILL }
3121 { &hf_uftp_tfmccack_flags_reserved,
3122 { "Reserved", "uftp4.tfmccack.flags.reserved",
3123 FT_UINT8, BASE_HEX, NULL, FLAG_CC_RESERVED, NULL, HFILL }
3125 { &hf_uftp_tfmccack_reserved,
3126 { "Reserved", "uftp4.tfmccack.reserved",
3127 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3129 { &hf_uftp_tfmccack_cc_seq,
3130 { "CC Sequence Number", "uftp4.tfmccack.cc_seq",
3131 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3133 { &hf_uftp_tfmccack_cc_rate,
3134 { "Rate", "uftp4.tfmccack.cc_rate",
3135 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3137 { &hf_uftp_tfmccack_client_id,
3138 { "Client ID", "uftp4.tfmccack.client_id",
3139 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3141 { &hf_uftp_tfmccack_tstamp,
3142 { "Timestamp", "uftp4.tfmccack.tstamp",
3143 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
3145 { &hf_uftp_encrypted,
3146 { "ENCRYPTED", "uftp4.encrypted",
3147 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3149 { &hf_uftp_encrypted_ivctr,
3150 { "IV Counter", "uftp4.encrypted.ivctr",
3151 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
3153 { &hf_uftp_encrypted_sig_len,
3154 { "Signature Length", "uftp4.encrypted.sig_len",
3155 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3157 { &hf_uftp_encrypted_payload_len,
3158 { "Payload Length", "uftp4.encrypted.payload_len",
3159 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3161 { &hf_uftp_encrypted_signature,
3162 { "Signature", "uftp4.encrypted.signature",
3163 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3165 { &hf_uftp_encrypted_payload,
3166 { "Encrypted Payload", "uftp4.encrypted.payload",
3167 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3169 { &hf_uftp_abort,
3170 { "ABORT", "uftp4.abort",
3171 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3173 { &hf_uftp_abort_func,
3174 { "Type", "uftp4.abort.func",
3175 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3177 { &hf_uftp_abort_hlen,
3178 { "Header Length", "uftp4.abort.hlen",
3179 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3181 { &hf_uftp_abort_flags,
3182 { "Flags", "uftp4.abort.flags",
3183 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3185 { &hf_uftp_abort_flags_curfile,
3186 { "Current file", "uftp4.abort.flags.curfile",
3187 FT_BOOLEAN, 8, NULL, FLAG_CURRENT_FILE, NULL, HFILL }
3189 { &hf_uftp_abort_flags_reserved,
3190 { "Reserved", "uftp4.abort.flags.reserved",
3191 FT_UINT8, BASE_HEX, NULL, FLAG_ABORT_RESERVED, NULL, HFILL }
3193 { &hf_uftp_abort_reserved,
3194 { "Reserved", "uftp4.abort.reserved",
3195 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3197 { &hf_uftp_abort_clientid,
3198 { "Client ID", "uftp4.abort.clientid",
3199 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3201 { &hf_uftp_abort_message,
3202 { "Message", "uftp4.abort.message",
3203 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
3207 /* Setup protocol subtree array */
3208 static int *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
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 }}
3254 expert_module_t* expert_uftp;
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));
3266 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3268 * Local variables:
3269 * c-basic-offset: 4
3270 * tab-width: 8
3271 * indent-tabs-mode: nil
3272 * End:
3274 * vi: set shiftwidth=4 tabstop=8 expandtab:
3275 * :indentSize=4:tabSize=8:noTabs=true: