Coverage Report

Created: 2026-07-12 07:10

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-uftp.c
Line
Count
Source
1
/* packet-uftp.c
2
 * Routines for UFTP packet dissection
3
 * Copyright Dennis Bush <bush@tcnj.edu>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include "config.h"
13
14
#include <epan/packet.h>
15
#include <epan/expert.h>
16
17
20
#define UFTP_VER_NUM 0x31
18
9
#define UFTP_3_0_VER 0x30
19
20
0
#define ANNOUNCE    1
21
0
#define REGISTER    2
22
0
#define CLIENT_KEY  3
23
0
#define REG_CONF    4
24
0
#define FILEINFO    5
25
0
#define KEYINFO     6
26
0
#define INFO_ACK    7
27
0
#define FILESEG     8
28
0
#define DONE        9
29
0
#define STATUS     10
30
0
#define PRSTATUS   11
31
0
#define COMPLETE   12
32
0
#define DONE_CONF  13
33
0
#define HB_REQ     14
34
0
#define HB_RESP    15
35
0
#define KEY_REQ    16
36
0
#define PROXY_KEY  17
37
0
#define ENCRYPTED  80
38
0
#define ABORT      99
39
40
#define MAXDEST 10000
41
#define MAXFILENAME 100
42
#define MAXDIRNAME 200
43
0
#define MAXPATHNAME 300
44
#define MAXPROXYDEST 1000
45
46
#define DESTNAME_LEN 100
47
#define MAXFILES 500
48
#define IFNAME_LEN 25
49
#define MAX_INTERFACES 20
50
#define IPSTR_LEN 16
51
52
#define FTYPE_REG 0
53
#define FTYPE_DIR 1
54
#define FTYPE_LINK 2
55
56
#define KEY_NONE 0x00
57
#define KEY_DES 0x01
58
#define KEY_DES_EDE3 0x02
59
#define KEY_AES128 0x03
60
#define KEY_AES256 0x04
61
62
#define HASH_NONE 0x00
63
#define HASH_MD5 0x01
64
#define HASH_SHA1 0x02
65
#define HASH_SHA256 0x03
66
67
#define SIG_NONE 0x00
68
#define SIG_HMAC 0x01
69
#define SIG_RSA 0x02
70
71
15
#define FLAG_RESTART 0x01
72
15
#define FLAG_SYNC_MODE 0x02
73
15
#define FLAG_SYNC_PREVIEW 0x04
74
15
#define FLAG_ANNOUNCE_RESERVED 0xF8
75
76
15
#define FLAG_PARTIAL 0x01
77
15
#define FLAG_INFOACK_RESERVED 0xFE
78
79
15
#define FLAG_CURRENT_FILE 0x01
80
15
#define FLAG_ABORT_RESERVED 0xFE
81
82
#define COMP_STAT_NORMAL 0
83
#define COMP_STAT_SKIPPED 1
84
#define COMP_STAT_OVERWRITE 2
85
#define COMP_STAT_REJECTED 3
86
87
#define HB_AUTH_FAILED 0
88
#define HB_AUTH_OK 1
89
#define HB_AUTH_CHALLENGE 2
90
91
#define PUBKEY_LEN 256  /* big enough for RSA-2048 */
92
0
#define RAND_LEN 32     /* rfc 5246 */
93
#define HMAC_LEN 32     /* big enough for SHA-256 */
94
0
#define VERIFY_LEN 12   /* rfc 5246 */
95
#define MASTER_LEN 48   /* rfc 5246 */
96
#define MAXIV 16        /* big enough for AES256 */
97
#define MAXKEY 32       /* big enough for AES256 */
98
#define KEYBLSIZE 16    /* Maximum symetric key blocksize */
99
#define DEF_RSA_LEN 512 /* Default length of generated RSA keys */
100
#define RSA_EXP 65537   /* Public key exponent of generated RSA keys */
101
102
3
#define UFTP_LEN 16
103
0
#define ANNOUNCE_LEN 64
104
0
#define REGISTER_LEN 40
105
0
#define CLIENT_KEY_LEN 12
106
0
#define REG_CONF_LEN 4
107
0
#define FILEINFO_LEN 324
108
0
#define FILEINFO_30_LEN 320
109
0
#define KEYINFO_LEN 12
110
0
#define DESTKEY_LEN 52
111
0
#define INFO_ACK_LEN 20
112
0
#define FILESEG_LEN 12
113
0
#define DONE_LEN 8
114
0
#define STATUS_LEN 12
115
0
#define PRSTATUS_LEN 12
116
0
#define COMPLETE_LEN 8
117
0
#define DONE_CONF_LEN 8
118
0
#define HB_REQ_LEN 16
119
0
#define HB_RESP_LEN 8
120
0
#define KEY_REQ_LEN 4
121
0
#define PROXY_KEY_LEN 16
122
0
#define ENCRYPTED_LEN 12
123
0
#define ABORT_LEN 308
124
125
void proto_register_uftp(void);
126
void proto_reg_handoff_uftp(void);
127
128
static dissector_handle_t uftp_handle;
129
130
static int proto_uftp;
131
15
#define UFTP_PORT   1044 /* Not IANA registered */
132
133
/* main header and common fields */
134
static int hf_uftp_version;
135
static int hf_uftp_func;
136
static int hf_uftp_blsize;
137
static int hf_uftp_group_id;
138
static int hf_uftp_srcaddr;
139
static int hf_uftp_destaddr;
140
141
static int hf_uftp_destlist;
142
static int hf_uftp_dest;
143
144
/* ANNOUNCE fields */
145
static int hf_uftp_announce;
146
static int hf_uftp_announce_func;
147
static int hf_uftp_announce_flags;
148
static int hf_uftp_announce_flags_restart;
149
static int hf_uftp_announce_flags_sync;
150
static int hf_uftp_announce_flags_syncpreview;
151
static int hf_uftp_announce_flags_reserved;
152
static int hf_uftp_announce_destcount;
153
static int hf_uftp_announce_announce_int;
154
static int hf_uftp_announce_status_int;
155
static int hf_uftp_announce_register_int;
156
static int hf_uftp_announce_done_int;
157
static int hf_uftp_announce_announce_time;
158
static int hf_uftp_announce_status_time;
159
static int hf_uftp_announce_mtu;
160
static int hf_uftp_announce_privatemcast;
161
static int hf_uftp_announce_client_auth;
162
static int hf_uftp_announce_sigtype;
163
static int hf_uftp_announce_hashtype;
164
static int hf_uftp_announce_keytype;
165
static int hf_uftp_announce_keylen;
166
static int hf_uftp_announce_reserved;
167
static int hf_uftp_announce_keyexp;
168
static int hf_uftp_announce_rand1;
169
static int hf_uftp_announce_keymod;
170
171
/* REGISTER fields */
172
static int hf_uftp_register;
173
static int hf_uftp_register_func;
174
static int hf_uftp_register_reserved;
175
static int hf_uftp_register_destcount;
176
static int hf_uftp_register_premaster_len;
177
static int hf_uftp_register_rand2;
178
static int hf_uftp_register_premaster;
179
180
/* CLIENT_KEY fields */
181
static int hf_uftp_clientkey;
182
static int hf_uftp_clientkey_func;
183
static int hf_uftp_clientkey_reserved;
184
static int hf_uftp_clientkey_keylen;
185
static int hf_uftp_clientkey_verifylen;
186
static int hf_uftp_clientkey_keyexp;
187
static int hf_uftp_clientkey_keymod;
188
static int hf_uftp_clientkey_verify;
189
190
/* REG_CONF fields */
191
static int hf_uftp_regconf;
192
static int hf_uftp_regconf_func;
193
static int hf_uftp_regconf_reserved;
194
static int hf_uftp_regconf_destcount;
195
196
/* FILEINFO fields */
197
static int hf_uftp_fileinfo;
198
static int hf_uftp_fileinfo_func;
199
static int hf_uftp_fileinfo_ftype;
200
static int hf_uftp_fileinfo_file_id;
201
static int hf_uftp_fileinfo_block_total;
202
static int hf_uftp_fileinfo_section_total;
203
static int hf_uftp_fileinfo_destcount;
204
static int hf_uftp_fileinfo_fsize;
205
static int hf_uftp_fileinfo_ftstamp;
206
static int hf_uftp_fileinfo_name;
207
208
/* KEYINFO fields */
209
static int hf_uftp_keyinfo;
210
static int hf_uftp_keyinfo_func;
211
static int hf_uftp_keyinfo_reserved;
212
static int hf_uftp_keyinfo_destcount;
213
static int hf_uftp_keyinfo_groupmaster_len;
214
static int hf_uftp_keyinfo_tstamp;
215
static int hf_uftp_keyinfo_destkey;
216
static int hf_uftp_keyinfo_destaddr;
217
static int hf_uftp_keyinfo_groupmaster;
218
219
/* INFO_ACK fields */
220
static int hf_uftp_infoack;
221
static int hf_uftp_infoack_func;
222
static int hf_uftp_infoack_flags;
223
static int hf_uftp_infoack_flags_partial;
224
static int hf_uftp_infoack_flags_reserved;
225
static int hf_uftp_infoack_file_id;
226
static int hf_uftp_infoack_destcount;
227
static int hf_uftp_infoack_reserved;
228
static int hf_uftp_infoack_verify_data;
229
230
/* FILESEG fields */
231
static int hf_uftp_fileseg;
232
static int hf_uftp_fileseg_func;
233
static int hf_uftp_fileseg_reserved1;
234
static int hf_uftp_fileseg_file_id;
235
static int hf_uftp_fileseg_pass;
236
static int hf_uftp_fileseg_reserved2;
237
static int hf_uftp_fileseg_section;
238
static int hf_uftp_fileseg_seq_num;
239
static int hf_uftp_fileseg_data;
240
241
/* DONE fields */
242
static int hf_uftp_done;
243
static int hf_uftp_done_func;
244
static int hf_uftp_done_pass;
245
static int hf_uftp_done_section;
246
static int hf_uftp_done_file_id;
247
static int hf_uftp_done_destcount;
248
249
/* STATUS fields */
250
static int hf_uftp_status;
251
static int hf_uftp_status_func;
252
static int hf_uftp_status_reserved;
253
static int hf_uftp_status_file_id;
254
static int hf_uftp_status_pass;
255
static int hf_uftp_status_seq;
256
static int hf_uftp_status_section;
257
static int hf_uftp_status_nak_count;
258
static int hf_uftp_status_naks;
259
260
/* PRSTATUS fields */
261
static int hf_uftp_prstatus;
262
static int hf_uftp_prstatus_func;
263
static int hf_uftp_prstatus_reserved1;
264
static int hf_uftp_prstatus_file_id;
265
static int hf_uftp_prstatus_pass;
266
static int hf_uftp_prstatus_seq;
267
static int hf_uftp_prstatus_section;
268
static int hf_uftp_prstatus_destcount;
269
static int hf_uftp_prstatus_reserved2;
270
271
/* COMPLETE fields */
272
static int hf_uftp_complete;
273
static int hf_uftp_complete_func;
274
static int hf_uftp_complete_status;
275
static int hf_uftp_complete_file_id;
276
static int hf_uftp_complete_destcount;
277
static int hf_uftp_complete_reserved2;
278
279
/* DONE_CONF fields */
280
static int hf_uftp_doneconf;
281
static int hf_uftp_doneconf_func;
282
static int hf_uftp_doneconf_reserved1;
283
static int hf_uftp_doneconf_file_id;
284
static int hf_uftp_doneconf_destcount;
285
static int hf_uftp_doneconf_reserved2;
286
287
/* HB_REQ fields */
288
static int hf_uftp_hbreq;
289
static int hf_uftp_hbreq_func;
290
static int hf_uftp_hbreq_reserved;
291
static int hf_uftp_hbreq_nonce;
292
static int hf_uftp_hbreq_keylen;
293
static int hf_uftp_hbreq_siglen;
294
static int hf_uftp_hbreq_keyexp;
295
static int hf_uftp_hbreq_keymod;
296
static int hf_uftp_hbreq_verify;
297
298
/* HB_RESP fields */
299
static int hf_uftp_hbresp;
300
static int hf_uftp_hbresp_func;
301
static int hf_uftp_hbresp_authenticated;
302
static int hf_uftp_hbresp_reserved;
303
static int hf_uftp_hbresp_nonce;
304
305
/* KEY_REQ fields */
306
static int hf_uftp_keyreq;
307
static int hf_uftp_keyreq_func;
308
static int hf_uftp_keyreq_reserved;
309
310
/* PROXY_KEY fields */
311
static int hf_uftp_proxykey;
312
static int hf_uftp_proxykey_func;
313
static int hf_uftp_proxykey_reserved;
314
static int hf_uftp_proxykey_nonce;
315
static int hf_uftp_proxykey_keylen;
316
static int hf_uftp_proxykey_siglen;
317
static int hf_uftp_proxykey_keyexp;
318
static int hf_uftp_proxykey_keymod;
319
static int hf_uftp_proxykey_verify;
320
321
/* ENCRYPTED fields */
322
static int hf_uftp_encrypted;
323
static int hf_uftp_encrypted_tstamp;
324
static int hf_uftp_encrypted_sig_len;
325
static int hf_uftp_encrypted_payload_len;
326
static int hf_uftp_encrypted_signature;
327
static int hf_uftp_encrypted_payload;
328
329
/* ABORT fields */
330
static int hf_uftp_abort;
331
static int hf_uftp_abort_func;
332
static int hf_uftp_abort_flags;
333
static int hf_uftp_abort_flags_curfile;
334
static int hf_uftp_abort_flags_reserved;
335
static int hf_uftp_abort_reserved;
336
static int hf_uftp_abort_host;
337
static int hf_uftp_abort_message;
338
339
static int ett_uftp;
340
static int ett_uftp_announce;
341
static int ett_uftp_register;
342
static int ett_uftp_clientkey;
343
static int ett_uftp_regconf;
344
static int ett_uftp_fileinfo;
345
static int ett_uftp_keyinfo;
346
static int ett_uftp_infoack;
347
static int ett_uftp_fileseg;
348
static int ett_uftp_done;
349
static int ett_uftp_status;
350
static int ett_uftp_prstatus;
351
static int ett_uftp_complete;
352
static int ett_uftp_doneconf;
353
static int ett_uftp_hbreq;
354
static int ett_uftp_hbresp;
355
static int ett_uftp_keyreq;
356
static int ett_uftp_proxykey;
357
static int ett_uftp_encrypted;
358
static int ett_uftp_abort;
359
360
static int ett_uftp_announce_flags;
361
static int ett_uftp_keyinfo_destkey;
362
static int ett_uftp_infoack_flags;
363
static int ett_uftp_abort_flags;
364
365
static int ett_uftp_destlist;
366
367
static expert_field ei_uftp_length_invalid;
368
static expert_field ei_uftp_func_unknown;
369
370
static dissector_handle_t uftp4_handle;
371
static dissector_handle_t uftp5_handle;
372
373
static const value_string messages[] = {
374
    { ANNOUNCE,   "ANNOUNCE" },
375
    { REGISTER,   "REGISTER" },
376
    { CLIENT_KEY, "CLIENT_KEY" },
377
    { REG_CONF,   "REG_CONF" },
378
    { FILEINFO,   "FILEINFO" },
379
    { KEYINFO,    "KEYINFO" },
380
    { INFO_ACK,   "INFO_ACK" },
381
    { FILESEG,    "FILESEG" },
382
    { DONE,       "DONE" },
383
    { STATUS,     "STATUS" },
384
    { PRSTATUS,   "PRSTATUS" },
385
    { COMPLETE,   "COMPLETE" },
386
    { DONE_CONF,  "DONE_CONF" },
387
    { HB_REQ,     "HB_REQ" },
388
    { HB_RESP,    "HB_RESP" },
389
    { KEY_REQ,    "KEY_REQ" },
390
    { PROXY_KEY,  "PROXY_KEY" },
391
    { ENCRYPTED,  "ENCRYPTED" },
392
    { ABORT,      "ABORT" },
393
    { 0, NULL }
394
};
395
396
static const value_string signature_types[] = {
397
    { SIG_NONE, "NONE" },
398
    { SIG_HMAC, "HMAC" },
399
    { SIG_RSA,  "RSA" },
400
    { 0, NULL }
401
};
402
403
static const value_string hash_types[] = {
404
    { HASH_NONE,   "NONE" },
405
    { HASH_MD5,    "MD5" },
406
    { HASH_SHA1,   "SHA-1" },
407
    { HASH_SHA256, "SHA-256" },
408
    { 0, NULL }
409
};
410
411
static const value_string key_types[] = {
412
    { KEY_NONE,     "NONE" },
413
    { KEY_DES,      "DES" },
414
    { KEY_DES_EDE3, "3 Key Triple DES" },
415
    { KEY_AES128,   "AES-128" },
416
    { KEY_AES256,   "AES-256" },
417
    { 0, NULL }
418
};
419
420
static const value_string hb_auth_types[] = {
421
    { HB_AUTH_FAILED,    "Authorization Failed" },
422
    { HB_AUTH_OK,        "Authorization Succeeded" },
423
    { HB_AUTH_CHALLENGE, "Authorization Required" },
424
    { 0, NULL }
425
};
426
427
static const value_string file_types[] = {
428
    { FTYPE_REG,  "Regular file" },
429
    { FTYPE_DIR,  "Directory" },
430
    { FTYPE_LINK, "Symbolic link" },
431
    { 0, NULL }
432
};
433
434
static int * const announce_flags[] = {
435
    &hf_uftp_announce_flags_restart,
436
    &hf_uftp_announce_flags_sync,
437
    &hf_uftp_announce_flags_syncpreview,
438
    &hf_uftp_announce_flags_reserved,
439
    NULL
440
};
441
442
static int * const infoack_flags[] = {
443
    &hf_uftp_infoack_flags_partial,
444
    &hf_uftp_infoack_flags_reserved,
445
    NULL
446
};
447
448
static int * const abort_flags[] = {
449
    &hf_uftp_abort_flags_curfile,
450
    &hf_uftp_abort_flags_reserved,
451
    NULL
452
};
453
454
static const value_string comp_status[] = {
455
    { COMP_STAT_NORMAL,     "Normal" },
456
    { COMP_STAT_SKIPPED,    "Skipped" },
457
    { COMP_STAT_OVERWRITE,  "Overwrite" },
458
    { COMP_STAT_REJECTED,   "Rejected" },
459
    { 0, NULL }
460
};
461
462
static void dissect_uftp_announce(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
463
0
{
464
0
    proto_item *ti = NULL;
465
0
    proto_item *destlist = NULL;
466
0
    proto_tree *announce_tree = NULL;
467
0
    proto_tree *destlist_tree = NULL;
468
0
    unsigned offset = 0;
469
0
    uint16_t destcount, keylen, idx;
470
471
0
    if (tvb_reported_length(tvb) < ANNOUNCE_LEN) {
472
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
473
0
                            "Invalid length: %d", tvb_reported_length(tvb));
474
0
        return;
475
0
    }
476
477
0
    destcount = tvb_get_ntohs(tvb, 2);
478
0
    keylen = tvb_get_ntohs(tvb, 24);
479
0
    if ((int)tvb_reported_length(tvb) < ANNOUNCE_LEN + keylen + (destcount * 4)) {
480
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
481
0
                            "Invalid length, len = %d, keylen = %d, count=%d",
482
0
                            tvb_reported_length(tvb), keylen, destcount);
483
0
        return;
484
0
    }
