Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-uftp5.c
blobb09cf0c942a974d826ba682a5058a06c8d1ea1f3
1 /* packet-uftp5.c
2 * Routines for UFTP version 5 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 0x50
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 // obsolete: 16
36 #define KEY_REQ 16
37 #define PROXY_KEY 17
38 #define ENCRYPTED 18
39 #define ABORT 19
40 #define CONG_CTRL 20
41 #define CC_ACK 21
43 #define FTYPE_REG 0
44 #define FTYPE_DIR 1
45 #define FTYPE_LINK 2
46 #define FTYPE_DELETE 3
47 #define FTYPE_FREESPACE 4
49 #define KEY_NONE 0
50 // obsolete: 1-4
51 #define KEY_DES 1
52 #define KEY_DES_EDE3 2
53 #define KEY_AES128_CBC 3
54 #define KEY_AES256_CBC 4
55 #define KEY_AES128_GCM 5
56 #define KEY_AES256_GCM 6
57 #define KEY_AES128_CCM 7
58 #define KEY_AES256_CCM 8
60 #define HASH_NONE 0
61 // obsolete: 1-2
62 #define HASH_MD5 1
63 #define HASH_SHA1 2
64 #define HASH_SHA256 3
65 #define HASH_SHA384 4
66 #define HASH_SHA512 5
68 #define KEYBLOB_RSA 1
69 #define KEYBLOB_EC 2
71 // obsolete: 1-22
72 #define CURVE_sect163k1 1
73 #define CURVE_sect163r1 2
74 #define CURVE_sect163r2 3
75 #define CURVE_sect193r1 4
76 #define CURVE_sect193r2 5
77 #define CURVE_sect233k1 6
78 #define CURVE_sect233r1 7
79 #define CURVE_sect239k1 8
80 #define CURVE_sect283k1 9
81 #define CURVE_sect283r1 10
82 #define CURVE_sect409k1 11
83 #define CURVE_sect409r1 12
84 #define CURVE_sect571k1 13
85 #define CURVE_sect571r1 14
86 #define CURVE_secp160k1 15
87 #define CURVE_secp160r1 16
88 #define CURVE_secp160r2 17
89 #define CURVE_secp192k1 18
90 #define CURVE_secp192r1 19
91 #define CURVE_secp224k1 20
92 #define CURVE_secp224r1 21
93 #define CURVE_secp256k1 22
94 #define CURVE_secp256r1 23
95 #define CURVE_secp384r1 24
96 #define CURVE_secp521r1 25
97 #define CURVE_prime192v1 CURVE_secp192r1
98 #define CURVE_prime256v1 CURVE_secp256r1
100 #define CC_NONE 0
101 #define CC_UFTP3 1
102 #define CC_TFMCC 2
103 #define CC_PGMCC 3
105 #define EXT_ENC_INFO 1
106 #define EXT_TFMCC_DATA_INFO 2
107 #define EXT_TFMCC_ACK_INFO 3
109 #define EXT_PGMCC_DATA_INFO 4
110 #define EXT_PGMCC_NAK_INFO 5
111 #define EXT_PGMCC_ACK_INFO 6
113 #define EXT_FREESPACE_INFO 7
115 #define FLAG_SYNC_MODE 0x01
116 #define FLAG_SYNC_PREVIEW 0x02
117 #define FLAG_IPV6 0x04
118 #define FLAG_ANNOUNCE_RESERVED 0xF8
120 #define FLAG_CLIENT_AUTH 0x01
121 #define FLAG_ENCINFO_RESERVED 0xFE
123 #define FLAG_PARTIAL 0x01
124 #define FLAG_FILEINFOACK_RESERVED 0xFE
126 #define FLAG_CURRENT_FILE 0x01
127 #define FLAG_ABORT_RESERVED 0xFE
129 #define FLAG_CC_CLR 0x01
130 #define FLAG_CC_RTT 0x02
131 #define FLAG_CC_START 0x04
132 #define FLAG_CC_LEAVE 0x08
133 #define FLAG_CC_RESERVED 0xF0
135 #define COMP_STAT_NORMAL 0
136 #define COMP_STAT_SKIPPED 1
137 #define COMP_STAT_OVERWRITE 2
138 #define COMP_STAT_REJECTED 3
140 #define HB_AUTH_FAILED 0
141 #define HB_AUTH_OK 1
142 #define HB_AUTH_CHALLENGE 2
144 #define MAXFILENAME 100
145 #define MAXDIRNAME 200
146 #define MAXPATHNAME 300
147 #define MAXBACKUPPATHNAME 600
148 #define MAXPROXYDEST 1000
149 #define MAXDIR 10
150 #define MAXSECTION 65536
152 #define DESTNAME_LEN 80
153 #define IFNAME_LEN 25
154 #define MAX_INTERFACES 100
155 #define IPSTR_LEN 16
157 #define PUBKEY_LEN 392 // big enough for a keyblob with RSA-3072
158 #define RAND_LEN 32 // RFC 8446/5246
159 #define HMAC_LEN 64 // big enough for SHA-512
160 #define HASH_LEN 64 // big enough for SHA-512
161 #define VERIFY4_LEN 12 // RFC 5246
162 #define MASTER4_LEN 48 // RFC 5246
163 #define MASTER_LEN 32 // based on SHA-256 length
164 #define ENC_MASTER_LEN 48 // based on SHA-256 length + tag length
165 #define MAXIV 16 // big enough for AES256
166 #define MAXKEY 32 // big enough for AES256
167 #define KEYBLSIZE 16 // Maximum symmetric key blocksize
168 #define DEF_RSA_LEN 1024 // Default length of generated RSA keys
169 #define RSA_MIN 1024 // Minimum RSA key length
170 #define RSA_MAX 3072 // Maximum RSA key length
171 #define DEF_CURVE CURVE_prime256v1 // Default EC curve
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 4
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 PROXY_KEY_LEN 8
200 #define ENCRYPTED_LEN 12
201 #define ABORT_LEN 308
202 #define CONG_CTRL_LEN 16
203 #define CC_ITEM_LEN 8
204 #define CC_ACK_LEN 4
205 #define TFMCC_ACK_LEN 20
206 #define RSA_BLOB_LEN 8
207 #define EC_BLOB_LEN 4
209 void proto_register_uftp5(void);
211 static int proto_uftp;
213 /* main header and common fields */
214 static int hf_uftp_version;
215 static int hf_uftp_func;
216 static int hf_uftp_seq;
217 static int hf_uftp_src_id;
218 static int hf_uftp_group_id;
219 static int hf_uftp_group_inst;
220 static int hf_uftp_grtt;
221 static int hf_uftp_gsize;
222 static int hf_uftp_reserved;
224 static int hf_uftp_destlist;
225 static int hf_uftp_dest;
227 /* ANNOUNCE fields */
228 static int hf_uftp_announce;
229 static int hf_uftp_announce_func;
230 static int hf_uftp_announce_hlen;
231 static int hf_uftp_announce_flags;
232 static int hf_uftp_announce_flags_sync;
233 static int hf_uftp_announce_flags_syncpreview;
234 static int hf_uftp_announce_flags_ipv6;
235 static int hf_uftp_announce_flags_reserved;
236 static int hf_uftp_announce_robust;
237 static int hf_uftp_announce_cc_type;
238 static int hf_uftp_announce_reserved;
239 static int hf_uftp_announce_blocksize;
240 static int hf_uftp_announce_tstamp;
241 static int hf_uftp_announce_publicmcast_ipv4;
242 static int hf_uftp_announce_publicmcast_ipv6;
243 static int hf_uftp_announce_privatemcast_ipv4;
244 static int hf_uftp_announce_privatemcast_ipv6;
246 /* EXT_ENC_INFO fields */
247 static int hf_uftp_encinfo;
248 static int hf_uftp_encinfo_exttype;
249 static int hf_uftp_encinfo_extlen;
250 static int hf_uftp_encinfo_flags;
251 static int hf_uftp_encinfo_flags_client_auth;
252 static int hf_uftp_encinfo_flags_reserved;
253 static int hf_uftp_encinfo_reserved;
254 static int hf_uftp_encinfo_keytype;
255 static int hf_uftp_encinfo_hashtype;
256 static int hf_uftp_encinfo_keylen;
257 static int hf_uftp_encinfo_dhlen;
258 static int hf_uftp_encinfo_siglen;
259 static int hf_uftp_encinfo_rand1;
260 static int hf_uftp_encinfo_keyblob;
261 static int hf_uftp_encinfo_dhblob;
262 static int hf_uftp_encinfo_sig;
264 /* rsa_blob_t fields */
265 static int hf_uftp_rsablob_blobtype;
266 static int hf_uftp_rsablob_reserved;
267 static int hf_uftp_rsablob_modlen;
268 static int hf_uftp_rsablob_exponent;
269 static int hf_uftp_rsablob_modulus;
271 /* ec_blob_t fields */
272 static int hf_uftp_ecblob_blobtype;
273 static int hf_uftp_ecblob_curve;
274 static int hf_uftp_ecblob_keylen;
275 static int hf_uftp_ecblob_key;
277 /* REGISTER fields */
278 static int hf_uftp_register;
279 static int hf_uftp_register_func;
280 static int hf_uftp_register_hlen;
281 static int hf_uftp_register_dhlen;
282 static int hf_uftp_register_tstamp;
283 static int hf_uftp_register_rand2;
284 static int hf_uftp_register_dhkey;
286 /* CLIENT_KEY fields */
287 static int hf_uftp_clientkey;
288 static int hf_uftp_clientkey_func;
289 static int hf_uftp_clientkey_hlen;
290 static int hf_uftp_clientkey_reserved;
291 static int hf_uftp_clientkey_bloblen;
292 static int hf_uftp_clientkey_siglen;
293 static int hf_uftp_clientkey_keyblob;
294 static int hf_uftp_clientkey_verify;
296 /* REG_CONF fields */
297 static int hf_uftp_regconf;
298 static int hf_uftp_regconf_func;
299 static int hf_uftp_regconf_hlen;
300 static int hf_uftp_regconf_reserved;
302 /* KEYINFO fields */
303 static int hf_uftp_keyinfo;
304 static int hf_uftp_keyinfo_func;
305 static int hf_uftp_keyinfo_hlen;
306 static int hf_uftp_keyinfo_siglen;
307 static int hf_uftp_keyinfo_ivctr;
308 static int hf_uftp_keyinfo_sig;
309 static int hf_uftp_keyinfo_destkey;
310 static int hf_uftp_keyinfo_destid;
311 static int hf_uftp_keyinfo_groupmaster;
313 /* KEYINFO_ACK fields */
314 static int hf_uftp_keyinfoack;
315 static int hf_uftp_keyinfoack_func;
316 static int hf_uftp_keyinfoack_hlen;
317 static int hf_uftp_keyinfoack_verify_len;
318 static int hf_uftp_keyinfoack_verify_data;
320 /* FILEINFO fields */
321 static int hf_uftp_fileinfo;
322 static int hf_uftp_fileinfo_func;
323 static int hf_uftp_fileinfo_hlen;
324 static int hf_uftp_fileinfo_file_id;
325 static int hf_uftp_fileinfo_ftype;
326 static int hf_uftp_fileinfo_reserved;
327 static int hf_uftp_fileinfo_ftstamp_hi;
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 /* PROXY_KEY fields */
422 static int hf_uftp_proxykey;
423 static int hf_uftp_proxykey_func;
424 static int hf_uftp_proxykey_hlen;
425 static int hf_uftp_proxykey_bloblen;
426 static int hf_uftp_proxykey_dhlen;
427 static int hf_uftp_proxykey_siglen;
428 static int hf_uftp_proxykey_keyblob;
429 static int hf_uftp_proxykey_dhblob;
430 static int hf_uftp_proxykey_sig;
432 /* CONG_CTRL fields */
433 static int hf_uftp_congctrl;
434 static int hf_uftp_congctrl_func;
435 static int hf_uftp_congctrl_hlen;
436 static int hf_uftp_congctrl_reserved;
437 static int hf_uftp_congctrl_cc_seq;
438 static int hf_uftp_congctrl_cc_rate;
439 static int hf_uftp_congctrl_tstamp;
440 static int hf_uftp_congctrl_cclist;
441 static int hf_uftp_congctrl_item;
442 static int hf_uftp_congctrl_item_destid;
443 static int hf_uftp_congctrl_item_flags;
444 static int hf_uftp_congctrl_item_flags_clr;
445 static int hf_uftp_congctrl_item_flags_rtt;
446 static int hf_uftp_congctrl_item_flags_start;
447 static int hf_uftp_congctrl_item_flags_leave;
448 static int hf_uftp_congctrl_item_flags_reserved;
449 static int hf_uftp_congctrl_item_rtt;
450 static int hf_uftp_congctrl_item_rate;
452 /* CC_ACK fields */
453 static int hf_uftp_ccack;
454 static int hf_uftp_ccack_func;
455 static int hf_uftp_ccack_hlen;
456 static int hf_uftp_ccack_reserved;
458 /* EXT_TFMCC_ACK_INFO fields */
459 static int hf_uftp_tfmccack;
460 static int hf_uftp_tfmccack_exttype;
461 static int hf_uftp_tfmccack_extlen;
462 static int hf_uftp_tfmccack_flags;
463 static int hf_uftp_tfmccack_flags_clr;
464 static int hf_uftp_tfmccack_flags_rtt;
465 static int hf_uftp_tfmccack_flags_start;
466 static int hf_uftp_tfmccack_flags_leave;
467 static int hf_uftp_tfmccack_flags_reserved;
468 static int hf_uftp_tfmccack_reserved;
469 static int hf_uftp_tfmccack_cc_seq;
470 static int hf_uftp_tfmccack_cc_rate;
471 static int hf_uftp_tfmccack_client_id;
472 static int hf_uftp_tfmccack_tstamp;
474 /* ENCRYPTED fields */
475 static int hf_uftp_encrypted;
476 static int hf_uftp_encrypted_ivctr;
477 static int hf_uftp_encrypted_reserved;
478 static int hf_uftp_encrypted_payload_len;
479 static int hf_uftp_encrypted_payload;
481 /* ABORT fields */
482 static int hf_uftp_abort;
483 static int hf_uftp_abort_func;
484 static int hf_uftp_abort_hlen;
485 static int hf_uftp_abort_flags;
486 static int hf_uftp_abort_flags_curfile;
487 static int hf_uftp_abort_flags_reserved;
488 static int hf_uftp_abort_reserved;
489 static int hf_uftp_abort_clientid;
490 static int hf_uftp_abort_message;
492 static int ett_uftp;
493 static int ett_uftp_announce;
494 static int ett_uftp_register;
495 static int ett_uftp_clientkey;
496 static int ett_uftp_regconf;
497 static int ett_uftp_keyinfo;
498 static int ett_uftp_keyinfoack;
499 static int ett_uftp_fileinfo;
500 static int ett_uftp_fileinfoack;
501 static int ett_uftp_fileseg;
502 static int ett_uftp_done;
503 static int ett_uftp_status;
504 static int ett_uftp_complete;
505 static int ett_uftp_doneconf;
506 static int ett_uftp_hbreq;
507 static int ett_uftp_hbresp;
508 static int ett_uftp_proxykey;
509 static int ett_uftp_congctrl;
510 static int ett_uftp_ccack;
511 static int ett_uftp_encrypted;
512 static int ett_uftp_abort;
514 static int ett_uftp_announce_flags;
515 static int ett_uftp_encinfo;
516 static int ett_uftp_encinfo_flags;
517 static int ett_uftp_keyinfo_destkey;
518 static int ett_uftp_fileinfoack_flags;
519 static int ett_uftp_congctrl_cclist;
520 static int ett_uftp_congctrl_item;
521 static int ett_uftp_congctrl_item_flags;
522 static int ett_uftp_tfmccdata;
523 static int ett_uftp_tfmccack;
524 static int ett_uftp_tfmccack_flags;
525 static int ett_uftp_freespace;
526 static int ett_uftp_abort_flags;
528 static int ett_uftp_destlist;
529 static int ett_uftp_rsablob;
530 static int ett_uftp_ecblob;
532 static expert_field ei_uftp_length_invalid;
533 static expert_field ei_uftp_func_unknown;
535 static const value_string messages[] = {
536 { ANNOUNCE, "ANNOUNCE" },
537 { REGISTER, "REGISTER" },
538 { CLIENT_KEY, "CLIENT_KEY" },
539 { REG_CONF, "REG_CONF" },
540 { KEYINFO, "KEYINFO" },
541 { KEYINFO_ACK, "KEYINFO_ACK" },
542 { FILEINFO, "FILEINFO" },
543 { FILEINFO_ACK, "FILEINFO_ACK" },
544 { FILESEG, "FILESEG" },
545 { DONE, "DONE" },
546 { STATUS, "STATUS" },
547 { COMPLETE, "COMPLETE" },
548 { DONE_CONF, "DONE_CONF" },
549 { HB_REQ, "HB_REQ" },
550 { HB_RESP, "HB_RESP" },
551 { KEY_REQ, "KEY_REQ (obsolete)" },
552 { PROXY_KEY, "PROXY_KEY" },
553 { ENCRYPTED, "ENCRYPTED" },
554 { ABORT, "ABORT" },
555 { CONG_CTRL, "CONG_CTRL" },
556 { CC_ACK, "CC_ACK" },
557 { 0, NULL }
560 static const value_string extensions[] = {
561 { EXT_ENC_INFO, "EXT_ENC_INFO" },
562 { EXT_TFMCC_DATA_INFO, "EXT_TFMCC_DATA_INFO" },
563 { EXT_TFMCC_ACK_INFO, "EXT_TFMCC_ACK_INFO" },
564 { EXT_PGMCC_DATA_INFO, "EXT_PGMCC_DATA_INFO" },
565 { EXT_PGMCC_NAK_INFO, "EXT_PGMCC_NAK_INFO" },
566 { EXT_PGMCC_ACK_INFO, "EXT_PGMCC_ACK_INFO" },
567 { EXT_FREESPACE_INFO, "EXT_FREESPACE_INFO" },
568 { 0, NULL }
571 static const value_string cc_types[] = {
572 { CC_NONE, "NONE" },
573 { CC_UFTP3, "UFTP3 (obsolete)" },
574 { CC_TFMCC, "TFMCC" },
575 { CC_PGMCC, "PGMCC" },
576 { 0, NULL }
579 static const value_string keyblob_types[] = {
580 { KEYBLOB_RSA, "RSA" },
581 { KEYBLOB_EC, "EC" },
582 { 0, NULL }
585 static const value_string curves[] = {
586 { CURVE_sect163k1, "sect163k1 (obsolete)" },
587 { CURVE_sect163r1, "sect163r1 (obsolete)" },
588 { CURVE_sect163r2, "sect163r2 (obsolete)" },
589 { CURVE_sect193r1, "sect193r1 (obsolete)" },
590 { CURVE_sect193r2, "sect193r2 (obsolete)" },
591 { CURVE_sect233k1, "sect233k1 (obsolete)" },
592 { CURVE_sect233r1, "sect233r1 (obsolete)" },
593 { CURVE_sect239k1, "sect239k1 (obsolete)" },
594 { CURVE_sect283k1, "sect283k1 (obsolete)" },
595 { CURVE_sect283r1, "sect283r1 (obsolete)" },
596 { CURVE_sect409k1, "sect409k1 (obsolete)" },
597 { CURVE_sect409r1, "sect409r1 (obsolete)" },
598 { CURVE_sect571k1, "sect571k1 (obsolete)" },
599 { CURVE_sect571r1, "sect571r1 (obsolete)" },
600 { CURVE_secp160k1, "secp160k1 (obsolete)" },
601 { CURVE_secp160r1, "secp160r1 (obsolete)" },
602 { CURVE_secp160r2, "secp160r2 (obsolete)" },
603 { CURVE_secp192k1, "secp192k1 (obsolete)" },
604 { CURVE_secp192r1, "prime192v1 (obsolete)" },
605 { CURVE_secp224k1, "secp224k1 (obsolete)" },
606 { CURVE_secp224r1, "secp224r1 (obsolete)" },
607 { CURVE_secp256k1, "secp256k1 (obsolete)" },
608 { CURVE_secp256r1, "prime256v1" },
609 { CURVE_secp384r1, "secp384r1" },
610 { CURVE_secp521r1, "secp521r1" },
611 { 0, NULL }
614 static const value_string hash_types[] = {
615 { HASH_NONE, "NONE" },
616 { HASH_MD5, "MD5 (obsolete)" },
617 { HASH_SHA1, "SHA-1 (obsolete)" },
618 { HASH_SHA256, "SHA-256" },
619 { HASH_SHA384, "SHA-384" },
620 { HASH_SHA512, "SHA-512" },
621 { 0, NULL }
624 static const value_string key_types[] = {
625 { KEY_NONE, "NONE" },
626 { KEY_DES, "DES (obsolete)" },
627 { KEY_DES_EDE3, "3 Key Triple DES (obsolete)" },
628 { KEY_AES128_CBC, "AES-128-CBC (obsolete)" },
629 { KEY_AES256_CBC, "AES-256-CBC (obsolete)" },
630 { KEY_AES128_GCM, "AES-128-GCM" },
631 { KEY_AES256_GCM, "AES-256-GCM" },
632 { KEY_AES128_CCM, "AES-128-CCM" },
633 { KEY_AES256_CCM, "AES-256-CCM" },
634 { 0, NULL }
637 static const value_string hb_auth_types[] = {
638 { HB_AUTH_FAILED, "Authorization Failed" },
639 { HB_AUTH_OK, "Authorization Succeeded" },
640 { HB_AUTH_CHALLENGE, "Authorization Required" },
641 { 0, NULL }
644 static const value_string file_types[] = {
645 { FTYPE_REG, "Regular file" },
646 { FTYPE_DIR, "Directory" },
647 { FTYPE_LINK, "Symbolic link" },
648 { FTYPE_DELETE, "Delete request" },
649 { FTYPE_FREESPACE, "Free space request" },
650 { 0, NULL }
653 static int * const announce_flags[] = {
654 &hf_uftp_announce_flags_sync,
655 &hf_uftp_announce_flags_syncpreview,
656 &hf_uftp_announce_flags_ipv6,
657 &hf_uftp_announce_flags_reserved,
658 NULL
661 static int * const encinfo_flags[] = {
662 &hf_uftp_encinfo_flags_client_auth,
663 &hf_uftp_encinfo_flags_reserved,
664 NULL
667 static int * const fileinfoack_flags[] = {
668 &hf_uftp_fileinfoack_flags_partial,
669 &hf_uftp_fileinfoack_flags_reserved,
670 NULL
673 static int * const abort_flags[] = {
674 &hf_uftp_abort_flags_curfile,
675 &hf_uftp_abort_flags_reserved,
676 NULL
679 static int * const cc_item_flags[] = {
680 &hf_uftp_congctrl_item_flags_clr,
681 &hf_uftp_congctrl_item_flags_rtt,
682 &hf_uftp_congctrl_item_flags_start,
683 &hf_uftp_congctrl_item_flags_leave,
684 &hf_uftp_congctrl_item_flags_reserved,
685 NULL
688 static int * const tfmcc_ack_flags[] = {
689 &hf_uftp_tfmccack_flags_clr,
690 &hf_uftp_tfmccack_flags_rtt,
691 &hf_uftp_tfmccack_flags_start,
692 &hf_uftp_tfmccack_flags_leave,
693 &hf_uftp_tfmccack_flags_reserved,
694 NULL
697 static const value_string comp_status[] = {
698 { COMP_STAT_NORMAL, "Normal" },
699 { COMP_STAT_SKIPPED, "Skipped" },
700 { COMP_STAT_OVERWRITE, "Overwrite" },
701 { COMP_STAT_REJECTED, "Rejected" },
702 { 0, NULL }
705 #define RTT_MIN 1.0e-6
706 #define RTT_MAX 1000.0
708 static double unquantize_grtt(uint8_t rtt)
710 return ((rtt <= 31) ?
711 (((double)(rtt + 1)) * (double)RTT_MIN) :
712 (RTT_MAX / exp(((double)(255 - rtt)) / (double)13.0)));
715 static unsigned unquantize_gsize(uint8_t size)
717 int E, i;
718 double rval;
720 E = size & 0x7;
721 rval = (size >> 3) * (10.0 / 32.0);
722 for (i = 0; i < E; i++) {
723 rval *= 10;
726 return (unsigned)(rval + 0.5);
729 static unsigned unquantize_rate(uint16_t rate)
731 int E, i;
732 double rval;
734 E = rate & 0xF;
735 rval = (rate >> 4) * (10.0 / 4096.0);
736 for (i = 0; i < E; i++) {
737 rval *= 10;
740 return (unsigned)rval;
743 static nstime_t usec_to_nstime(uint64_t t)
745 nstime_t result;
746 result.secs = t / 1000000;
747 result.nsecs = (t % 1000000) * 1000;
748 return result;
751 static int dissect_uftp_rsablob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int tree_hf)
753 proto_item *ti = NULL;
754 proto_tree *rsablob_tree = NULL;
755 int offset = 0, modlen;
757 if (tvb_reported_length(tvb) < RSA_BLOB_LEN) {
758 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
759 "Invalid length: %d", tvb_reported_length(tvb));
760 return 0;
763 modlen = (int)tvb_get_ntohs(tvb, 2);
764 if ((int)tvb_reported_length(tvb) < modlen + RSA_BLOB_LEN) {
765 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
766 "Invalid length, len = %d", tvb_reported_length(tvb));
767 return 0;
770 ti = proto_tree_add_item(tree, tree_hf, tvb, offset, RSA_BLOB_LEN + modlen, ENC_NA);
771 rsablob_tree = proto_item_add_subtree(ti, ett_uftp_rsablob);
772 proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_blobtype, tvb, offset, 1, ENC_BIG_ENDIAN);
773 offset += 1;
774 proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
775 offset += 1;
776 proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_modlen, tvb, offset, 2, ENC_BIG_ENDIAN);
777 offset += 2;
778 proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_exponent, tvb, offset, 4, ENC_BIG_ENDIAN);
779 offset += 4;
780 proto_tree_add_item(rsablob_tree, hf_uftp_rsablob_modulus, tvb, offset, modlen, ENC_NA);
782 return RSA_BLOB_LEN + modlen;
785 static int dissect_uftp_ecblob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int tree_hf)
787 proto_item *ti = NULL;
788 proto_tree *ecblob_tree = NULL;
789 int offset = 0, keylen;
791 if (tvb_reported_length(tvb) < EC_BLOB_LEN) {
792 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
793 "Invalid length: %d", tvb_reported_length(tvb));
794 return 0;
797 keylen = (int)tvb_get_ntohs(tvb, 2);
798 if ((int)tvb_reported_length(tvb) < keylen + EC_BLOB_LEN) {
799 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
800 "Invalid length, len = %d", tvb_reported_length(tvb));
801 return 0;
804 ti = proto_tree_add_item(tree, tree_hf, tvb, offset, EC_BLOB_LEN + keylen, ENC_NA);
805 ecblob_tree = proto_item_add_subtree(ti, ett_uftp_ecblob);
806 proto_tree_add_item(ecblob_tree, hf_uftp_ecblob_blobtype, tvb, offset, 1, ENC_BIG_ENDIAN);
807 offset += 1;
808 proto_tree_add_item(ecblob_tree, hf_uftp_ecblob_curve, tvb, offset, 1, ENC_BIG_ENDIAN);
809 offset += 1;
810 proto_tree_add_item(ecblob_tree, hf_uftp_ecblob_keylen, tvb, offset, 2, ENC_BIG_ENDIAN);
811 offset += 2;
812 proto_tree_add_item(ecblob_tree, hf_uftp_ecblob_key, tvb, offset, keylen, ENC_NA);
814 return EC_BLOB_LEN + keylen;
817 static int dissect_uftp_encinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
819 proto_item *ti = NULL;
820 proto_tree *encinfo_tree = NULL;
821 int offset = 0, hlen, keylen, dhlen, siglen;
822 int8_t blobtype;
823 tvbuff_t *next_tvb;
825 if (tvb_reported_length(tvb) < ENC_INFO_LEN) {
826 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
827 "Invalid length: %d", tvb_reported_length(tvb));
828 return 0;
831 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
832 keylen = (int)tvb_get_ntohs(tvb, 6);
833 dhlen = (int)tvb_get_ntohs(tvb, 8);
834 siglen = (int)tvb_get_ntohs(tvb, 10);
835 if (((int)tvb_reported_length(tvb) < hlen) ||
836 (hlen < ENC_INFO_LEN + keylen + dhlen + siglen)) {
837 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
838 "Invalid length, len = %d, hlen = %d, "
839 "keylen = %d, dhlen = %d, siglen = %d",
840 tvb_reported_length(tvb), hlen, keylen, dhlen, siglen);
841 return 0;
844 ti = proto_tree_add_item(tree, hf_uftp_encinfo, tvb, offset, ENC_INFO_LEN + keylen + dhlen + siglen, ENC_NA);
845 encinfo_tree = proto_item_add_subtree(ti, ett_uftp_encinfo);
846 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_exttype, tvb, offset, 1, ENC_BIG_ENDIAN);
847 offset += 1;
848 proto_tree_add_uint_format_value(encinfo_tree, hf_uftp_encinfo_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
849 offset += 1;
850 proto_tree_add_bitmask(encinfo_tree, tvb, offset, hf_uftp_encinfo_flags, ett_uftp_encinfo_flags, encinfo_flags, ENC_BIG_ENDIAN);
851 offset += 1;
852 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
853 offset += 1;
854 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_keytype, tvb, offset, 1, ENC_BIG_ENDIAN);
855 offset += 1;
856 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_hashtype, tvb, offset, 1, ENC_BIG_ENDIAN);
857 offset += 1;
858 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_keylen, tvb, offset, 2, ENC_BIG_ENDIAN);
859 offset += 2;
860 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_dhlen, tvb, offset, 2, ENC_BIG_ENDIAN);
861 offset += 2;
862 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
863 offset += 2;
864 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_rand1, tvb, offset, RAND_LEN, ENC_NA);
865 offset += RAND_LEN;
866 if (keylen > 0) {
867 int parsed = 0;
869 next_tvb = tvb_new_subset_length(tvb, offset, keylen);
870 blobtype = tvb_get_uint8(tvb, offset);
871 switch (blobtype) {
872 case KEYBLOB_RSA:
873 parsed = dissect_uftp_rsablob(next_tvb, pinfo, encinfo_tree, hf_uftp_encinfo_keyblob);
874 break;
875 case KEYBLOB_EC:
876 parsed = dissect_uftp_ecblob(next_tvb, pinfo, encinfo_tree, hf_uftp_encinfo_keyblob);
877 break;
879 offset += parsed;
881 if (dhlen > 0) {
882 int parsed = 0;
884 next_tvb = tvb_new_subset_length(tvb, offset, dhlen);
885 blobtype = tvb_get_uint8(tvb, offset);
886 switch (blobtype) {
887 case KEYBLOB_RSA:
888 parsed = dissect_uftp_rsablob(next_tvb, pinfo, encinfo_tree, hf_uftp_encinfo_dhblob);
889 break;
890 case KEYBLOB_EC:
891 parsed = dissect_uftp_ecblob(next_tvb, pinfo, encinfo_tree, hf_uftp_encinfo_dhblob);
892 break;
894 offset += parsed;
896 if (siglen > 0) {
897 proto_tree_add_item(encinfo_tree, hf_uftp_encinfo_sig, tvb, offset, siglen, ENC_NA);
900 return ENC_INFO_LEN + keylen + dhlen + siglen;
903 static void dissect_uftp_announce(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
905 proto_item *ti = NULL;
906 proto_item *destlist = NULL;
907 proto_tree *announce_tree = NULL;
908 proto_tree *destlist_tree = NULL;
909 int offset = 0;
910 int hlen, iplen, destcount, idx, extlen_total;
911 uint8_t flags, ext_type;
912 nstime_t tstamp;
913 tvbuff_t *next_tvb;
915 if (tvb_reported_length(tvb) < ANNOUNCE_LEN) {
916 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
917 "Invalid length: %d", tvb_reported_length(tvb));
918 return;
921 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
922 if ((int)tvb_reported_length(tvb) < hlen) {
923 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
924 "Invalid length, len = %d, hlen = %d",
925 tvb_reported_length(tvb), hlen);
926 return;
929 flags = tvb_get_uint8(tvb, 2);
931 ti = proto_tree_add_item(tree, hf_uftp_announce, tvb, offset, -1, ENC_NA);
932 announce_tree = proto_item_add_subtree(ti, ett_uftp_announce);
933 proto_tree_add_item(announce_tree, hf_uftp_announce_func, tvb, offset, 1, ENC_BIG_ENDIAN);
934 offset += 1;
935 proto_tree_add_uint_format_value(announce_tree, hf_uftp_announce_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
936 offset += 1;
937 proto_tree_add_bitmask(announce_tree, tvb, offset, hf_uftp_announce_flags, ett_uftp_announce_flags, announce_flags, ENC_BIG_ENDIAN);
938 offset += 1;
939 proto_tree_add_item(announce_tree, hf_uftp_announce_robust, tvb, offset, 1, ENC_BIG_ENDIAN);
940 offset += 1;
941 proto_tree_add_item(announce_tree, hf_uftp_announce_cc_type, tvb, offset, 1, ENC_BIG_ENDIAN);
942 offset += 1;
943 proto_tree_add_item(announce_tree, hf_uftp_announce_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
944 offset += 1;
945 proto_tree_add_item(announce_tree, hf_uftp_announce_blocksize, tvb, offset, 2, ENC_BIG_ENDIAN);
946 offset += 2;
947 tstamp = usec_to_nstime(tvb_get_ntoh64(tvb, offset));
948 proto_tree_add_time(announce_tree, hf_uftp_announce_tstamp, tvb, offset, 8, &tstamp);
949 offset += 8;
950 if (flags & FLAG_IPV6) {
951 iplen = 16;
952 proto_tree_add_item(announce_tree, hf_uftp_announce_publicmcast_ipv6, tvb, offset, iplen, ENC_NA);
953 offset += iplen;
954 proto_tree_add_item(announce_tree, hf_uftp_announce_privatemcast_ipv6, tvb, offset, iplen, ENC_NA);
955 offset += iplen;
956 } else {
957 iplen = 4;
958 proto_tree_add_item(announce_tree, hf_uftp_announce_publicmcast_ipv4, tvb, offset, iplen, ENC_BIG_ENDIAN);
959 offset += iplen;
960 proto_tree_add_item(announce_tree, hf_uftp_announce_privatemcast_ipv4, tvb, offset, iplen, ENC_BIG_ENDIAN);
961 offset += iplen;
964 extlen_total = hlen - (ANNOUNCE_LEN + ( 2 * iplen));
965 while (extlen_total > 0) {
966 int parsed = 0;
968 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
969 ext_type = tvb_get_uint8(tvb, offset);
970 switch (ext_type) {
971 case EXT_ENC_INFO:
972 parsed = dissect_uftp_encinfo(next_tvb, pinfo, announce_tree);
973 break;
975 if (!parsed) break;
976 extlen_total -= parsed;
977 offset += parsed;
980 destcount = (tvb_reported_length(tvb) - hlen) / 4;
981 offset = hlen;
982 if (destcount > 0) {
983 destlist = proto_tree_add_item(announce_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
984 destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
986 for (idx = 0; idx < destcount; idx++) {
987 proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
988 offset += 4;
992 static void dissect_uftp_register(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
994 proto_item *ti = NULL;
995 proto_item *destlist = NULL;
996 proto_tree *register_tree = NULL;
997 proto_tree *destlist_tree = NULL;
998 int offset = 0, hlen;
999 uint16_t destcount, keylen, idx;
1000 nstime_t tstamp;
1002 if (tvb_reported_length(tvb) < REGISTER_LEN) {
1003 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1004 "Invalid length: %d", tvb_reported_length(tvb));
1005 return;
1008 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1009 keylen = tvb_get_ntohs(tvb, 2);
1010 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < REGISTER_LEN + keylen)) {
1011 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1012 "Invalid length, len = %d, hlen = %d, keylen = %d",
1013 tvb_reported_length(tvb), hlen, keylen);
1014 return;
1017 ti = proto_tree_add_item(tree, hf_uftp_register, tvb, offset, -1, ENC_NA);
1018 register_tree = proto_item_add_subtree(ti, ett_uftp_register);
1019 proto_tree_add_item(register_tree, hf_uftp_register_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1020 offset += 1;
1021 proto_tree_add_uint_format_value(register_tree, hf_uftp_register_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1022 offset += 1;
1023 proto_tree_add_item(register_tree, hf_uftp_register_dhlen, tvb, offset, 2, ENC_BIG_ENDIAN);
1024 offset += 2;
1025 tstamp = usec_to_nstime(tvb_get_ntoh64(tvb, offset));
1026 proto_tree_add_time(register_tree, hf_uftp_register_tstamp, tvb, offset, 8, &tstamp);
1027 offset += 8;
1028 proto_tree_add_item(register_tree, hf_uftp_register_rand2, tvb, offset, RAND_LEN, ENC_NA);
1029 offset += RAND_LEN;
1030 if (keylen > 0) {
1031 proto_tree_add_item(register_tree, hf_uftp_register_dhkey, tvb, offset, keylen, ENC_NA);
1034 destcount = (tvb_reported_length(tvb) - hlen) / 4;
1035 offset = hlen;
1036 if (destcount > 0) {
1037 destlist = proto_tree_add_item(register_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1038 destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1040 for (idx = 0; idx < destcount; idx++) {
1041 proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1042 offset += 4;
1046 static void dissect_uftp_clientkey(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1048 proto_item *ti = NULL;
1049 proto_tree *clientkey_tree = NULL;
1050 int offset = 0, hlen;
1051 uint16_t keylen, verifylen;
1052 int8_t blobtype;
1053 tvbuff_t *next_tvb;
1055 if (tvb_reported_length(tvb) < CLIENT_KEY_LEN) {
1056 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1057 "Invalid length: %d", tvb_reported_length(tvb));
1058 return;
1061 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1062 keylen = tvb_get_ntohs(tvb, 4);
1063 verifylen = tvb_get_ntohs(tvb, 6);
1064 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < CLIENT_KEY_LEN + keylen + verifylen)) {
1065 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1066 "Invalid length, len = %d, hlen = %d, keylen = %d verifylen = %d",
1067 tvb_reported_length(tvb), hlen, keylen, verifylen);
1068 return;
1071 ti = proto_tree_add_item(tree, hf_uftp_clientkey, tvb, offset, -1, ENC_NA);
1072 clientkey_tree = proto_item_add_subtree(ti, ett_uftp_clientkey);
1073 proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1074 offset += 1;
1075 proto_tree_add_uint_format_value(clientkey_tree, hf_uftp_clientkey_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1076 offset += 1;
1077 proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1078 offset += 2;
1079 proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_bloblen, tvb, offset, 2, ENC_BIG_ENDIAN);
1080 offset += 2;
1081 proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1082 offset += 2;
1083 if (keylen > 0) {
1084 int parsed = 0;
1086 next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1087 blobtype = tvb_get_uint8(tvb, offset);
1088 switch (blobtype) {
1089 case KEYBLOB_RSA:
1090 parsed = dissect_uftp_rsablob(next_tvb, pinfo, clientkey_tree, hf_uftp_clientkey_keyblob);
1091 break;
1092 case KEYBLOB_EC:
1093 parsed = dissect_uftp_ecblob(next_tvb, pinfo, clientkey_tree, hf_uftp_clientkey_keyblob);
1094 break;
1096 offset += parsed;
1098 if (verifylen > 0) {
1099 proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_verify, tvb, offset, verifylen, ENC_NA);
1103 static void dissect_uftp_regconf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1105 proto_item *ti = NULL;
1106 proto_item *destlist = NULL;
1107 proto_tree *regconf_tree = NULL;
1108 proto_tree *destlist_tree = NULL;
1109 int offset = 0, hlen;
1110 uint16_t destcount, idx;
1112 if (tvb_reported_length(tvb) < REG_CONF_LEN) {
1113 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1114 "Invalid length: %d", tvb_reported_length(tvb));
1115 return;
1118 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1119 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < REG_CONF_LEN)) {
1120 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1121 "Invalid length, len = %d, hlen = %d",
1122 tvb_reported_length(tvb), hlen);
1123 return;
1126 ti = proto_tree_add_item(tree, hf_uftp_regconf, tvb, offset, -1, ENC_NA);
1127 regconf_tree = proto_item_add_subtree(ti, ett_uftp_regconf);
1128 proto_tree_add_item(regconf_tree, hf_uftp_regconf_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1129 offset += 1;
1130 proto_tree_add_uint_format_value(regconf_tree, hf_uftp_regconf_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1131 offset += 1;
1132 proto_tree_add_item(regconf_tree, hf_uftp_regconf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1134 destcount = (tvb_reported_length(tvb) - hlen) / 4;
1135 offset = hlen;
1136 if (destcount > 0) {
1137 destlist = proto_tree_add_item(regconf_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1138 destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1140 for (idx = 0; idx < destcount; idx++) {
1141 proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1142 offset += 4;
1146 static void dissect_uftp_keyinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1148 proto_item *ti = NULL;
1149 proto_item *destlist = NULL;
1150 proto_item *destkey = NULL;
1151 proto_tree *keyinfo_tree = NULL;
1152 proto_tree *destlist_tree = NULL;
1153 proto_tree *destkey_tree = NULL;
1154 int offset = 0, hlen, siglen;
1155 uint8_t destcount, idx;
1157 if (tvb_reported_length(tvb) < KEYINFO_LEN) {
1158 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1159 "Invalid length: %d", tvb_reported_length(tvb));
1160 return;
1163 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1164 siglen = (int)tvb_get_ntohs(tvb, 2);
1165 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < KEYINFO_LEN + siglen)) {
1166 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1167 "Invalid length, len = %d, hlen = %d, siglen = %d",
1168 tvb_reported_length(tvb), hlen, siglen);
1169 return;
1172 ti = proto_tree_add_item(tree, hf_uftp_keyinfo, tvb, offset, -1, ENC_NA);
1173 keyinfo_tree = proto_item_add_subtree(ti, ett_uftp_keyinfo);
1174 proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1175 offset += 1;
1176 proto_tree_add_uint_format_value(keyinfo_tree, hf_uftp_keyinfo_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1177 offset += 1;
1178 proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1179 offset += 2;
1180 proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_ivctr, tvb, offset, 8, ENC_BIG_ENDIAN);
1181 offset += 8;
1182 proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_sig, tvb, offset, siglen, ENC_NA);
1184 destcount = (tvb_reported_length(tvb) - hlen) / DESTKEY_LEN;
1185 offset = hlen;
1186 if (destcount > 0) {
1187 destlist = proto_tree_add_item(keyinfo_tree, hf_uftp_destlist, tvb, offset, destcount * DESTKEY_LEN, ENC_NA);
1188 destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1190 for (idx = 0; idx < destcount; idx++) {
1191 destkey = proto_tree_add_item(destlist_tree, hf_uftp_keyinfo_destkey, tvb, offset, DESTKEY_LEN, ENC_NA);
1192 destkey_tree = proto_item_add_subtree(destkey, ett_uftp_keyinfo_destkey);
1193 proto_tree_add_item(destkey_tree, hf_uftp_keyinfo_destid, tvb, offset, 4, ENC_BIG_ENDIAN);
1194 offset += 4;
1195 proto_tree_add_item(destkey_tree, hf_uftp_keyinfo_groupmaster, tvb, offset, 48, ENC_NA);
1196 offset += 48;
1200 static void dissect_uftp_keyinfoack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1202 proto_item *ti = NULL;
1203 proto_tree *keyinfoack_tree = NULL;
1204 int offset = 0, hlen, verifylen;
1206 if (tvb_reported_length(tvb) < KEYINFO_ACK_LEN) {
1207 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1208 "Invalid length: %d", tvb_reported_length(tvb));
1209 return;
1212 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1213 verifylen = (int)tvb_get_uint8(tvb, 2);
1214 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < KEYINFO_ACK_LEN + verifylen)) {
1215 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1216 "Invalid length, len = %d, hlen = %d",
1217 tvb_reported_length(tvb), hlen);
1218 return;
1221 ti = proto_tree_add_item(tree, hf_uftp_keyinfoack, tvb, offset, -1, ENC_NA);
1222 keyinfoack_tree = proto_item_add_subtree(ti, ett_uftp_keyinfoack);
1223 proto_tree_add_item(keyinfoack_tree, hf_uftp_keyinfoack_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1224 offset += 1;
1225 proto_tree_add_uint_format_value(keyinfoack_tree, hf_uftp_keyinfoack_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1226 offset += 1;
1227 proto_tree_add_item(keyinfoack_tree, hf_uftp_keyinfoack_verify_len, tvb, offset, 2, ENC_BIG_ENDIAN);
1228 offset += 2;
1229 proto_tree_add_item(keyinfoack_tree, hf_uftp_keyinfoack_verify_data, tvb, offset, verifylen, ENC_NA);
1232 static void dissect_uftp_fileinfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1234 proto_item *ti = NULL;
1235 proto_item *destlist = NULL;
1236 proto_tree *fileinfo_tree = NULL;
1237 proto_tree *destlist_tree = NULL;
1238 int offset = 0, hlen;
1239 uint16_t file_id, destcount, idx, namelen, linklen;
1240 nstime_t ftstamp, tstamp;
1242 if (tvb_reported_length(tvb) < FILEINFO_LEN) {
1243 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1244 "Invalid length: %d", tvb_reported_length(tvb));
1245 return;
1248 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1249 namelen = tvb_get_uint8(tvb, 8) * 4;
1250 linklen = tvb_get_uint8(tvb, 9) * 4;
1251 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < FILEINFO_LEN + namelen + linklen)) {
1252 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1253 "Invalid length, len = %d, hlen = %d, namelen = %d, linklen = %d",
1254 tvb_reported_length(tvb), hlen, namelen, linklen);
1255 return;
1258 file_id = tvb_get_ntohs(tvb, 2);
1259 col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1261 ti = proto_tree_add_item(tree, hf_uftp_fileinfo, tvb, offset, -1, ENC_NA);
1262 fileinfo_tree = proto_item_add_subtree(ti, ett_uftp_fileinfo);
1263 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1264 offset += 1;
1265 proto_tree_add_uint_format_value(fileinfo_tree, hf_uftp_fileinfo_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1266 offset += 1;
1267 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1268 offset += 2;
1269 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftype, tvb, offset, 1, ENC_BIG_ENDIAN);
1270 offset += 1;
1271 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1272 offset += 1;
1273 // high bytes of file timestamp
1274 ftstamp.secs = (int64_t)tvb_get_ntohs(tvb, offset) << 16;
1275 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftstamp_hi, tvb, offset, 2, ENC_BIG_ENDIAN);
1276 offset +=2;
1277 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_namelen, tvb, offset, 1, ENC_BIG_ENDIAN);
1278 offset += 1;
1279 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_linklen, tvb, offset, 1, ENC_BIG_ENDIAN);
1280 offset += 1;
1281 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_fsize, tvb, offset, 6, ENC_BIG_ENDIAN);
1282 offset += 6;
1283 // low bytes of file timestamp
1284 ftstamp.secs |= tvb_get_ntohl(tvb, offset);
1285 ftstamp.nsecs = 0;
1286 proto_tree_add_time(fileinfo_tree, hf_uftp_fileinfo_ftstamp, tvb, offset, 4, &ftstamp);
1287 offset += 4;
1288 tstamp = usec_to_nstime(tvb_get_ntoh64(tvb, offset));
1289 proto_tree_add_time(fileinfo_tree, hf_uftp_fileinfo_tstamp, tvb, offset, 8, &tstamp);
1290 offset += 8;
1291 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_name, tvb, offset, namelen, ENC_ASCII);
1292 offset += namelen;
1293 if (linklen > 0) {
1294 proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_link, tvb, offset, linklen, ENC_ASCII);
1297 destcount = (tvb_reported_length(tvb) - hlen) / 4;
1298 offset = hlen;
1299 if (destcount > 0) {
1300 destlist = proto_tree_add_item(fileinfo_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1301 destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1303 for (idx = 0; idx < destcount; idx++) {
1304 proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1305 offset += 4;
1309 static void dissect_uftp_fileinfoack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1311 proto_item *ti = NULL;
1312 proto_item *destlist = NULL;
1313 proto_tree *fileinfoack_tree = NULL;
1314 proto_tree *destlist_tree = NULL;
1315 int offset = 0, hlen;
1316 uint16_t file_id, destcount, idx;
1317 nstime_t tstamp;
1319 if (tvb_reported_length(tvb) < FILEINFO_ACK_LEN) {
1320 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1321 "Invalid length: %d", tvb_reported_length(tvb));
1322 return;
1325 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1326 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < FILEINFO_ACK_LEN)) {
1327 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1328 "Invalid length, len = %d, hlen = %d",
1329 tvb_reported_length(tvb), hlen);
1330 return;
1333 file_id = tvb_get_ntohs(tvb, 2);
1334 if (file_id > 0) {
1335 col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1338 ti = proto_tree_add_item(tree, hf_uftp_fileinfoack, tvb, offset, -1, ENC_NA);
1339 fileinfoack_tree = proto_item_add_subtree(ti, ett_uftp_fileinfoack);
1340 proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1341 offset += 1;
1342 proto_tree_add_uint_format_value(fileinfoack_tree, hf_uftp_fileinfoack_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1343 offset += 1;
1344 proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1345 offset += 2;
1346 proto_tree_add_bitmask(fileinfoack_tree, tvb, offset, hf_uftp_fileinfoack_flags, ett_uftp_fileinfoack_flags, fileinfoack_flags, ENC_BIG_ENDIAN);
1347 offset += 1;
1348 proto_tree_add_item(fileinfoack_tree, hf_uftp_fileinfoack_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1349 offset += 3;
1350 tstamp = usec_to_nstime(tvb_get_ntoh64(tvb, offset));
1351 proto_tree_add_time(fileinfoack_tree, hf_uftp_fileinfoack_tstamp, tvb, offset, 8, &tstamp);
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;
1526 nstime_t tstamp;
1528 if (tvb_reported_length(tvb) < TFMCC_ACK_LEN) {
1529 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1530 "Invalid length: %d", tvb_reported_length(tvb));
1531 return 0;
1534 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1535 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < TFMCC_ACK_LEN)) {
1536 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1537 "Invalid length, len = %d, hlen = %d",
1538 tvb_reported_length(tvb), hlen);
1539 return 0;
1542 rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
1544 ti = proto_tree_add_item(tree, hf_uftp_tfmccack, tvb, offset, TFMCC_ACK_LEN, ENC_NA);
1545 tfmccack_tree = proto_item_add_subtree(ti, ett_uftp_tfmccack);
1546 proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_exttype, tvb, offset, 1, ENC_BIG_ENDIAN);
1547 offset += 1;
1548 proto_tree_add_uint_format_value(tfmccack_tree, hf_uftp_tfmccack_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1549 offset += 1;
1550 proto_tree_add_bitmask(tfmccack_tree, tvb, offset, hf_uftp_tfmccack_flags, ett_uftp_tfmccack_flags, tfmcc_ack_flags, ENC_BIG_ENDIAN);
1551 offset += 1;
1552 proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1553 offset += 1;
1554 proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_cc_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
1555 offset += 2;
1556 proto_tree_add_uint(tfmccack_tree, hf_uftp_tfmccack_cc_rate, tvb, offset, 2, rate);
1557 offset += 2;
1558 proto_tree_add_item(tfmccack_tree, hf_uftp_tfmccack_client_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1559 offset += 4;
1560 tstamp = usec_to_nstime(tvb_get_ntoh64(tvb, offset));
1561 proto_tree_add_time(tfmccack_tree, hf_uftp_tfmccack_tstamp, tvb, offset, 8, &tstamp);
1563 return TFMCC_ACK_LEN;
1566 static void dissect_uftp_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1568 proto_item *ti = NULL;
1569 proto_tree *status_tree = NULL;
1570 int offset = 0, hlen, extlen_total;
1571 uint16_t file_id, section;
1572 uint8_t ext_type;
1573 tvbuff_t *next_tvb;
1575 if (tvb_reported_length(tvb) < STATUS_LEN) {
1576 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1577 "Invalid length: %d", tvb_reported_length(tvb));
1578 return;
1581 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1582 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < STATUS_LEN)) {
1583 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1584 "Invalid length, len = %d, hlen = %d",
1585 tvb_reported_length(tvb), hlen);
1586 return;
1589 file_id = tvb_get_ntohs(tvb, 2);
1590 section = tvb_get_ntohs(tvb, 4);
1591 col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X Section=%d",
1592 file_id, section);
1594 ti = proto_tree_add_item(tree, hf_uftp_status, tvb, offset, -1, ENC_NA);
1595 status_tree = proto_item_add_subtree(ti, ett_uftp_status);
1596 proto_tree_add_item(status_tree, hf_uftp_status_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1597 offset += 1;
1598 proto_tree_add_uint_format_value(status_tree, hf_uftp_status_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1599 offset += 1;
1600 proto_tree_add_item(status_tree, hf_uftp_status_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1601 offset += 2;
1602 proto_tree_add_item(status_tree, hf_uftp_status_section, tvb, offset, 2, ENC_BIG_ENDIAN);
1603 offset += 2;
1604 proto_tree_add_item(status_tree, hf_uftp_status_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1605 offset += 2;
1607 extlen_total = hlen - STATUS_LEN;
1608 while (extlen_total > 0) {
1609 int parsed = 0;
1611 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1612 ext_type = tvb_get_uint8(tvb, offset);
1613 switch (ext_type) {
1614 case EXT_TFMCC_ACK_INFO:
1615 parsed = dissect_uftp_tfmccack(next_tvb, pinfo, status_tree);
1616 break;
1618 if (!parsed) break;
1619 extlen_total -= parsed;
1620 offset += parsed;
1623 offset = hlen;
1624 proto_tree_add_item(status_tree, hf_uftp_status_naks, tvb, offset, -1, ENC_NA);
1627 static int dissect_uftp_freespace(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1629 proto_item *ti = NULL;
1630 proto_tree *freespace_tree = NULL;
1631 int offset = 0, hlen;
1633 if (tvb_reported_length(tvb) < FREESPACE_LEN) {
1634 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1635 "Invalid length: %d", tvb_reported_length(tvb));
1636 return 0;
1639 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1640 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < FREESPACE_LEN)) {
1641 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1642 "Invalid length, len = %d, hlen = %d",
1643 tvb_reported_length(tvb), hlen);
1644 return 0;
1647 ti = proto_tree_add_item(tree, hf_uftp_freespace, tvb, offset, FREESPACE_LEN, ENC_NA);
1648 freespace_tree = proto_item_add_subtree(ti, ett_uftp_freespace);
1649 proto_tree_add_item(freespace_tree, hf_uftp_freespace_exttype, tvb, offset, 1, ENC_BIG_ENDIAN);
1650 offset += 1;
1651 proto_tree_add_uint_format_value(freespace_tree, hf_uftp_freespace_extlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1652 offset += 1;
1653 proto_tree_add_item(freespace_tree, hf_uftp_freespace_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1654 offset += 2;
1655 proto_tree_add_item(freespace_tree, hf_uftp_freespace_freespace, tvb, offset, 8, ENC_BIG_ENDIAN);
1657 return FREESPACE_LEN;
1660 static void dissect_uftp_complete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1662 proto_item *ti = NULL;
1663 proto_item *destlist = NULL;
1664 proto_tree *complete_tree = NULL;
1665 proto_tree *destlist_tree = NULL;
1666 int offset = 0, hlen, extlen_total;
1667 uint16_t file_id, destcount, idx;
1668 uint8_t ext_type;
1669 tvbuff_t *next_tvb;
1671 if (tvb_reported_length(tvb) < COMPLETE_LEN) {
1672 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1673 "Invalid length: %d", tvb_reported_length(tvb));
1674 return;
1677 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1678 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < COMPLETE_LEN)) {
1679 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1680 "Invalid length, len = %d, hlen = %d",
1681 tvb_reported_length(tvb), hlen);
1682 return;
1685 file_id = tvb_get_ntohs(tvb, 2);
1686 if (file_id > 0) {
1687 col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1690 ti = proto_tree_add_item(tree, hf_uftp_complete, tvb, offset, -1, ENC_NA);
1691 complete_tree = proto_item_add_subtree(ti, ett_uftp_complete);
1692 proto_tree_add_item(complete_tree, hf_uftp_complete_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1693 offset += 1;
1694 proto_tree_add_uint_format_value(complete_tree, hf_uftp_complete_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1695 offset += 1;
1696 proto_tree_add_item(complete_tree, hf_uftp_complete_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1697 offset += 2;
1698 proto_tree_add_item(complete_tree, hf_uftp_complete_status, tvb, offset, 1, ENC_BIG_ENDIAN);
1699 offset += 1;
1700 proto_tree_add_item(complete_tree, hf_uftp_complete_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1701 offset += 3;
1703 extlen_total = hlen - COMPLETE_LEN;
1704 while (extlen_total > 0) {
1705 int parsed = 0;
1707 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
1708 ext_type = tvb_get_uint8(tvb, offset);
1709 switch (ext_type) {
1710 case EXT_FREESPACE_INFO:
1711 parsed = dissect_uftp_freespace(next_tvb, pinfo, complete_tree);
1712 break;
1714 if (!parsed) break;
1715 extlen_total -= parsed;
1716 offset += parsed;
1719 destcount = (tvb_reported_length(tvb) - hlen) / 4;
1720 offset = hlen;
1721 if (destcount > 0) {
1722 destlist = proto_tree_add_item(complete_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1723 destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1725 for (idx = 0; idx < destcount; idx++) {
1726 proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1727 offset += 4;
1731 static void dissect_uftp_doneconf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1733 proto_item *ti = NULL;
1734 proto_item *destlist = NULL;
1735 proto_tree *doneconf_tree = NULL;
1736 proto_tree *destlist_tree = NULL;
1737 int offset = 0, hlen;
1738 uint16_t destcount, idx;
1740 if (tvb_reported_length(tvb) < DONE_CONF_LEN) {
1741 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1742 "Invalid length: %d", tvb_reported_length(tvb));
1743 return;
1746 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1747 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < DONE_CONF_LEN)) {
1748 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1749 "Invalid length, len = %d, hlen = %d",
1750 tvb_reported_length(tvb), hlen);
1751 return;
1754 ti = proto_tree_add_item(tree, hf_uftp_doneconf, tvb, offset, -1, ENC_NA);
1755 doneconf_tree = proto_item_add_subtree(ti, ett_uftp_doneconf);
1756 proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1757 offset += 1;
1758 proto_tree_add_uint_format_value(doneconf_tree, hf_uftp_doneconf_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1759 offset += 1;
1760 proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1762 destcount = (tvb_reported_length(tvb) - hlen) / 4;
1763 offset = hlen;
1764 if (destcount > 0) {
1765 destlist = proto_tree_add_item(doneconf_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1766 destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1768 for (idx = 0; idx < destcount; idx++) {
1769 proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1770 offset += 4;
1774 static void dissect_uftp_hbreq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1776 proto_item *ti = NULL;
1777 proto_tree *hbreq_tree = NULL;
1778 int offset = 0, hlen;
1779 uint16_t keylen, siglen;
1780 int8_t blobtype;
1781 tvbuff_t *next_tvb;
1783 if (tvb_reported_length(tvb) < HB_REQ_LEN) {
1784 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1785 "Invalid length: %d", tvb_reported_length(tvb));
1786 return;
1789 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1790 keylen = tvb_get_ntohs(tvb, 4);
1791 siglen = tvb_get_ntohs(tvb, 6);
1792 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < HB_REQ_LEN + keylen + siglen)) {
1793 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1794 "Invalid length, len = %d, hlen = %d, keylen=%d siglen=%d",
1795 tvb_reported_length(tvb), hlen, keylen, siglen);
1796 return;
1799 ti = proto_tree_add_item(tree, hf_uftp_hbreq, tvb, offset, -1, ENC_NA);
1800 hbreq_tree = proto_item_add_subtree(ti, ett_uftp_hbreq);
1801 proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1802 offset += 1;
1803 proto_tree_add_uint_format_value(hbreq_tree, hf_uftp_hbreq_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1804 offset += 1;
1805 proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1806 offset += 2;
1807 proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_bloblen, tvb, offset, 2, ENC_BIG_ENDIAN);
1808 offset += 2;
1809 proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1810 offset += 2;
1811 proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1812 offset += 4;
1813 if (keylen > 0) {
1814 int parsed = 0;
1816 next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1817 blobtype = tvb_get_uint8(tvb, offset);
1818 switch (blobtype) {
1819 case KEYBLOB_RSA:
1820 parsed = dissect_uftp_rsablob(next_tvb, pinfo, hbreq_tree, hf_uftp_hbreq_keyblob);
1821 break;
1822 case KEYBLOB_EC:
1823 parsed = dissect_uftp_ecblob(next_tvb, pinfo, hbreq_tree, hf_uftp_hbreq_keyblob);
1824 break;
1826 offset += parsed;
1828 if (siglen > 0) {
1829 proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_verify, tvb, offset, siglen, ENC_NA);
1833 static void dissect_uftp_hbresp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1835 proto_item *ti = NULL;
1836 proto_tree *hbresp_tree = NULL;
1837 int offset = 0, hlen;
1839 if (tvb_reported_length(tvb) < HB_RESP_LEN) {
1840 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1841 "Invalid length: %d", tvb_reported_length(tvb));
1842 return;
1845 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1846 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < HB_RESP_LEN)) {
1847 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1848 "Invalid length, len = %d, hlen = %d",
1849 tvb_reported_length(tvb), hlen);
1850 return;
1853 ti = proto_tree_add_item(tree, hf_uftp_hbresp, tvb, offset, -1, ENC_NA);
1854 hbresp_tree = proto_item_add_subtree(ti, ett_uftp_hbresp);
1855 proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1856 offset += 1;
1857 proto_tree_add_uint_format_value(hbresp_tree, hf_uftp_hbresp_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1858 offset += 1;
1859 proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_authenticated, tvb, offset, 1, ENC_BIG_ENDIAN);
1860 offset += 1;
1861 proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1862 offset += 1;
1863 proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1866 static void dissect_uftp_proxykey(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1868 proto_item *ti = NULL;
1869 proto_tree *proxykey_tree = NULL;
1870 int offset = 0, hlen;
1871 uint16_t keylen, dhlen, siglen;
1872 int8_t blobtype;
1873 tvbuff_t *next_tvb;
1875 if (tvb_reported_length(tvb) < PROXY_KEY_LEN) {
1876 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1877 "Invalid length: %d", tvb_reported_length(tvb));
1878 return;
1881 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1882 keylen = tvb_get_ntohs(tvb, 2);
1883 dhlen = tvb_get_ntohs(tvb, 4);
1884 siglen = tvb_get_ntohs(tvb, 6);
1885 if (((int)tvb_reported_length(tvb) < hlen) ||
1886 (hlen < PROXY_KEY_LEN + keylen + dhlen + siglen)) {
1887 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1888 "Invalid length, len = %d, hlen = %d, keylen=%d, dhlen=%d, siglen=%d",
1889 tvb_reported_length(tvb), hlen, keylen, dhlen, siglen);
1890 return;
1893 ti = proto_tree_add_item(tree, hf_uftp_proxykey, tvb, offset, -1, ENC_NA);
1894 proxykey_tree = proto_item_add_subtree(ti, ett_uftp_proxykey);
1895 proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1896 offset += 1;
1897 proto_tree_add_uint_format_value(proxykey_tree, hf_uftp_proxykey_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1898 offset += 1;
1899 proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_bloblen, tvb, offset, 2, ENC_BIG_ENDIAN);
1900 offset += 2;
1901 proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_dhlen, tvb, offset, 2, ENC_BIG_ENDIAN);
1902 offset += 2;
1903 proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1904 offset += 2;
1905 if (keylen > 0) {
1906 int parsed = 0;
1908 next_tvb = tvb_new_subset_length(tvb, offset, keylen);
1909 blobtype = tvb_get_uint8(tvb, offset);
1910 switch (blobtype) {
1911 case KEYBLOB_RSA:
1912 parsed = dissect_uftp_rsablob(next_tvb, pinfo, proxykey_tree, hf_uftp_proxykey_keyblob);
1913 break;
1914 case KEYBLOB_EC:
1915 parsed = dissect_uftp_ecblob(next_tvb, pinfo, proxykey_tree, hf_uftp_proxykey_keyblob);
1916 break;
1918 offset += parsed;
1920 if (dhlen > 0) {
1921 int parsed = 0;
1923 next_tvb = tvb_new_subset_length(tvb, offset, dhlen);
1924 blobtype = tvb_get_uint8(tvb, offset);
1925 switch (blobtype) {
1926 case KEYBLOB_RSA:
1927 parsed = dissect_uftp_rsablob(next_tvb, pinfo, proxykey_tree, hf_uftp_proxykey_dhblob);
1928 break;
1929 case KEYBLOB_EC:
1930 parsed = dissect_uftp_ecblob(next_tvb, pinfo, proxykey_tree, hf_uftp_proxykey_dhblob);
1931 break;
1933 offset += parsed;
1935 if (siglen > 0) {
1936 proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_sig, tvb, offset, siglen, ENC_NA);
1940 static void dissect_uftp_congctrl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1942 proto_item *ti = NULL;
1943 proto_item *cclist = NULL;
1944 proto_item *ccitem = NULL;
1945 proto_tree *congctrl_tree = NULL;
1946 proto_tree *cclist_tree = NULL;
1947 proto_tree *ccitem_tree = NULL;
1948 int offset = 0, hlen;
1949 unsigned rate;
1950 uint8_t itemcount, idx;
1951 nstime_t tstamp;
1953 if (tvb_reported_length(tvb) < CONG_CTRL_LEN) {
1954 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1955 "Invalid length: %d", tvb_reported_length(tvb));
1956 return;
1959 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
1960 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < CONG_CTRL_LEN)) {
1961 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
1962 "Invalid length, len = %d, hlen = %d",
1963 tvb_reported_length(tvb), hlen);
1964 return;
1967 rate = unquantize_rate(tvb_get_ntohs(tvb, 6));
1969 ti = proto_tree_add_item(tree, hf_uftp_congctrl, tvb, offset, -1, ENC_NA);
1970 congctrl_tree = proto_item_add_subtree(ti, ett_uftp_congctrl);
1971 proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1972 offset += 1;
1973 proto_tree_add_uint_format_value(congctrl_tree, hf_uftp_congctrl_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
1974 offset += 1;
1975 proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1976 offset += 2;
1977 proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_cc_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
1978 offset += 2;
1979 proto_tree_add_uint(congctrl_tree, hf_uftp_congctrl_cc_rate, tvb, offset, 2, rate);
1980 offset += 2;
1981 tstamp = usec_to_nstime(tvb_get_ntoh64(tvb, offset));
1982 proto_tree_add_time(congctrl_tree, hf_uftp_congctrl_tstamp, tvb, offset, 8, &tstamp);
1984 itemcount = (tvb_reported_length(tvb) - hlen) / CC_ITEM_LEN;
1985 offset = hlen;
1986 if (itemcount > 0) {
1987 cclist = proto_tree_add_item(congctrl_tree, hf_uftp_congctrl_cclist, tvb, offset, itemcount * CC_ITEM_LEN, ENC_NA);
1988 cclist_tree = proto_item_add_subtree(cclist, ett_uftp_congctrl_cclist);
1990 for (idx = 0; idx < itemcount; idx++) {
1991 unsigned itemrate;
1992 double itemrtt;
1993 itemrtt = unquantize_grtt(tvb_get_uint8(tvb, offset + 5));
1994 itemrate = unquantize_rate(tvb_get_ntohs(tvb, offset + 6));
1996 ccitem = proto_tree_add_item(cclist_tree, hf_uftp_congctrl_item, tvb, offset, CC_ITEM_LEN, ENC_NA);
1997 ccitem_tree = proto_item_add_subtree(ccitem, ett_uftp_congctrl_item);
1998 proto_tree_add_item(ccitem_tree, hf_uftp_congctrl_item_destid, tvb, offset, 4, ENC_BIG_ENDIAN);
1999 offset += 4;
2000 proto_tree_add_bitmask(ccitem_tree, tvb, offset, hf_uftp_congctrl_item_flags, ett_uftp_congctrl_item_flags, cc_item_flags, ENC_BIG_ENDIAN);
2001 offset += 1;
2002 proto_tree_add_double(ccitem_tree, hf_uftp_congctrl_item_rtt, tvb, offset, 1, itemrtt);
2003 offset += 1;
2004 proto_tree_add_uint(ccitem_tree, hf_uftp_congctrl_item_rate, tvb, offset, 2, itemrate);
2005 offset += 2;
2009 static void dissect_uftp_ccack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2011 proto_item *ti = NULL;
2012 proto_tree *ccack_tree = NULL;
2013 int offset = 0, hlen, extlen_total;
2014 uint8_t ext_type;
2015 tvbuff_t *next_tvb;
2017 if (tvb_reported_length(tvb) < CC_ACK_LEN) {
2018 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2019 "Invalid length: %d", tvb_reported_length(tvb));
2020 return;
2023 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
2024 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < CC_ACK_LEN)) {
2025 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2026 "Invalid length, len = %d, hlen = %d",
2027 tvb_reported_length(tvb), hlen);
2028 return;
2031 ti = proto_tree_add_item(tree, hf_uftp_ccack, tvb, offset, -1, ENC_NA);
2032 ccack_tree = proto_item_add_subtree(ti, ett_uftp_ccack);
2033 proto_tree_add_item(ccack_tree, hf_uftp_ccack_func, tvb, offset, 1, ENC_BIG_ENDIAN);
2034 offset += 1;
2035 proto_tree_add_uint_format_value(ccack_tree, hf_uftp_ccack_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
2036 offset += 1;
2037 proto_tree_add_item(ccack_tree, hf_uftp_ccack_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2038 offset += 2;
2040 extlen_total = hlen - CC_ACK_LEN;
2041 while (extlen_total > 0) {
2042 int parsed = 0;
2044 next_tvb = tvb_new_subset_length(tvb, offset, extlen_total);
2045 ext_type = tvb_get_uint8(tvb, offset);
2046 switch (ext_type) {
2047 case EXT_TFMCC_ACK_INFO:
2048 parsed = dissect_uftp_tfmccack(next_tvb, pinfo, ccack_tree);
2049 break;
2051 if (!parsed) break;
2052 extlen_total -= parsed;
2053 offset += parsed;
2057 static void dissect_uftp_encrypted(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2059 proto_item *ti = NULL;
2060 proto_tree *encrypted_tree = NULL;
2061 int offset = 0;
2062 uint16_t payload_len;
2064 if (tvb_reported_length(tvb) < ENCRYPTED_LEN) {
2065 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2066 "Invalid length: %d", tvb_reported_length(tvb));
2067 return;
2070 payload_len = tvb_get_ntohs(tvb, 10);
2071 if ((int)tvb_reported_length(tvb) < ENCRYPTED_LEN + payload_len) {
2072 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2073 "Invalid length, len = %d, payload=%d",
2074 tvb_reported_length(tvb), payload_len);
2075 return;
2078 ti = proto_tree_add_item(tree, hf_uftp_encrypted, tvb, offset, -1, ENC_NA);
2079 encrypted_tree = proto_item_add_subtree(ti, ett_uftp_encrypted);
2080 proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_ivctr, tvb, offset, 8, ENC_BIG_ENDIAN);
2081 offset += 8;
2082 proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
2083 offset += 2;
2084 proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN);
2085 offset += 2;
2086 proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_payload, tvb, offset, payload_len, ENC_NA);
2089 static void dissect_uftp_abort(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
2091 proto_item *ti = NULL;
2092 proto_tree *abort_tree = NULL;
2093 int offset = 0, hlen;
2095 if (tvb_reported_length(tvb) < ABORT_LEN) {
2096 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2097 "Invalid length: %d", tvb_reported_length(tvb));
2098 return;
2101 hlen = (int)tvb_get_uint8(tvb, 1) * 4;
2102 if (((int)tvb_reported_length(tvb) < hlen) || (hlen < ABORT_LEN)) {
2103 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_length_invalid, tvb, offset, -1,
2104 "Invalid length, len = %d, hlen = %d",
2105 tvb_reported_length(tvb), hlen);
2106 return;
2109 ti = proto_tree_add_item(tree, hf_uftp_abort, tvb, offset, -1, ENC_NA);
2110 abort_tree = proto_item_add_subtree(ti, ett_uftp_abort);
2111 proto_tree_add_item(abort_tree, hf_uftp_abort_func, tvb, offset, 1, ENC_BIG_ENDIAN);
2112 offset += 1;
2113 proto_tree_add_uint_format_value(abort_tree, hf_uftp_abort_hlen, tvb, offset, 1, hlen, "%d bytes (%d)", hlen, hlen/4);
2114 offset += 1;
2115 proto_tree_add_bitmask(abort_tree, tvb, offset, hf_uftp_abort_flags, ett_uftp_abort_flags, abort_flags, ENC_BIG_ENDIAN);
2116 offset += 1;
2117 proto_tree_add_item(abort_tree, hf_uftp_abort_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2118 offset += 1;
2119 proto_tree_add_item(abort_tree, hf_uftp_abort_clientid, tvb, offset, 4, ENC_BIG_ENDIAN);
2120 offset += 4;
2121 proto_tree_add_item(abort_tree, hf_uftp_abort_message, tvb, offset, -1, ENC_ASCII);
2124 static int dissect_uftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2126 uint8_t version;
2127 uint8_t mes_type;
2128 uint32_t group_id;
2129 tvbuff_t *next_tvb;
2130 proto_item *ti = NULL;
2131 proto_tree *uftp_tree = NULL;
2132 int offset = 0;
2133 unsigned l_gsize;
2134 double grtt;
2136 if (tvb_reported_length(tvb) < UFTP_LEN + 4) {
2137 return 0;
2140 version = tvb_get_uint8(tvb, 0);
2141 mes_type = tvb_get_uint8(tvb, 1);
2142 group_id = tvb_get_ntohl(tvb, 8);
2144 if (version != UFTP_VER_NUM) {
2145 return 0;
2148 col_set_str(pinfo->cinfo, COL_PROTOCOL, "UFTP");
2149 /* Clear out stuff in the info column */
2150 col_clear(pinfo->cinfo,COL_INFO);
2151 col_add_fstr(pinfo->cinfo, COL_INFO, "%-12s",
2152 val_to_str(mes_type, messages, "Unknown (%d)"));
2153 if ((mes_type != HB_REQ) && (mes_type != HB_RESP)) {
2154 col_append_fstr(pinfo->cinfo, COL_INFO, " ID=%08X", group_id);
2157 grtt = unquantize_grtt(tvb_get_uint8(tvb, 13));
2158 l_gsize = unquantize_gsize(tvb_get_uint8(tvb, 14));
2160 ti = proto_tree_add_item(tree, proto_uftp, tvb, 0, -1, ENC_NA);
2161 uftp_tree = proto_item_add_subtree(ti, ett_uftp);
2162 proto_tree_add_item(uftp_tree, hf_uftp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
2163 offset += 1;
2164 proto_tree_add_item(uftp_tree, hf_uftp_func, tvb, offset, 1, ENC_BIG_ENDIAN);
2165 offset += 1;
2166 proto_tree_add_item(uftp_tree, hf_uftp_seq, tvb, offset, 2, ENC_BIG_ENDIAN);
2167 offset += 2;
2168 proto_tree_add_item(uftp_tree, hf_uftp_src_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2169 offset += 4;
2170 proto_tree_add_item(uftp_tree, hf_uftp_group_id, tvb, offset, 4, ENC_BIG_ENDIAN);
2171 offset += 4;
2172 proto_tree_add_item(uftp_tree, hf_uftp_group_inst, tvb, offset, 1, ENC_BIG_ENDIAN);
2173 offset += 1;
2174 proto_tree_add_double(uftp_tree, hf_uftp_grtt, tvb, offset, 1, grtt);
2175 offset += 1;
2176 proto_tree_add_uint(uftp_tree, hf_uftp_gsize, tvb, offset, 1, l_gsize);
2177 offset += 1;
2178 proto_tree_add_item(uftp_tree, hf_uftp_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2179 offset += 1;
2181 next_tvb = tvb_new_subset_length(tvb, offset, tvb_reported_length(tvb) - UFTP_LEN);
2183 switch (mes_type) {
2184 case ANNOUNCE:
2185 dissect_uftp_announce(next_tvb, pinfo, uftp_tree);
2186 break;
2187 case REGISTER:
2188 dissect_uftp_register(next_tvb, pinfo, uftp_tree);
2189 break;
2190 case CLIENT_KEY:
2191 dissect_uftp_clientkey(next_tvb, pinfo, uftp_tree);
2192 break;
2193 case REG_CONF:
2194 dissect_uftp_regconf(next_tvb, pinfo, uftp_tree);
2195 break;
2196 case KEYINFO:
2197 dissect_uftp_keyinfo(next_tvb, pinfo, uftp_tree);
2198 break;
2199 case KEYINFO_ACK:
2200 dissect_uftp_keyinfoack(next_tvb, pinfo, uftp_tree);
2201 break;
2202 case FILEINFO:
2203 dissect_uftp_fileinfo(next_tvb, pinfo, uftp_tree);
2204 break;
2205 case FILEINFO_ACK:
2206 dissect_uftp_fileinfoack(next_tvb, pinfo, uftp_tree);
2207 break;
2208 case FILESEG:
2209 dissect_uftp_fileseg(next_tvb, pinfo, uftp_tree);
2210 break;
2211 case DONE:
2212 dissect_uftp_done(next_tvb, pinfo, uftp_tree);
2213 break;
2214 case STATUS:
2215 dissect_uftp_status(next_tvb, pinfo, uftp_tree);
2216 break;
2217 case COMPLETE:
2218 dissect_uftp_complete(next_tvb, pinfo, uftp_tree);
2219 break;
2220 case DONE_CONF:
2221 dissect_uftp_doneconf(next_tvb, pinfo, uftp_tree);
2222 break;
2223 case HB_REQ:
2224 dissect_uftp_hbreq(next_tvb, pinfo, uftp_tree);
2225 break;
2226 case HB_RESP:
2227 dissect_uftp_hbresp(next_tvb, pinfo, uftp_tree);
2228 break;
2229 case PROXY_KEY:
2230 dissect_uftp_proxykey(next_tvb, pinfo, uftp_tree);
2231 break;
2232 case CONG_CTRL:
2233 dissect_uftp_congctrl(next_tvb, pinfo, uftp_tree);
2234 break;
2235 case CC_ACK:
2236 dissect_uftp_ccack(next_tvb, pinfo, uftp_tree);
2237 break;
2238 case ENCRYPTED:
2239 dissect_uftp_encrypted(next_tvb, pinfo, uftp_tree);
2240 break;
2241 case ABORT:
2242 dissect_uftp_abort(next_tvb, pinfo, uftp_tree);
2243 break;
2244 default:
2245 proto_tree_add_expert_format(tree, pinfo, &ei_uftp_func_unknown, tvb, offset, -1,
2246 "Function unknown: %d", mes_type);
2247 break;
2250 return tvb_reported_length(tvb);
2253 void proto_register_uftp5(void)
2255 static hf_register_info hf[] = {
2256 { &hf_uftp_version,
2257 { "Protocol Version", "uftp5.version",
2258 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2260 { &hf_uftp_func,
2261 { "Type", "uftp5.func",
2262 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2264 { &hf_uftp_seq,
2265 { "Sequence Number", "uftp5.seq",
2266 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2268 { &hf_uftp_src_id,
2269 { "Source ID", "uftp5.src_id",
2270 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2272 { &hf_uftp_group_id,
2273 { "Group ID", "uftp5.group_id",
2274 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2276 { &hf_uftp_group_inst,
2277 { "Group Instance ID", "uftp5.group_inst",
2278 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2280 { &hf_uftp_grtt,
2281 { "Group Round Trip Time", "uftp5.grtt",
2282 FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2284 { &hf_uftp_gsize,
2285 { "Group Size", "uftp5.gsize",
2286 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2288 { &hf_uftp_reserved,
2289 { "Reserved", "uftp5.reserved",
2290 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2292 { &hf_uftp_destlist,
2293 { "Destination List", "uftp5.destlist",
2294 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2296 { &hf_uftp_dest,
2297 { "Destination", "uftp5.dest",
2298 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2300 { &hf_uftp_announce,
2301 { "ANNOUNCE", "uftp5.announce",
2302 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2304 { &hf_uftp_announce_func,
2305 { "Type", "uftp5.announce.func",
2306 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2308 { &hf_uftp_announce_hlen,
2309 { "Header Length", "uftp5.announce.hlen",
2310 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2312 { &hf_uftp_announce_flags,
2313 { "Flags", "uftp5.announce.flags",
2314 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2316 { &hf_uftp_announce_flags_sync,
2317 { "Sync mode", "uftp5.announce.flags.sync",
2318 FT_BOOLEAN, 8, NULL, FLAG_SYNC_MODE, NULL, HFILL }
2320 { &hf_uftp_announce_flags_syncpreview,
2321 { "Sync preview mode", "uftp5.announce.flags.syncpreview",
2322 FT_BOOLEAN, 8, NULL, FLAG_SYNC_PREVIEW, NULL, HFILL }
2324 { &hf_uftp_announce_flags_ipv6,
2325 { "IPv6", "uftp5.announce.flags.ipv6",
2326 FT_BOOLEAN, 8, NULL, FLAG_IPV6, NULL, HFILL }
2328 { &hf_uftp_announce_flags_reserved,
2329 { "Reserved", "uftp5.announce.flags.reserved",
2330 FT_UINT8, BASE_HEX, NULL, FLAG_ANNOUNCE_RESERVED, NULL, HFILL }
2332 { &hf_uftp_announce_robust,
2333 { "Robustness Factor", "uftp5.announce.robust",
2334 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2336 { &hf_uftp_announce_cc_type,
2337 { "Congestion Control Type", "uftp5.announce.cc_type",
2338 FT_UINT8, BASE_DEC, VALS(cc_types), 0x0, NULL, HFILL }
2340 { &hf_uftp_announce_reserved,
2341 { "Reserved", "uftp5.announce.reserved",
2342 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2344 { &hf_uftp_announce_blocksize,
2345 { "Block Size", "uftp5.announce.blocksize",
2346 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2348 { &hf_uftp_announce_tstamp,
2349 { "Timestamp", "uftp5.announce.tstamp",
2350 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2352 { &hf_uftp_announce_publicmcast_ipv4,
2353 { "Public Multicast Address", "uftp5.announce.publicmcast.ipv4",
2354 FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2356 { &hf_uftp_announce_publicmcast_ipv6,
2357 { "Public Multicast Address", "uftp5.announce.publicmcast.ipv6",
2358 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
2360 { &hf_uftp_announce_privatemcast_ipv4,
2361 { "Private Multicast Address", "uftp5.announce.privatemcast.ipv4",
2362 FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2364 { &hf_uftp_announce_privatemcast_ipv6,
2365 { "Private Multicast Address", "uftp5.announce.privatemcast.ipv6",
2366 FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }
2368 { &hf_uftp_encinfo,
2369 { "EXT_ENC_INFO", "uftp5.encinfo",
2370 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2372 { &hf_uftp_encinfo_exttype,
2373 { "Extension Type", "uftp5.encinfo.exttype",
2374 FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2376 { &hf_uftp_encinfo_extlen,
2377 { "Extension Length", "uftp5.encinfo.extlen",
2378 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2380 { &hf_uftp_encinfo_flags,
2381 { "Flags", "uftp5.encinfo.flags",
2382 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2384 { &hf_uftp_encinfo_flags_client_auth,
2385 { "Client Authorization", "uftp5.encinfo.flags.client_auth",
2386 FT_BOOLEAN, 8, NULL, FLAG_CLIENT_AUTH, NULL, HFILL }
2388 { &hf_uftp_encinfo_flags_reserved,
2389 { "Reserved", "uftp5.encinfo.flags.reserved",
2390 FT_UINT8, BASE_HEX, NULL, FLAG_ENCINFO_RESERVED, NULL, HFILL }
2392 { &hf_uftp_encinfo_reserved,
2393 { "Reserved", "uftp5.encinfo.reserved",
2394 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2396 { &hf_uftp_encinfo_keytype,
2397 { "Key Type", "uftp5.encinfo.keytype",
2398 FT_UINT8, BASE_DEC, VALS(key_types), 0x0, NULL, HFILL }
2400 { &hf_uftp_encinfo_hashtype,
2401 { "Hash Type", "uftp5.encinfo.hashtype",
2402 FT_UINT8, BASE_DEC, VALS(hash_types), 0x0, NULL, HFILL }
2404 { &hf_uftp_encinfo_keylen,
2405 { "Public Key Length", "uftp5.encinfo.keylen",
2406 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2408 { &hf_uftp_encinfo_dhlen,
2409 { "Diffie-Hellman Key Length", "uftp5.encinfo.dhlen",
2410 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2412 { &hf_uftp_encinfo_siglen,
2413 { "Signature Length", "uftp5.encinfo.siglen",
2414 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2416 { &hf_uftp_encinfo_rand1,
2417 { "Server Random Number", "uftp5.encinfo.rand1",
2418 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2420 { &hf_uftp_encinfo_keyblob,
2421 { "Public Key Blob", "uftp5.encinfo.keyblob",
2422 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2424 { &hf_uftp_encinfo_dhblob,
2425 { "Diffie-Hellman Key Blob", "uftp5.encinfo.dhblob",
2426 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2428 { &hf_uftp_encinfo_sig,
2429 { "Signature", "uftp5.encinfo.sig",
2430 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2432 { &hf_uftp_rsablob_blobtype,
2433 { "Keyblob Type", "uftp5.rsablob.blobtype",
2434 FT_UINT8, BASE_DEC, VALS(keyblob_types), 0x0, NULL, HFILL }
2436 { &hf_uftp_rsablob_reserved,
2437 { "Reserved", "uftp5.rsablob.reserved",
2438 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2440 { &hf_uftp_rsablob_modlen,
2441 { "Modulus Length", "uftp5.rsablob.modlen",
2442 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2444 { &hf_uftp_rsablob_exponent,
2445 { "Exponent", "uftp5.rsablob.exponent",
2446 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2448 { &hf_uftp_rsablob_modulus,
2449 { "Modulus", "uftp5.rsablob.modulus",
2450 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2452 { &hf_uftp_ecblob_blobtype,
2453 { "Keyblob Type", "uftp5.ecblob.blobtype",
2454 FT_UINT8, BASE_DEC, VALS(keyblob_types), 0x0, NULL, HFILL }
2456 { &hf_uftp_ecblob_curve,
2457 { "Curve", "uftp5.ecblob.curve",
2458 FT_UINT8, BASE_DEC, VALS(curves), 0x0, NULL, HFILL }
2460 { &hf_uftp_ecblob_keylen,
2461 { "Key Length", "uftp5.ecblob.keylen",
2462 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2464 { &hf_uftp_ecblob_key,
2465 { "Key", "uftp5.ecblob.key",
2466 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2468 { &hf_uftp_register,
2469 { "REGISTER", "uftp5.register",
2470 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2472 { &hf_uftp_register_func,
2473 { "Type", "uftp5.register.func",
2474 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2476 { &hf_uftp_register_hlen,
2477 { "Header Length", "uftp5.register.hlen",
2478 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2480 { &hf_uftp_register_dhlen,
2481 { "Key Info Length", "uftp5.register.dhlen",
2482 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2484 { &hf_uftp_register_tstamp,
2485 { "Timestamp", "uftp5.register.tstamp",
2486 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2488 { &hf_uftp_register_rand2,
2489 { "Client Random Number", "uftp5.register.rand2",
2490 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2492 { &hf_uftp_register_dhkey,
2493 { "Key Info", "uftp5.register.dhkey",
2494 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2496 { &hf_uftp_clientkey,
2497 { "CLIENT_KEY", "uftp5.clientkey",
2498 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2500 { &hf_uftp_clientkey_func,
2501 { "Type", "uftp5.clientkey.func",
2502 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2504 { &hf_uftp_clientkey_hlen,
2505 { "Header Length", "uftp5.clientkey.hlen",
2506 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2508 { &hf_uftp_clientkey_reserved,
2509 { "Reserved", "uftp5.clientkey.reserved",
2510 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2512 { &hf_uftp_clientkey_bloblen,
2513 { "Keyblob Length", "uftp5.clientkey.bloblen",
2514 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2516 { &hf_uftp_clientkey_siglen,
2517 { "Signature Length", "uftp5.clientkey.siglen",
2518 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2520 { &hf_uftp_clientkey_keyblob,
2521 { "Public Key Blob", "uftp5.clientkey.keyblob",
2522 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2524 { &hf_uftp_clientkey_verify,
2525 { "Signature", "uftp5.clientkey.verify",
2526 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2528 { &hf_uftp_regconf,
2529 { "REG_CONF", "uftp5.regconf",
2530 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2532 { &hf_uftp_regconf_func,
2533 { "Type", "uftp5.regconf.func",
2534 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2536 { &hf_uftp_regconf_hlen,
2537 { "Header Length", "uftp5.regconf.hlen",
2538 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2540 { &hf_uftp_regconf_reserved,
2541 { "Reserved", "uftp5.regconf.reserved",
2542 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2544 { &hf_uftp_keyinfo,
2545 { "KEYINFO", "uftp5.keyinfo",
2546 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2548 { &hf_uftp_keyinfo_func,
2549 { "Type", "uftp5.keyinfo.func",
2550 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2552 { &hf_uftp_keyinfo_hlen,
2553 { "Header Length", "uftp5.keyinfo.hlen",
2554 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2556 { &hf_uftp_keyinfo_siglen,
2557 { "Signature Length", "uftp5.keyinfo.siglen",
2558 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2560 { &hf_uftp_keyinfo_ivctr,
2561 { "IV Counter", "uftp5.keyinfo.ivctr",
2562 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
2564 { &hf_uftp_keyinfo_sig,
2565 { "signature", "uftp5.keyinfo.sig",
2566 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2568 { &hf_uftp_keyinfo_destkey,
2569 { "Destination Key", "uftp5.keyinfo.destkey",
2570 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2572 { &hf_uftp_keyinfo_destid,
2573 { "Destination ID", "uftp5.keyinfo.destid",
2574 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2576 { &hf_uftp_keyinfo_groupmaster,
2577 { "Encrypted Group Master", "uftp5.keyinfo.groupmaster",
2578 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2580 { &hf_uftp_keyinfoack,
2581 { "KEYINFO_ACK", "uftp5.keyinfoack",
2582 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2584 { &hf_uftp_keyinfoack_func,
2585 { "Type", "uftp5.keyinfoack.func",
2586 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2588 { &hf_uftp_keyinfoack_hlen,
2589 { "Header Length", "uftp5.keyinfoack.hlen",
2590 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2592 { &hf_uftp_keyinfoack_verify_len,
2593 { "Verify Data Length", "uftp5.keyinfoack.verify_len",
2594 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2596 { &hf_uftp_keyinfoack_verify_data,
2597 { "Verify Data", "uftp5.keyinfoack.verify_data",
2598 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2600 { &hf_uftp_fileinfo,
2601 { "FILEINFO", "uftp5.fileinfo",
2602 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2604 { &hf_uftp_fileinfo_func,
2605 { "Type", "uftp5.fileinfo.func",
2606 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2608 { &hf_uftp_fileinfo_hlen,
2609 { "Header Length", "uftp5.fileinfo.hlen",
2610 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2612 { &hf_uftp_fileinfo_file_id,
2613 { "File ID", "uftp5.fileinfo.file_id",
2614 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2616 { &hf_uftp_fileinfo_ftype,
2617 { "File Type", "uftp5.fileinfo.ftype",
2618 FT_UINT8, BASE_DEC, VALS(file_types), 0x0, NULL, HFILL }
2620 { &hf_uftp_fileinfo_reserved,
2621 { "Reserved", "uftp5.fileinfo.reserved",
2622 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2624 { &hf_uftp_fileinfo_ftstamp_hi,
2625 { "File Timestamp (high order bytes)", "uftp5.fileinfo.ftstamp_hi",
2626 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2628 { &hf_uftp_fileinfo_namelen,
2629 { "Name Length", "uftp5.fileinfo.namelen",
2630 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2632 { &hf_uftp_fileinfo_linklen,
2633 { "Link Length", "uftp5.fileinfo.linklen",
2634 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2636 { &hf_uftp_fileinfo_fsize,
2637 { "File Size", "uftp5.fileinfo.fsize",
2638 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
2640 { &hf_uftp_fileinfo_ftstamp,
2641 { "File Timestamp", "uftp5.fileinfo.ftstamp",
2642 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2644 { &hf_uftp_fileinfo_tstamp,
2645 { "Timestamp", "uftp5.fileinfo.tstamp",
2646 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2648 { &hf_uftp_fileinfo_name,
2649 { "File Name", "uftp5.fileinfo.name",
2650 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2652 { &hf_uftp_fileinfo_link,
2653 { "Link Name", "uftp5.fileinfo.link",
2654 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2656 { &hf_uftp_fileinfoack,
2657 { "FILEINFO_ACK", "uftp5.fileinfoack",
2658 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2660 { &hf_uftp_fileinfoack_func,
2661 { "Type", "uftp5.fileinfoack.func",
2662 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2664 { &hf_uftp_fileinfoack_hlen,
2665 { "Header Length", "uftp5.fileinfoack.hlen",
2666 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2668 { &hf_uftp_fileinfoack_file_id,
2669 { "File ID", "uftp5.fileinfoack.file_id",
2670 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2672 { &hf_uftp_fileinfoack_flags,
2673 { "Flags", "uftp5.fileinfoack.flags",
2674 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2676 { &hf_uftp_fileinfoack_flags_partial,
2677 { "Partial", "uftp5.fileinfoack.flags.partial",
2678 FT_BOOLEAN, 8, NULL, FLAG_PARTIAL, NULL, HFILL }
2680 { &hf_uftp_fileinfoack_flags_reserved,
2681 { "Reserved", "uftp5.fileinfoack.flags.reserved",
2682 FT_UINT8, BASE_HEX, NULL, FLAG_FILEINFOACK_RESERVED, NULL, HFILL }
2684 { &hf_uftp_fileinfoack_reserved,
2685 { "Reserved", "uftp5.fileinfoack.reserved",
2686 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2688 { &hf_uftp_fileinfoack_tstamp,
2689 { "Timestamp", "uftp5.fileinfoack.tstamp",
2690 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2692 { &hf_uftp_fileseg,
2693 { "FILESEG", "uftp5.fileseg",
2694 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2696 { &hf_uftp_fileseg_func,
2697 { "Type", "uftp5.fileseg.func",
2698 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2700 { &hf_uftp_fileseg_hlen,
2701 { "Header Length", "uftp5.fileseg.hlen",
2702 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2704 { &hf_uftp_fileseg_file_id,
2705 { "File ID", "uftp5.fileseg.file_id",
2706 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2708 { &hf_uftp_fileseg_section,
2709 { "Section", "uftp5.fileseg.section",
2710 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2712 { &hf_uftp_fileseg_sec_block,
2713 { "Block", "uftp5.fileseg.sec_block",
2714 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2716 { &hf_uftp_tfmccdata,
2717 { "EXT_TFMCC_DATA_INFO", "uftp5.tfmccdata",
2718 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2720 { &hf_uftp_tfmccdata_exttype,
2721 { "Extension Type", "uftp5.tfmccdata.exttype",
2722 FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2724 { &hf_uftp_tfmccdata_extlen,
2725 { "Extension Length", "uftp5.tfmccdata.extlen",
2726 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2728 { &hf_uftp_tfmccdata_send_rate,
2729 { "Send Rate", "uftp5.tfmccdata.send_rate",
2730 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2732 { &hf_uftp_tfmccdata_cc_seq,
2733 { "CC Sequence Number", "uftp5.tfmccdata.cc_seq",
2734 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2736 { &hf_uftp_tfmccdata_cc_rate,
2737 { "Rate", "uftp5.tfmccdata.cc_rate",
2738 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2740 { &hf_uftp_fileseg_data,
2741 { "Data", "uftp5.fileseg.data",
2742 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2744 { &hf_uftp_done,
2745 { "DONE", "uftp5.done",
2746 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2748 { &hf_uftp_done_func,
2749 { "Type", "uftp5.done.func",
2750 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2752 { &hf_uftp_done_hlen,
2753 { "Header Length", "uftp5.done.hlen",
2754 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2756 { &hf_uftp_done_file_id,
2757 { "File ID", "uftp5.done.file_id",
2758 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2760 { &hf_uftp_done_section,
2761 { "Section", "uftp5.done.section",
2762 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2764 { &hf_uftp_done_reserved,
2765 { "Reserved", "uftp5.done.reserved",
2766 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2768 { &hf_uftp_status,
2769 { "STATUS", "uftp5.status",
2770 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2772 { &hf_uftp_status_func,
2773 { "Type", "uftp5.status.func",
2774 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2776 { &hf_uftp_status_hlen,
2777 { "Header Length", "uftp5.status.hlen",
2778 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2780 { &hf_uftp_status_file_id,
2781 { "File ID", "uftp5.status.file_id",
2782 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2784 { &hf_uftp_status_section,
2785 { "Section", "uftp5.status.section",
2786 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2788 { &hf_uftp_status_reserved,
2789 { "Reserved", "uftp5.status.reserved",
2790 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2792 { &hf_uftp_status_naks,
2793 { "NAKs", "uftp5.status.naks",
2794 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2796 { &hf_uftp_complete,
2797 { "COMPLETE", "uftp5.complete",
2798 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2800 { &hf_uftp_complete_func,
2801 { "Type", "uftp5.complete.func",
2802 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2804 { &hf_uftp_complete_hlen,
2805 { "Header Length", "uftp5.complete.hlen",
2806 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2808 { &hf_uftp_complete_file_id,
2809 { "File ID", "uftp5.complete.file_id",
2810 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2812 { &hf_uftp_complete_status,
2813 { "Completion Status", "uftp5.complete.status",
2814 FT_UINT8, BASE_DEC, VALS(comp_status), 0x0, NULL, HFILL }
2816 { &hf_uftp_complete_reserved,
2817 { "Reserved", "uftp5.complete.reserved",
2818 FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2820 { &hf_uftp_freespace,
2821 { "EXT_FREESPACE_INFO", "uftp5.freespace",
2822 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2824 { &hf_uftp_freespace_exttype,
2825 { "Extension Type", "uftp5.freespace.exttype",
2826 FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
2828 { &hf_uftp_freespace_extlen,
2829 { "Extension Length", "uftp5.freespace.extlen",
2830 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2832 { &hf_uftp_freespace_reserved,
2833 { "Reserved", "uftp5.freespace.reserved",
2834 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2836 { &hf_uftp_freespace_freespace,
2837 { "Free Space", "uftp5.freespace.freespace",
2838 FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
2840 { &hf_uftp_doneconf,
2841 { "DONE_CONF", "uftp5.doneconf",
2842 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2844 { &hf_uftp_doneconf_func,
2845 { "Type", "uftp5.doneconf.func",
2846 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2848 { &hf_uftp_doneconf_hlen,
2849 { "Header Length", "uftp5.doneconf.hlen",
2850 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2852 { &hf_uftp_doneconf_reserved,
2853 { "Reserved", "uftp5.doneconf.reserved",
2854 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2856 { &hf_uftp_hbreq,
2857 { "HB_REQ", "uftp5.hbreq",
2858 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2860 { &hf_uftp_hbreq_func,
2861 { "Type", "uftp5.hbreq.func",
2862 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2864 { &hf_uftp_hbreq_hlen,
2865 { "Header Length", "uftp5.hbreq.hlen",
2866 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2868 { &hf_uftp_hbreq_reserved,
2869 { "Reserved", "uftp5.hbreq.reserved",
2870 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2872 { &hf_uftp_hbreq_bloblen,
2873 { "Keyblob Length", "uftp5.hbreq.bloblen",
2874 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2876 { &hf_uftp_hbreq_siglen,
2877 { "Signature Length", "uftp5.hbreq.siglen",
2878 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2880 { &hf_uftp_hbreq_nonce,
2881 { "Nonce", "uftp5.hbreq.nonce",
2882 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2884 { &hf_uftp_hbreq_keyblob,
2885 { "Public Key Blob", "uftp5.hbreq.keyblob",
2886 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2888 { &hf_uftp_hbreq_verify,
2889 { "Signature", "uftp5.hbreq.verify",
2890 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2892 { &hf_uftp_hbresp,
2893 { "HB_RESP", "uftp5.hbresp",
2894 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2896 { &hf_uftp_hbresp_func,
2897 { "Type", "uftp5.hbresp.func",
2898 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2900 { &hf_uftp_hbresp_hlen,
2901 { "Header Length", "uftp5.hbresp.hlen",
2902 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2904 { &hf_uftp_hbresp_authenticated,
2905 { "Authenticated", "uftp5.hbresp.authenticated",
2906 FT_UINT8, BASE_DEC, VALS(hb_auth_types), 0x0, NULL, HFILL }
2908 { &hf_uftp_hbresp_reserved,
2909 { "Reserved", "uftp5.hbresp.reserved",
2910 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2912 { &hf_uftp_hbresp_nonce,
2913 { "Nonce", "uftp5.hbresp.nonce",
2914 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2916 { &hf_uftp_proxykey,
2917 { "PROXY_KEY", "uftp5.proxykey",
2918 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2920 { &hf_uftp_proxykey_func,
2921 { "Type", "uftp5.proxykey.func",
2922 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2924 { &hf_uftp_proxykey_hlen,
2925 { "Header Length", "uftp5.proxykey.hlen",
2926 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2928 { &hf_uftp_proxykey_bloblen,
2929 { "Keyblob Length", "uftp5.proxykey.bloblen",
2930 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2932 { &hf_uftp_proxykey_dhlen,
2933 { "Diffie-Hellman Keyblob Length", "uftp5.proxykey.dhlen",
2934 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2936 { &hf_uftp_proxykey_siglen,
2937 { "Signature Length", "uftp5.proxykey.siglen",
2938 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2940 { &hf_uftp_proxykey_keyblob,
2941 { "Public Key Blob", "uftp5.proxykey.keyblob",
2942 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2944 { &hf_uftp_proxykey_dhblob,
2945 { "Diffie-Hellman Key Blob", "uftp5.proxykey.dhblob",
2946 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2948 { &hf_uftp_proxykey_sig,
2949 { "Signature", "uftp5.proxykey.sig",
2950 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2952 { &hf_uftp_congctrl,
2953 { "CONG_CTRL", "uftp5.congctrl",
2954 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2956 { &hf_uftp_congctrl_func,
2957 { "Type", "uftp5.congctrl.func",
2958 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2960 { &hf_uftp_congctrl_hlen,
2961 { "Header Length", "uftp5.congctrl.hlen",
2962 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
2964 { &hf_uftp_congctrl_reserved,
2965 { "Reserved", "uftp5.congctrl.reserved",
2966 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2968 { &hf_uftp_congctrl_cc_seq,
2969 { "CC Sequence", "uftp5.congctrl.cc_seq",
2970 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2972 { &hf_uftp_congctrl_cc_rate,
2973 { "Rate", "uftp5.congctrl.cc_rate",
2974 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2976 { &hf_uftp_congctrl_tstamp,
2977 { "Timestamp", "uftp5.congctrl.tstamp",
2978 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2980 { &hf_uftp_congctrl_cclist,
2981 { "Congestion Control List", "uftp5.congctrl.cclist",
2982 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2984 { &hf_uftp_congctrl_item,
2985 { "Destination", "uftp5.congctrl.item",
2986 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2988 { &hf_uftp_congctrl_item_destid,
2989 { "Destination ID", "uftp5.congctrl.item.destid",
2990 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2992 { &hf_uftp_congctrl_item_flags,
2993 { "Flags", "uftp5.congctrl.item.flags",
2994 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2996 { &hf_uftp_congctrl_item_flags_clr,
2997 { "CLR", "uftp5.congctrl.item.flags.clr",
2998 FT_BOOLEAN, 8, NULL, FLAG_CC_CLR, NULL, HFILL }
3000 { &hf_uftp_congctrl_item_flags_rtt,
3001 { "RTT", "uftp5.congctrl.item.flags.rtt",
3002 FT_BOOLEAN, 8, NULL, FLAG_CC_RTT, NULL, HFILL }
3004 { &hf_uftp_congctrl_item_flags_start,
3005 { "Slowstart", "uftp5.congctrl.item.flags.start",
3006 FT_BOOLEAN, 8, NULL, FLAG_CC_START, NULL, HFILL }
3008 { &hf_uftp_congctrl_item_flags_leave,
3009 { "Leave", "uftp5.congctrl.item.flags.leave",
3010 FT_BOOLEAN, 8, NULL, FLAG_CC_LEAVE, NULL, HFILL }
3012 { &hf_uftp_congctrl_item_flags_reserved,
3013 { "Reserved", "uftp5.congctrl.item.flags.reserved",
3014 FT_UINT8, BASE_HEX, NULL, FLAG_CC_RESERVED, NULL, HFILL }
3016 { &hf_uftp_congctrl_item_rtt,
3017 { "Round Trip Time", "uftp5.congctrl.item.rtt",
3018 FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3020 { &hf_uftp_congctrl_item_rate,
3021 { "Rate", "uftp5.congctrl.item.rate",
3022 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3024 { &hf_uftp_ccack,
3025 { "CC_ACK", "uftp5.ccack",
3026 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3028 { &hf_uftp_ccack_func,
3029 { "Type", "uftp5.ccack.func",
3030 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3032 { &hf_uftp_ccack_hlen,
3033 { "Header Length", "uftp5.ccack.hlen",
3034 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3036 { &hf_uftp_ccack_reserved,
3037 { "Reserved", "uftp5.ccack.reserved",
3038 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
3040 { &hf_uftp_tfmccack,
3041 { "EXT_TFMCC_ACK_INFO", "uftp5.tfmccack",
3042 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3044 { &hf_uftp_tfmccack_exttype,
3045 { "Extension Type", "uftp5.tfmccack.exttype",
3046 FT_UINT8, BASE_DEC, VALS(extensions), 0x0, NULL, HFILL }
3048 { &hf_uftp_tfmccack_extlen,
3049 { "Extension Length", "uftp5.tfmccack.extlen",
3050 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3052 { &hf_uftp_tfmccack_flags,
3053 { "Flags", "uftp5.tfmccack.flags",
3054 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3056 { &hf_uftp_tfmccack_flags_clr,
3057 { "CLR", "uftp5.tfmccack.flags.clr",
3058 FT_BOOLEAN, 8, NULL, FLAG_CC_CLR, NULL, HFILL }
3060 { &hf_uftp_tfmccack_flags_rtt,
3061 { "RTT", "uftp5.tfmccack.flags.rtt",
3062 FT_BOOLEAN, 8, NULL, FLAG_CC_RTT, NULL, HFILL }
3064 { &hf_uftp_tfmccack_flags_start,
3065 { "Slowstart", "uftp5.tfmccack.flags.start",
3066 FT_BOOLEAN, 8, NULL, FLAG_CC_START, NULL, HFILL }
3068 { &hf_uftp_tfmccack_flags_leave,
3069 { "Leave", "uftp5.tfmccack.flags.leave",
3070 FT_BOOLEAN, 8, NULL, FLAG_CC_LEAVE, NULL, HFILL }
3072 { &hf_uftp_tfmccack_flags_reserved,
3073 { "Reserved", "uftp5.tfmccack.flags.reserved",
3074 FT_UINT8, BASE_HEX, NULL, FLAG_CC_RESERVED, NULL, HFILL }
3076 { &hf_uftp_tfmccack_reserved,
3077 { "Reserved", "uftp5.tfmccack.reserved",
3078 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3080 { &hf_uftp_tfmccack_cc_seq,
3081 { "CC Sequence Number", "uftp5.tfmccack.cc_seq",
3082 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3084 { &hf_uftp_tfmccack_cc_rate,
3085 { "Rate", "uftp5.tfmccack.cc_rate",
3086 FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
3088 { &hf_uftp_tfmccack_client_id,
3089 { "Client ID", "uftp5.tfmccack.client_id",
3090 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3092 { &hf_uftp_tfmccack_tstamp,
3093 { "Timestamp", "uftp5.tfmccack.tstamp",
3094 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
3096 { &hf_uftp_encrypted,
3097 { "ENCRYPTED", "uftp5.encrypted",
3098 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3100 { &hf_uftp_encrypted_ivctr,
3101 { "IV Counter", "uftp5.encrypted.ivctr",
3102 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }
3104 { &hf_uftp_encrypted_reserved,
3105 { "Reserved", "uftp5.encrypted.reserved",
3106 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
3108 { &hf_uftp_encrypted_payload_len,
3109 { "Payload Length", "uftp5.encrypted.payload_len",
3110 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
3112 { &hf_uftp_encrypted_payload,
3113 { "Encrypted Payload", "uftp5.encrypted.payload",
3114 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
3116 { &hf_uftp_abort,
3117 { "ABORT", "uftp5.abort",
3118 FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
3120 { &hf_uftp_abort_func,
3121 { "Type", "uftp5.abort.func",
3122 FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
3124 { &hf_uftp_abort_hlen,
3125 { "Header Length", "uftp5.abort.hlen",
3126 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
3128 { &hf_uftp_abort_flags,
3129 { "Flags", "uftp5.abort.flags",
3130 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3132 { &hf_uftp_abort_flags_curfile,
3133 { "Current file", "uftp5.abort.flags.curfile",
3134 FT_BOOLEAN, 8, NULL, FLAG_CURRENT_FILE, NULL, HFILL }
3136 { &hf_uftp_abort_flags_reserved,
3137 { "Reserved", "uftp5.abort.flags.reserved",
3138 FT_UINT8, BASE_HEX, NULL, FLAG_ABORT_RESERVED, NULL, HFILL }
3140 { &hf_uftp_abort_reserved,
3141 { "Reserved", "uftp5.abort.reserved",
3142 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
3144 { &hf_uftp_abort_clientid,
3145 { "Client ID", "uftp5.abort.clientid",
3146 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
3148 { &hf_uftp_abort_message,
3149 { "Message", "uftp5.abort.message",
3150 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
3154 /* Setup protocol subtree array */
3155 static int *ett[] = {
3156 &ett_uftp,
3157 &ett_uftp_announce,
3158 &ett_uftp_encinfo,
3159 &ett_uftp_register,
3160 &ett_uftp_clientkey,
3161 &ett_uftp_regconf,
3162 &ett_uftp_keyinfo,
3163 &ett_uftp_keyinfo_destkey,
3164 &ett_uftp_keyinfoack,
3165 &ett_uftp_fileinfo,
3166 &ett_uftp_fileinfoack,
3167 &ett_uftp_fileseg,
3168 &ett_uftp_tfmccdata,
3169 &ett_uftp_done,
3170 &ett_uftp_status,
3171 &ett_uftp_complete,
3172 &ett_uftp_freespace,
3173 &ett_uftp_doneconf,
3174 &ett_uftp_hbreq,
3175 &ett_uftp_hbresp,
3176 &ett_uftp_proxykey,
3177 &ett_uftp_congctrl,
3178 &ett_uftp_congctrl_cclist,
3179 &ett_uftp_congctrl_item,
3180 &ett_uftp_ccack,
3181 &ett_uftp_tfmccack,
3182 &ett_uftp_encrypted,
3183 &ett_uftp_abort,
3184 &ett_uftp_announce_flags,
3185 &ett_uftp_encinfo_flags,
3186 &ett_uftp_fileinfoack_flags,
3187 &ett_uftp_abort_flags,
3188 &ett_uftp_congctrl_item_flags,
3189 &ett_uftp_tfmccack_flags,
3190 &ett_uftp_destlist,
3191 &ett_uftp_rsablob,
3192 &ett_uftp_ecblob
3195 static ei_register_info ei[] = {
3196 { &ei_uftp_length_invalid, { "uftp5.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }},
3197 { &ei_uftp_func_unknown, { "uftp5.func.invalid", PI_MALFORMED, PI_ERROR, "Unknown function", EXPFILL }}
3200 expert_module_t* expert_uftp;
3202 proto_uftp = proto_register_protocol("UDP based FTP w/ multicast V5",
3203 "UFTP5", "uftp5");
3204 proto_register_field_array(proto_uftp, hf, array_length(hf));
3205 proto_register_subtree_array(ett, array_length(ett));
3206 register_dissector("uftp5", dissect_uftp, proto_uftp);
3207 expert_uftp = expert_register_protocol(proto_uftp);
3208 expert_register_field_array(expert_uftp, ei, array_length(ei));
3212 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3214 * Local variables:
3215 * c-basic-offset: 4
3216 * tab-width: 8
3217 * indent-tabs-mode: nil
3218 * End:
3220 * vi: set shiftwidth=4 tabstop=8 expandtab:
3221 * :indentSize=4:tabSize=8:noTabs=true: