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-rdt.c
Line
Count
Source
1
/* packet-rdt.c
2
 *
3
 * Routines for RDT dissection
4
 * RDT = Real Data Transport
5
 *
6
 * Copyright 2005
7
 * Written by Martin Mathieson and Tom Marshall
8
 *
9
 * Wireshark - Network traffic analyzer
10
 * By Gerald Combs <gerald@wireshark.org>
11
 * Copyright 1998 Gerald Combs
12
 *
13
 * SPDX-License-Identifier: GPL-2.0-or-later
14
 */
15
16
/* Information sources:
17
 * helixcommunity.org sources, in particular
18
 * server/protocol/transport/rdt/pub/tngpkt.pm
19
 */
20
21
#include "config.h"
22
23
#include <epan/packet.h>
24
#include <epan/expert.h>
25
#include <epan/conversation.h>
26
#include <epan/prefs.h>
27
#include <epan/proto_data.h>
28
#include "packet-rdt.h"
29
30
static dissector_handle_t rdt_handle;
31
32
static int     proto_rdt;
33
34
/* Packet fields */
35
static int     hf_rdt_packet;
36
37
/* flags1: shared */
38
static int     hf_rdt_len_included;
39
40
/* flags1: data packet */
41
static int     hf_rdt_data_flags1;
42
static int     hf_rdt_data_need_reliable;
43
static int     hf_rdt_data_stream_id;
44
static int     hf_rdt_data_is_reliable;
45
46
/* flags2: data packet */
47
static int     hf_rdt_data_flags2;
48
static int     hf_rdt_data_backtoback;
49
static int     hf_rdt_data_slowdata;
50
static int     hf_rdt_data_asmrule;
51
52
/* flags1: asm action packet */
53
static int     hf_rdt_aact_flags;
54
static int     hf_rdt_aact_stream_id;
55
56
/* flags1: ack packet */
57
static int     hf_rdt_ack_flags;
58
static int     hf_rdt_ack_lost_high;
59
60
/* flags1: latency report packet */
61
static int     hf_rdt_latency_report_flags;
62
63
/* flags1: bandwidth report packet */
64
static int     hf_rdt_bandwidth_report_flags;
65
66
/* flags1: stream end packet */
67
static int     hf_rdt_stre_flags;
68
static int     hf_rdt_stre_need_reliable;
69
static int     hf_rdt_stre_stream_id;
70
static int     hf_rdt_stre_packet_sent;
71
static int     hf_rdt_stre_ext_flag;
72
73
/* static int     hf_rdt_rtt_request_flags; */
74
/* static int     hf_rdt_rtt_response_flags; */
75
/* static int     hf_rdt_congestion_flags; */
76
static int     hf_rdt_report_flags;
77
/* static int     hf_rdt_tirq_flags; */
78
static int     hf_rdt_tirp_flags;
79
static int     hf_rdt_bw_probing_flags;
80
81
/* Octets 1-2: sequence number or packet type */
82
static int     hf_rdt_sequence_number;
83
static int     hf_rdt_packet_type;
84
85
/* Only present if length_included */
86
static int     hf_rdt_packet_length;
87
88
/* General shared fields */
89
static int     hf_rdt_timestamp;
90
static int     hf_rdt_stream_id_ex;
91
static int     hf_rdt_asmrule_ex;
92
static int     hf_rdt_total_reliable;
93
static int     hf_rdt_data;
94
95
/* Special use fields */
96
static int     hf_rdt_aact_reliable_seqno;
97
static int     hf_rdt_brpt_interval;
98
static int     hf_rdt_brpt_bandwidth;
99
static int     hf_rdt_brpt_sequence;
100
static int     hf_rdt_rtrp_ts_sec;
101
static int     hf_rdt_rtrp_ts_usec;
102
static int     hf_rdt_cong_xmit_mult;
103
static int     hf_rdt_cong_recv_mult;
104
static int     hf_rdt_stre_seqno;
105
static int     hf_rdt_stre_dummy_flags1;
106
static int     hf_rdt_stre_dummy_type;
107
static int     hf_rdt_stre_reason_code;
108
static int     hf_rdt_lrpt_server_out_time;
109
static int     hf_rdt_tirq_request_rtt_info;
110
static int     hf_rdt_tirq_request_buffer_info;
111
static int     hf_rdt_tirq_request_time_msec;
112
static int     hf_rdt_tirp_has_rtt_info;
113
static int     hf_rdt_tirp_is_delayed;
114
static int     hf_rdt_tirp_has_buffer_info;
115
static int     hf_rdt_tirp_request_time_msec;
116
static int     hf_rdt_tirp_response_time_msec;
117
static int     hf_rdt_tirp_buffer_info;
118
static int     hf_rdt_tirp_buffer_info_count;
119
static int     hf_rdt_tirp_buffer_info_stream_id;
120
static int     hf_rdt_tirp_buffer_info_lowest_timestamp;
121
static int     hf_rdt_tirp_buffer_info_highest_timestamp;
122
static int     hf_rdt_tirp_buffer_info_bytes_buffered;
123
static int     hf_rdt_bwpp_seqno;
124
static int     hf_rdt_unk_flags1;
125
126
/* RDT setup fields */
127
static int     hf_rdt_setup;
128
static int     hf_rdt_setup_frame;
129
static int     hf_rdt_setup_method;
130
static int     hf_rdt_feature_level;
131
132
/* RDT fields defining a sub tree */
133
static int     ett_rdt;
134
static int     ett_rdt_packet;
135
static int     ett_rdt_setup;
136
static int     ett_rdt_data_flags1;
137
static int     ett_rdt_data_flags2;
138
static int     ett_rdt_aact_flags;
139
static int     ett_rdt_ack_flags;
140
static int     ett_rdt_latency_report_flags;
141
static int     ett_rdt_bandwidth_report_flags;
142
static int     ett_rdt_stre_flags;
143
static int     ett_rdt_rtt_request_flags;
144
static int     ett_rdt_rtt_response_flags;
145
static int     ett_rdt_congestion_flags;
146
static int     ett_rdt_report_flags;
147
static int     ett_rdt_tirq_flags;
148
static int     ett_rdt_tirp_flags;
149
static int     ett_rdt_tirp_buffer_info;
150
static int     ett_rdt_bw_probing_flags;
151
152
static expert_field ei_rdt_packet_length;
153
154
15
#define RDT_UDP_PORT        6970
155
156
void proto_register_rdt(void);
157
void proto_reg_handoff_rdt(void);
158
159
/* Parse individual packet types */
160
static unsigned dissect_rdt_data_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
161
static unsigned dissect_rdt_asm_action_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
162
static unsigned dissect_rdt_bandwidth_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
163
static unsigned dissect_rdt_ack_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
164
static unsigned dissect_rdt_rtt_request_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
165
static unsigned dissect_rdt_rtt_response_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
166
static unsigned dissect_rdt_congestion_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
167
static unsigned dissect_rdt_stream_end_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
168
static unsigned dissect_rdt_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
169
static unsigned dissect_rdt_latency_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
170
static unsigned dissect_rdt_transport_info_request_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
171
static unsigned dissect_rdt_transport_info_response_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
172
static unsigned dissect_rdt_bw_probing_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
173
static unsigned dissect_rdt_unknown_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
174
175
static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
176
177
/* Preferences bool to control whether or not setup info should be shown */
178
static bool global_rdt_show_setup_info = true;
179
180
/* Packet types */
181
2
#define RDT_ASMACTIION_PACKET               0xff00
182
1
#define RDT_BANDWIDTHREPORT_PACKET          0xff01
183
1
#define RDT_ACK_PACKET                      0xff02
184
1
#define RDT_RTTREQUEST_PACKET               0xff03
185
0
#define RDT_RTTRESPONSE_PACKET              0xff04
186
0
#define RDT_CONGESTION_PACKET               0xff05
187
1
#define RDT_STREAMEND_PACKET                0xff06
188
1
#define RDT_REPORT_PACKET                   0xff07
189
0
#define RDT_LATENCYREPORT_PACKET            0xff08
190
1
#define RDT_TRANSPORTINFO_PACKET            0xff09
191
8
#define RDT_TRANSPORTINFORESPONSE_PACKET    0xff0a
192
2
#define RDT_BWPROBING_PACKET                0xff0b
193
194
static const value_string packet_type_vals[] =
195
{
196
    { RDT_ASMACTIION_PACKET,             "Asm action"  },
197
    { RDT_BANDWIDTHREPORT_PACKET,        "Bandwidth report"  },
198
    { RDT_ACK_PACKET,                    "Ack"  },
199
    { RDT_RTTREQUEST_PACKET,             "RTT request"  },
200
    { RDT_RTTRESPONSE_PACKET,            "RTT response"  },
201
    { RDT_CONGESTION_PACKET,             "Congestion"  },
202
    { RDT_STREAMEND_PACKET,              "Stream end" },
203
    { RDT_REPORT_PACKET,                 "Report" },
204
    { RDT_LATENCYREPORT_PACKET,          "Latency report" },
205
    { RDT_TRANSPORTINFO_PACKET,          "Transport info" },
206
    { RDT_TRANSPORTINFORESPONSE_PACKET,  "Transport info response" },
207
    { RDT_BWPROBING_PACKET,              "BW probing" },
208
    { 0, NULL }
209
};
210
211
212
/* Set up an RDT conversation */
213
void rdt_add_address(packet_info *pinfo,
214
                     address *addr, int port,
215
                     int other_port,
216
                     const char *setup_method,
217
                     int   rdt_feature_level)