485
486
0
    ti = proto_tree_add_item(tree, hf_uftp_announce, tvb, offset, -1, ENC_NA);
487
0
    announce_tree = proto_item_add_subtree(ti, ett_uftp_announce);
488
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_func, tvb, offset, 1, ENC_BIG_ENDIAN);
489
0
    offset += 1;
490
0
    proto_tree_add_bitmask(announce_tree, tvb, offset, hf_uftp_announce_flags, ett_uftp_announce_flags, announce_flags, ENC_BIG_ENDIAN);
491
0
    offset += 1;
492
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
493
0
    offset += 2;
494
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_announce_int, tvb, offset, 2, ENC_BIG_ENDIAN);
495
0
    offset += 2;
496
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_status_int, tvb, offset, 2, ENC_BIG_ENDIAN);
497
0
    offset += 2;
498
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_register_int, tvb, offset, 2, ENC_BIG_ENDIAN);
499
0
    offset += 2;
500
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_done_int, tvb, offset, 2, ENC_BIG_ENDIAN);
501
0
    offset += 2;
502
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_announce_time, tvb, offset, 1, ENC_BIG_ENDIAN);
503
0
    offset += 1;
504
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_status_time, tvb, offset, 1, ENC_BIG_ENDIAN);
505
0
    offset += 1;
506
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_mtu, tvb, offset, 2, ENC_BIG_ENDIAN);
507
0
    offset += 2;
508
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_privatemcast, tvb, offset, 4, ENC_BIG_ENDIAN);
509
0
    offset += 4;
510
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_client_auth, tvb, offset, 1, ENC_BIG_ENDIAN);
511
0
    offset += 1;
512
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_sigtype, tvb, offset, 1, ENC_BIG_ENDIAN);
513
0
    offset += 1;
514
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_hashtype, tvb, offset, 1, ENC_BIG_ENDIAN);
515
0
    offset += 1;
516
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_keytype, tvb, offset, 1, ENC_BIG_ENDIAN);
517
0
    offset += 1;
518
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_keylen, tvb, offset, 2, ENC_BIG_ENDIAN);
519
0
    offset += 2;
520
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
521
0
    offset += 2;
522
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_keyexp, tvb, offset, 4, ENC_BIG_ENDIAN);
523
0
    offset += 4;
524
0
    proto_tree_add_item(announce_tree, hf_uftp_announce_rand1, tvb, offset, RAND_LEN, ENC_NA);
525
0
    offset += RAND_LEN;
526
0
    if (keylen > 0) {
527
0
        proto_tree_add_item(announce_tree, hf_uftp_announce_keymod, tvb, offset, keylen, ENC_NA);
528
0
        offset += keylen;
529
0
    }
530
0
    if (destcount > 0) {
531
0
        destlist = proto_tree_add_item(announce_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
532
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
533
0
    }
534
0
    for (idx = 0; idx < destcount; idx++) {
535
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
536
0
        offset += 4;
537
0
    }
538
0
}
539
540
static void dissect_uftp_register(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
541
0
{
542
0
    proto_item *ti = NULL;
543
0
    proto_item *destlist = NULL;
544
0
    proto_tree *register_tree = NULL;
545
0
    proto_tree *destlist_tree = NULL;
546
0
    unsigned offset = 0;
547
0
    uint16_t destcount, keylen, idx;
548
549
0
    if (tvb_reported_length(tvb) < REGISTER_LEN) {
550
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
551
0
                            "Invalid length: %d", tvb_reported_length(tvb));
552
0
        return;
553
0
    }
554
555
0
    destcount = tvb_get_ntohs(tvb, 4);
556
0
    keylen = tvb_get_ntohs(tvb, 6);
557
0
    if ((int)tvb_reported_length(tvb) < REGISTER_LEN + keylen + (destcount * 4)) {
558
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
559
0
                            "Invalid length, len = %d, keylen = %d, count=%d",
560
0
                            tvb_reported_length(tvb), keylen, destcount);
561
0
        return;
562
0
    }
563
564
0
    ti = proto_tree_add_item(tree, hf_uftp_register, tvb, offset, -1, ENC_NA);
565
0
    register_tree = proto_item_add_subtree(ti, ett_uftp_register);
566
0
    proto_tree_add_item(register_tree, hf_uftp_register_func, tvb, offset, 1, ENC_BIG_ENDIAN);
567
0
    offset += 1;
568
0
    proto_tree_add_item(register_tree, hf_uftp_register_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
569
0
    offset += 3;
570
0
    proto_tree_add_item(register_tree, hf_uftp_register_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
571
0
    offset += 2;
572
0
    proto_tree_add_item(register_tree, hf_uftp_register_premaster_len, tvb, offset, 2, ENC_BIG_ENDIAN);
573
0
    offset += 2;
574
0
    proto_tree_add_item(register_tree, hf_uftp_register_rand2, tvb, offset, RAND_LEN, ENC_NA);
575
0
    offset += RAND_LEN;
576
0
    if (keylen > 0) {
577
0
        proto_tree_add_item(register_tree, hf_uftp_register_premaster, tvb, offset, keylen, ENC_NA);
578
0
        offset += keylen;
579
0
    }
580
0
    if (destcount > 0) {
581
0
        destlist = proto_tree_add_item(register_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
582
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
583
0
    }
584
0
    for (idx = 0; idx < destcount; idx++) {
585
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
586
0
        offset += 4;
587
0
    }
588
0
}
589
590
static void dissect_uftp_clientkey(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
591
0
{
592
0
    proto_item *ti = NULL;
593
0
    proto_tree *clientkey_tree = NULL;
594
0
    unsigned offset = 0;
595
0
    uint16_t keylen, verifylen;
596
597
0
    if (tvb_reported_length(tvb) < CLIENT_KEY_LEN) {
598
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
599
0
                            "Invalid length: %d", tvb_reported_length(tvb));
600
0
        return;
601
0
    }
602
603
0
    keylen = tvb_get_ntohs(tvb, 4);
604
0
    verifylen = tvb_get_ntohs(tvb, 6);
605
0
    if ((int)tvb_reported_length(tvb) < CLIENT_KEY_LEN + keylen + verifylen) {
606
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
607
0
                            "Invalid length, len = %d, keylen=%d verifylen=%d",
608
0
                            tvb_reported_length(tvb), keylen, verifylen);
609
0
        return;
610
0
    }
611
612
0
    ti = proto_tree_add_item(tree, hf_uftp_clientkey, tvb, offset, -1, ENC_NA);
613
0
    clientkey_tree = proto_item_add_subtree(ti, ett_uftp_clientkey);
614
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_func, tvb, offset, 1, ENC_BIG_ENDIAN);
615
0
    offset += 1;
616
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
617
0
    offset += 3;
618
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_keylen, tvb, offset, 2, ENC_BIG_ENDIAN);
619
0
    offset += 2;
620
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_verifylen, tvb, offset, 2, ENC_BIG_ENDIAN);
621
0
    offset += 2;
622
0
    proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_keyexp, tvb, offset, 4, ENC_BIG_ENDIAN);
623
0
    offset += 4;
624
0
    if (keylen > 0) {
625
0
        proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_keymod, tvb, offset, keylen, ENC_NA);
626
0
        offset += keylen;
627
0
    }
628
0
    if (verifylen > 0) {
629
0
        proto_tree_add_item(clientkey_tree, hf_uftp_clientkey_verify, tvb, offset, verifylen, ENC_NA);
630
0
    }
631
0
}
632
633
static void dissect_uftp_regconf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
634
0
{
635
0
    proto_item *ti = NULL;
636
0
    proto_item *destlist = NULL;
637
0
    proto_tree *regconf_tree = NULL;
638
0
    proto_tree *destlist_tree = NULL;
639
0
    unsigned offset = 0;
640
0
    uint16_t destcount, idx;
641
642
0
    if (tvb_reported_length(tvb) < REG_CONF_LEN) {
643
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
644
0
                            "Invalid length: %d", tvb_reported_length(tvb));
645
0
        return;
646
0
    }
647
648
0
    destcount = tvb_get_ntohs(tvb, 2);
649
0
    if ((int)tvb_reported_length(tvb) < REG_CONF_LEN + (destcount * 4)) {
650
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
651
0
                            "Invalid length, len = %d, count=%d",
652
0
                            tvb_reported_length(tvb), destcount);
653
0
        return;
654
0
    }
655
656
0
    ti = proto_tree_add_item(tree, hf_uftp_regconf, tvb, offset, -1, ENC_NA);
657
0
    regconf_tree = proto_item_add_subtree(ti, ett_uftp_regconf);
658
0
    proto_tree_add_item(regconf_tree, hf_uftp_regconf_func, tvb, offset, 1, ENC_BIG_ENDIAN);
659
0
    offset += 1;
660
0
    proto_tree_add_item(regconf_tree, hf_uftp_regconf_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
661
0
    offset += 1;
662
0
    proto_tree_add_item(regconf_tree, hf_uftp_regconf_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
663
0
    offset += 2;
664
0
    if (destcount > 0) {
665
0
        destlist = proto_tree_add_item(regconf_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
666
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
667
0
    }
668
0
    for (idx = 0; idx < destcount; idx++) {
669
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
670
0
        offset += 4;
671
0
    }
672
0
}
673
674
static void dissect_uftp_fileinfo_30(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
675
0
{
676
0
    proto_item *ti = NULL;
677
0
    proto_item *destlist = NULL;
678
0
    proto_tree *fileinfo_tree = NULL;
679
0
    proto_tree *destlist_tree = NULL;
680
0
    unsigned offset = 0;
681
0
    uint16_t file_id, destcount, idx;
682
683
0
    if (tvb_reported_length(tvb) < FILEINFO_30_LEN) {
684
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
685
0
                            "Invalid length: %d", tvb_reported_length(tvb));
686
0
        return;
687
0
    }
688
689
0
    destcount = tvb_get_ntohs(tvb, 10);
690
0
    if ((int)tvb_reported_length(tvb) < FILEINFO_30_LEN + (destcount * 4)) {
691
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
692
0
                            "Invalid length, len = %d, count=%d",
693
0
                            tvb_reported_length(tvb), destcount);
694
0
        return;
695
0
    }
696
697
0
    file_id = tvb_get_ntohs(tvb, 2);
698
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
699
700
0
    ti = proto_tree_add_item(tree, hf_uftp_fileinfo, tvb, offset, -1, ENC_NA);
701
0
    fileinfo_tree = proto_item_add_subtree(ti, ett_uftp_fileinfo);
702
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
703
0
    offset += 1;
704
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftype, tvb, offset, 1, ENC_BIG_ENDIAN);
705
0
    offset += 1;
706
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
707
0
    offset += 2;
708
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_block_total, tvb, offset, 4, ENC_BIG_ENDIAN);
709
0
    offset += 4;
710
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_section_total, tvb, offset, 2, ENC_BIG_ENDIAN);
711
0
    offset += 2;
712
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
713
0
    offset += 2;
714
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_fsize, tvb, offset, 8, ENC_BIG_ENDIAN);
715
0
    offset += 8;
716
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_name, tvb, offset, MAXPATHNAME, ENC_ASCII);
717
0
    offset += MAXPATHNAME;
718
0
    if (destcount > 0) {
719
0
        destlist = proto_tree_add_item(fileinfo_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
720
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
721
0
    }
722
0
    for (idx = 0; idx < destcount; idx++) {
723
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
724
0
        offset += 4;
725
0
    }
726
0
}
727
728
static void dissect_uftp_fileinfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
729
0
{
730
0
    proto_item *ti = NULL;
731
0
    proto_item *destlist = NULL;
732
0
    proto_tree *fileinfo_tree = NULL;
733
0
    proto_tree *destlist_tree = NULL;
734
0
    unsigned offset = 0;
735
0
    uint16_t file_id, destcount, idx;
736
737
0
    if (tvb_reported_length(tvb) < FILEINFO_LEN) {
738
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
739
0
                            "Invalid length: %d", tvb_reported_length(tvb));
740
0
        return;
741
0
    }
742
743
0
    destcount = tvb_get_ntohs(tvb, 10);
744
0
    if ((int)tvb_reported_length(tvb) < FILEINFO_LEN + (destcount * 4)) {
745
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
746
0
                            "Invalid length, len = %d, count=%d",
747
0
                            tvb_reported_length(tvb), destcount);
748
0
        return;
749
0
    }
750
751
0
    file_id = tvb_get_ntohs(tvb, 2);
752
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
753
754
0
    ti = proto_tree_add_item(tree, hf_uftp_fileinfo, tvb, offset, -1, ENC_NA);
755
0
    fileinfo_tree = proto_item_add_subtree(ti, ett_uftp_fileinfo);
756
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
757
0
    offset += 1;
758
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftype, tvb, offset, 1, ENC_BIG_ENDIAN);
759
0
    offset += 1;
760
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
761
0
    offset += 2;
762
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_block_total, tvb, offset, 4, ENC_BIG_ENDIAN);
763
0
    offset += 4;
764
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_section_total, tvb, offset, 2, ENC_BIG_ENDIAN);
765
0
    offset += 2;
766
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
767
0
    offset += 2;
768
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_fsize, tvb, offset, 8, ENC_BIG_ENDIAN);
769
0
    offset += 8;
770
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_ftstamp, tvb, offset, 4, ENC_BIG_ENDIAN);
771
0
    offset += 4;
772
0
    proto_tree_add_item(fileinfo_tree, hf_uftp_fileinfo_name, tvb, offset, MAXPATHNAME, ENC_ASCII);
773
0
    offset += MAXPATHNAME;
774
0
    if (destcount > 0) {
775
0
        destlist = proto_tree_add_item(fileinfo_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
776
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
777
0
    }
778
0
    for (idx = 0; idx < destcount; idx++) {
779
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
780
0
        offset += 4;
781
0
    }
782
0
}
783
784
static void dissect_uftp_keyinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
785
0
{
786
0
    proto_item *ti = NULL;
787
0
    proto_item *destlist = NULL;
788
0
    proto_item *destkey = NULL;
789
0
    proto_tree *keyinfo_tree = NULL;
790
0
    proto_tree *destlist_tree = NULL;
791
0
    proto_tree *destkey_tree = NULL;
792
0
    unsigned offset = 0;
793
0
    uint8_t destcount, idx;
794
795
0
    if (tvb_reported_length(tvb) < KEYINFO_LEN) {
796
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
797
0
                            "Invalid length: %d", tvb_reported_length(tvb));
798
0
        return;
799
0
    }
800
801
0
    destcount = tvb_get_uint8(tvb, 2);
802
0
    if ((int)tvb_reported_length(tvb) < KEYINFO_LEN + (destcount * DESTKEY_LEN)) {
803
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
804
0
                            "Invalid length, len = %d, count=%d",
805
0
                            tvb_reported_length(tvb), destcount);
806
0
        return;
807
0
    }
808
809
0
    ti = proto_tree_add_item(tree, hf_uftp_keyinfo, tvb, offset, -1, ENC_NA);
810
0
    keyinfo_tree = proto_item_add_subtree(ti, ett_uftp_keyinfo);
811
0
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_func, tvb, offset, 1, ENC_BIG_ENDIAN);
812
0
    offset += 1;
813
0
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
814
0
    offset += 1;
815
0
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_destcount, tvb, offset, 1, ENC_BIG_ENDIAN);
816
0
    offset += 1;
817
0
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_groupmaster_len, tvb, offset, 1, ENC_BIG_ENDIAN);
818
0
    offset += 1;
819
0
    proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_tstamp, tvb, offset, 8, ENC_TIME_SECS_NSECS);
820
0
    offset += 8;
821
0
    if (destcount > 0) {
822
0
        destlist = proto_tree_add_item(keyinfo_tree, hf_uftp_destlist, tvb, offset, destcount * DESTKEY_LEN, ENC_NA);
823
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
824
0
    }
825
0
    for (idx = 0; idx < destcount; idx++) {
826
0
        destkey = proto_tree_add_item(destlist_tree, hf_uftp_keyinfo_destkey, tvb, offset, DESTKEY_LEN, ENC_NA);
827
0
        destkey_tree = proto_item_add_subtree(destkey, ett_uftp_keyinfo_destkey);
828
0
        proto_tree_add_item(destkey_tree, hf_uftp_keyinfo_destaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
829
0
        offset += 4;
830
0
        proto_tree_add_item(destkey_tree, hf_uftp_keyinfo_groupmaster, tvb, offset, 48, ENC_NA);
831
0
        offset += 48;
832
0
    }
833
0
}
834
835
static void dissect_uftp_infoack(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
836
0
{
837
0
    proto_item *ti = NULL;
838
0
    proto_item *destlist = NULL;
839
0
    proto_tree *infoack_tree = NULL;
840
0
    proto_tree *destlist_tree = NULL;
841
0
    unsigned offset = 0;
842
0
    uint16_t file_id, destcount, idx;
843
844
0
    if (tvb_reported_length(tvb) < INFO_ACK_LEN) {
845
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
846
0
                            "Invalid length: %d", tvb_reported_length(tvb));
847
0
        return;
848
0
    }
849
850
0
    destcount = tvb_get_ntohs(tvb, 4);
851
0
    if ((int)tvb_reported_length(tvb) < INFO_ACK_LEN + (destcount * 4)) {
852
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
853
0
                            "Invalid length, len = %d, count=%d",
854
0
                            tvb_reported_length(tvb), destcount);
855
0
        return;
856
0
    }