218
0
{
219
0
    address null_addr;
220
0
    conversation_t* p_conv;
221
0
    struct _rdt_conversation_info *p_conv_data;
222
223
    /* If this isn't the first time this packet has been processed,
224
       we've already done this work, so we don't need to do it
225
      again. */
226
0
    if (pinfo->fd->visited)
227
0
    {
228
0
        return;
229
0
    }
230
231
0
    clear_address(&null_addr);
232
233
    /* Check if the ip address and port combination is not already registered
234
       as a conversation. */
235
0
    p_conv = find_conversation(pinfo->num, addr, &null_addr, CONVERSATION_UDP, port, other_port,
236
0
                               NO_ADDR_B | (!other_port ? NO_PORT_B : 0));
237
238
    /* If not, create a new conversation. */
239
0
    if ( !p_conv || p_conv->setup_frame != pinfo->num)
240
0
    {
241
0
        p_conv = conversation_new(pinfo->num, addr, &null_addr, CONVERSATION_UDP,
242
0
                                  (uint32_t)port, (uint32_t)other_port,
243
0
                                  NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
244
0
    }
245
246
    /* Set dissector */
247
0
    conversation_set_dissector(p_conv, rdt_handle);
248
249
    /* Check if the conversation has data associated with it. */
250
0
    p_conv_data = (struct _rdt_conversation_info *)conversation_get_proto_data(p_conv, proto_rdt);
251
252
    /* If not, add a new data item. */
253
0
    if (!p_conv_data)
254
0
    {
255
        /* Create conversation data */
256
0
        p_conv_data = wmem_new(wmem_file_scope(), struct _rdt_conversation_info);
257
0
        conversation_add_proto_data(p_conv, proto_rdt, p_conv_data);
258
0
    }
259
260
    /* Update the conversation data. */
261
0
    (void) g_strlcpy(p_conv_data->method, setup_method, MAX_RDT_SETUP_METHOD_SIZE);
262
0
    p_conv_data->frame_number = pinfo->num;
263
0
    p_conv_data->feature_level = rdt_feature_level;
264
0
}
265
266
267
268
/****************************************************************************/
269
/* Main dissection function                                                 */
270
/****************************************************************************/
271
static int dissect_rdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
272
26
{
273
26
    unsigned    previous_offset = 0;
274
26
    int         offset = 0;
275
26
    proto_item  *ti;
276
26
    proto_tree  *rdt_tree = NULL;
277
26
    proto_tree  *rdt_packet_tree;
278
26
    uint16_t    packet_type;
279
280
    /* Set/clear columns */
281
26
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "RDT");
282
26
    col_clear(pinfo->cinfo, COL_INFO);
283
284
    /* Create RDT protocol tree */
285
26
    ti = proto_tree_add_item(tree, proto_rdt, tvb, offset, -1, ENC_NA);
286
26
    rdt_tree = proto_item_add_subtree(ti, ett_rdt);
287
288
    /* Conversation setup info */
289
26
    if (global_rdt_show_setup_info)
290
26
    {
291
26
        show_setup_info(tvb, pinfo, rdt_tree);
292
26
    }
293
294
    /* Parse all RDT packets found in the frame */
295
42
    while (offset != -1 && tvb_reported_length_remaining(tvb, offset))
296
29
    {
297
        /* Every packet type should have at least 3 bytes */
298
29
        tvb_ensure_bytes_exist(tvb, offset, 3);
299
300
        /* 2nd & 3rd bytes determine packet type */
301
29
        packet_type = tvb_get_ntohs(tvb, offset+1);
302
303
        /* Add a tree for the next individual packet */
304
29
        ti =  proto_tree_add_string_format(rdt_tree, hf_rdt_packet, tvb, offset, -1,
305
29
                                           "",
306
29
                                           "RDT packet (%s)",
307
29
                                           packet_type < 0xff00 ? "Data" :
308
29
                                               val_to_str_const(packet_type, packet_type_vals, "Unknown"));
309
29
        rdt_packet_tree = proto_item_add_subtree(ti, ett_rdt_packet);
310
311
        /* Dissect the details of the next packet in this frame */
312
29
        if (packet_type < 0xff00)
313
7
        {
314
7
            offset = dissect_rdt_data_packet(tvb, pinfo, rdt_packet_tree, offset);
315
7
        }
316
22
        else
317
22
        {
318
22
            switch (packet_type)
319
22
            {
320
2
            case RDT_ASMACTIION_PACKET:
321
2
                offset = dissect_rdt_asm_action_packet(tvb, pinfo, rdt_packet_tree, offset);
322
2
                break;
323
1
            case RDT_BANDWIDTHREPORT_PACKET:
324
1
                offset = dissect_rdt_bandwidth_report_packet(tvb, pinfo, rdt_packet_tree, offset);
325
1
                break;
326
1
            case RDT_ACK_PACKET:
327
1
                offset = dissect_rdt_ack_packet(tvb, pinfo, rdt_packet_tree, offset);
328
1
                break;
329
1
            case RDT_RTTREQUEST_PACKET:
330
1
                offset = dissect_rdt_rtt_request_packet(tvb, pinfo, rdt_packet_tree, offset);
331
1
                break;
332
0
            case RDT_RTTRESPONSE_PACKET:
333
0
                offset = dissect_rdt_rtt_response_packet(tvb, pinfo, rdt_packet_tree, offset);
334
0
                break;
335
0
            case RDT_CONGESTION_PACKET:
336
0
                offset = dissect_rdt_congestion_packet(tvb, pinfo, rdt_packet_tree, offset);
337
0
                break;
338
1
            case RDT_STREAMEND_PACKET:
339
1
                offset = dissect_rdt_stream_end_packet(tvb, pinfo, rdt_packet_tree, offset);
340
1
                break;
341
1
            case RDT_REPORT_PACKET:
342
1
                offset = dissect_rdt_report_packet(tvb, pinfo, rdt_packet_tree, offset);
343
1
                break;
344
0
            case RDT_LATENCYREPORT_PACKET:
345
0
                offset = dissect_rdt_latency_report_packet(tvb, pinfo, rdt_packet_tree, offset);
346
0
                break;
347
1
            case RDT_TRANSPORTINFO_PACKET:
348
1
                offset = dissect_rdt_transport_info_request_packet(tvb, pinfo, rdt_packet_tree, offset);
349
1
                break;
350
8
            case RDT_TRANSPORTINFORESPONSE_PACKET:
351
8
                offset = dissect_rdt_transport_info_response_packet(tvb, pinfo, rdt_packet_tree, offset);
352
8
                break;
353
2
            case RDT_BWPROBING_PACKET:
354
2
                offset = dissect_rdt_bw_probing_packet(tvb, pinfo, rdt_packet_tree, offset);
355
2
                break;
356
357
1
            default:
358
                /* Unknown control packet */
359
1
                offset = dissect_rdt_unknown_control(tvb, pinfo, rdt_packet_tree, offset);
360
1
                break;
361
22
            }
362
22
        }
363
364
        /* Select correct number of bytes for the tree showing this packet */
365
16
        if (offset != -1)
366
13
        {
367
13
            proto_item_set_len(rdt_packet_tree, offset-previous_offset);
368
13
        }
369
16
        previous_offset = offset;
370
16
    }
371
372
13
    return tvb_captured_length(tvb);
373
26
}
374
375
376
377
/************************************************/
378
/* Functions to dissect individual packet types */
379
/************************************************/
380
381
/* Dissect a data packet */
382
unsigned dissect_rdt_data_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
383
7
{
384
7
    unsigned    start_offset = offset;
385
7
    uint16_t    packet_length;
386
7
    uint8_t     flags1;
387
7
    uint8_t     length_included_flag;
388
7
    uint8_t     need_reliable_flag;
389
7
    uint16_t    stream_id;
390
7
    uint16_t    sequence_number;
391
7
    uint8_t     is_reliable_flag;
392
7
    uint8_t     flags2;
393
7
    uint32_t    timestamp;
394
7
    uint16_t    asm_rule_number;
395
7
    uint8_t     back_to_back;
396
7
    uint8_t     slow_data;
397
7
    proto_tree  *flags_tree1;
398
7
    proto_tree  *flags_tree2;
399
7
    proto_item  *ti;
400
401
    /* Flags in first byte */
402
7
    flags1 = tvb_get_uint8(tvb, offset);
403
7
    length_included_flag = (flags1 & 0x80) >> 7;
404
7
    need_reliable_flag = (flags1 & 0x40) >> 6;
405
7
    stream_id = (flags1 & 0x3e) >> 1;
406
7
    is_reliable_flag = flags1 & 0x01;
407
408
    /* Create subtree for flags1 fields */
409
7
    ti =  proto_tree_add_string_format(tree, hf_rdt_data_flags1, tvb, offset, 1,
410
7
            "",
411
7
            "Length-included=%u, need-reliable=%u, stream-id=%u, is-reliable=%u",
412
7
            length_included_flag,
413
7
            need_reliable_flag,
414
7
            stream_id,
415
7
            is_reliable_flag);
416
7
    flags_tree1 = proto_item_add_subtree(ti, ett_rdt_data_flags1);
417
418
7
    proto_tree_add_item(flags_tree1, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
419
7
    proto_tree_add_item(flags_tree1, hf_rdt_data_need_reliable, tvb, offset, 1, ENC_BIG_ENDIAN);
420
7
    proto_tree_add_item(flags_tree1, hf_rdt_data_stream_id, tvb, offset, 1, ENC_BIG_ENDIAN);
421
7
    proto_tree_add_item(flags_tree1, hf_rdt_data_is_reliable, tvb, offset, 1, ENC_BIG_ENDIAN);
422
7
    offset++;
423
424
    /* Sequence number */
425
7
    proto_tree_add_item_ret_uint16(tree, hf_rdt_sequence_number, tvb, offset, 2, ENC_BIG_ENDIAN, &sequence_number);
426
7
    offset += 2;
427
428
    /* Length field is optional */
429
7
    if (length_included_flag)
430
3
    {
431
3
        proto_tree_add_item_ret_uint16(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN, &packet_length);
432
3
        offset += 2;
433
434
        /* Check that there are as many bytes as reported */
435
3
        tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
436
3
    }
437
4
    else
438
4
    {
439
4
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
440
4
    }
441
442
    /* More flags */
443
7
    flags2 = tvb_get_uint8(tvb, offset);
444
7
    back_to_back = (flags2 & 0x80) >> 7;
445
7
    slow_data = (flags2 & 0x40) >> 6;
446
7
    asm_rule_number = flags2 & 0x3f;
447
448
449
    /* Create subtree for flags2 fields */
450
7
    ti =  proto_tree_add_string_format(tree, hf_rdt_data_flags2, tvb, offset, 1,
451
7
            "",
452
7
            "Back-to-back=%u, slow-data=%u, asm-rule=%u",
453
7
            back_to_back,
454
7
            slow_data,
455
7
            asm_rule_number);
456
457
    /* Create subtree for flags and add fields */
458
7
    flags_tree2 = proto_item_add_subtree(ti, ett_rdt_data_flags2);
459
460
7
    proto_tree_add_item(flags_tree2, hf_rdt_data_backtoback, tvb, offset, 1, ENC_BIG_ENDIAN);
461
7
    proto_tree_add_item(flags_tree2, hf_rdt_data_slowdata, tvb, offset, 1, ENC_BIG_ENDIAN);
462
7
    proto_tree_add_item(flags_tree2, hf_rdt_data_asmrule, tvb, offset, 1, ENC_BIG_ENDIAN);
463
7
    offset++;
464
465
    /* Timestamp */
466
7
    proto_tree_add_item_ret_uint(tree, hf_rdt_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN, &timestamp);
467
7
    offset += 4;
468
469
    /* Stream ID expansion */
470
7
    if (stream_id == 31)
471
0
    {
472
0
        stream_id = tvb_get_ntohs(tvb, offset);
473
0
        proto_tree_add_item(tree, hf_rdt_stream_id_ex, tvb, offset, 2, ENC_BIG_ENDIAN);
474
0
        offset += 2;
475
0
    }
476
477
    /* Total reliable */
478
7
    if (need_reliable_flag)
479
1
    {
480
1
        proto_tree_add_item(tree, hf_rdt_total_reliable, tvb, offset, 2, ENC_BIG_ENDIAN);
481
1
        offset += 2;
482
1
    }
483
484
    /* Asm rule number */
485
7
    if (asm_rule_number == 63)
486
1
    {
487
1
        asm_rule_number = tvb_get_ntohs(tvb, offset);
488
1
        proto_tree_add_item(tree, hf_rdt_asmrule_ex, tvb, offset, 2, ENC_BIG_ENDIAN);
489
1
        offset += 2;
490
1
    }
491
492
7
    col_append_fstr(pinfo->cinfo, COL_INFO,
493
7
                    "DATA: stream-id=%02u asm-rule=%02u seq=%05u ts=%05u  ",
494
7
                    stream_id, asm_rule_number, sequence_number, timestamp);
495
496
    /* The remaining data is unparsed. */
497
7
    proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
498
7
    offset += tvb_captured_length_remaining(tvb, offset);
499
500
7
    if (packet_length < (offset - start_offset) ||
501
3
        packet_length > tvb_reported_length_remaining(tvb, start_offset))
502
1
    {
503
1
        proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
504
1
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
505
1
    }
506
507
7
    return start_offset + packet_length;
508
7
}
509
510
/* Dissect an asm-action packet */
511
unsigned dissect_rdt_asm_action_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
512
2
{
513
2
    unsigned    start_offset = offset;
514
2
    uint16_t    packet_length;
515
2
    uint8_t     flags1;
516
2
    uint8_t     length_included_flag;
517
2
    uint16_t    stream_id;
518
2
    uint16_t    rel_seqno;
519
2
    proto_tree  *flags_tree;
520
2
    proto_item  *ti;
521
522
    /* Flags in first byte */
523
2
    flags1 = tvb_get_uint8(tvb, offset);
524
2
    length_included_flag = (flags1 & 0x80) >> 7;
525
2
    stream_id = (flags1 & 0x7c) >> 2;
526
527
    /* Create subtree for flags fields */
528
2
    proto_tree_add_item(tree, proto_rdt, tvb, offset, -1, ENC_NA);
529
2
    ti =  proto_tree_add_string_format(tree, hf_rdt_aact_flags, tvb, offset, 1,
530
2
            "",
531
2
            "Length-included=%u, stream_id=%u",
532
2
            length_included_flag,
533
2
            stream_id);
534
2
    flags_tree = proto_item_add_subtree(ti, ett_rdt_aact_flags);
535
536
2
    proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
537
2
    proto_tree_add_item(flags_tree, hf_rdt_aact_stream_id, tvb, offset, 1, ENC_BIG_ENDIAN);
538
2
    offset++;
539
540
    /* Packet type */
541
2
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
542
2
    offset += 2;
543
544
2
    proto_tree_add_item_ret_uint16(tree, hf_rdt_aact_reliable_seqno, tvb, offset, 2, ENC_BIG_ENDIAN, &rel_seqno);
545
2
    offset += 2;
546
547
    /* Length field is optional */
548
2
    if (length_included_flag)
549
1
    {
550
1
        proto_tree_add_item_ret_uint16(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN, &packet_length);
551
1
        offset += 2;
552
553
        /* Check that there are as many bytes as reported */
554
1
        tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
555
1
    }
556
1
    else
557
1
    {
558
1
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
559
1
    }
560
561
    /* Stream ID expansion */
562
2
    if (stream_id == 31)
563
0
    {
564
0
        stream_id = tvb_get_ntohs(tvb, offset);
565
0
        proto_tree_add_item(tree, hf_rdt_stream_id_ex, tvb, offset, 2, ENC_BIG_ENDIAN);
566
0
        offset += 2;
567
0
    }
568
569
2
    col_append_fstr(pinfo->cinfo, COL_INFO,
570
2
                    "ASM-ACTION: stream-id=%02u rel-seqno=%05u  ",
571
2
                    stream_id, rel_seqno);
572
573
    /* The remaining data is unparsed. */
574
2
    proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
575
576
2
    if (packet_length < (offset - start_offset) ||
577
1
        packet_length > tvb_reported_length_remaining(tvb, start_offset))
578
0
    {
579
0
        proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
580
0
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
581
0
    }
582
583
2
    return start_offset + packet_length;
584
2
}
585
586
/* Dissect an bandwidth-report packet */
587
unsigned dissect_rdt_bandwidth_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
588
1
{
589
1
    unsigned    start_offset = offset;
590
1
    uint16_t    packet_length;
591
1
    uint8_t     flags1;
592
1
    uint8_t     length_included_flag;
593
1
    proto_tree  *flags_tree;
594
1
    proto_item  *ti;
595
596
    /* Flags in first byte */
597
1
    flags1 = tvb_get_uint8(tvb, offset);
598
1
    length_included_flag = (flags1 & 0x80) >> 7;
599
600
    /* Create subtree for flags fields */
601
1
    ti =  proto_tree_add_string_format(tree, hf_rdt_bandwidth_report_flags, tvb, offset, 1,
602
1
            "",
603
1
            "Length-included=%u",
604
1
            length_included_flag);
605
1
    flags_tree = proto_item_add_subtree(ti, ett_rdt_bandwidth_report_flags);
606
607
1
    proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
608
1
    offset++;
609
610
    /* Packet type */
611
1
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
612
1
    offset += 2;
613
614
    /* Length field is optional */
615
1
    if (length_included_flag)
616
1
    {
617
1
        proto_tree_add_item_ret_uint16(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN, &packet_length);
618
1
        offset += 2;
619
620
        /* Check that there are as many bytes as reported */
621
1
        tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
622
1
    }
623
0
    else
624
0
    {
625
0
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
626
0
    }
627
628
1
    proto_tree_add_item(tree, hf_rdt_brpt_interval, tvb, offset, 2, ENC_BIG_ENDIAN);
629
1
    offset += 2;
630
1
    proto_tree_add_item(tree, hf_rdt_brpt_bandwidth, tvb, offset, 4, ENC_BIG_ENDIAN);
631
1
    offset += 4;
632
1
    proto_tree_add_item(tree, hf_rdt_brpt_sequence, tvb, offset, 1, ENC_BIG_ENDIAN);
633
1
    offset += 1;
634
635
1
    col_append_str(pinfo->cinfo, COL_INFO, "BANDWIDTH-REPORT:  ");
636
637
1
    if (packet_length < (offset - start_offset) ||
638
0
        packet_length > tvb_reported_length_remaining(tvb, start_offset))
639
0
    {
640
0
        proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
641
0
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
642
0
    }
643
644
1
    return start_offset + packet_length;
645
1
}
646
647
/* Dissect an ack packet */
648
unsigned dissect_rdt_ack_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
649
1
{
650
1
    unsigned    start_offset = offset;
651
1
    uint16_t    packet_length;
652
1
    uint8_t     flags1;
653
1
    uint8_t     length_included_flag;
654
1
    uint8_t     lost_high_flag;
655
1
    proto_tree  *flags_tree;
656
1
    proto_item  *ti;
657
658
    /* Flags in first byte */
659
1
    flags1 = tvb_get_uint8(tvb, offset);
660
1
    length_included_flag = (flags1 & 0x80) >> 7;
661
1
    lost_high_flag = (flags1 & 0x40) >> 6;
662
663
    /* Create subtree for flags fields */
664
1
    ti =  proto_tree_add_string_format(tree, hf_rdt_ack_flags, tvb, offset, 1,
665
1
            "",
666
1
            "Length-included=%u, lost-high=%u",
667
1
            length_included_flag,
668
1
            lost_high_flag);
669
1
    flags_tree = proto_item_add_subtree(ti, ett_rdt_ack_flags);
670
671
1
    proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
672
1
    proto_tree_add_item(flags_tree, hf_rdt_ack_lost_high, tvb, offset, 1, ENC_BIG_ENDIAN);
673
1
    offset++;
674
675
    /* Packet type */
676
1
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
677
1
    offset += 2;
678
679
    /* Length field is optional */
680
1
    if (length_included_flag)
681
0
    {
682
0
        proto_tree_add_item_ret_uint16(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN, &packet_length);
683
0
        offset += 2;
684
685
        /* Check that there are as many bytes as reported */
686
0
        tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
687
0
    }
688
1
    else
689
1
    {
690
1
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
691
1
    }
692
693
    /* XXX: The remaining data is unparsed. */
694
1
    proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
695
696
1
    col_append_fstr(pinfo->cinfo, COL_INFO, "ACK: lh=%u  ", lost_high_flag);
697
698
1
    if (packet_length < (offset - start_offset) ||
699
1
        packet_length > tvb_reported_length_remaining(tvb, start_offset))
700
0
    {
701
0
        proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
702
0
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
703
0
    }
704
705
1
    return start_offset + packet_length;
706
1
}
707
708
/* Dissect an att-request packet */
709
unsigned dissect_rdt_rtt_request_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
710
1
{
711
    /* Flags in first byte */
712
1
    offset++;
713
714
    /* Packet type */
715
1
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
716
1
    offset += 2;
717
718
1
    col_append_str(pinfo->cinfo, COL_INFO, "RTT-REQUEST:  ");
719
720
1
    return offset;
721
1
}
722
723
/* Dissect an att-response packet */
724
unsigned dissect_rdt_rtt_response_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
725
0
{
726
    /* Flags in first byte */
727
0
    offset++;
728
729
    /* Packet type */
730
0
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
731
0
    offset += 2;
732
733
0
    proto_tree_add_item(tree, hf_rdt_rtrp_ts_sec, tvb, offset, 4, ENC_BIG_ENDIAN);
734
0
    offset += 4;
735
0
    proto_tree_add_item(tree, hf_rdt_rtrp_ts_usec, tvb, offset, 4, ENC_BIG_ENDIAN);
736
0
    offset += 4;
737
738
0
    col_append_str(pinfo->cinfo, COL_INFO, "RTT-RESPONSE:  ");
739
740
0
    return offset;
741
0
}
742
743
/* Dissect an congestion packet */
744
unsigned dissect_rdt_congestion_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
745
0
{
746
    /* Flags in first byte */
747
0
    offset++;
748
749
    /* Packet type */
750
0
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
751
0
    offset += 2;
752
753
0
    proto_tree_add_item(tree, hf_rdt_cong_xmit_mult, tvb, offset, 4, ENC_BIG_ENDIAN);
754
0
    offset += 4;
755
0
    proto_tree_add_item(tree, hf_rdt_cong_recv_mult, tvb, offset, 4, ENC_BIG_ENDIAN);
756
0
    offset += 4;
757
758
0
    col_append_str(pinfo->cinfo, COL_INFO, "CONGESTION:  ");
759
760
0
    return offset;
761
0
}
762
763
/* Dissect an stream-end packet */
764
unsigned dissect_rdt_stream_end_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
765
1
{
766
1
    uint8_t     flags1;
767
1
    uint8_t     need_reliable;
768
1
    uint16_t    stream_id;
769
1
    uint8_t     packet_sent;
770
1
    uint8_t     ext_flag;
771
1
    proto_tree  *flags_tree;
772
1
    proto_item  *ti;
773
774
    /* Flags in first byte */
775
1
    flags1 = tvb_get_uint8(tvb, offset);
776
1
    need_reliable = (flags1 & 0x80) >> 7;
777
1
    stream_id = (flags1 & 0x7c) >> 2;
778
1
    packet_sent = (flags1 & 0x2) >> 1;
779
1
    ext_flag = flags1 & 0x1;
780
781
    /* Create subtree for flags fields */
782
1
    ti =  proto_tree_add_string_format(tree, hf_rdt_stre_flags, tvb, offset, 1,
783
1
            "",
784
1
            "Need-reliable=%u, stream-id=%u, packet-sent=%u, ext-flag=%u",
785
1
            need_reliable,
786
1
            stream_id,
787
1
            packet_sent,
788
1
            ext_flag);
789
1
    flags_tree = proto_item_add_subtree(ti, ett_rdt_stre_flags);
790
791
1
    proto_tree_add_item(flags_tree, hf_rdt_stre_need_reliable, tvb, offset, 1, ENC_BIG_ENDIAN);
792
1
    proto_tree_add_item(flags_tree, hf_rdt_stre_stream_id, tvb, offset, 1, ENC_BIG_ENDIAN);
793
1
    proto_tree_add_item(flags_tree, hf_rdt_stre_packet_sent, tvb, offset, 1, ENC_BIG_ENDIAN);
794
1
    proto_tree_add_item(flags_tree, hf_rdt_stre_ext_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
795
1
    offset++;
796
797
    /* Packet type */
798
1
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
799
1
    offset += 2;
800
801
1
    proto_tree_add_item(tree, hf_rdt_stre_seqno, tvb, offset, 2, ENC_BIG_ENDIAN);
802
1
    offset += 2;
803
1
    proto_tree_add_item(tree, hf_rdt_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
804
1
    offset += 4;
805
806
    /* Stream ID expansion */
807
1
    if (stream_id == 31)
808
1
    {
809
1
        stream_id = tvb_get_ntohs(tvb, offset);
810
1
        proto_tree_add_item(tree, hf_rdt_stream_id_ex, tvb, offset, 2, ENC_BIG_ENDIAN);
811
1
        offset += 2;
812
1
    }
813
814
    /* Total reliable */
815
1
    if (need_reliable)
816
1
    {
817
1
        proto_tree_add_item(tree, hf_rdt_total_reliable, tvb, offset, 2, ENC_BIG_ENDIAN);
818
1
        offset += 2;
819
1
    }
820
821
1
    if (ext_flag)
822
0
    {
823
0
        proto_tree_add_item(tree, hf_rdt_stre_dummy_flags1, tvb, offset, 1, ENC_BIG_ENDIAN);
824
0
        offset += 1;
825
0
        proto_tree_add_item(tree, hf_rdt_stre_dummy_type, tvb, offset, 2, ENC_BIG_ENDIAN);
826
0
        offset += 2;
827
0
        proto_tree_add_item(tree, hf_rdt_stre_reason_code, tvb, offset, 4, ENC_BIG_ENDIAN);
828
0
        offset += 4;
829
        /* XXX: Remainder is reason_text */
830
0
        offset += tvb_captured_length_remaining(tvb, offset);
831
0
    }
832
833
1
    col_append_fstr(pinfo->cinfo, COL_INFO, "STREAM-END: stream-id=%02u  ", stream_id);
834
835
1
    return offset;
836
1
}
837
838
/* Dissect an report packet */
839
unsigned dissect_rdt_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
840
1
{
841
1
    unsigned    start_offset = offset;
842
1
    uint16_t    packet_length;
843
1
    uint8_t     flags1;
844
1
    uint8_t     length_included_flag;
845
1
    proto_tree  *flags_tree;
846
1
    proto_item  *ti;
847
848
    /* Flags in first byte */
849
1
    flags1 = tvb_get_uint8(tvb, offset);
850
1
    length_included_flag = (flags1 & 0x80) >> 7;
851
852
    /* Create subtree for flags fields */
853
1
    ti =  proto_tree_add_string_format(tree, hf_rdt_report_flags, tvb, offset, 1,
854
1
            "",
855
1
            "Length-included=%u",
856
1
            length_included_flag);
857
1
    flags_tree = proto_item_add_subtree(ti, ett_rdt_report_flags);
858
859
1
    proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
860
1
    offset++;
861
862
    /* Packet type */
863
1
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
864
1
    offset += 2;
865
866
    /* Length field is optional */
867
1
    if (length_included_flag)
868
0
    {
869
0
        proto_tree_add_item_ret_uint16(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN, &packet_length);
870
0
        offset += 2;
871
872
        /* Check that there are as many bytes as reported */
873
0
        tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
874
0
    }
875
1
    else
876
1
    {
877
1
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
878
1
    }
879
880
1
    col_append_str(pinfo->cinfo, COL_INFO, "REPORT:  ");
881
882
    /* The remaining data is unparsed. */
883
1
    proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
884
885
1
    if (packet_length < (offset - start_offset) ||
886
1
        packet_length > tvb_reported_length_remaining(tvb, start_offset))
887
0
    {
888
0
        proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
889
0
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
890
0
    }
891
892
1
    return start_offset + packet_length;
893
1
}
894
895
/* Dissect an latency-report packet */
896
unsigned dissect_rdt_latency_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
897
0
{
898
0
    unsigned    start_offset = offset;
899
0
    uint16_t    packet_length;
900
0
    uint8_t     flags1;
901
0
    uint8_t     length_included_flag;
902
0
    uint32_t    server_out_time;
903
0
    proto_tree  *flags_tree;
904
0
    proto_item  *ti;
905
906
    /* Flags in first byte */
907
0
    flags1 = tvb_get_uint8(tvb, offset);
908
0
    length_included_flag = (flags1 & 0x80) >> 7;
909
910
    /* Create subtree for flags fields */
911
0
    ti =  proto_tree_add_string_format(tree, hf_rdt_latency_report_flags, tvb, offset, 1,
912
0
            "",
913
0
            "Length-included=%u",
914
0
            length_included_flag);
915
0
    flags_tree = proto_item_add_subtree(ti, ett_rdt_latency_report_flags);
916
917
0
    proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
918
0
    offset++;
919
920
    /* Packet type */
921
0
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
922
0
    offset += 2;
923
924
    /* Length field is optional */
925
0
    if (length_included_flag)
926
0
    {
927
0
        proto_tree_add_item_ret_uint16(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN, &packet_length);
928
0
        offset += 2;
929
930
        /* Check that there are as many bytes as reported */
931
0
        tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
932
0
    }
933
0
    else
934
0
    {
935
0
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
936
0
    }
937
938
0
    proto_tree_add_item_ret_uint(tree, hf_rdt_lrpt_server_out_time, tvb, offset, 4, ENC_BIG_ENDIAN, &server_out_time);
939
0
    offset += 4;
940
941
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "LATENCY-REPORT: t=%u  ", server_out_time);
942
943
0
    if (packet_length < (offset - start_offset) ||
944
0
        packet_length > tvb_reported_length_remaining(tvb, start_offset))
945
0
    {
946
0
        proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
947
0
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
948
0
    }
949
950
0
    return start_offset + packet_length;
951
0
}
952
953
/* Dissect a transport-info packet */
954
unsigned dissect_rdt_transport_info_request_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
955
1
{
956
1
    uint8_t     flags1;
957
1
    uint8_t     request_rtt_info_flag;
958
1
    uint8_t     request_buffer_info_flag;
959
1
    proto_tree  *flags_tree;
960
1
    proto_item  *ti;
961
962
    /* Flags in first byte */
963
1
    flags1 = tvb_get_uint8(tvb, offset);
964
1
    request_rtt_info_flag = (flags1 & 0x2) >> 1;
965
1
    request_buffer_info_flag = (flags1 & 0x01);
966
967
    /* Create subtree for flags fields */
968
1
    ti =  proto_tree_add_string_format(tree, hf_rdt_ack_flags, tvb, offset, 1,
969
1
            "",
970
1
            "Request-rtt-info=%u, request-buffer-info=%u",
971
1
            request_rtt_info_flag,
972
1
            request_buffer_info_flag);
973
1
    flags_tree = proto_item_add_subtree(ti, ett_rdt_tirq_flags);
974
975
1
    proto_tree_add_item(flags_tree, hf_rdt_tirq_request_rtt_info, tvb, offset, 1, ENC_BIG_ENDIAN);
976
1
    proto_tree_add_item(flags_tree, hf_rdt_tirq_request_buffer_info, tvb, offset, 1, ENC_BIG_ENDIAN);
977
1
    offset++;
978
979
    /* Packet type */
980
1
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
981
1
    offset += 2;
982
983
1
    if (request_rtt_info_flag)
984
0
    {
985
0
        proto_tree_add_item(tree, hf_rdt_tirq_request_time_msec, tvb, offset, 4, ENC_BIG_ENDIAN);
986
0
        offset += 4;
987
0
    }
988
989
1
    col_append_str(pinfo->cinfo, COL_INFO, "TRANSPORT-INFO-REQUEST:  ");
990
991
1
    return offset;
992
1
}
993
994
/* Dissect an transport-info-response packet */
995
unsigned dissect_rdt_transport_info_response_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
996
8
{
997
8
    uint8_t     flags1;
998
8
    uint8_t     has_rtt_info;
999
8
    uint8_t     is_delayed;
1000
8
    uint8_t     has_buffer_info;
1001
8
    proto_tree  *flags_tree;
1002
8
    proto_item  *ti;
1003
1004
    /* Flags in first byte */
1005
8
    flags1 = tvb_get_uint8(tvb, offset);
1006
8
    has_rtt_info = (flags1 & 0x4) >> 2;
1007
8
    is_delayed = (flags1 & 0x2) >> 1;
1008
8
    has_buffer_info = (flags1 & 0x1);
1009
1010
    /* Create subtree for flags fields */
1011
8
    ti =  proto_tree_add_string_format(tree, hf_rdt_tirp_flags, tvb, offset, 1,
1012
8
            "",
1013
8
            "Has-rtt-info=%u, is-delayed=%u, has-buffer-info=%u",
1014
8
            has_rtt_info,
1015
8
            is_delayed,
1016
8
            has_buffer_info);
1017
8
    flags_tree = proto_item_add_subtree(ti, ett_rdt_tirp_flags);
1018
1019
8
    proto_tree_add_item(flags_tree, hf_rdt_tirp_has_rtt_info, tvb, offset, 1, ENC_BIG_ENDIAN);
1020
8
    proto_tree_add_item(flags_tree, hf_rdt_tirp_is_delayed, tvb, offset, 1, ENC_BIG_ENDIAN);
1021
8
    proto_tree_add_item(flags_tree, hf_rdt_tirp_has_buffer_info, tvb, offset, 1, ENC_BIG_ENDIAN);
1022
8
    offset++;
1023
1024
    /* Packet type */
1025
8
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1026
8
    offset += 2;
1027
1028
    /* RTT info */
1029
8
    if (has_rtt_info)
1030
8
    {
1031
8
        proto_tree_add_item(tree, hf_rdt_tirp_request_time_msec, tvb, offset, 4, ENC_BIG_ENDIAN);
1032
8
        offset += 4;
1033
1034
8
        if (is_delayed)
1035
7
        {
1036
7
            proto_tree_add_item(tree, hf_rdt_tirp_response_time_msec, tvb, offset, 4, ENC_BIG_ENDIAN);
1037
7
            offset += 4;
1038
7
        }
1039
8
    }
1040
1041
    /* Buffer info */
1042
8
    if (has_buffer_info)
1043
8
    {
1044
8
        uint16_t n;
1045
1046
        /* Read number of buffers */
1047
8
        uint16_t buffer_info_count = tvb_get_ntohs(tvb, offset);
1048
8
        proto_tree_add_item(tree, hf_rdt_tirp_buffer_info_count, tvb, offset, 2, ENC_BIG_ENDIAN);
1049
8
        offset += 2;
1050
1051
87
        for (n=0; n < buffer_info_count; n++)
1052
79
        {
1053
79
            proto_tree  *buffer_info_tree;
1054
79
            proto_item  *ti2;
1055
1056
            /* Each buffer info in a new subtree */
1057
79
            ti2 =  proto_tree_add_string_format(tree, hf_rdt_tirp_buffer_info, tvb, offset, 14,
1058
79
                                               "",
1059
79
                                               "Buffer info %u",
1060
79
                                               n+1);
1061
79
            buffer_info_tree = proto_item_add_subtree(ti2, ett_rdt_tirp_buffer_info);
1062
1063
            /* Read individual buffer info */
1064
79
            proto_tree_add_item(buffer_info_tree, hf_rdt_tirp_buffer_info_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1065
79
            offset += 2;
1066
79
            proto_tree_add_item(buffer_info_tree, hf_rdt_tirp_buffer_info_lowest_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
1067
79
            offset += 4;
1068
79
            proto_tree_add_item(buffer_info_tree, hf_rdt_tirp_buffer_info_highest_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
1069
79
            offset += 4;
1070
79
            proto_tree_add_item(buffer_info_tree, hf_rdt_tirp_buffer_info_bytes_buffered, tvb, offset, 4, ENC_BIG_ENDIAN);
1071
79
            offset += 4;
1072
79
        }
1073
8
    }
1074
1075
    /* Report what is left */
1076
8
    offset += tvb_captured_length_remaining(tvb, offset);
1077
1078
8
    col_append_str(pinfo->cinfo, COL_INFO, "RESPONSE:  ");
1079
1080
8
    return offset;
1081
8
}
1082
1083
/* Dissect a bw-probing packet */
1084
unsigned dissect_rdt_bw_probing_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
1085
2
{
1086
2
    unsigned    start_offset = offset;
1087
2
    uint16_t    packet_length;
1088
2
    uint8_t     flags1;
1089
2
    uint8_t     length_included_flag;
1090
2
    proto_tree  *flags_tree;
1091
2
    proto_item  *ti;
1092
1093
    /* Flags in first byte */
1094
2
    flags1 = tvb_get_uint8(tvb, offset);
1095
2
    length_included_flag = (flags1 & 0x80) >> 7;
1096
1097
    /* Create subtree for flags fields */
1098
2
    ti =  proto_tree_add_string_format(tree, hf_rdt_bw_probing_flags, tvb, offset, 1,
1099
2
            "",
1100
2
            "Length-included=%u",
1101
2
            length_included_flag);
1102
2
    flags_tree = proto_item_add_subtree(ti, ett_rdt_bw_probing_flags);
1103
1104
2
    proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
1105
2
    offset++;
1106
1107
    /* Packet type */
1108
2
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1109
2
    offset += 2;
1110
1111
    /* Length field is optional */
1112
2
    if (length_included_flag)
1113
1
    {
1114
1
        proto_tree_add_item_ret_uint16(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN, &packet_length);
1115
1
        offset += 2;
1116
1117
        /* Check that there are as many bytes as reported */
1118
1
        tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
1119
1
    }
1120
1
    else
1121
1
    {
1122
1
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
1123
1
    }
1124
1125
2
    proto_tree_add_item(tree, hf_rdt_bwpp_seqno, tvb, offset, 1, ENC_BIG_ENDIAN);
1126
2
    offset += 1;
1127
2
    proto_tree_add_item(tree, hf_rdt_timestamp, tvb, offset, 1, ENC_BIG_ENDIAN);
1128
2
    offset += 4;
1129
1130
2
    col_append_str(pinfo->cinfo, COL_INFO, "BW-PROBING:  ");
1131
1132
2
    if (packet_length < (offset - start_offset) ||
1133
1
        packet_length > tvb_reported_length_remaining(tvb, start_offset))
1134
0
    {
1135
0
        proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
1136
0
        packet_length = tvb_captured_length_remaining(tvb, start_offset);
1137
0
    }
1138
1139
2
    return start_offset + packet_length;
1140
2
}
1141
1142
/* Dissect an unknown control packet */
1143
unsigned dissect_rdt_unknown_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
1144
1
{
1145
    /* Flags in first byte */
1146
1
    proto_tree_add_item(tree, hf_rdt_unk_flags1, tvb, offset, 1, ENC_BIG_ENDIAN);
1147
1
    offset++;
1148
1149
    /* Packet type */
1150
1
    proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1151
1
    offset += 2;
1152
1153
    /* The remaining data is unparsed. */
1154
1
    proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
1155
1
    offset += tvb_captured_length_remaining(tvb, offset);
1156
1157
1
    col_append_str(pinfo->cinfo, COL_INFO, "UNKNOWN-CTL:  ");
1158
1159
1
    return offset;
1160
1
}
1161
1162
/* Look for conversation info and display any setup info found */
1163
static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1164
26
{
1165
    /* Conversation and current data */
1166
26
    conversation_t *p_conv;
1167
26
    struct _rdt_conversation_info *p_conv_data;
1168
1169
    /* Use existing packet info if available */
1170
26
    p_conv_data = (struct _rdt_conversation_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rdt, 0);
1171
1172
26
    if (!p_conv_data)
1173
26
    {
1174
        /* First time, get info from conversation */
1175
26
        p_conv = find_conversation(pinfo->num, &pinfo->net_dst, &pinfo->net_src,
1176
26
                                   conversation_pt_to_conversation_type(pinfo->ptype),
1177
26
                                   pinfo->destport, pinfo->srcport, NO_ADDR_B);
1178
26
        if (p_conv)
1179
0
        {
1180
            /* Create space for conversation info */
1181
0
            struct _rdt_conversation_info *p_conv_packet_data;
1182
0
            p_conv_data = (struct _rdt_conversation_info *)conversation_get_proto_data(p_conv, proto_rdt);
1183
1184
0
            if (p_conv_data)
1185
0
            {
1186
                /* Save this conversation info into packet info */
1187
0
                p_conv_packet_data = wmem_new(wmem_file_scope(), struct _rdt_conversation_info);
1188
0
                (void) g_strlcpy(p_conv_packet_data->method, p_conv_data->method, MAX_RDT_SETUP_METHOD_SIZE);
1189
0
                p_conv_packet_data->frame_number = p_conv_data->frame_number;
1190
0
                p_conv_packet_data->feature_level = p_conv_data->feature_level;
1191
0
                p_add_proto_data(wmem_file_scope(), pinfo, proto_rdt, 0, p_conv_packet_data);
1192
0
            }
1193
0
        }
1194
26
    }
1195
1196
    /* Create setup info subtree with summary info. */
1197
26
    if (p_conv_data)
1198
0
    {
1199
0
        proto_tree *rdt_setup_tree;
1200
0
        proto_item *ti =  proto_tree_add_string_format(tree, hf_rdt_setup, tvb, 0, 0,
1201
0
                                                       "",
1202
0
                                                       "Stream setup by %s (frame %u), feature level %d",
1203
0
                                                       p_conv_data->method,
1204
0
                                                       p_conv_data->frame_number,
1205
0
                                                       p_conv_data->feature_level);
1206
0
        proto_item_set_generated(ti);
1207
0
        rdt_setup_tree = proto_item_add_subtree(ti, ett_rdt_setup);
1208
0
        if (rdt_setup_tree)
1209
0
        {
1210
            /* Add details into subtree */
1211
0
            proto_item* item = proto_tree_add_uint(rdt_setup_tree, hf_rdt_setup_frame,
1212
0
                                                   tvb, 0, 0, p_conv_data->frame_number);
1213
0
            proto_item_set_generated(item);
1214
0
            item = proto_tree_add_string(rdt_setup_tree, hf_rdt_setup_method,
1215
0
                                         tvb, 0, 0, p_conv_data->method);
1216
0
            proto_item_set_generated(item);
1217
0
            item = proto_tree_add_int(rdt_setup_tree, hf_rdt_feature_level,
1218
0
                                      tvb, 0, 0, p_conv_data->feature_level);
1219
0
            proto_item_set_generated(item);
1220
0
        }
1221
0
    }
1222
26
}
1223
1224
1225
void proto_register_rdt(void)
1226
15
{
1227
15
    static hf_register_info hf[] =
1228
15
    {
1229
15
        {
1230
15
            &hf_rdt_packet,
1231
15
            {
1232
15
                "RDT packet",
1233
15
                "rdt.packet",
1234
15
                FT_STRING,
1235
15
                BASE_NONE,
1236
15
                NULL,
1237
15
                0x0,
1238
15
                NULL, HFILL
1239
15
            }
1240
15
        },
1241
15
        {
1242
15
            &hf_rdt_data_flags1,
1243
15
            {
1244
15
                "RDT data flags 1",
1245
15
                "rdt.data-flags1",
1246
15
                FT_STRING,
1247
15
                BASE_NONE,
1248
15
                NULL,
1249
15
                0x0,
1250
15
                NULL, HFILL
1251
15
            }
1252
15
        },
1253
15
        {
1254
15
            &hf_rdt_len_included,
1255
15
            {
1256
15
                "Length included",
1257
15
                "rdt.length-included",
1258
15
                FT_UINT8,
1259
15
                BASE_DEC,
1260
15
                NULL,
1261
15
                0x80,
1262
15
                NULL, HFILL
1263
15
            }
1264
15
        },
1265
15
        {
1266
15
            &hf_rdt_data_need_reliable,
1267
15
            {
1268
15
                "Need reliable",
1269
15
                "rdt.need-reliable",
1270
15
                FT_UINT8,
1271
15
                BASE_DEC,
1272
15
                NULL,
1273
15
                0x40,
1274
15
                NULL, HFILL
1275
15
            }
1276
15
        },
1277
15
        {
1278
15
            &hf_rdt_data_stream_id,
1279
15
            {
1280
15
                "Stream ID",
1281
15
                "rdt.stream-id",
1282
15
                FT_UINT8,
1283
15
                BASE_DEC,
1284
15
                NULL,
1285
15
                0x3e,
1286
15
                NULL, HFILL
1287
15
            }
1288
15
        },
1289
15
        {
1290
15
            &hf_rdt_data_is_reliable,
1291
15
            {
1292
15
                "Is reliable",
1293
15
                "rdt.is-reliable",
1294
15
                FT_UINT8,
1295
15
                BASE_DEC,
1296
15
                NULL,
1297
15
                0x01,
1298
15
                NULL, HFILL
1299
15
            }
1300
15
        },
1301
15
        {
1302
15
            &hf_rdt_data_flags2,
1303
15
            {
1304
15
                "RDT data flags 2",
1305
15
                "rdt.data-flags2",
1306
15
                FT_STRING,
1307
15
                BASE_NONE,
1308
15
                NULL,
1309
15
                0x0,
1310
15
                "RDT data flags2", HFILL
1311
15
            }
1312
15
        },
1313
15
        {
1314
15
            &hf_rdt_data_backtoback,
1315
15
            {
1316
15
                "Back-to-back",
1317
15
                "rdt.back-to-back",
1318
15
                FT_UINT8,
1319
15
                BASE_DEC,
1320
15
                NULL,
1321
15
                0x80,
1322
15
                NULL, HFILL
1323
15
            }
1324
15
        },
1325
15
        {
1326
15
            &hf_rdt_data_slowdata,
1327
15
            {
1328
15
                "Slow data",
1329
15
                "rdt.slow-data",
1330
15
                FT_UINT8,
1331
15
                BASE_DEC,
1332
15
                NULL,
1333
15
                0x40,
1334
15
                NULL, HFILL
1335
15
            }
1336
15
        },
1337
15
        {
1338
15
            &hf_rdt_data_asmrule,
1339
15
            {
1340
15
                "asm rule",
1341
15
                "rdt.asm-rule",
1342
15
                FT_UINT8,
1343
15
                BASE_DEC,
1344
15
                NULL,
1345
15
                0x3f,
1346
15
                NULL, HFILL
1347
15
            }
1348
15
        },
1349
15
        {
1350
15
            &hf_rdt_aact_flags,
1351
15
            {
1352
15
                "RDT asm-action flags 1",
1353
15
                "rdt.aact-flags",
1354
15
                FT_STRING,
1355
15
                BASE_NONE,
1356
15
                NULL,
1357
15
                0x0,
1358
15
                "RDT aact flags", HFILL
1359
15
            }
1360
15
        },
1361
15
        {
1362
15
            &hf_rdt_aact_stream_id,
1363
15
            {
1364
15
                "Stream ID",
1365
15
                "rdt.stream-id",
1366
15
                FT_UINT8,
1367
15
                BASE_DEC,
1368
15
                NULL,
1369
15
                0x7c,
1370
15
                NULL, HFILL
1371
15
            }
1372
15
        },
1373
15
        {
1374
15
            &hf_rdt_sequence_number,
1375
15
            {
1376
15
                "Sequence number",
1377
15
                "rdt.sequence-number",
1378
15
                FT_UINT16,
1379
15
                BASE_DEC,
1380
15
                NULL,
1381
15
                0x0,
1382
15
                NULL, HFILL
1383
15
            }
1384
15
        },
1385
15
        {
1386
15
            &hf_rdt_packet_type,
1387
15
            {
1388
15
                "Packet type",
1389
15
                "rdt.packet-type",
1390
15
                FT_UINT16,
1391
15
                BASE_HEX,
1392
15
                VALS(packet_type_vals),
1393
15
                0x0,
1394
15
                NULL, HFILL
1395
15
            }
1396
15
        },
1397
15
        {
1398
15
            &hf_rdt_ack_flags,
1399
15
            {
1400
15
                "RDT ack flags",
1401
15
                "rdt.ack-flags",
1402
15
                FT_STRING,
1403
15
                BASE_NONE,
1404
15
                NULL,
1405
15
                0x0,
1406
15
                NULL, HFILL
1407
15
            }
1408
15
        },
1409
15
        {
1410
15
            &hf_rdt_ack_lost_high,
1411
15
            {
1412
15
                "Lost high",
1413
15
                "rdt.lost-high",
1414
15
                FT_UINT8,
1415
15
                BASE_DEC,
1416
15
                NULL,
1417
15
                0x40,
1418
15
                NULL, HFILL
1419
15
            }
1420
15
        },
1421
15
        {
1422
15
            &hf_rdt_latency_report_flags,
1423
15
            {
1424
15
                "RDT latency report flags",
1425
15
                "rdt.latency-report-flags",
1426
15
                FT_STRING,
1427
15
                BASE_NONE,
1428
15
                NULL,
1429
15
                0x0,
1430
15
                NULL, HFILL
1431
15
            }
1432
15
        },
1433
15
        {
1434
15
            &hf_rdt_bandwidth_report_flags,
1435
15
            {
1436
15
                "RDT bandwidth report flags",
1437
15
                "rdt.bandwidth-report-flags",
1438
15
                FT_STRING,
1439
15
                BASE_NONE,
1440
15
                NULL,
1441
15
                0x0,
1442
15
                NULL, HFILL
1443
15
            }
1444
15
        },
1445
15
        {
1446
15
            &hf_rdt_stre_flags,
1447
15
            {
1448
15
                "RDT stream end flags",
1449
15
                "rdt.stream-end-flags",
1450
15
                FT_STRING,
1451
15
                BASE_NONE,
1452
15
                NULL,
1453
15
                0x0,
1454
15
                NULL, HFILL
1455
15
            }
1456
15
        },
1457
#if 0
1458
        {
1459
            &hf_rdt_rtt_request_flags,
1460
            {
1461
                "RDT rtt request flags",
1462
                "rdt.rtt-request-flags",
1463
                FT_STRING,
1464
                BASE_NONE,
1465
                NULL,
1466
                0x0,
1467
                NULL, HFILL
1468
            }
1469
        },
1470
#endif
1471
#if 0
1472
        {
1473
            &hf_rdt_rtt_response_flags,
1474
            {
1475
                "RDT rtt response flags",
1476
                "rdt.rtt-response-flags",
1477
                FT_STRING,
1478
                BASE_NONE,
1479
                NULL,
1480
                0x0,
1481
                NULL, HFILL
1482
            }
1483
        },
1484
#endif
1485
#if 0
1486
        {
1487
            &hf_rdt_congestion_flags,
1488
            {
1489
                "RDT congestion flags",
1490
                "rdt.congestion-flags",
1491
                FT_STRING,
1492
                BASE_NONE,
1493
                NULL,
1494
                0x0,
1495
                NULL, HFILL
1496
            }
1497
        },
1498
#endif
1499
15
        {
1500
15
            &hf_rdt_report_flags,
1501
15
            {
1502
15
                "RDT report flags",
1503
15
                "rdt.report-flags",
1504
15
                FT_STRING,
1505
15
                BASE_NONE,
1506
15
                NULL,
1507
15
                0x0,
1508
15
                NULL, HFILL
1509
15
            }
1510
15
        },
1511
#if 0
1512
        {
1513
            &hf_rdt_tirq_flags,
1514
            {
1515
                "RDT transport info request flags",
1516
                "rdt.transport-info-request-flags",
1517
                FT_STRING,
1518
                BASE_NONE,
1519
                NULL,
1520
                0x0,
1521
                NULL, HFILL
1522
            }
1523
        },
1524
#endif
1525
15
        {
1526
15
            &hf_rdt_tirp_flags,
1527
15
            {
1528
15
                "RDT transport info response flags",
1529
15
                "rdt.transport-info-response-flags",
1530
15
                FT_STRING,
1531
15
                BASE_NONE,
1532
15
                NULL,
1533
15
                0x0,
1534
15
                NULL, HFILL
1535
15
            }
1536
15
        },
1537
15
        {
1538
15
            &hf_rdt_bw_probing_flags,
1539
15
            {
1540
15
                "RDT bw probing flags",
1541
15
                "rdt.bw-probing-flags",
1542
15
                FT_STRING,
1543
15
                BASE_NONE,
1544
15
                NULL,
1545
15
                0x0,
1546
15
                NULL, HFILL
1547
15
            }
1548
15
        },
1549
15
        {
1550
15
            &hf_rdt_packet_length,
1551
15
            {
1552
15
                "Packet length",
1553
15
                "rdt.packet-length",
1554
15
                FT_UINT16,
1555
15
                BASE_DEC,
1556
15
                NULL,
1557
15
                0x0,
1558
15
                NULL, HFILL
1559
15
            }
1560
15
        },
1561
15
        {
1562
15
            &hf_rdt_timestamp,
1563
15
            {
1564
15
                "Timestamp",
1565
15
                "rdt.timestamp",
1566
15
                FT_UINT32,
1567
15
                BASE_DEC,
1568
15
                NULL,
1569
15
                0x0,
1570
15
                NULL, HFILL
1571
15
            }
1572
15
        },
1573
15
        {
1574
15
            &hf_rdt_stream_id_ex,
1575
15
            {
1576
15
                "Stream-id expansion",
1577
15
                "rdt.stream-id-expansion",
1578
15
                FT_UINT16,
1579
15
                BASE_DEC,
1580
15
                NULL,
1581
15
                0x0,
1582
15
                NULL, HFILL
1583
15
            }
1584
15
        },
1585
15
        {
1586
15
            &hf_rdt_asmrule_ex,
1587
15
            {
1588
15
                "Asm rule expansion",
1589
15
                "rdt.asm-rule-expansion",
1590
15
                FT_UINT16,
1591
15
                BASE_DEC,
1592
15
                NULL,
1593
15
                0x0,
1594
15
                NULL, HFILL
1595
15
            }
1596
15
        },
1597
15
        {
1598
15
            &hf_rdt_total_reliable,
1599
15
            {
1600
15
                "Total reliable",
1601
15
                "rdt.total-reliable",
1602
15
                FT_UINT16,
1603
15
                BASE_DEC,
1604
15
                NULL,
1605
15
                0x0,
1606
15
                NULL, HFILL
1607
15
            }
1608
15
        },
1609
15
        {
1610
15
            &hf_rdt_data,
1611
15
            {
1612
15
                "Data",
1613
15
                "rdt.data",
1614
15
                FT_NONE,
1615
15
                BASE_NONE,
1616
15
                NULL,
1617
15
                0x0,
1618
15
               NULL, HFILL
1619
15
            }
1620
15
        },
1621
15
        {
1622
15
            &hf_rdt_aact_reliable_seqno,
1623
15
            {
1624
15
                "Reliable sequence number",
1625
15
                "rdt.reliable-seq-no",
1626
15
                FT_UINT16,
1627
15
                BASE_DEC,
1628
15
                NULL,
1629
15
                0x0,
1630
15
                NULL, HFILL
1631
15
            }
1632
15
        },
1633
15
        {
1634
15
            &hf_rdt_brpt_interval,
1635
15
            {
1636
15
                "Bandwidth report interval",
1637
15
                "rdt.bwid-report-interval",
1638
15
                FT_UINT16,
1639
15
                BASE_DEC,
1640
15
                NULL,
1641
15
                0x0,
1642
15
                NULL, HFILL
1643
15
            }
1644
15
        },
1645
15
        {
1646
15
            &hf_rdt_brpt_bandwidth,
1647
15
            {
1648
15
                "Bandwidth report bandwidth",
1649
15
                "rdt.bwid-report-bandwidth",
1650
15
                FT_UINT32,
1651
15
                BASE_DEC,
1652
15
                NULL,
1653
15
                0x0,
1654
15
                NULL, HFILL
1655
15
            }
1656
15
        },
1657
15
        {
1658
15
            &hf_rdt_brpt_sequence,
1659
15
            {
1660
15
                "Bandwidth report sequence",
1661
15
                "rdt.bwid-report-sequence",
1662
15
                FT_UINT16,
1663
15
                BASE_DEC,
1664
15
                NULL,
1665
15
                0x0,
1666
15
                NULL, HFILL
1667
15
            }
1668
15
        },
1669
15
        {
1670
15
            &hf_rdt_rtrp_ts_sec,
1671
15
            {
1672
15
                "Round trip response timestamp seconds",
1673
15
                "rdt.rtrp-ts-sec",
1674
15
                FT_UINT32,
1675
15
                BASE_DEC,
1676
15
                NULL,
1677
15
                0x0,
1678
15
                NULL, HFILL
1679
15
            }
1680
15
        },
1681
15
        {
1682
15
            &hf_rdt_rtrp_ts_usec,
1683
15
            {
1684
15
                "Round trip response timestamp microseconds",
1685
15
                "rdt.rtrp-ts-usec",
1686
15
                FT_UINT32,
1687
15
                BASE_DEC,
1688
15
                NULL,
1689
15
                0x0,
1690
15
                NULL, HFILL
1691
15
            }
1692
15
        },
1693
15
        {
1694
15
            &hf_rdt_cong_xmit_mult,
1695
15
            {
1696
15
                "Congestion transmit multiplier",
1697
15
                "rdt.cong-xmit-mult",
1698
15
                FT_UINT32,
1699
15
                BASE_DEC,
1700
15
                NULL,
1701
15
                0x0,
1702
15
                NULL, HFILL
1703
15
            }
1704
15
        },
1705
15
        {
1706
15
            &hf_rdt_cong_recv_mult,
1707
15
            {
1708
15
                "Congestion receive multiplier",
1709
15
                "rdt.cong-recv-mult",
1710
15
                FT_UINT32,
1711
15
                BASE_DEC,
1712
15
                NULL,
1713
15
                0x0,
1714
15
                NULL, HFILL
1715
15
            }
1716
15
        },
1717
15
        {
1718
15
            &hf_rdt_stre_need_reliable,
1719
15
            {
1720
15
                "Need reliable",
1721
15
                "rdt.stre-need-reliable",
1722
15
                FT_UINT8,
1723
15
                BASE_DEC,
1724
15
                NULL,
1725
15
                0x80,
1726
15
                NULL, HFILL
1727
15
            }
1728
15
        },
1729
15
        {
1730
15
            &hf_rdt_stre_stream_id,
1731
15
            {
1732
15
                "Stream id",
1733
15
                "rdt.stre-stream-id",
1734
15
                FT_UINT8,
1735
15
                BASE_DEC,
1736
15
                NULL,
1737
15
                0x7c,
1738
15
                NULL, HFILL
1739
15
            }
1740
15
        },
1741
15
        {
1742
15
            &hf_rdt_stre_packet_sent,
1743
15
            {
1744
15
                "Packet sent",
1745
15
                "rdt.stre-packet-sent",
1746
15
                FT_UINT8,
1747
15
                BASE_DEC,
1748
15
                NULL,
1749
15
                0x02,
1750
15
                NULL, HFILL
1751
15
            }
1752
15
        },
1753
15
        {
1754
15
            &hf_rdt_stre_ext_flag,
1755
15
            {
1756
15
                "Ext flag",
1757
15
                "rdt.stre-ext-flag",
1758
15
                FT_UINT8,
1759
15
                BASE_DEC,
1760
15
                NULL,
1761
15
                0x01,
1762
15
                NULL, HFILL
1763
15
            }
1764
15
        },
1765
1766
15
        {
1767
15
            &hf_rdt_stre_seqno,
1768
15
            {
1769
15
                "Stream end sequence number",
1770
15
                "rdt.stre-seqno",
1771
15
                FT_UINT16,
1772
15
                BASE_DEC,
1773
15
                NULL,
1774
15
                0x0,
1775
15
                NULL, HFILL
1776
15
            }
1777
15
        },
1778
15
        {
1779
15
            &hf_rdt_stre_dummy_flags1,
1780
15
            {
1781
15
                "Stream end reason dummy flags1",
1782
15
                "rdt.stre-reason-dummy-flags1",
1783
15
                FT_UINT8,
1784
15
                BASE_HEX,
1785
15
                NULL,
1786
15
                0x0,
1787
15
                NULL, HFILL
1788
15
            }
1789
15
        },
1790
15
        {
1791
15
            &hf_rdt_stre_dummy_type,
1792
15
            {
1793
15
                "Stream end reason dummy type",
1794
15
                "rdt.stre-reason-dummy-type",
1795
15
                FT_UINT16,
1796
15
                BASE_HEX,
1797
15
                NULL,
1798
15
                0x0,
1799
15
                NULL, HFILL
1800
15
            }
1801
15
        },
1802
15
        {
1803
15
            &hf_rdt_stre_reason_code,
1804
15
            {
1805
15
                "Stream end reason code",
1806
15
                "rdt.stre-reason-code",
1807
15
                FT_UINT32,
1808
15
                BASE_HEX,
1809
15
                NULL,
1810
15
                0x0,
1811
15
                NULL, HFILL
1812
15
            }
1813
15
        },
1814
15
        {
1815
15
            &hf_rdt_lrpt_server_out_time,
1816
15
            {
1817
15
                "Latency report server out time",
1818
15
                "rdt.lrpt-server-out-time",
1819
15
                FT_UINT32,
1820
15
                BASE_DEC,
1821
15
                NULL,
1822
15
                0x0,
1823
15
                NULL, HFILL
1824
15
            }
1825
15
        },
1826
15
        {
1827
15
            &hf_rdt_tirq_request_rtt_info,
1828
15
            {
1829
15
                "Transport info request rtt info flag",
1830
15
                "rdt.tirq-request-rtt-info",
1831
15
                FT_UINT8,
1832
15
                BASE_DEC,
1833
15
                NULL,
1834
15
                0x2,
1835
15
                NULL, HFILL
1836
15
            }
1837
15
        },
1838
15
        {
1839
15
            &hf_rdt_tirq_request_buffer_info,
1840
15
            {
1841
15
                "Transport info request buffer info flag",
1842
15
                "rdt.tirq-request-buffer-info",
1843
15
                FT_UINT8,
1844
15
                BASE_DEC,
1845
15
                NULL,
1846
15
                0x1,
1847
15
                NULL, HFILL
1848
15
            }
1849
15
        },
1850
15
        {
1851
15
            &hf_rdt_tirq_request_time_msec,
1852
15
            {
1853
15
                "Transport info request time msec",
1854
15
                "rdt.tirq-request-time-msec",
1855
15
                FT_UINT32,
1856
15
                BASE_DEC,
1857
15
                NULL,
1858
15
                0x0,
1859
15
                NULL, HFILL
1860
15
            }
1861
15
        },
1862
15
        {
1863
15
            &hf_rdt_tirp_has_rtt_info,
1864
15
            {
1865
15
                "Transport info response has rtt info flag",
1866
15
                "rdt.tirp-has-rtt-info",
1867
15
                FT_UINT8,
1868
15
                BASE_DEC,
1869
15
                NULL,
1870
15
                0x4,
1871
15
                NULL, HFILL
1872
15
            }
1873
15
        },
1874
15
        {
1875
15
            &hf_rdt_tirp_is_delayed,
1876
15
            {
1877
15
                "Transport info response is delayed",
1878
15
                "rdt.tirp-is-delayed",
1879
15
                FT_UINT8,
1880
15
                BASE_DEC,
1881
15
                NULL,
1882
15
                0x2,
1883
15
                NULL, HFILL
1884
15
            }
1885
15
        },
1886
15
        {
1887
15
            &hf_rdt_tirp_has_buffer_info,
1888
15
            {
1889
15
                "Transport info response has buffer info",
1890
15
                "rdt.tirp-has-buffer-info",
1891
15
                FT_UINT8,
1892
15
                BASE_DEC,
1893
15
                NULL,
1894
15
                0x1,
1895
15
                NULL, HFILL
1896
15
            }
1897
15
        },
1898
15
        {
1899
15
            &hf_rdt_tirp_request_time_msec,
1900
15
            {
1901
15
                "Transport info request time msec",
1902
15
                "rdt.tirp-request-time-msec",
1903
15
                FT_UINT32,
1904
15
                BASE_DEC,
1905
15
                NULL,
1906
15
                0x0,
1907
15
                NULL, HFILL
1908
15
            }
1909
15
        },
1910
15
        {
1911
15
            &hf_rdt_tirp_response_time_msec,
1912
15
            {
1913
15
                "Transport info response time msec",
1914
15
                "rdt.tirp-response-time-msec",
1915
15
                FT_UINT32,
1916
15
                BASE_DEC,
1917
15
                NULL,
1918
15
                0x0,
1919
15
                NULL, HFILL
1920
15
            }
1921
15
        },
1922
15
        {
1923
15
            &hf_rdt_tirp_buffer_info_count,
1924
15
            {
1925
15
                "Transport info buffer into count",
1926
15
                "rdt.tirp-buffer-info-count",
1927
15
                FT_UINT16,
1928
15
                BASE_DEC,
1929
15
                NULL,
1930
15
                0x0,
1931
15
                NULL, HFILL
1932
15
            }
1933
15
        },
1934
15
        {
1935
15
            &hf_rdt_tirp_buffer_info,
1936
15
            {
1937
15
                "RDT buffer info",
1938
15
                "rdt.tirp-buffer-info",
1939
15
                FT_STRING,
1940
15
                BASE_NONE,
1941
15
                NULL,
1942
15
                0x0,
1943
15
                NULL, HFILL
1944
15
            }
1945
15
        },
1946
15
        {
1947
15
            &hf_rdt_tirp_buffer_info_stream_id,
1948
15
            {
1949
15
                "Buffer info stream-id",
1950
15
                "rdt.tirp-buffer-info-stream-id",
1951
15
                FT_UINT16,
1952
15
                BASE_DEC,
1953
15
                NULL,
1954
15
                0x0,
1955
15
                NULL, HFILL
1956
15
            }
1957
15
        },
1958
15
        {
1959
15
            &hf_rdt_tirp_buffer_info_lowest_timestamp,
1960
15
            {
1961
15
                "Lowest timestamp",
1962
15
                "rdt.tirp-buffer-info-lowest-timestamp",
1963
15
                FT_UINT32,
1964
15
                BASE_DEC,
1965
15
                NULL,
1966
15
                0x0,
1967
15
                NULL, HFILL
1968
15
            }
1969
15
        },
1970
15
        {
1971
15
            &hf_rdt_tirp_buffer_info_highest_timestamp,
1972
15
            {
1973
15
                "Highest timestamp",
1974
15
                "rdt.tirp-buffer-info-highest-timestamp",
1975
15
                FT_UINT32,
1976
15
                BASE_DEC,
1977
15
                NULL,
1978
15
                0x0,
1979
15
                NULL, HFILL
1980
15
            }
1981
15
        },
1982
15
        {
1983
15
            &hf_rdt_tirp_buffer_info_bytes_buffered,
1984
15
            {
1985
15
                "Bytes buffered",
1986
15
                "rdt.tirp-buffer-info-bytes-buffered",
1987
15
                FT_UINT32,
1988
15
                BASE_DEC,
1989
15
                NULL,
1990
15
                0x0,
1991
15
                NULL, HFILL
1992
15
            }
1993
15
        },
1994
15
        {
1995
15
            &hf_rdt_bwpp_seqno,
1996
15
            {
1997
15
                "Bandwidth probing packet seqno",
1998
15
                "rdt.bwpp-seqno",
1999
15
                FT_UINT8,
2000
15
                BASE_DEC,
2001
15
                NULL,
2002
15
                0x0,
2003
15
                NULL, HFILL
2004
15
            }
2005
15
        },
2006
15
        {
2007
15
            &hf_rdt_unk_flags1,
2008
15
            {
2009
15
                "Unknown packet flags",
2010
15
                "rdt.unk-flags1",
2011
15
                FT_UINT8,
2012
15
                BASE_DEC,
2013
15
                NULL,
2014
15
                0x0,
2015
15
                NULL, HFILL
2016
15
            }
2017
15
        },
2018
15
        {
2019
15
            &hf_rdt_setup,
2020
15
            {
2021
15
                "Stream setup",
2022
15
                "rdt.setup",
2023
15
                FT_STRING,
2024
15
                BASE_NONE,
2025
15
                NULL,
2026
15
                0x0,
2027
15
                "Stream setup, method and frame number", HFILL
2028
15
            }
2029
15
        },
2030
15
        {
2031
15
            &hf_rdt_setup_frame,
2032
15
            {
2033
15
                "Setup frame",
2034
15
                "rdt.setup-frame",
2035
15
                FT_FRAMENUM,
2036
15
                BASE_NONE,
2037
15
                NULL,
2038
15
                0x0,
2039
15
                "Frame that set up this stream", HFILL
2040
15
            }
2041
15
        },
2042
15
        {
2043
15
            &hf_rdt_setup_method,
2044
15
            {
2045
15
                "Setup Method",
2046
15
                "rdt.setup-method",
2047
15
                FT_STRING,
2048
15
                BASE_NONE,
2049
15
                NULL,
2050
15
                0x0,
2051
15
                "Method used to set up this stream", HFILL
2052
15
            }
2053
15
        },
2054
15
        {
2055
15
            &hf_rdt_feature_level,
2056
15
            {
2057
15
                "RDT feature level",
2058
15
                "rdt.feature-level",
2059
15
                FT_INT32,
2060
15
                BASE_DEC,
2061
15
                NULL,
2062
15
                0x0,
2063
15
                NULL, HFILL
2064
15
            }
2065
15
        },
2066
15
    };
2067
2068
15
    static int *ett[] =
2069
15
    {
2070
15
        &ett_rdt,
2071
15
        &ett_rdt_packet,
2072
15
        &ett_rdt_setup,
2073
15
        &ett_rdt_data_flags1,
2074
15
        &ett_rdt_data_flags2,
2075
15
        &ett_rdt_aact_flags,
2076
15
        &ett_rdt_ack_flags,
2077
15
        &ett_rdt_latency_report_flags,
2078
15
        &ett_rdt_bandwidth_report_flags,
2079
15
        &ett_rdt_stre_flags,
2080
15
        &ett_rdt_rtt_request_flags,
2081
15
        &ett_rdt_rtt_response_flags,
2082
15
        &ett_rdt_congestion_flags,
2083
15
        &ett_rdt_report_flags,
2084
15
        &ett_rdt_tirq_flags,
2085
15
        &ett_rdt_tirp_flags,
2086
15
        &ett_rdt_tirp_buffer_info,
2087
15
        &ett_rdt_bw_probing_flags
2088
15
    };
2089
2090
15
    static ei_register_info ei[] = {
2091
15
        { &ei_rdt_packet_length, { "rdt.invalid_packet_length", PI_MALFORMED, PI_ERROR, "Packet length invalid", EXPFILL }},
2092
15
    };
2093
2094
15
    module_t *rdt_module;
2095
15
    expert_module_t* expert_rdt;
2096
2097
    /* Register protocol and fields */
2098
15
    proto_rdt = proto_register_protocol("Real Data Transport", "RDT", "rdt");
2099
15
    proto_register_field_array(proto_rdt, hf, array_length(hf));
2100
15
    proto_register_subtree_array(ett, array_length(ett));
2101
15
    expert_rdt = expert_register_protocol(proto_rdt);
2102
15
    expert_register_field_array(expert_rdt, ei, array_length(ei));
2103
15
    rdt_handle = register_dissector("rdt", dissect_rdt, proto_rdt);
2104
2105
    /* Preference settings */
2106
15
    rdt_module = prefs_register_protocol(proto_rdt, NULL);
2107
15
    prefs_register_bool_preference(rdt_module, "show_setup_info",
2108
15
                                   "Show stream setup information",
2109
15
                                   "Where available, show which protocol and frame caused "
2110
15
                                   "this RDT stream to be created",
2111
15
                                   &global_rdt_show_setup_info);
2112
2113
15
    prefs_register_obsolete_preference(rdt_module, "register_udp_port");
2114
15
}
2115
2116
void proto_reg_handoff_rdt(void)
2117
15
{
2118
15
    dissector_add_uint_with_preference("udp.port", RDT_UDP_PORT, rdt_handle);
2119
15
}
2120
2121
/*
2122
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
2123
 *
2124
 * Local variables:
2125
 * c-basic-offset: 4
2126
 * tab-width: 8
2127
 * indent-tabs-mode: nil
2128
 * End:
2129
 *
2130
 * vi: set shiftwidth=4 tabstop=8 expandtab:
2131
 * :indentSize=4:tabSize=8:noTabs=true:
2132
 */