857
858
0
    file_id = tvb_get_ntohs(tvb, 2);
859
0
    if (file_id > 0) {
860
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
861
0
    }
862
863
0
    ti = proto_tree_add_item(tree, hf_uftp_infoack, tvb, offset, -1, ENC_NA);
864
0
    infoack_tree = proto_item_add_subtree(ti, ett_uftp_infoack);
865
0
    proto_tree_add_item(infoack_tree, hf_uftp_infoack_func, tvb, offset, 1, ENC_BIG_ENDIAN);
866
0
    offset += 1;
867
0
    proto_tree_add_bitmask(infoack_tree, tvb, offset, hf_uftp_infoack_flags, ett_uftp_infoack_flags, infoack_flags, ENC_BIG_ENDIAN);
868
0
    offset += 1;
869
0
    proto_tree_add_item(infoack_tree, hf_uftp_infoack_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
870
0
    offset += 2;
871
0
    proto_tree_add_item(infoack_tree, hf_uftp_infoack_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
872
0
    offset += 2;
873
0
    proto_tree_add_item(infoack_tree, hf_uftp_infoack_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
874
0
    offset += 2;
875
0
    proto_tree_add_item(infoack_tree, hf_uftp_infoack_verify_data, tvb, offset, VERIFY_LEN, ENC_NA);
876
0
    offset += VERIFY_LEN;
877
0
    if (destcount > 0) {
878
0
        destlist = proto_tree_add_item(infoack_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
879
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
880
0
    }
881
0
    for (idx = 0; idx < destcount; idx++) {
882
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
883
0
        offset += 4;
884
0
    }
885
0
}
886
887
static void dissect_uftp_fileseg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
888
0
{
889
0
    proto_item *ti = NULL;
890
0
    proto_tree *fileseg_tree = NULL;
891
0
    unsigned offset = 0;
892
0
    uint8_t pass;
893
0
    uint16_t file_id;
894
0
    uint32_t seq_num;
895
896
0
    if (tvb_reported_length(tvb) < FILESEG_LEN) {
897
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
898
0
                            "Invalid length: %d", tvb_reported_length(tvb));
899
0
        return;
900
0
    }
901
902
0
    file_id = tvb_get_ntohs(tvb, 2);
903
0
    pass = tvb_get_uint8(tvb, 4);
904
0
    seq_num = tvb_get_ntohl(tvb, 8);
905
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Pass=%d  Seq=%d",
906
0
                    file_id, pass, seq_num);
907
908
0
    ti = proto_tree_add_item(tree, hf_uftp_fileseg, tvb, offset, -1, ENC_NA);
909
0
    fileseg_tree = proto_item_add_subtree(ti, ett_uftp_fileseg);
910
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_func, tvb, offset, 1, ENC_BIG_ENDIAN);
911
0
    offset += 1;
912
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
913
0
    offset += 1;
914
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
915
0
    offset += 2;
916
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_pass, tvb, offset, 1, ENC_BIG_ENDIAN);
917
0
    offset += 1;
918
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_reserved2, tvb, offset, 1, ENC_BIG_ENDIAN);
919
0
    offset += 1;
920
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_section, tvb, offset, 2, ENC_BIG_ENDIAN);
921
0
    offset += 2;
922
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_seq_num, tvb, offset, 4, ENC_BIG_ENDIAN);
923
0
    offset += 4;
924
0
    proto_tree_add_item(fileseg_tree, hf_uftp_fileseg_data, tvb, offset, -1, ENC_NA);
925
0
}
926
927
static void dissect_uftp_done(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
928
0
{
929
0
    proto_item *ti = NULL;
930
0
    proto_item *destlist = NULL;
931
0
    proto_tree *done_tree = NULL;
932
0
    proto_tree *destlist_tree = NULL;
933
0
    unsigned offset = 0;
934
0
    uint8_t pass;
935
0
    uint16_t file_id, section, destcount, idx;
936
937
0
    if (tvb_reported_length(tvb) < DONE_LEN) {
938
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
939
0
                            "Invalid length: %d", tvb_reported_length(tvb));
940
0
        return;
941
0
    }
942
943
0
    destcount = tvb_get_ntohs(tvb, 6);
944
0
    if ((int)tvb_reported_length(tvb) < DONE_LEN + (destcount * 4)) {
945
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
946
0
                            "Invalid length, len = %d, count=%d",
947
0
                            tvb_reported_length(tvb), destcount);
948
0
        return;
949
0
    }
950
951
0
    pass = tvb_get_uint8(tvb, 1);
952
0
    section = tvb_get_ntohs(tvb, 2);
953
0
    file_id = tvb_get_ntohs(tvb, 4);
954
0
    if (file_id > 0) {
955
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Pass=%d  Section=%d",
956
0
                        file_id, pass, section);
957
0
    }
958
959
0
    ti = proto_tree_add_item(tree, hf_uftp_done, tvb, offset, -1, ENC_NA);
960
0
    done_tree = proto_item_add_subtree(ti, ett_uftp_done);
961
0
    proto_tree_add_item(done_tree, hf_uftp_done_func, tvb, offset, 1, ENC_BIG_ENDIAN);
962
0
    offset += 1;
963
0
    proto_tree_add_item(done_tree, hf_uftp_done_pass, tvb, offset, 1, ENC_BIG_ENDIAN);
964
0
    offset += 1;
965
0
    proto_tree_add_item(done_tree, hf_uftp_done_section, tvb, offset, 2, ENC_BIG_ENDIAN);
966
0
    offset += 2;
967
0
    proto_tree_add_item(done_tree, hf_uftp_done_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
968
0
    offset += 2;
969
0
    proto_tree_add_item(done_tree, hf_uftp_done_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
970
0
    offset += 2;
971
0
    if (destcount > 0) {
972
0
        destlist = proto_tree_add_item(done_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
973
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
974
0
    }
975
0
    for (idx = 0; idx < destcount; idx++) {
976
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
977
0
        offset += 4;
978
0
    }
979
0
}
980
981
static void dissect_uftp_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
982
0
{
983
0
    proto_item *ti = NULL;
984
0
    proto_tree *status_tree = NULL;
985
0
    unsigned offset = 0;
986
0
    uint8_t pass, seq;
987
0
    uint16_t file_id, section;
988
0
    uint32_t nak_count;
989
990
0
    if (tvb_reported_length(tvb) < STATUS_LEN) {
991
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
992
0
                            "Invalid length: %d", tvb_reported_length(tvb));
993
0
        return;
994
0
    }
995
996
0
    file_id = tvb_get_ntohs(tvb, 2);
997
0
    section = tvb_get_ntohs(tvb, 2);
998
0
    pass = tvb_get_uint8(tvb, 4);
999
0
    seq = tvb_get_uint8(tvb, 5);
1000
0
    nak_count = tvb_get_ntohl(tvb, 8);
1001
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Pass=%d  Section=%d Seq=%d",
1002
0
                    file_id, pass, section, seq);
1003
1004
0
    ti = proto_tree_add_item(tree, hf_uftp_status, tvb, offset, -1, ENC_NA);
1005
0
    status_tree = proto_item_add_subtree(ti, ett_uftp_status);
1006
0
    proto_tree_add_item(status_tree, hf_uftp_status_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1007
0
    offset += 1;
1008
0
    proto_tree_add_item(status_tree, hf_uftp_status_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
1009
0
    offset += 1;
1010
0
    proto_tree_add_item(status_tree, hf_uftp_status_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1011
0
    offset += 2;
1012
0
    proto_tree_add_item(status_tree, hf_uftp_status_pass, tvb, offset, 1, ENC_BIG_ENDIAN);
1013
0
    offset += 1;
1014
0
    proto_tree_add_item(status_tree, hf_uftp_status_seq, tvb, offset, 1, ENC_BIG_ENDIAN);
1015
0
    offset += 1;
1016
0
    proto_tree_add_item(status_tree, hf_uftp_status_section, tvb, offset, 2, ENC_BIG_ENDIAN);
1017
0
    offset += 2;
1018
0
    proto_tree_add_item(status_tree, hf_uftp_status_nak_count, tvb, offset, 4, ENC_BIG_ENDIAN);
1019
0
    offset += 4;
1020
0
    if (nak_count > 0) {
1021
0
        proto_tree_add_item(status_tree, hf_uftp_status_naks, tvb, offset, -1, ENC_NA);
1022
0
    }
1023
0
}
1024
1025
static void dissect_uftp_prstatus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1026
0
{
1027
0
    proto_item *ti = NULL;
1028
0
    proto_item *destlist = NULL;
1029
0
    proto_tree *prstatus_tree = NULL;
1030
0
    proto_tree *destlist_tree = NULL;
1031
0
    unsigned offset = 0;
1032
0
    uint8_t pass, seq;
1033
0
    uint16_t file_id, destcount, idx, section;
1034
0
    uint32_t nak_count;
1035
1036
0
    if (tvb_reported_length(tvb) < PRSTATUS_LEN) {
1037
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1038
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1039
0
        return;
1040
0
    }
1041
1042
0
    destcount = tvb_get_ntohs(tvb, 8);
1043
0
    if ((int)tvb_reported_length(tvb) < PRSTATUS_LEN + (destcount * 4)) {
1044
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1045
0
                            "Invalid length, len = %d, count=%d",
1046
0
                            tvb_reported_length(tvb), destcount);
1047
0
        return;
1048
0
    }
1049
1050
0
    file_id = tvb_get_ntohs(tvb, 2);
1051
0
    section = tvb_get_ntohs(tvb, 2);
1052
0
    pass = tvb_get_uint8(tvb, 4);
1053
0
    seq = tvb_get_uint8(tvb, 5);
1054
0
    nak_count = tvb_get_ntohl(tvb, 8);
1055
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X  Pass=%d Section=%d Seq=%d "
1056
0
                    "NAKs=%d", file_id, pass, section, seq, nak_count);
1057
1058
0
    ti = proto_tree_add_item(tree, hf_uftp_prstatus, tvb, offset, -1, ENC_NA);
1059
0
    prstatus_tree = proto_item_add_subtree(ti, ett_uftp_prstatus);
1060
0
    proto_tree_add_item(prstatus_tree, hf_uftp_prstatus_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1061
0
    offset += 1;
1062
0
    proto_tree_add_item(prstatus_tree, hf_uftp_prstatus_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
1063
0
    offset += 1;
1064
0
    proto_tree_add_item(prstatus_tree, hf_uftp_prstatus_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1065
0
    offset += 2;
1066
0
    proto_tree_add_item(prstatus_tree, hf_uftp_prstatus_pass, tvb, offset, 1, ENC_BIG_ENDIAN);
1067
0
    offset += 1;
1068
0
    proto_tree_add_item(prstatus_tree, hf_uftp_prstatus_seq, tvb, offset, 1, ENC_BIG_ENDIAN);
1069
0
    offset += 1;
1070
0
    proto_tree_add_item(prstatus_tree, hf_uftp_prstatus_section, tvb, offset, 2, ENC_BIG_ENDIAN);
1071
0
    offset += 2;
1072
0
    proto_tree_add_item(prstatus_tree, hf_uftp_prstatus_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
1073
0
    offset += 2;
1074
0
    proto_tree_add_item(prstatus_tree, hf_uftp_prstatus_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
1075
0
    offset += 2;
1076
0
    if (destcount > 0) {
1077
0
        destlist = proto_tree_add_item(prstatus_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1078
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1079
0
    }
1080
0
    for (idx = 0; idx < destcount; idx++) {
1081
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1082
0
        offset += 4;
1083
0
    }
1084
0
}
1085
1086
static void dissect_uftp_complete(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1087
0
{
1088
0
    proto_item *ti = NULL;
1089
0
    proto_item *destlist = NULL;
1090
0
    proto_tree *complete_tree = NULL;
1091
0
    proto_tree *destlist_tree = NULL;
1092
0
    unsigned offset = 0;
1093
0
    uint16_t file_id, destcount, idx;
1094
1095
0
    if (tvb_reported_length(tvb) < COMPLETE_LEN) {
1096
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1097
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1098
0
        return;
1099
0
    }
1100
1101
0
    destcount = tvb_get_ntohs(tvb, 4);
1102
0
    if ((int)tvb_reported_length(tvb) < COMPLETE_LEN + (destcount * 4)) {
1103
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1104
0
                            "Invalid length, len = %d, count=%d",
1105
0
                            tvb_reported_length(tvb), destcount);
1106
0
        return;
1107
0
    }
1108
1109
0
    file_id = tvb_get_ntohs(tvb, 2);
1110
0
    if (file_id > 0) {
1111
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1112
0
    }
1113
1114
0
    ti = proto_tree_add_item(tree, hf_uftp_complete, tvb, offset, -1, ENC_NA);
1115
0
    complete_tree = proto_item_add_subtree(ti, ett_uftp_complete);
1116
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1117
0
    offset += 1;
1118
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_status, tvb, offset, 1, ENC_BIG_ENDIAN);
1119
0
    offset += 1;
1120
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1121
0
    offset += 2;
1122
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
1123
0
    offset += 2;
1124
0
    proto_tree_add_item(complete_tree, hf_uftp_complete_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
1125
0
    offset += 2;
1126
0
    if (destcount > 0) {
1127
0
        destlist = proto_tree_add_item(complete_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1128
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1129
0
    }
1130
0
    for (idx = 0; idx < destcount; idx++) {
1131
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1132
0
        offset += 4;
1133
0
    }
1134
0
}
1135
1136
static void dissect_uftp_doneconf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1137
0
{
1138
0
    proto_item *ti = NULL;
1139
0
    proto_item *destlist = NULL;
1140
0
    proto_tree *doneconf_tree = NULL;
1141
0
    proto_tree *destlist_tree = NULL;
1142
0
    unsigned offset = 0;
1143
0
    uint16_t file_id, destcount, idx;
1144
1145
0
    if (tvb_reported_length(tvb) < DONE_CONF_LEN) {
1146
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1147
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1148
0
        return;
1149
0
    }
1150
1151
0
    destcount = tvb_get_ntohs(tvb, 4);
1152
0
    if ((int)tvb_reported_length(tvb) < DONE_CONF_LEN + (destcount * 4)) {
1153
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1154
0
                            "Invalid length, len = %d, count=%d",
1155
0
                            tvb_reported_length(tvb), destcount);
1156
0
        return;
1157
0
    }
1158
1159
0
    file_id = tvb_get_ntohs(tvb, 2);
1160
0
    if (file_id > 0) {
1161
0
        col_append_fstr(pinfo->cinfo, COL_INFO, ":%04X", file_id);
1162
0
    }
1163
1164
0
    ti = proto_tree_add_item(tree, hf_uftp_doneconf, tvb, offset, -1, ENC_NA);
1165
0
    doneconf_tree = proto_item_add_subtree(ti, ett_uftp_doneconf);
1166
0
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1167
0
    offset += 1;
1168
0
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_reserved1, tvb, offset, 1, ENC_BIG_ENDIAN);
1169
0
    offset += 1;
1170
0
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_file_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1171
0
    offset += 2;
1172
0
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_destcount, tvb, offset, 2, ENC_BIG_ENDIAN);
1173
0
    offset += 2;
1174
0
    proto_tree_add_item(doneconf_tree, hf_uftp_doneconf_reserved2, tvb, offset, 2, ENC_BIG_ENDIAN);
1175
0
    offset += 2;
1176
0
    if (destcount > 0) {
1177
0
        destlist = proto_tree_add_item(doneconf_tree, hf_uftp_destlist, tvb, offset, destcount * 4, ENC_NA);
1178
0
        destlist_tree = proto_item_add_subtree(destlist, ett_uftp_destlist);
1179
0
    }
1180
0
    for (idx = 0; idx < destcount; idx++) {
1181
0
        proto_tree_add_item(destlist_tree, hf_uftp_dest, tvb, offset, 4, ENC_BIG_ENDIAN);
1182
0
        offset += 4;
1183
0
    }
1184
0
}
1185
1186
static void dissect_uftp_hbreq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1187
0
{
1188
0
    proto_item *ti = NULL;
1189
0
    proto_tree *hbreq_tree = NULL;
1190
0
    unsigned offset = 0;
1191
0
    uint16_t keylen, siglen;
1192
1193
0
    if (tvb_reported_length(tvb) < HB_REQ_LEN) {
1194
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1195
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1196
0
        return;
1197
0
    }
1198
1199
0
    keylen = tvb_get_ntohs(tvb, 8);
1200
0
    siglen = tvb_get_ntohs(tvb, 10);
1201
0
    if ((int)tvb_reported_length(tvb) < HB_REQ_LEN + keylen + siglen) {
1202
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1203
0
                            "Invalid length, len = %d, keylen=%d siglen=%d",
1204
0
                            tvb_reported_length(tvb), keylen, siglen);
1205
0
        return;
1206
0
    }
1207
1208
0
    ti = proto_tree_add_item(tree, hf_uftp_hbreq, tvb, offset, -1, ENC_NA);
1209
0
    hbreq_tree = proto_item_add_subtree(ti, ett_uftp_hbreq);
1210
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1211
0
    offset += 1;
1212
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1213
0
    offset += 3;
1214
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1215
0
    offset += 4;
1216
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_keylen, tvb, offset, 2, ENC_BIG_ENDIAN);
1217
0
    offset += 2;
1218
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1219
0
    offset += 2;
1220
0
    proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_keyexp, tvb, offset, 4, ENC_BIG_ENDIAN);
1221
0
    offset += 4;
1222
0
    if (keylen > 0) {
1223
0
        proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_keymod, tvb, offset, keylen, ENC_NA);
1224
0
        offset += keylen;
1225
0
    }
1226
0
    if (siglen > 0) {
1227
0
        proto_tree_add_item(hbreq_tree, hf_uftp_hbreq_verify, tvb, offset, siglen, ENC_NA);
1228
0
    }
1229
0
}
1230
1231
static void dissect_uftp_hbresp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1232
0
{
1233
0
    proto_item *ti = NULL;
1234
0
    proto_tree *hbresp_tree = NULL;
1235
0
    unsigned offset = 0;
1236
1237
0
    if (tvb_reported_length(tvb) < HB_RESP_LEN) {
1238
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1239
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1240
0
        return;
1241
0
    }
1242
1243
0
    ti = proto_tree_add_item(tree, hf_uftp_hbresp, tvb, offset, -1, ENC_NA);
1244
0
    hbresp_tree = proto_item_add_subtree(ti, ett_uftp_hbresp);
1245
0
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1246
0
    offset += 1;
1247
0
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_authenticated, tvb, offset, 1, ENC_BIG_ENDIAN);
1248
0
    offset += 1;
1249
0
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1250
0
    offset += 2;
1251
0
    proto_tree_add_item(hbresp_tree, hf_uftp_hbresp_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1252
0
}
1253
1254
static void dissect_uftp_keyreq(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1255
0
{
1256
0
    proto_item *ti = NULL;
1257
0
    proto_tree *keyreq_tree = NULL;
1258
0
    unsigned offset = 0;
1259
1260
0
    if (tvb_reported_length(tvb) < KEY_REQ_LEN) {
1261
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1262
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1263
0
        return;
1264
0
    }
1265
1266
0
    ti = proto_tree_add_item(tree, hf_uftp_keyreq, tvb, offset, -1, ENC_NA);
1267
0
    keyreq_tree = proto_item_add_subtree(ti, ett_uftp_keyreq);
1268
0
    proto_tree_add_item(keyreq_tree, hf_uftp_keyreq_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1269
0
    offset += 1;
1270
0
    proto_tree_add_item(keyreq_tree, hf_uftp_keyreq_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1271
0
}
1272
1273
static void dissect_uftp_proxykey(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1274
0
{
1275
0
    proto_item *ti = NULL;
1276
0
    proto_tree *proxykey_tree = NULL;
1277
0
    unsigned offset = 0;
1278
0
    uint16_t keylen, siglen;
1279
1280
0
    if (tvb_reported_length(tvb) < PROXY_KEY_LEN) {
1281
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1282
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1283
0
        return;
1284
0
    }
1285
1286
0
    keylen = tvb_get_ntohs(tvb, 8);
1287
0
    siglen = tvb_get_ntohs(tvb, 10);
1288
0
    if ((int)tvb_reported_length(tvb) < PROXY_KEY_LEN + keylen + siglen) {
1289
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1290
0
                            "Invalid length, len = %d, keylen=%d siglen=%d",
1291
0
                            tvb_reported_length(tvb), keylen, siglen);
1292
0
        return;
1293
0
    }
1294
1295
0
    ti = proto_tree_add_item(tree, hf_uftp_proxykey, tvb, offset, -1, ENC_NA);
1296
0
    proxykey_tree = proto_item_add_subtree(ti, ett_uftp_proxykey);
1297
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1298
0
    offset += 1;
1299
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
1300
0
    offset += 3;
1301
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
1302
0
    offset += 4;
1303
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_keylen, tvb, offset, 2, ENC_BIG_ENDIAN);
1304
0
    offset += 2;
1305
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_siglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1306
0
    offset += 2;
1307
0
    proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_keyexp, tvb, offset, 4, ENC_BIG_ENDIAN);
1308
0
    offset += 4;
1309
0
    if (keylen > 0) {
1310
0
        proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_keymod, tvb, offset, keylen, ENC_NA);
1311
0
        offset += keylen;
1312
0
    }
1313
0
    if (siglen > 0) {
1314
0
        proto_tree_add_item(proxykey_tree, hf_uftp_proxykey_verify, tvb, offset, siglen, ENC_NA);
1315
0
    }
1316
0
}
1317
1318
static void dissect_uftp_encrypted(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1319
0
{
1320
0
    proto_item *ti = NULL;
1321
0
    proto_tree *encrypted_tree = NULL;
1322
0
    unsigned offset = 0;
1323
0
    uint16_t sig_len, payload_len;
1324
1325
0
    if (tvb_reported_length(tvb) < ENCRYPTED_LEN) {
1326
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1327
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1328
0
        return;
1329
0
    }
1330
1331
0
    sig_len = tvb_get_ntohs(tvb, 8);
1332
0
    payload_len = tvb_get_ntohs(tvb, 10);
1333
0
    if ((int)tvb_reported_length(tvb) < ENCRYPTED_LEN + sig_len + payload_len) {
1334
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1335
0
                            "Invalid length, len = %d, sig=%d, payload=%d",
1336
0
                            tvb_reported_length(tvb), sig_len, payload_len);
1337
0
        return;
1338
0
    }
1339
1340
0
    ti = proto_tree_add_item(tree, hf_uftp_encrypted, tvb, offset, -1, ENC_NA);
1341
0
    encrypted_tree = proto_item_add_subtree(ti, ett_uftp_encrypted);
1342
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_tstamp, tvb, offset, 8, ENC_TIME_SECS_NSECS);
1343
0
    offset += 8;
1344
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_sig_len, tvb, offset, 2, ENC_BIG_ENDIAN);
1345
0
    offset += 2;
1346
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN);
1347
0
    offset += 2;
1348
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_signature, tvb, offset, sig_len, ENC_NA);
1349
0
    offset += sig_len;
1350
0
    proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_payload, tvb, offset, payload_len, ENC_NA);
1351
0
}
1352
1353
static void dissect_uftp_abort(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1354
0
{
1355
0
    proto_item *ti = NULL;
1356
0
    proto_tree *abort_tree = NULL;
1357
0
    unsigned offset = 0;
1358
1359
0
    if (tvb_reported_length(tvb) < ABORT_LEN) {
1360
0
        proto_tree_add_expert_format_remaining(tree, pinfo, &ei_uftp_length_invalid, tvb, offset,
1361
0
                            "Invalid length: %d", tvb_reported_length(tvb));
1362
0
        return;
1363
0
    }
1364
1365
0
    ti = proto_tree_add_item(tree, hf_uftp_abort, tvb, offset, -1, ENC_NA);
1366
0
    abort_tree = proto_item_add_subtree(ti, ett_uftp_abort);
1367
0
    proto_tree_add_item(abort_tree, hf_uftp_abort_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1368
0
    offset += 1;
1369
0
    proto_tree_add_bitmask(abort_tree, tvb, offset, hf_uftp_abort_flags, ett_uftp_abort_flags, abort_flags, ENC_BIG_ENDIAN);
1370
0
    offset += 1;
1371
0
    proto_tree_add_item(abort_tree, hf_uftp_abort_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
1372
0
    offset += 2;
1373
0
    proto_tree_add_item(abort_tree, hf_uftp_abort_host, tvb, offset, 4, ENC_BIG_ENDIAN);
1374
0
    offset += 4;
1375
0
    proto_tree_add_item(abort_tree, hf_uftp_abort_message, tvb, offset, -1, ENC_ASCII);
1376
0
}
1377
1378
static int dissect_uftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1379
229
{
1380
229
    uint8_t version;
1381
229
    uint8_t mes_type;
1382
229
    uint32_t group_id;
1383
229
    uint16_t blsize;
1384
229
    tvbuff_t *next_tvb;
1385
229
    proto_item *ti = NULL;
1386
229
    proto_tree *uftp_tree = NULL;
1387
229
    unsigned offset = 0;
1388
1389
229
    version = tvb_get_uint8(tvb, 0);
1390
229
    if (version == 0x50) {
1391
96
        return call_dissector(uftp5_handle, tvb, pinfo, tree);
1392
133
    } else if (version == 0x40) {
1393
123
        return call_dissector(uftp4_handle, tvb, pinfo, tree);
1394
123
    } else if (version != UFTP_VER_NUM && version != UFTP_3_0_VER) {
1395
8
        return 0;
1396
8
    }
1397
1398
2
    if (tvb_reported_length(tvb) < UFTP_LEN) {
1399
1
        return 0;
1400
1
    }
1401
1402
1
    mes_type = tvb_get_uint8(tvb, 1);
1403
1
    blsize = tvb_get_ntohs(tvb, 2);
1404
1
    group_id = tvb_get_ntohl(tvb, 4);
1405
1406
1
    if (tvb_reported_length(tvb) != (unsigned)UFTP_LEN + blsize) {
1407
1
        return 0;
1408
1
    }
1409
1410
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "UFTP");
1411
    /* Clear out stuff in the info column */
1412
0
    col_clear(pinfo->cinfo,COL_INFO);
1413
0
    col_add_fstr(pinfo->cinfo, COL_INFO, "%-10s",
1414
0
                 val_to_str(pinfo->pool, mes_type, messages, "Unknown (%d)"));
1415
0
    if ((mes_type != HB_REQ) && (mes_type != HB_RESP)) {
1416
0
        col_append_fstr(pinfo->cinfo, COL_INFO, " ID=%08X", group_id);
1417
0
    }
1418
1419
0
    ti = proto_tree_add_item(tree, proto_uftp, tvb, 0, -1, ENC_NA);
1420
0
    uftp_tree = proto_item_add_subtree(ti, ett_uftp);
1421
0
    proto_tree_add_item(uftp_tree, hf_uftp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
1422
0
    offset += 1;
1423
0
    proto_tree_add_item(uftp_tree, hf_uftp_func, tvb, offset, 1, ENC_BIG_ENDIAN);
1424
0
    offset += 1;
1425
0
    proto_tree_add_item(uftp_tree, hf_uftp_blsize, tvb, offset, 2, ENC_BIG_ENDIAN);
1426
0
    offset += 2;
1427
0
    proto_tree_add_item(uftp_tree, hf_uftp_group_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1428
0
    offset += 4;
1429
0
    proto_tree_add_item(uftp_tree, hf_uftp_srcaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
1430
0
    offset += 4;
1431
0
    proto_tree_add_item(uftp_tree, hf_uftp_destaddr, tvb, offset, 4, ENC_BIG_ENDIAN);
1432
0
    offset += 4;
1433
1434
0
    next_tvb = tvb_new_subset_length(tvb, offset, blsize);
1435
1436
0
    switch (mes_type) {
1437
0
        case ANNOUNCE:
1438
0
            dissect_uftp_announce(next_tvb, pinfo, uftp_tree);
1439
0
            break;
1440
0
        case REGISTER:
1441
0
            dissect_uftp_register(next_tvb, pinfo, uftp_tree);
1442
0
            break;
1443
0
        case CLIENT_KEY:
1444
0
            dissect_uftp_clientkey(next_tvb, pinfo, uftp_tree);
1445
0
            break;
1446
0
        case REG_CONF:
1447
0
            dissect_uftp_regconf(next_tvb, pinfo, uftp_tree);
1448
0
            break;
1449
0
        case FILEINFO:
1450
0
            if (version == UFTP_3_0_VER) {
1451
0
                dissect_uftp_fileinfo_30(next_tvb, pinfo, uftp_tree);
1452
0
            } else {
1453
0
                dissect_uftp_fileinfo(next_tvb, pinfo, uftp_tree);
1454
0
            }
1455
0
            break;
1456
0
        case KEYINFO:
1457
0
            dissect_uftp_keyinfo(next_tvb, pinfo, uftp_tree);
1458
0
            break;
1459
0
        case INFO_ACK:
1460
0
            dissect_uftp_infoack(next_tvb, pinfo, uftp_tree);
1461
0
            break;
1462
0
        case FILESEG:
1463
0
            dissect_uftp_fileseg(next_tvb, pinfo, uftp_tree);
1464
0
            break;
1465
0
        case DONE:
1466
0
            dissect_uftp_done(next_tvb, pinfo, uftp_tree);
1467
0
            break;
1468
0
        case STATUS:
1469
0
            dissect_uftp_status(next_tvb, pinfo, uftp_tree);
1470
0
            break;
1471
0
        case PRSTATUS:
1472
0
            dissect_uftp_prstatus(next_tvb, pinfo, uftp_tree);
1473
0
            break;
1474
0
        case COMPLETE:
1475
0
            dissect_uftp_complete(next_tvb, pinfo, uftp_tree);
1476
0
            break;
1477
0
        case DONE_CONF:
1478
0
            dissect_uftp_doneconf(next_tvb, pinfo, uftp_tree);
1479
0
            break;
1480
0
        case HB_REQ:
1481
0
            dissect_uftp_hbreq(next_tvb, pinfo, uftp_tree);
1482
0
            break;
1483
0
        case HB_RESP:
1484
0
            dissect_uftp_hbresp(next_tvb, pinfo, uftp_tree);
1485
0
            break;
1486
0
        case KEY_REQ:
1487
0
            dissect_uftp_keyreq(next_tvb, pinfo, uftp_tree);
1488
0
            break;
1489
0
        case PROXY_KEY:
1490
0
            dissect_uftp_proxykey(next_tvb, pinfo, uftp_tree);
1491
0
            break;
1492
0
        case ENCRYPTED:
1493
0
            dissect_uftp_encrypted(next_tvb, pinfo, uftp_tree);
1494
0
            break;
1495
0
        case ABORT:
1496
0
            dissect_uftp_abort(next_tvb, pinfo, uftp_tree);
1497
0
            break;
1498
0
        default:
1499
0
            proto_tree_add_expert_format(tree, pinfo, &ei_uftp_func_unknown, tvb, offset, -1,
1500
0
                        "Function unknown: %d", mes_type);
1501
0
            break;
1502
0
    }
1503
1504
0
    return tvb_reported_length(tvb);
1505
0
}
1506
1507
void proto_register_uftp(void)
1508
15
{
1509
15
    static hf_register_info hf[] = {
1510
15
        { &hf_uftp_version,
1511
15
            { "Protocol Version", "uftp.version",
1512
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1513
15
        },
1514
15
        { &hf_uftp_func,
1515
15
            { "Type", "uftp.func",
1516
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1517
15
        },
1518
15
        { &hf_uftp_blsize,
1519
15
            { "Block Size", "uftp.blsize",
1520
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1521
15
        },
1522
15
        { &hf_uftp_group_id,
1523
15
            { "Group ID", "uftp.group_id",
1524
15
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
1525
15
        },
1526
15
        { &hf_uftp_srcaddr,
1527
15
            { "Source Address", "uftp.srcaddr",
1528
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
1529
15
        },
1530
15
        { &hf_uftp_destaddr,
1531
15
            { "Destination Address", "uftp.destaddr",
1532
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
1533
15
        },
1534
15
        { &hf_uftp_destlist,
1535
15
            { "Destination List", "uftp.destlist",
1536
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1537
15
        },
1538
15
        { &hf_uftp_dest,
1539
15
            { "Destination", "uftp.dest",
1540
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
1541
15
        },
1542
15
        { &hf_uftp_announce,
1543
15
            { "ANNOUNCE", "uftp.announce",
1544
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1545
15
        },
1546
15
        { &hf_uftp_announce_func,
1547
15
            { "Type", "uftp.announce.func",
1548
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1549
15
        },
1550
15
        { &hf_uftp_announce_flags,
1551
15
            { "Flags", "uftp.announce.flags",
1552
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1553
15
        },
1554
15
        { &hf_uftp_announce_flags_restart,
1555
15
            { "Restart", "uftp.announce.flags.restart",
1556
15
            FT_BOOLEAN, 8, NULL, FLAG_RESTART, NULL, HFILL }
1557
15
        },
1558
15
        { &hf_uftp_announce_flags_sync,
1559
15
            { "Sync mode", "uftp.announce.flags.sync",
1560
15
            FT_BOOLEAN, 8, NULL, FLAG_SYNC_MODE, NULL, HFILL }
1561
15
        },
1562
15
        { &hf_uftp_announce_flags_syncpreview,
1563
15
            { "Sync preview mode", "uftp.announce.flags.syncpreview",
1564
15
            FT_BOOLEAN, 8, NULL, FLAG_SYNC_PREVIEW, NULL, HFILL }
1565
15
        },
1566
15
        { &hf_uftp_announce_flags_reserved,
1567
15
            { "Reserved", "uftp.announce.flags.reserved",
1568
15
            FT_BOOLEAN, 8, NULL, FLAG_ANNOUNCE_RESERVED, NULL, HFILL }
1569
15
        },
1570
15
        { &hf_uftp_announce_destcount,
1571
15
            { "Destination Count", "uftp.announce.destcount",
1572
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1573
15
        },
1574
15
        { &hf_uftp_announce_announce_int,
1575
15
            { "Announce Interval", "uftp.announce.announce_int",
1576
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1577
15
        },
1578
15
        { &hf_uftp_announce_status_int,
1579
15
            { "Status Interval", "uftp.announce.status_int",
1580
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1581
15
        },
1582
15
        { &hf_uftp_announce_register_int,
1583
15
            { "Register Interval", "uftp.announce.register_int",
1584
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1585
15
        },
1586
15
        { &hf_uftp_announce_done_int,
1587
15
            { "Done Interval", "uftp.announce.done_int",
1588
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1589
15
        },
1590
15
        { &hf_uftp_announce_announce_time,
1591
15
            { "Announce Time", "uftp.announce.announce_time",
1592
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1593
15
        },
1594
15
        { &hf_uftp_announce_status_time,
1595
15
            { "Status Time", "uftp.announce.status_time",
1596
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1597
15
        },
1598
15
        { &hf_uftp_announce_mtu,
1599
15
            { "MTU", "uftp.announce.mtu",
1600
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1601
15
        },
1602
15
        { &hf_uftp_announce_privatemcast,
1603
15
            { "Private Multicast Address", "uftp.announce.privatemcast",
1604
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
1605
15
        },
1606
15
        { &hf_uftp_announce_client_auth,
1607
15
            { "Client Auth", "uftp.announce.client_auth",
1608
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1609
15
        },
1610
15
        { &hf_uftp_announce_sigtype,
1611
15
            { "Signature Type", "uftp.announce.sigtype",
1612
15
            FT_UINT8, BASE_DEC, VALS(signature_types), 0x0, NULL, HFILL }
1613
15
        },
1614
15
        { &hf_uftp_announce_hashtype,
1615
15
            { "Hash Type", "uftp.announce.hashtype",
1616
15
            FT_UINT8, BASE_DEC, VALS(hash_types), 0x0, NULL, HFILL }
1617
15
        },
1618
15
        { &hf_uftp_announce_keytype,
1619
15
            { "Key Type", "uftp.announce.keytype",
1620
15
            FT_UINT8, BASE_DEC, VALS(key_types), 0x0, NULL, HFILL }
1621
15
        },
1622
15
        { &hf_uftp_announce_keylen,
1623
15
            { "Public Key Length", "uftp.announce.keylen",
1624
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1625
15
        },
1626
15
        { &hf_uftp_announce_reserved,
1627
15
            { "Reserved", "uftp.announce.reserved",
1628
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1629
15
        },
1630
15
        { &hf_uftp_announce_keyexp,
1631
15
            { "Public Key Exponent", "uftp.announce.keyexp",
1632
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1633
15
        },
1634
15
        { &hf_uftp_announce_rand1,
1635
15
            { "Server Random Number", "uftp.announce.rand1",
1636
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1637
15
        },
1638
15
        { &hf_uftp_announce_keymod,
1639
15
            { "Public Key Modulus", "uftp.announce.keymod",
1640
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1641
15
        },
1642
15
        { &hf_uftp_register,
1643
15
            { "REGISTER", "uftp.register",
1644
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1645
15
        },
1646
15
        { &hf_uftp_register_func,
1647
15
            { "Type", "uftp.register.func",
1648
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1649
15
        },
1650
15
        { &hf_uftp_register_reserved,
1651
15
            { "Reserved", "uftp.register.reserved",
1652
15
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
1653
15
        },
1654
15
        { &hf_uftp_register_destcount,
1655
15
            { "Destination Count", "uftp.register.destcount",
1656
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1657
15
        },
1658
15
        { &hf_uftp_register_premaster_len,
1659
15
            { "Premaster Secret Length", "uftp.register.premaster_len",
1660
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1661
15
        },
1662
15
        { &hf_uftp_register_rand2,
1663
15
            { "Client Random Number", "uftp.register.rand2",
1664
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1665
15
        },
1666
15
        { &hf_uftp_register_premaster,
1667
15
            { "Encrypted Premaster Secret", "uftp.register.premaster",
1668
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1669
15
        },
1670
15
        { &hf_uftp_clientkey,
1671
15
            { "CLIENT_KEY", "uftp.clientkey",
1672
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1673
15
        },
1674
15
        { &hf_uftp_clientkey_func,
1675
15
            { "Type", "uftp.clientkey.func",
1676
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1677
15
        },
1678
15
        { &hf_uftp_clientkey_reserved,
1679
15
            { "Reserved", "uftp.clientkey.reserved",
1680
15
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
1681
15
        },
1682
15
        { &hf_uftp_clientkey_keylen,
1683
15
            { "Key Length", "uftp.clientkey.keylen",
1684
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1685
15
        },
1686
15
        { &hf_uftp_clientkey_verifylen,
1687
15
            { "Signature Length", "uftp.clientkey.verifylen",
1688
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1689
15
        },
1690
15
        { &hf_uftp_clientkey_keyexp,
1691
15
            { "Public Key Exponent", "uftp.clientkey.keyexp",
1692
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1693
15
        },
1694
15
        { &hf_uftp_clientkey_keymod,
1695
15
            { "Public Key Modulus", "uftp.clientkey.keymod",
1696
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1697
15
        },
1698
15
        { &hf_uftp_clientkey_verify,
1699
15
            { "Signature", "uftp.clientkey.verify",
1700
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1701
15
        },
1702
15
        { &hf_uftp_regconf,
1703
15
            { "REG_CONF", "uftp.regconf",
1704
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1705
15
        },
1706
15
        { &hf_uftp_regconf_func,
1707
15
            { "Type", "uftp.regconf.func",
1708
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1709
15
        },
1710
15
        { &hf_uftp_regconf_reserved,
1711
15
            { "Reserved", "uftp.regconf.reserved",
1712
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1713
15
        },
1714
15
        { &hf_uftp_regconf_destcount,
1715
15
            { "Destination Count", "uftp.regconf.destcount",
1716
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1717
15
        },
1718
15
        { &hf_uftp_fileinfo,
1719
15
            { "FILEINFO", "uftp.fileinfo",
1720
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1721
15
        },
1722
15
        { &hf_uftp_fileinfo_func,
1723
15
            { "Type", "uftp.fileinfo.func",
1724
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1725
15
        },
1726
15
        { &hf_uftp_fileinfo_ftype,
1727
15
            { "File Type", "uftp.fileinfo.ftype",
1728
15
            FT_UINT8, BASE_DEC, VALS(file_types), 0x0, NULL, HFILL }
1729
15
        },
1730
15
        { &hf_uftp_fileinfo_file_id,
1731
15
            { "File ID", "uftp.fileinfo.file_id",
1732
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1733
15
        },
1734
15
        { &hf_uftp_fileinfo_block_total,
1735
15
            { "Total Blocks", "uftp.fileinfo.block_total",
1736
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1737
15
        },
1738
15
        { &hf_uftp_fileinfo_section_total,
1739
15
            { "Total Sections", "uftp.fileinfo.section_total",
1740
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1741
15
        },
1742
15
        { &hf_uftp_fileinfo_destcount,
1743
15
            { "Destination Count", "uftp.fileinfo.destcount",
1744
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1745
15
        },
1746
15
        { &hf_uftp_fileinfo_fsize,
1747
15
            { "File Size", "uftp.fileinfo.fsize",
1748
15
            FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }
1749
15
        },
1750
15
        { &hf_uftp_fileinfo_ftstamp,
1751
15
            { "File Timestamp", "uftp.fileinfo.tstamp",
1752
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1753
15
        },
1754
15
        { &hf_uftp_fileinfo_name,
1755
15
            { "File Name", "uftp.fileinfo.name",
1756
15
            FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
1757
15
        },
1758
15
        { &hf_uftp_keyinfo,
1759
15
            { "KEYINFO", "uftp.keyinfo",
1760
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1761
15
        },
1762
15
        { &hf_uftp_keyinfo_func,
1763
15
            { "Type", "uftp.keyinfo.func",
1764
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1765
15
        },
1766
15
        { &hf_uftp_keyinfo_reserved,
1767
15
            { "Reserved", "uftp.keyinfo.reserved",
1768
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1769
15
        },
1770
15
        { &hf_uftp_keyinfo_destcount,
1771
15
            { "Destination Count", "uftp.keyinfo.destcount",
1772
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1773
15
        },
1774
15
        { &hf_uftp_keyinfo_groupmaster_len,
1775
15
            { "Group Master Length", "uftp.keyinfo.groupmaster_len",
1776
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1777
15
        },
1778
15
        { &hf_uftp_keyinfo_tstamp,
1779
15
            { "Timestamp", "uftp.keyinfo.tstamp",
1780
15
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
1781
15
        },
1782
15
        { &hf_uftp_keyinfo_destkey,
1783
15
            { "Destination Key", "uftp.keyinfo.destkey",
1784
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1785
15
        },
1786
15
        { &hf_uftp_keyinfo_destaddr,
1787
15
            { "Destination Address", "uftp.keyinfo.destaddr",
1788
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
1789
15
        },
1790
15
        { &hf_uftp_keyinfo_groupmaster,
1791
15
            { "Encrypted Group Master", "uftp.keyinfo.groupmaster",
1792
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1793
15
        },
1794
15
        { &hf_uftp_infoack,
1795
15
            { "INFO_ACK", "uftp.infoack",
1796
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1797
15
        },
1798
15
        { &hf_uftp_infoack_func,
1799
15
            { "Type", "uftp.infoack.func",
1800
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1801
15
        },
1802
15
        { &hf_uftp_infoack_flags,
1803
15
            { "Flags", "uftp.infoack.flags",
1804
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1805
15
        },
1806
15
        { &hf_uftp_infoack_flags_partial,
1807
15
            { "Partial", "uftp.infoack.flags.partial",
1808
15
            FT_BOOLEAN, 8, NULL, FLAG_PARTIAL, NULL, HFILL }
1809
15
        },
1810
15
        { &hf_uftp_infoack_flags_reserved,
1811
15
            { "Reserved", "uftp.infoack.flags.reserved",
1812
15
            FT_BOOLEAN, 8, NULL, FLAG_INFOACK_RESERVED, NULL, HFILL }
1813
15
        },
1814
15
        { &hf_uftp_infoack_file_id,
1815
15
            { "File ID", "uftp.infoack.file_id",
1816
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1817
15
        },
1818
15
        { &hf_uftp_infoack_destcount,
1819
15
            { "Destination Count", "uftp.infoack.destcount",
1820
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1821
15
        },
1822
15
        { &hf_uftp_infoack_reserved,
1823
15
            { "Reserved", "uftp.infoack.reserved",
1824
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1825
15
        },
1826
15
        { &hf_uftp_infoack_verify_data,
1827
15
            { "Verify Data", "uftp.infoack.verify_data",
1828
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1829
15
        },
1830
15
        { &hf_uftp_fileseg,
1831
15
            { "FILESEG", "uftp.fileseg",
1832
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1833
15
        },
1834
15
        { &hf_uftp_fileseg_func,
1835
15
            { "Type", "uftp.fileseg.func",
1836
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1837
15
        },
1838
15
        { &hf_uftp_fileseg_reserved1,
1839
15
            { "Reserved", "uftp.fileseg.reserved1",
1840
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1841
15
        },
1842
15
        { &hf_uftp_fileseg_file_id,
1843
15
            { "File ID", "uftp.fileseg.file_id",
1844
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1845
15
        },
1846
15
        { &hf_uftp_fileseg_pass,
1847
15
            { "Pass", "uftp.fileseg.pass",
1848
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1849
15
        },
1850
15
        { &hf_uftp_fileseg_reserved2,
1851
15
            { "Reserved", "uftp.fileseg.reserved2",
1852
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1853
15
        },
1854
15
        { &hf_uftp_fileseg_section,
1855
15
            { "Section", "uftp.fileseg.section",
1856
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1857
15
        },
1858
15
        { &hf_uftp_fileseg_seq_num,
1859
15
            { "Sequence Number", "uftp.fileseg.seq_num",
1860
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1861
15
        },
1862
15
        { &hf_uftp_fileseg_data,
1863
15
            { "Data", "uftp.fileseg.data",
1864
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1865
15
        },
1866
15
        { &hf_uftp_done,
1867
15
            { "DONE", "uftp.done",
1868
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1869
15
        },
1870
15
        { &hf_uftp_done_func,
1871
15
            { "Type", "uftp.done.func",
1872
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1873
15
        },
1874
15
        { &hf_uftp_done_pass,
1875
15
            { "Pass", "uftp.done.pass",
1876
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1877
15
        },
1878
15
        { &hf_uftp_done_section,
1879
15
            { "Section", "uftp.done.section",
1880
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1881
15
        },
1882
15
        { &hf_uftp_done_file_id,
1883
15
            { "File ID", "uftp.done.file_id",
1884
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1885
15
        },
1886
15
        { &hf_uftp_done_destcount,
1887
15
            { "Destination Count", "uftp.done.destcount",
1888
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1889
15
        },
1890
15
        { &hf_uftp_status,
1891
15
            { "STATUS", "uftp.status",
1892
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1893
15
        },
1894
15
        { &hf_uftp_status_func,
1895
15
            { "Type", "uftp.status.func",
1896
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1897
15
        },
1898
15
        { &hf_uftp_status_reserved,
1899
15
            { "Reserved", "uftp.status.reserved",
1900
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1901
15
        },
1902
15
        { &hf_uftp_status_file_id,
1903
15
            { "File ID", "uftp.status.file_id",
1904
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1905
15
        },
1906
15
        { &hf_uftp_status_pass,
1907
15
            { "Pass", "uftp.status.pass",
1908
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1909
15
        },
1910
15
        { &hf_uftp_status_seq,
1911
15
            { "Sequence", "uftp.status.seq",
1912
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1913
15
        },
1914
15
        { &hf_uftp_status_section,
1915
15
            { "Section", "uftp.status.section",
1916
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1917
15
        },
1918
15
        { &hf_uftp_status_nak_count,
1919
15
            { "NAK Count", "uftp.status.nak_count",
1920
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1921
15
        },
1922
15
        { &hf_uftp_status_naks,
1923
15
            { "NAKs", "uftp.status.naks",
1924
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
1925
15
        },
1926
15
        { &hf_uftp_prstatus,
1927
15
            { "PRSTATUS", "uftp.prstatus",
1928
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1929
15
        },
1930
15
        { &hf_uftp_prstatus_func,
1931
15
            { "Type", "uftp.prstatus.func",
1932
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1933
15
        },
1934
15
        { &hf_uftp_prstatus_reserved1,
1935
15
            { "Reserved", "uftp.prstatus.reserved1",
1936
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1937
15
        },
1938
15
        { &hf_uftp_prstatus_file_id,
1939
15
            { "File ID", "uftp.prstatus.file_id",
1940
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1941
15
        },
1942
15
        { &hf_uftp_prstatus_pass,
1943
15
            { "Pass", "uftp.prstatus.pass",
1944
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1945
15
        },
1946
15
        { &hf_uftp_prstatus_seq,
1947
15
            { "Sequence", "uftp.prstatus.seq",
1948
15
            FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
1949
15
        },
1950
15
        { &hf_uftp_prstatus_section,
1951
15
            { "Section", "uftp.prstatus.section",
1952
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1953
15
        },
1954
15
        { &hf_uftp_prstatus_destcount,
1955
15
            { "Destination Count", "uftp.prstatus.destcount",
1956
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
1957
15
        },
1958
15
        { &hf_uftp_prstatus_reserved2,
1959
15
            { "Reserved", "uftp.prstatus.reserved2",
1960
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1961
15
        },
1962
15
        { &hf_uftp_complete,
1963
15
            { "COMPLETE", "uftp.complete",
1964
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1965
15
        },
1966
15
        { &hf_uftp_complete_func,
1967
15
            { "Type", "uftp.complete.func",
1968
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1969
15
        },
1970
15
        { &hf_uftp_complete_status,
1971
15
            { "Completion status", "uftp.complete.status",
1972
15
            FT_UINT8, BASE_DEC, VALS(comp_status), 0x0, NULL, HFILL }
1973
15
        },
1974
15
        { &hf_uftp_complete_file_id,
1975
15
            { "File ID", "uftp.complete.file_id",
1976
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1977
15
        },
1978
15
        { &hf_uftp_complete_destcount,
1979
15
            { "Destination Count", "uftp.complete.destcount",
1980
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
1981
15
        },
1982
15
        { &hf_uftp_complete_reserved2,
1983
15
            { "Reserved", "uftp.complete.reserved2",
1984
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
1985
15
        },
1986
15
        { &hf_uftp_doneconf,
1987
15
            { "DONE_CONF", "uftp.doneconf",
1988
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
1989
15
        },
1990
15
        { &hf_uftp_doneconf_func,
1991
15
            { "Type", "uftp.doneconf.func",
1992
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
1993
15
        },
1994
15
        { &hf_uftp_doneconf_reserved1,
1995
15
            { "Reserved", "uftp.doneconf.reserved1",
1996
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
1997
15
        },
1998
15
        { &hf_uftp_doneconf_file_id,
1999
15
            { "File ID", "uftp.doneconf.file_id",
2000
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2001
15
        },
2002
15
        { &hf_uftp_doneconf_destcount,
2003
15
            { "Destination Count", "uftp.doneconf.destcount",
2004
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2005
15
        },
2006
15
        { &hf_uftp_doneconf_reserved2,
2007
15
            { "Reserved", "uftp.doneconf.reserved2",
2008
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2009
15
        },
2010
15
        { &hf_uftp_hbreq,
2011
15
            { "HB_REQ", "uftp.hbreq",
2012
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2013
15
        },
2014
15
        { &hf_uftp_hbreq_func,
2015
15
            { "Type", "uftp.hbreq.func",
2016
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2017
15
        },
2018
15
        { &hf_uftp_hbreq_reserved,
2019
15
            { "Reserved", "uftp.hbreq.reserved",
2020
15
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2021
15
        },
2022
15
        { &hf_uftp_hbreq_nonce,
2023
15
            { "Nonce", "uftp.hbreq.nonce",
2024
15
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2025
15
        },
2026
15
        { &hf_uftp_hbreq_keylen,
2027
15
            { "Key Length", "uftp.hbreq.keylen",
2028
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2029
15
        },
2030
15
        { &hf_uftp_hbreq_siglen,
2031
15
            { "Signature Length", "uftp.hbreq.siglen",
2032
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2033
15
        },
2034
15
        { &hf_uftp_hbreq_keyexp,
2035
15
            { "Public Key Exponent", "uftp.hbreq.keyexp",
2036
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2037
15
        },
2038
15
        { &hf_uftp_hbreq_keymod,
2039
15
            { "Public Key Modulus", "uftp.hbreq.keymod",
2040
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2041
15
        },
2042
15
        { &hf_uftp_hbreq_verify,
2043
15
            { "Signature", "uftp.hbreq.verify",
2044
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2045
15
        },
2046
15
        { &hf_uftp_hbresp,
2047
15
            { "HB_RESP", "uftp.hbresp",
2048
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2049
15
        },
2050
15
        { &hf_uftp_hbresp_func,
2051
15
            { "Type", "uftp.hbresp.func",
2052
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2053
15
        },
2054
15
        { &hf_uftp_hbresp_authenticated,
2055
15
            { "Authenticated", "uftp.hbresp.authenticated",
2056
15
            FT_UINT8, BASE_DEC, VALS(hb_auth_types), 0x0, NULL, HFILL }
2057
15
        },
2058
15
        { &hf_uftp_hbresp_reserved,
2059
15
            { "Reserved", "uftp.hbresp.reserved",
2060
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2061
15
        },
2062
15
        { &hf_uftp_hbresp_nonce,
2063
15
            { "Nonce", "uftp.hbresp.nonce",
2064
15
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2065
15
        },
2066
15
        { &hf_uftp_keyreq,
2067
15
            { "KEY_REQ", "uftp.keyreq",
2068
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2069
15
        },
2070
15
        { &hf_uftp_keyreq_func,
2071
15
            { "Type", "uftp.keyreq.func",
2072
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2073
15
        },
2074
15
        { &hf_uftp_keyreq_reserved,
2075
15
            { "Reserved", "uftp.keyreq.reserved",
2076
15
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2077
15
        },
2078
15
        { &hf_uftp_proxykey,
2079
15
            { "PROXY_KEY", "uftp.proxykey",
2080
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2081
15
        },
2082
15
        { &hf_uftp_proxykey_func,
2083
15
            { "Type", "uftp.proxykey.func",
2084
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2085
15
        },
2086
15
        { &hf_uftp_proxykey_reserved,
2087
15
            { "Reserved", "uftp.proxykey.reserved",
2088
15
            FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }
2089
15
        },
2090
15
        { &hf_uftp_proxykey_nonce,
2091
15
            { "Nonce", "uftp.proxykey.nonce",
2092
15
            FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
2093
15
        },
2094
15
        { &hf_uftp_proxykey_keylen,
2095
15
            { "Key Length", "uftp.proxykey.keylen",
2096
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2097
15
        },
2098
15
        { &hf_uftp_proxykey_siglen,
2099
15
            { "Signature Length", "uftp.proxykey.siglen",
2100
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2101
15
        },
2102
15
        { &hf_uftp_proxykey_keyexp,
2103
15
            { "Public Key Exponent", "uftp.proxykey.keyexp",
2104
15
            FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
2105
15
        },
2106
15
        { &hf_uftp_proxykey_keymod,
2107
15
            { "Public Key Modulus", "uftp.proxykey.keymod",
2108
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2109
15
        },
2110
15
        { &hf_uftp_proxykey_verify,
2111
15
            { "Signature", "uftp.proxykey.verify",
2112
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2113
15
        },
2114
15
        { &hf_uftp_encrypted,
2115
15
            { "ENCRYPTED", "uftp.encrypted",
2116
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2117
15
        },
2118
15
        { &hf_uftp_encrypted_tstamp,
2119
15
            { "Timestamp", "uftp.encrypted.tstamp",
2120
15
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL }
2121
15
        },
2122
15
        { &hf_uftp_encrypted_sig_len,
2123
15
            { "Signature Length", "uftp.encrypted.sig_len",
2124
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2125
15
        },
2126
15
        { &hf_uftp_encrypted_payload_len,
2127
15
            { "Payload Length", "uftp.encrypted.payload_len",
2128
15
            FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
2129
15
        },
2130
15
        { &hf_uftp_encrypted_signature,
2131
15
            { "Signature", "uftp.encrypted.signature",
2132
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2133
15
        },
2134
15
        { &hf_uftp_encrypted_payload,
2135
15
            { "Encrypted Payload", "uftp.encrypted.payload",
2136
15
            FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
2137
15
        },
2138
15
        { &hf_uftp_abort,
2139
15
            { "ABORT", "uftp.abort",
2140
15
            FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
2141
15
        },
2142
15
        { &hf_uftp_abort_func,
2143
15
            { "Type", "uftp.abort.func",
2144
15
            FT_UINT8, BASE_DEC, VALS(messages), 0x0, NULL, HFILL }
2145
15
        },
2146
15
        { &hf_uftp_abort_flags,
2147
15
            { "Flags", "uftp.abort.flags",
2148
15
            FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }
2149
15
        },
2150
15
        { &hf_uftp_abort_flags_curfile,
2151
15
            { "Current file", "uftp.abort.flags.curfile",
2152
15
            FT_BOOLEAN, 8, NULL, FLAG_CURRENT_FILE, NULL, HFILL }
2153
15
        },
2154
15
        { &hf_uftp_abort_flags_reserved,
2155
15
            { "Reserved", "uftp.abort.flags.reserved",
2156
15
            FT_BOOLEAN, 8, NULL, FLAG_ABORT_RESERVED, NULL, HFILL }
2157
15
        },
2158
15
        { &hf_uftp_abort_reserved,
2159
15
            { "Reserved", "uftp.abort.reserved",
2160
15
            FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }
2161
15
        },
2162
15
        { &hf_uftp_abort_host,
2163
15
            { "Host", "uftp.abort.host",
2164
15
            FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }
2165
15
        },
2166
15
        { &hf_uftp_abort_message,
2167
15
            { "Message", "uftp.abort.message",
2168
15
            FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
2169
15
        }
2170
15
    };
2171
2172
    /* Setup protocol subtree array */
2173
15
    static int *ett[] = {
2174
15
        &ett_uftp,
2175
15
        &ett_uftp_announce,
2176
15
        &ett_uftp_register,
2177
15
        &ett_uftp_clientkey,
2178
15
        &ett_uftp_regconf,
2179
15
        &ett_uftp_fileinfo,
2180
15
        &ett_uftp_keyinfo,
2181
15
        &ett_uftp_keyinfo_destkey,
2182
15
        &ett_uftp_infoack,
2183
15
        &ett_uftp_fileseg,
2184
15
        &ett_uftp_done,
2185
15
        &ett_uftp_status,
2186
15
        &ett_uftp_prstatus,
2187
15
        &ett_uftp_complete,
2188
15
        &ett_uftp_doneconf,
2189
15
        &ett_uftp_hbreq,
2190
15
        &ett_uftp_hbresp,
2191
15
        &ett_uftp_keyreq,
2192
15
        &ett_uftp_proxykey,
2193
15
        &ett_uftp_encrypted,
2194
15
        &ett_uftp_abort,
2195
15
        &ett_uftp_announce_flags,
2196
15
        &ett_uftp_infoack_flags,
2197
15
        &ett_uftp_abort_flags,
2198
15
        &ett_uftp_destlist
2199
15
    };
2200
2201
15
    static ei_register_info ei[] = {
2202
15
        { &ei_uftp_length_invalid, { "uftp.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }},
2203
15
        { &ei_uftp_func_unknown, { "uftp.func.invalid", PI_MALFORMED, PI_ERROR, "Unknown function", EXPFILL }}
2204
15
    };
2205
2206
15
    expert_module_t* expert_uftp;
2207
2208
15
    proto_uftp = proto_register_protocol("UDP based FTP w/ multicast", "UFTP", "uftp");
2209
2210
15
    proto_register_field_array(proto_uftp, hf, array_length(hf));
2211
15
    proto_register_subtree_array(ett, array_length(ett));
2212
15
    expert_uftp = expert_register_protocol(proto_uftp);
2213
15
    expert_register_field_array(expert_uftp, ei, array_length(ei));
2214
15
    uftp_handle = register_dissector("uftp", dissect_uftp, proto_uftp);
2215
15
}
2216
2217
void proto_reg_handoff_uftp(void)
2218
15
{
2219
15
    uftp4_handle = find_dissector("uftp4");
2220
15
    uftp5_handle = find_dissector("uftp5");
2221
15
    dissector_add_uint_with_preference("udp.port", UFTP_PORT, uftp_handle);
2222
15
}
2223
2224
/*
2225
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
2226
 *
2227
 * Local variables:
2228
 * c-basic-offset: 4
2229
 * tab-width: 8
2230
 * indent-tabs-mode: nil
2231
 * End:
2232
 *
2233
 * vi: set shiftwidth=4 tabstop=8 expandtab:
2234
 * :indentSize=4:tabSize=8:noTabs=true:
2235
 */