Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-rdt.c
blob4c9a16354adac110604367a789ffa5ad76c87be5
1 /* packet-rdt.c
3 * Routines for RDT dissection
4 * RDT = Real Data Transport
6 * Copyright 2005
7 * Written by Martin Mathieson and Tom Marshall
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * SPDX-License-Identifier: GPL-2.0-or-later
16 /* Information sources:
17 * helixcommunity.org sources, in particular
18 * server/protocol/transport/rdt/pub/tngpkt.pm
21 #include "config.h"
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"
30 static dissector_handle_t rdt_handle;
32 static int proto_rdt;
34 /* Packet fields */
35 static int hf_rdt_packet;
37 /* flags1: shared */
38 static int hf_rdt_len_included;
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;
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;
52 /* flags1: asm action packet */
53 static int hf_rdt_aact_flags;
54 static int hf_rdt_aact_stream_id;
56 /* flags1: ack packet */
57 static int hf_rdt_ack_flags;
58 static int hf_rdt_ack_lost_high;
60 /* flags1: latency report packet */
61 static int hf_rdt_latency_report_flags;
63 /* flags1: bandwidth report packet */
64 static int hf_rdt_bandwidth_report_flags;
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;
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;
81 /* Octets 1-2: sequence number or packet type */
82 static int hf_rdt_sequence_number;
83 static int hf_rdt_packet_type;
85 /* Only present if length_included */
86 static int hf_rdt_packet_length;
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;
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;
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;
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;
152 static expert_field ei_rdt_packet_length;
154 #define RDT_UDP_PORT 6970
156 void proto_register_rdt(void);
157 void proto_reg_handoff_rdt(void);
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);
175 static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
177 /* Preferences bool to control whether or not setup info should be shown */
178 static bool global_rdt_show_setup_info = true;
180 /* Packet types */
181 #define RDT_ASMACTIION_PACKET 0xff00
182 #define RDT_BANDWIDTHREPORT_PACKET 0xff01
183 #define RDT_ACK_PACKET 0xff02
184 #define RDT_RTTREQUEST_PACKET 0xff03
185 #define RDT_RTTRESPONSE_PACKET 0xff04
186 #define RDT_CONGESTION_PACKET 0xff05
187 #define RDT_STREAMEND_PACKET 0xff06
188 #define RDT_REPORT_PACKET 0xff07
189 #define RDT_LATENCYREPORT_PACKET 0xff08
190 #define RDT_TRANSPORTINFO_PACKET 0xff09
191 #define RDT_TRANSPORTINFORESPONSE_PACKET 0xff0a
192 #define RDT_BWPROBING_PACKET 0xff0b
194 static const value_string packet_type_vals[] =
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 }
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)
219 address null_addr;
220 conversation_t* p_conv;
221 struct _rdt_conversation_info *p_conv_data;
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 if (pinfo->fd->visited)
228 return;
231 clear_address(&null_addr);
233 /* Check if the ip address and port combination is not already registered
234 as a conversation. */
235 p_conv = find_conversation(pinfo->num, addr, &null_addr, CONVERSATION_UDP, port, other_port,
236 NO_ADDR_B | (!other_port ? NO_PORT_B : 0));
238 /* If not, create a new conversation. */
239 if ( !p_conv || p_conv->setup_frame != pinfo->num)
241 p_conv = conversation_new(pinfo->num, addr, &null_addr, CONVERSATION_UDP,
242 (uint32_t)port, (uint32_t)other_port,
243 NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
246 /* Set dissector */
247 conversation_set_dissector(p_conv, rdt_handle);
249 /* Check if the conversation has data associated with it. */
250 p_conv_data = (struct _rdt_conversation_info *)conversation_get_proto_data(p_conv, proto_rdt);
252 /* If not, add a new data item. */
253 if (!p_conv_data)
255 /* Create conversation data */
256 p_conv_data = wmem_new(wmem_file_scope(), struct _rdt_conversation_info);
257 conversation_add_proto_data(p_conv, proto_rdt, p_conv_data);
260 /* Update the conversation data. */
261 (void) g_strlcpy(p_conv_data->method, setup_method, MAX_RDT_SETUP_METHOD_SIZE);
262 p_conv_data->frame_number = pinfo->num;
263 p_conv_data->feature_level = rdt_feature_level;
268 /****************************************************************************/
269 /* Main dissection function */
270 /****************************************************************************/
271 static int dissect_rdt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
273 unsigned previous_offset = 0;
274 int offset = 0;
275 proto_item *ti;
276 proto_tree *rdt_tree = NULL;
277 proto_tree *rdt_packet_tree;
278 uint16_t packet_type;
280 /* Set/clear columns */
281 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RDT");
282 col_clear(pinfo->cinfo, COL_INFO);
284 /* Create RDT protocol tree */
285 ti = proto_tree_add_item(tree, proto_rdt, tvb, offset, -1, ENC_NA);
286 rdt_tree = proto_item_add_subtree(ti, ett_rdt);
288 /* Conversation setup info */
289 if (global_rdt_show_setup_info)
291 show_setup_info(tvb, pinfo, rdt_tree);
294 /* Parse all RDT packets found in the frame */
295 while (offset != -1 && tvb_reported_length_remaining(tvb, offset))
297 /* Every packet type should have at least 3 bytes */
298 tvb_ensure_bytes_exist(tvb, offset, 3);
300 /* 2nd & 3rd bytes determine packet type */
301 packet_type = tvb_get_ntohs(tvb, offset+1);
303 /* Add a tree for the next individual packet */
304 ti = proto_tree_add_string_format(rdt_tree, hf_rdt_packet, tvb, offset, -1,
306 "RDT packet (%s)",
307 packet_type < 0xff00 ? "Data" :
308 val_to_str_const(packet_type, packet_type_vals, "Unknown"));
309 rdt_packet_tree = proto_item_add_subtree(ti, ett_rdt_packet);
311 /* Dissect the details of the next packet in this frame */
312 if (packet_type < 0xff00)
314 offset = dissect_rdt_data_packet(tvb, pinfo, rdt_packet_tree, offset);
316 else
318 switch (packet_type)
320 case RDT_ASMACTIION_PACKET:
321 offset = dissect_rdt_asm_action_packet(tvb, pinfo, rdt_packet_tree, offset);
322 break;
323 case RDT_BANDWIDTHREPORT_PACKET:
324 offset = dissect_rdt_bandwidth_report_packet(tvb, pinfo, rdt_packet_tree, offset);
325 break;
326 case RDT_ACK_PACKET:
327 offset = dissect_rdt_ack_packet(tvb, pinfo, rdt_packet_tree, offset);
328 break;
329 case RDT_RTTREQUEST_PACKET:
330 offset = dissect_rdt_rtt_request_packet(tvb, pinfo, rdt_packet_tree, offset);
331 break;
332 case RDT_RTTRESPONSE_PACKET:
333 offset = dissect_rdt_rtt_response_packet(tvb, pinfo, rdt_packet_tree, offset);
334 break;
335 case RDT_CONGESTION_PACKET:
336 offset = dissect_rdt_congestion_packet(tvb, pinfo, rdt_packet_tree, offset);
337 break;
338 case RDT_STREAMEND_PACKET:
339 offset = dissect_rdt_stream_end_packet(tvb, pinfo, rdt_packet_tree, offset);
340 break;
341 case RDT_REPORT_PACKET:
342 offset = dissect_rdt_report_packet(tvb, pinfo, rdt_packet_tree, offset);
343 break;
344 case RDT_LATENCYREPORT_PACKET:
345 offset = dissect_rdt_latency_report_packet(tvb, pinfo, rdt_packet_tree, offset);
346 break;
347 case RDT_TRANSPORTINFO_PACKET:
348 offset = dissect_rdt_transport_info_request_packet(tvb, pinfo, rdt_packet_tree, offset);
349 break;
350 case RDT_TRANSPORTINFORESPONSE_PACKET:
351 offset = dissect_rdt_transport_info_response_packet(tvb, pinfo, rdt_packet_tree, offset);
352 break;
353 case RDT_BWPROBING_PACKET:
354 offset = dissect_rdt_bw_probing_packet(tvb, pinfo, rdt_packet_tree, offset);
355 break;
357 default:
358 /* Unknown control packet */
359 offset = dissect_rdt_unknown_control(tvb, pinfo, rdt_packet_tree, offset);
360 break;
364 /* Select correct number of bytes for the tree showing this packet */
365 if (offset != -1)
367 proto_item_set_len(rdt_packet_tree, offset-previous_offset);
369 previous_offset = offset;
372 return tvb_captured_length(tvb);
377 /************************************************/
378 /* Functions to dissect individual packet types */
379 /************************************************/
381 /* Dissect a data packet */
382 unsigned dissect_rdt_data_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
384 unsigned start_offset = offset;
385 uint16_t packet_length;
386 uint8_t flags1;
387 uint8_t length_included_flag;
388 uint8_t need_reliable_flag;
389 uint16_t stream_id;
390 uint16_t sequence_number;
391 uint8_t is_reliable_flag;
392 uint8_t flags2;
393 uint32_t timestamp;
394 uint16_t asm_rule_number;
395 uint8_t back_to_back;
396 uint8_t slow_data;
397 proto_tree *flags_tree1;
398 proto_tree *flags_tree2;
399 proto_item *ti;
401 /* Flags in first byte */
402 flags1 = tvb_get_uint8(tvb, offset);
403 length_included_flag = (flags1 & 0x80) >> 7;
404 need_reliable_flag = (flags1 & 0x40) >> 6;
405 stream_id = (flags1 & 0x3e) >> 1;
406 is_reliable_flag = flags1 & 0x01;
408 /* Create subtree for flags1 fields */
409 ti = proto_tree_add_string_format(tree, hf_rdt_data_flags1, tvb, offset, 1,
411 "Length-included=%u, need-reliable=%u, stream-id=%u, is-reliable=%u",
412 length_included_flag,
413 need_reliable_flag,
414 stream_id,
415 is_reliable_flag);
416 flags_tree1 = proto_item_add_subtree(ti, ett_rdt_data_flags1);
418 proto_tree_add_item(flags_tree1, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
419 proto_tree_add_item(flags_tree1, hf_rdt_data_need_reliable, tvb, offset, 1, ENC_BIG_ENDIAN);
420 proto_tree_add_item(flags_tree1, hf_rdt_data_stream_id, tvb, offset, 1, ENC_BIG_ENDIAN);
421 proto_tree_add_item(flags_tree1, hf_rdt_data_is_reliable, tvb, offset, 1, ENC_BIG_ENDIAN);
422 offset++;
424 /* Sequence number */
425 sequence_number = tvb_get_ntohs(tvb, offset);
426 proto_tree_add_item(tree, hf_rdt_sequence_number, tvb, offset, 2, ENC_BIG_ENDIAN);
427 offset += 2;
429 /* Length field is optional */
430 if (length_included_flag)
432 packet_length = tvb_get_ntohs(tvb, offset);
433 proto_tree_add_item(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN);
434 offset += 2;
436 /* Check that there are as many bytes as reported */
437 tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
439 else
441 packet_length = tvb_captured_length_remaining(tvb, start_offset);
444 /* More flags */
445 flags2 = tvb_get_uint8(tvb, offset);
446 back_to_back = (flags2 & 0x80) >> 7;
447 slow_data = (flags2 & 0x40) >> 6;
448 asm_rule_number = flags2 & 0x3f;
451 /* Create subtree for flags2 fields */
452 ti = proto_tree_add_string_format(tree, hf_rdt_data_flags2, tvb, offset, 1,
454 "Back-to-back=%u, slow-data=%u, asm-rule=%u",
455 back_to_back,
456 slow_data,
457 asm_rule_number);
459 /* Create subtree for flags and add fields */
460 flags_tree2 = proto_item_add_subtree(ti, ett_rdt_data_flags2);
462 proto_tree_add_item(flags_tree2, hf_rdt_data_backtoback, tvb, offset, 1, ENC_BIG_ENDIAN);
463 proto_tree_add_item(flags_tree2, hf_rdt_data_slowdata, tvb, offset, 1, ENC_BIG_ENDIAN);
464 proto_tree_add_item(flags_tree2, hf_rdt_data_asmrule, tvb, offset, 1, ENC_BIG_ENDIAN);
465 offset++;
467 /* Timestamp */
468 timestamp = tvb_get_ntohl(tvb, offset);
469 proto_tree_add_item(tree, hf_rdt_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
470 offset += 4;
472 /* Stream ID expansion */
473 if (stream_id == 31)
475 stream_id = tvb_get_ntohs(tvb, offset);
476 proto_tree_add_item(tree, hf_rdt_stream_id_ex, tvb, offset, 2, ENC_BIG_ENDIAN);
477 offset += 2;
480 /* Total reliable */
481 if (need_reliable_flag)
483 proto_tree_add_item(tree, hf_rdt_total_reliable, tvb, offset, 2, ENC_BIG_ENDIAN);
484 offset += 2;
487 /* Asm rule number */
488 if (asm_rule_number == 63)
490 asm_rule_number = tvb_get_ntohs(tvb, offset);
491 proto_tree_add_item(tree, hf_rdt_asmrule_ex, tvb, offset, 2, ENC_BIG_ENDIAN);
492 offset += 2;
495 col_append_fstr(pinfo->cinfo, COL_INFO,
496 "DATA: stream-id=%02u asm-rule=%02u seq=%05u ts=%05u ",
497 stream_id, asm_rule_number, sequence_number, timestamp);
499 /* The remaining data is unparsed. */
500 proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
501 offset += tvb_captured_length_remaining(tvb, offset);
503 if (packet_length < (offset - start_offset) ||
504 packet_length > tvb_reported_length_remaining(tvb, start_offset))
506 proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
507 packet_length = tvb_captured_length_remaining(tvb, start_offset);
510 return start_offset + packet_length;
513 /* Dissect an asm-action packet */
514 unsigned dissect_rdt_asm_action_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
516 unsigned start_offset = offset;
517 uint16_t packet_length;
518 uint8_t flags1;
519 uint8_t length_included_flag;
520 uint16_t stream_id;
521 uint16_t rel_seqno;
522 proto_tree *flags_tree;
523 proto_item *ti;
525 /* Flags in first byte */
526 flags1 = tvb_get_uint8(tvb, offset);
527 length_included_flag = (flags1 & 0x80) >> 7;
528 stream_id = (flags1 & 0x7c) >> 2;
530 /* Create subtree for flags fields */
531 proto_tree_add_item(tree, proto_rdt, tvb, offset, -1, ENC_NA);
532 ti = proto_tree_add_string_format(tree, hf_rdt_aact_flags, tvb, offset, 1,
534 "Length-included=%u, stream_id=%u",
535 length_included_flag,
536 stream_id);
537 flags_tree = proto_item_add_subtree(ti, ett_rdt_aact_flags);
539 proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
540 proto_tree_add_item(flags_tree, hf_rdt_aact_stream_id, tvb, offset, 1, ENC_BIG_ENDIAN);
541 offset++;
543 /* Packet type */
544 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
545 offset += 2;
547 rel_seqno = tvb_get_ntohs(tvb, offset);
548 proto_tree_add_item(tree, hf_rdt_aact_reliable_seqno, tvb, offset, 2, ENC_BIG_ENDIAN);
549 offset += 2;
551 /* Length field is optional */
552 if (length_included_flag)
554 packet_length = tvb_get_ntohs(tvb, offset);
555 proto_tree_add_item(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN);
556 offset += 2;
558 /* Check that there are as many bytes as reported */
559 tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
561 else
563 packet_length = tvb_captured_length_remaining(tvb, start_offset);
566 /* Stream ID expansion */
567 if (stream_id == 31)
569 stream_id = tvb_get_ntohs(tvb, offset);
570 proto_tree_add_item(tree, hf_rdt_stream_id_ex, tvb, offset, 2, ENC_BIG_ENDIAN);
571 offset += 2;
574 col_append_fstr(pinfo->cinfo, COL_INFO,
575 "ASM-ACTION: stream-id=%02u rel-seqno=%05u ",
576 stream_id, rel_seqno);
578 /* The remaining data is unparsed. */
579 proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
581 if (packet_length < (offset - start_offset) ||
582 packet_length > tvb_reported_length_remaining(tvb, start_offset))
584 proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
585 packet_length = tvb_captured_length_remaining(tvb, start_offset);
588 return start_offset + packet_length;
591 /* Dissect an bandwidth-report packet */
592 unsigned dissect_rdt_bandwidth_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
594 unsigned start_offset = offset;
595 uint16_t packet_length;
596 uint8_t flags1;
597 uint8_t length_included_flag;
598 proto_tree *flags_tree;
599 proto_item *ti;
601 /* Flags in first byte */
602 flags1 = tvb_get_uint8(tvb, offset);
603 length_included_flag = (flags1 & 0x80) >> 7;
605 /* Create subtree for flags fields */
606 ti = proto_tree_add_string_format(tree, hf_rdt_bandwidth_report_flags, tvb, offset, 1,
608 "Length-included=%u",
609 length_included_flag);
610 flags_tree = proto_item_add_subtree(ti, ett_rdt_bandwidth_report_flags);
612 proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
613 offset++;
615 /* Packet type */
616 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
617 offset += 2;
619 /* Length field is optional */
620 if (length_included_flag)
622 packet_length = tvb_get_ntohs(tvb, offset);
623 proto_tree_add_item(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN);
624 offset += 2;
626 /* Check that there are as many bytes as reported */
627 tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
629 else
631 packet_length = tvb_captured_length_remaining(tvb, start_offset);
634 proto_tree_add_item(tree, hf_rdt_brpt_interval, tvb, offset, 2, ENC_BIG_ENDIAN);
635 offset += 2;
636 proto_tree_add_item(tree, hf_rdt_brpt_bandwidth, tvb, offset, 4, ENC_BIG_ENDIAN);
637 offset += 4;
638 proto_tree_add_item(tree, hf_rdt_brpt_sequence, tvb, offset, 1, ENC_BIG_ENDIAN);
639 offset += 1;
641 col_append_str(pinfo->cinfo, COL_INFO, "BANDWIDTH-REPORT: ");
643 if (packet_length < (offset - start_offset) ||
644 packet_length > tvb_reported_length_remaining(tvb, start_offset))
646 proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
647 packet_length = tvb_captured_length_remaining(tvb, start_offset);
650 return start_offset + packet_length;
653 /* Dissect an ack packet */
654 unsigned dissect_rdt_ack_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
656 unsigned start_offset = offset;
657 uint16_t packet_length;
658 uint8_t flags1;
659 uint8_t length_included_flag;
660 uint8_t lost_high_flag;
661 proto_tree *flags_tree;
662 proto_item *ti;
664 /* Flags in first byte */
665 flags1 = tvb_get_uint8(tvb, offset);
666 length_included_flag = (flags1 & 0x80) >> 7;
667 lost_high_flag = (flags1 & 0x40) >> 6;
669 /* Create subtree for flags fields */
670 ti = proto_tree_add_string_format(tree, hf_rdt_ack_flags, tvb, offset, 1,
672 "Length-included=%u, lost-high=%u",
673 length_included_flag,
674 lost_high_flag);
675 flags_tree = proto_item_add_subtree(ti, ett_rdt_ack_flags);
677 proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
678 proto_tree_add_item(flags_tree, hf_rdt_ack_lost_high, tvb, offset, 1, ENC_BIG_ENDIAN);
679 offset++;
681 /* Packet type */
682 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
683 offset += 2;
685 /* Length field is optional */
686 if (length_included_flag)
688 packet_length = tvb_get_ntohs(tvb, offset);
689 proto_tree_add_item(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN);
690 offset += 2;
692 /* Check that there are as many bytes as reported */
693 tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
695 else
697 packet_length = tvb_captured_length_remaining(tvb, start_offset);
700 /* XXX: The remaining data is unparsed. */
701 proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
703 col_append_fstr(pinfo->cinfo, COL_INFO, "ACK: lh=%u ", lost_high_flag);
705 if (packet_length < (offset - start_offset) ||
706 packet_length > tvb_reported_length_remaining(tvb, start_offset))
708 proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
709 packet_length = tvb_captured_length_remaining(tvb, start_offset);
712 return start_offset + packet_length;
715 /* Dissect an att-request packet */
716 unsigned dissect_rdt_rtt_request_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
718 /* Flags in first byte */
719 offset++;
721 /* Packet type */
722 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
723 offset += 2;
725 col_append_str(pinfo->cinfo, COL_INFO, "RTT-REQUEST: ");
727 return offset;
730 /* Dissect an att-response packet */
731 unsigned dissect_rdt_rtt_response_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
733 /* Flags in first byte */
734 offset++;
736 /* Packet type */
737 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
738 offset += 2;
740 proto_tree_add_item(tree, hf_rdt_rtrp_ts_sec, tvb, offset, 4, ENC_BIG_ENDIAN);
741 offset += 4;
742 proto_tree_add_item(tree, hf_rdt_rtrp_ts_usec, tvb, offset, 4, ENC_BIG_ENDIAN);
743 offset += 4;
745 col_append_str(pinfo->cinfo, COL_INFO, "RTT-RESPONSE: ");
747 return offset;
750 /* Dissect an congestion packet */
751 unsigned dissect_rdt_congestion_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
753 /* Flags in first byte */
754 offset++;
756 /* Packet type */
757 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
758 offset += 2;
760 proto_tree_add_item(tree, hf_rdt_cong_xmit_mult, tvb, offset, 4, ENC_BIG_ENDIAN);
761 offset += 4;
762 proto_tree_add_item(tree, hf_rdt_cong_recv_mult, tvb, offset, 4, ENC_BIG_ENDIAN);
763 offset += 4;
765 col_append_str(pinfo->cinfo, COL_INFO, "CONGESTION: ");
767 return offset;
770 /* Dissect an stream-end packet */
771 unsigned dissect_rdt_stream_end_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
773 uint8_t flags1;
774 uint8_t need_reliable;
775 uint16_t stream_id;
776 uint8_t packet_sent;
777 uint8_t ext_flag;
778 proto_tree *flags_tree;
779 proto_item *ti;
781 /* Flags in first byte */
782 flags1 = tvb_get_uint8(tvb, offset);
783 need_reliable = (flags1 & 0x80) >> 7;
784 stream_id = (flags1 & 0x7c) >> 2;
785 packet_sent = (flags1 & 0x2) >> 1;
786 ext_flag = flags1 & 0x1;
788 /* Create subtree for flags fields */
789 ti = proto_tree_add_string_format(tree, hf_rdt_stre_flags, tvb, offset, 1,
791 "Need-reliable=%u, stream-id=%u, packet-sent=%u, ext-flag=%u",
792 need_reliable,
793 stream_id,
794 packet_sent,
795 ext_flag);
796 flags_tree = proto_item_add_subtree(ti, ett_rdt_stre_flags);
798 proto_tree_add_item(flags_tree, hf_rdt_stre_need_reliable, tvb, offset, 1, ENC_BIG_ENDIAN);
799 proto_tree_add_item(flags_tree, hf_rdt_stre_stream_id, tvb, offset, 1, ENC_BIG_ENDIAN);
800 proto_tree_add_item(flags_tree, hf_rdt_stre_packet_sent, tvb, offset, 1, ENC_BIG_ENDIAN);
801 proto_tree_add_item(flags_tree, hf_rdt_stre_ext_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
802 offset++;
804 /* Packet type */
805 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
806 offset += 2;
808 proto_tree_add_item(tree, hf_rdt_stre_seqno, tvb, offset, 2, ENC_BIG_ENDIAN);
809 offset += 2;
810 proto_tree_add_item(tree, hf_rdt_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
811 offset += 4;
813 /* Stream ID expansion */
814 if (stream_id == 31)
816 stream_id = tvb_get_ntohs(tvb, offset);
817 proto_tree_add_item(tree, hf_rdt_stream_id_ex, tvb, offset, 2, ENC_BIG_ENDIAN);
818 offset += 2;
821 /* Total reliable */
822 if (need_reliable)
824 proto_tree_add_item(tree, hf_rdt_total_reliable, tvb, offset, 2, ENC_BIG_ENDIAN);
825 offset += 2;
828 if (ext_flag)
830 proto_tree_add_item(tree, hf_rdt_stre_dummy_flags1, tvb, offset, 1, ENC_BIG_ENDIAN);
831 offset += 1;
832 proto_tree_add_item(tree, hf_rdt_stre_dummy_type, tvb, offset, 2, ENC_BIG_ENDIAN);
833 offset += 2;
834 proto_tree_add_item(tree, hf_rdt_stre_reason_code, tvb, offset, 4, ENC_BIG_ENDIAN);
835 offset += 4;
836 /* XXX: Remainder is reason_text */
837 offset += tvb_captured_length_remaining(tvb, offset);
840 col_append_fstr(pinfo->cinfo, COL_INFO, "STREAM-END: stream-id=%02u ", stream_id);
842 return offset;
845 /* Dissect an report packet */
846 unsigned dissect_rdt_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
848 unsigned start_offset = offset;
849 uint16_t packet_length;
850 uint8_t flags1;
851 uint8_t length_included_flag;
852 proto_tree *flags_tree;
853 proto_item *ti;
855 /* Flags in first byte */
856 flags1 = tvb_get_uint8(tvb, offset);
857 length_included_flag = (flags1 & 0x80) >> 7;
859 /* Create subtree for flags fields */
860 ti = proto_tree_add_string_format(tree, hf_rdt_report_flags, tvb, offset, 1,
862 "Length-included=%u",
863 length_included_flag);
864 flags_tree = proto_item_add_subtree(ti, ett_rdt_report_flags);
866 proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
867 offset++;
869 /* Packet type */
870 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
871 offset += 2;
873 /* Length field is optional */
874 if (length_included_flag)
876 packet_length = tvb_get_ntohs(tvb, offset);
877 proto_tree_add_item(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN);
878 offset += 2;
880 /* Check that there are as many bytes as reported */
881 tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
883 else
885 packet_length = tvb_captured_length_remaining(tvb, start_offset);
888 col_append_str(pinfo->cinfo, COL_INFO, "REPORT: ");
890 /* The remaining data is unparsed. */
891 proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
893 if (packet_length < (offset - start_offset) ||
894 packet_length > tvb_reported_length_remaining(tvb, start_offset))
896 proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
897 packet_length = tvb_captured_length_remaining(tvb, start_offset);
900 return start_offset + packet_length;
903 /* Dissect an latency-report packet */
904 unsigned dissect_rdt_latency_report_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
906 unsigned start_offset = offset;
907 uint16_t packet_length;
908 uint8_t flags1;
909 uint8_t length_included_flag;
910 uint32_t server_out_time;
911 proto_tree *flags_tree;
912 proto_item *ti;
914 /* Flags in first byte */
915 flags1 = tvb_get_uint8(tvb, offset);
916 length_included_flag = (flags1 & 0x80) >> 7;
918 /* Create subtree for flags fields */
919 ti = proto_tree_add_string_format(tree, hf_rdt_latency_report_flags, tvb, offset, 1,
921 "Length-included=%u",
922 length_included_flag);
923 flags_tree = proto_item_add_subtree(ti, ett_rdt_latency_report_flags);
925 proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
926 offset++;
928 /* Packet type */
929 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
930 offset += 2;
932 /* Length field is optional */
933 if (length_included_flag)
935 packet_length = tvb_get_ntohs(tvb, offset);
936 proto_tree_add_item(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN);
937 offset += 2;
939 /* Check that there are as many bytes as reported */
940 tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
942 else
944 packet_length = tvb_captured_length_remaining(tvb, start_offset);
947 server_out_time = tvb_get_ntohl(tvb, offset);
948 proto_tree_add_item(tree, hf_rdt_lrpt_server_out_time, tvb, offset, 4, ENC_BIG_ENDIAN);
949 offset += 4;
951 col_append_fstr(pinfo->cinfo, COL_INFO, "LATENCY-REPORT: t=%u ", server_out_time);
953 if (packet_length < (offset - start_offset) ||
954 packet_length > tvb_reported_length_remaining(tvb, start_offset))
956 proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
957 packet_length = tvb_captured_length_remaining(tvb, start_offset);
960 return start_offset + packet_length;
963 /* Dissect a transport-info packet */
964 unsigned dissect_rdt_transport_info_request_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
966 uint8_t flags1;
967 uint8_t request_rtt_info_flag;
968 uint8_t request_buffer_info_flag;
969 proto_tree *flags_tree;
970 proto_item *ti;
972 /* Flags in first byte */
973 flags1 = tvb_get_uint8(tvb, offset);
974 request_rtt_info_flag = (flags1 & 0x2) >> 1;
975 request_buffer_info_flag = (flags1 & 0x01);
977 /* Create subtree for flags fields */
978 ti = proto_tree_add_string_format(tree, hf_rdt_ack_flags, tvb, offset, 1,
980 "Request-rtt-info=%u, request-buffer-info=%u",
981 request_rtt_info_flag,
982 request_buffer_info_flag);
983 flags_tree = proto_item_add_subtree(ti, ett_rdt_tirq_flags);
985 proto_tree_add_item(flags_tree, hf_rdt_tirq_request_rtt_info, tvb, offset, 1, ENC_BIG_ENDIAN);
986 proto_tree_add_item(flags_tree, hf_rdt_tirq_request_buffer_info, tvb, offset, 1, ENC_BIG_ENDIAN);
987 offset++;
989 /* Packet type */
990 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
991 offset += 2;
993 if (request_rtt_info_flag)
995 proto_tree_add_item(tree, hf_rdt_tirq_request_time_msec, tvb, offset, 4, ENC_BIG_ENDIAN);
996 offset += 4;
999 col_append_str(pinfo->cinfo, COL_INFO, "TRANSPORT-INFO-REQUEST: ");
1001 return offset;
1004 /* Dissect an transport-info-response packet */
1005 unsigned dissect_rdt_transport_info_response_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
1007 uint8_t flags1;
1008 uint8_t has_rtt_info;
1009 uint8_t is_delayed;
1010 uint8_t has_buffer_info;
1011 proto_tree *flags_tree;
1012 proto_item *ti;
1014 /* Flags in first byte */
1015 flags1 = tvb_get_uint8(tvb, offset);
1016 has_rtt_info = (flags1 & 0x4) >> 2;
1017 is_delayed = (flags1 & 0x2) >> 1;
1018 has_buffer_info = (flags1 & 0x1);
1020 /* Create subtree for flags fields */
1021 ti = proto_tree_add_string_format(tree, hf_rdt_tirp_flags, tvb, offset, 1,
1023 "Has-rtt-info=%u, is-delayed=%u, has-buffer-info=%u",
1024 has_rtt_info,
1025 is_delayed,
1026 has_buffer_info);
1027 flags_tree = proto_item_add_subtree(ti, ett_rdt_tirp_flags);
1029 proto_tree_add_item(flags_tree, hf_rdt_tirp_has_rtt_info, tvb, offset, 1, ENC_BIG_ENDIAN);
1030 proto_tree_add_item(flags_tree, hf_rdt_tirp_is_delayed, tvb, offset, 1, ENC_BIG_ENDIAN);
1031 proto_tree_add_item(flags_tree, hf_rdt_tirp_has_buffer_info, tvb, offset, 1, ENC_BIG_ENDIAN);
1032 offset++;
1034 /* Packet type */
1035 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1036 offset += 2;
1038 /* RTT info */
1039 if (has_rtt_info)
1041 proto_tree_add_item(tree, hf_rdt_tirp_request_time_msec, tvb, offset, 4, ENC_BIG_ENDIAN);
1042 offset += 4;
1044 if (is_delayed)
1046 proto_tree_add_item(tree, hf_rdt_tirp_response_time_msec, tvb, offset, 4, ENC_BIG_ENDIAN);
1047 offset += 4;
1051 /* Buffer info */
1052 if (has_buffer_info)
1054 uint16_t n;
1056 /* Read number of buffers */
1057 uint16_t buffer_info_count = tvb_get_ntohs(tvb, offset);
1058 proto_tree_add_item(tree, hf_rdt_tirp_buffer_info_count, tvb, offset, 2, ENC_BIG_ENDIAN);
1059 offset += 2;
1061 for (n=0; n < buffer_info_count; n++)
1063 proto_tree *buffer_info_tree;
1064 proto_item *ti2;
1066 /* Each buffer info in a new subtree */
1067 ti2 = proto_tree_add_string_format(tree, hf_rdt_tirp_buffer_info, tvb, offset, 14,
1069 "Buffer info %u",
1070 n+1);
1071 buffer_info_tree = proto_item_add_subtree(ti2, ett_rdt_tirp_buffer_info);
1073 /* Read individual buffer info */
1074 proto_tree_add_item(buffer_info_tree, hf_rdt_tirp_buffer_info_stream_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1075 offset += 2;
1076 proto_tree_add_item(buffer_info_tree, hf_rdt_tirp_buffer_info_lowest_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
1077 offset += 4;
1078 proto_tree_add_item(buffer_info_tree, hf_rdt_tirp_buffer_info_highest_timestamp, tvb, offset, 4, ENC_BIG_ENDIAN);
1079 offset += 4;
1080 proto_tree_add_item(buffer_info_tree, hf_rdt_tirp_buffer_info_bytes_buffered, tvb, offset, 4, ENC_BIG_ENDIAN);
1081 offset += 4;
1085 /* Report what is left */
1086 offset += tvb_captured_length_remaining(tvb, offset);
1088 col_append_str(pinfo->cinfo, COL_INFO, "RESPONSE: ");
1090 return offset;
1093 /* Dissect a bw-probing packet */
1094 unsigned dissect_rdt_bw_probing_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
1096 unsigned start_offset = offset;
1097 uint16_t packet_length;
1098 uint8_t flags1;
1099 uint8_t length_included_flag;
1100 proto_tree *flags_tree;
1101 proto_item *ti;
1103 /* Flags in first byte */
1104 flags1 = tvb_get_uint8(tvb, offset);
1105 length_included_flag = (flags1 & 0x80) >> 7;
1107 /* Create subtree for flags fields */
1108 ti = proto_tree_add_string_format(tree, hf_rdt_bw_probing_flags, tvb, offset, 1,
1110 "Length-included=%u",
1111 length_included_flag);
1112 flags_tree = proto_item_add_subtree(ti, ett_rdt_bw_probing_flags);
1114 proto_tree_add_item(flags_tree, hf_rdt_len_included, tvb, offset, 1, ENC_BIG_ENDIAN);
1115 offset++;
1117 /* Packet type */
1118 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1119 offset += 2;
1121 /* Length field is optional */
1122 if (length_included_flag)
1124 packet_length = tvb_get_ntohs(tvb, offset);
1125 proto_tree_add_item(tree, hf_rdt_packet_length, tvb, offset, 2, ENC_BIG_ENDIAN);
1126 offset += 2;
1128 /* Check that there are as many bytes as reported */
1129 tvb_ensure_bytes_exist(tvb, start_offset, packet_length);
1131 else
1133 packet_length = tvb_captured_length_remaining(tvb, start_offset);
1136 proto_tree_add_item(tree, hf_rdt_bwpp_seqno, tvb, offset, 1, ENC_BIG_ENDIAN);
1137 offset += 1;
1138 proto_tree_add_item(tree, hf_rdt_timestamp, tvb, offset, 1, ENC_BIG_ENDIAN);
1139 offset += 4;
1141 col_append_str(pinfo->cinfo, COL_INFO, "BW-PROBING: ");
1143 if (packet_length < (offset - start_offset) ||
1144 packet_length > tvb_reported_length_remaining(tvb, start_offset))
1146 proto_tree_add_expert(tree, pinfo, &ei_rdt_packet_length, tvb, 0, 0);
1147 packet_length = tvb_captured_length_remaining(tvb, start_offset);
1150 return start_offset + packet_length;
1153 /* Dissect an unknown control packet */
1154 unsigned dissect_rdt_unknown_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset)
1156 /* Flags in first byte */
1157 proto_tree_add_item(tree, hf_rdt_unk_flags1, tvb, offset, 1, ENC_BIG_ENDIAN);
1158 offset++;
1160 /* Packet type */
1161 proto_tree_add_item(tree, hf_rdt_packet_type, tvb, offset, 2, ENC_BIG_ENDIAN);
1162 offset += 2;
1164 /* The remaining data is unparsed. */
1165 proto_tree_add_item(tree, hf_rdt_data, tvb, offset, -1, ENC_NA);
1166 offset += tvb_captured_length_remaining(tvb, offset);
1168 col_append_str(pinfo->cinfo, COL_INFO, "UNKNOWN-CTL: ");
1170 return offset;
1173 /* Look for conversation info and display any setup info found */
1174 static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1176 /* Conversation and current data */
1177 conversation_t *p_conv;
1178 struct _rdt_conversation_info *p_conv_data;
1180 /* Use existing packet info if available */
1181 p_conv_data = (struct _rdt_conversation_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_rdt, 0);
1183 if (!p_conv_data)
1185 /* First time, get info from conversation */
1186 p_conv = find_conversation(pinfo->num, &pinfo->net_dst, &pinfo->net_src,
1187 conversation_pt_to_conversation_type(pinfo->ptype),
1188 pinfo->destport, pinfo->srcport, NO_ADDR_B);
1189 if (p_conv)
1191 /* Create space for conversation info */
1192 struct _rdt_conversation_info *p_conv_packet_data;
1193 p_conv_data = (struct _rdt_conversation_info *)conversation_get_proto_data(p_conv, proto_rdt);
1195 if (p_conv_data)
1197 /* Save this conversation info into packet info */
1198 p_conv_packet_data = wmem_new(wmem_file_scope(), struct _rdt_conversation_info);
1199 (void) g_strlcpy(p_conv_packet_data->method, p_conv_data->method, MAX_RDT_SETUP_METHOD_SIZE);
1200 p_conv_packet_data->frame_number = p_conv_data->frame_number;
1201 p_conv_packet_data->feature_level = p_conv_data->feature_level;
1202 p_add_proto_data(wmem_file_scope(), pinfo, proto_rdt, 0, p_conv_packet_data);
1207 /* Create setup info subtree with summary info. */
1208 if (p_conv_data)
1210 proto_tree *rdt_setup_tree;
1211 proto_item *ti = proto_tree_add_string_format(tree, hf_rdt_setup, tvb, 0, 0,
1213 "Stream setup by %s (frame %u), feature level %d",
1214 p_conv_data->method,
1215 p_conv_data->frame_number,
1216 p_conv_data->feature_level);
1217 proto_item_set_generated(ti);
1218 rdt_setup_tree = proto_item_add_subtree(ti, ett_rdt_setup);
1219 if (rdt_setup_tree)
1221 /* Add details into subtree */
1222 proto_item* item = proto_tree_add_uint(rdt_setup_tree, hf_rdt_setup_frame,
1223 tvb, 0, 0, p_conv_data->frame_number);
1224 proto_item_set_generated(item);
1225 item = proto_tree_add_string(rdt_setup_tree, hf_rdt_setup_method,
1226 tvb, 0, 0, p_conv_data->method);
1227 proto_item_set_generated(item);
1228 item = proto_tree_add_int(rdt_setup_tree, hf_rdt_feature_level,
1229 tvb, 0, 0, p_conv_data->feature_level);
1230 proto_item_set_generated(item);
1236 void proto_register_rdt(void)
1238 static hf_register_info hf[] =
1241 &hf_rdt_packet,
1243 "RDT packet",
1244 "rdt.packet",
1245 FT_STRING,
1246 BASE_NONE,
1247 NULL,
1248 0x0,
1249 NULL, HFILL
1253 &hf_rdt_data_flags1,
1255 "RDT data flags 1",
1256 "rdt.data-flags1",
1257 FT_STRING,
1258 BASE_NONE,
1259 NULL,
1260 0x0,
1261 NULL, HFILL
1265 &hf_rdt_len_included,
1267 "Length included",
1268 "rdt.length-included",
1269 FT_UINT8,
1270 BASE_DEC,
1271 NULL,
1272 0x80,
1273 NULL, HFILL
1277 &hf_rdt_data_need_reliable,
1279 "Need reliable",
1280 "rdt.need-reliable",
1281 FT_UINT8,
1282 BASE_DEC,
1283 NULL,
1284 0x40,
1285 NULL, HFILL
1289 &hf_rdt_data_stream_id,
1291 "Stream ID",
1292 "rdt.stream-id",
1293 FT_UINT8,
1294 BASE_DEC,
1295 NULL,
1296 0x3e,
1297 NULL, HFILL
1301 &hf_rdt_data_is_reliable,
1303 "Is reliable",
1304 "rdt.is-reliable",
1305 FT_UINT8,
1306 BASE_DEC,
1307 NULL,
1308 0x01,
1309 NULL, HFILL
1313 &hf_rdt_data_flags2,
1315 "RDT data flags 2",
1316 "rdt.data-flags2",
1317 FT_STRING,
1318 BASE_NONE,
1319 NULL,
1320 0x0,
1321 "RDT data flags2", HFILL
1325 &hf_rdt_data_backtoback,
1327 "Back-to-back",
1328 "rdt.back-to-back",
1329 FT_UINT8,
1330 BASE_DEC,
1331 NULL,
1332 0x80,
1333 NULL, HFILL
1337 &hf_rdt_data_slowdata,
1339 "Slow data",
1340 "rdt.slow-data",
1341 FT_UINT8,
1342 BASE_DEC,
1343 NULL,
1344 0x40,
1345 NULL, HFILL
1349 &hf_rdt_data_asmrule,
1351 "asm rule",
1352 "rdt.asm-rule",
1353 FT_UINT8,
1354 BASE_DEC,
1355 NULL,
1356 0x3f,
1357 NULL, HFILL
1361 &hf_rdt_aact_flags,
1363 "RDT asm-action flags 1",
1364 "rdt.aact-flags",
1365 FT_STRING,
1366 BASE_NONE,
1367 NULL,
1368 0x0,
1369 "RDT aact flags", HFILL
1373 &hf_rdt_aact_stream_id,
1375 "Stream ID",
1376 "rdt.stream-id",
1377 FT_UINT8,
1378 BASE_DEC,
1379 NULL,
1380 0x7c,
1381 NULL, HFILL
1385 &hf_rdt_sequence_number,
1387 "Sequence number",
1388 "rdt.sequence-number",
1389 FT_UINT16,
1390 BASE_DEC,
1391 NULL,
1392 0x0,
1393 NULL, HFILL
1397 &hf_rdt_packet_type,
1399 "Packet type",
1400 "rdt.packet-type",
1401 FT_UINT16,
1402 BASE_HEX,
1403 VALS(packet_type_vals),
1404 0x0,
1405 NULL, HFILL
1409 &hf_rdt_ack_flags,
1411 "RDT ack flags",
1412 "rdt.ack-flags",
1413 FT_STRING,
1414 BASE_NONE,
1415 NULL,
1416 0x0,
1417 NULL, HFILL
1421 &hf_rdt_ack_lost_high,
1423 "Lost high",
1424 "rdt.lost-high",
1425 FT_UINT8,
1426 BASE_DEC,
1427 NULL,
1428 0x40,
1429 NULL, HFILL
1433 &hf_rdt_latency_report_flags,
1435 "RDT latency report flags",
1436 "rdt.latency-report-flags",
1437 FT_STRING,
1438 BASE_NONE,
1439 NULL,
1440 0x0,
1441 NULL, HFILL
1445 &hf_rdt_bandwidth_report_flags,
1447 "RDT bandwidth report flags",
1448 "rdt.bandwidth-report-flags",
1449 FT_STRING,
1450 BASE_NONE,
1451 NULL,
1452 0x0,
1453 NULL, HFILL
1457 &hf_rdt_stre_flags,
1459 "RDT stream end flags",
1460 "rdt.stream-end-flags",
1461 FT_STRING,
1462 BASE_NONE,
1463 NULL,
1464 0x0,
1465 NULL, HFILL
1468 #if 0
1470 &hf_rdt_rtt_request_flags,
1472 "RDT rtt request flags",
1473 "rdt.rtt-request-flags",
1474 FT_STRING,
1475 BASE_NONE,
1476 NULL,
1477 0x0,
1478 NULL, HFILL
1481 #endif
1482 #if 0
1484 &hf_rdt_rtt_response_flags,
1486 "RDT rtt response flags",
1487 "rdt.rtt-response-flags",
1488 FT_STRING,
1489 BASE_NONE,
1490 NULL,
1491 0x0,
1492 NULL, HFILL
1495 #endif
1496 #if 0
1498 &hf_rdt_congestion_flags,
1500 "RDT congestion flags",
1501 "rdt.congestion-flags",
1502 FT_STRING,
1503 BASE_NONE,
1504 NULL,
1505 0x0,
1506 NULL, HFILL
1509 #endif
1511 &hf_rdt_report_flags,
1513 "RDT report flags",
1514 "rdt.report-flags",
1515 FT_STRING,
1516 BASE_NONE,
1517 NULL,
1518 0x0,
1519 NULL, HFILL
1522 #if 0
1524 &hf_rdt_tirq_flags,
1526 "RDT transport info request flags",
1527 "rdt.transport-info-request-flags",
1528 FT_STRING,
1529 BASE_NONE,
1530 NULL,
1531 0x0,
1532 NULL, HFILL
1535 #endif
1537 &hf_rdt_tirp_flags,
1539 "RDT transport info response flags",
1540 "rdt.transport-info-response-flags",
1541 FT_STRING,
1542 BASE_NONE,
1543 NULL,
1544 0x0,
1545 NULL, HFILL
1549 &hf_rdt_bw_probing_flags,
1551 "RDT bw probing flags",
1552 "rdt.bw-probing-flags",
1553 FT_STRING,
1554 BASE_NONE,
1555 NULL,
1556 0x0,
1557 NULL, HFILL
1561 &hf_rdt_packet_length,
1563 "Packet length",
1564 "rdt.packet-length",
1565 FT_UINT16,
1566 BASE_DEC,
1567 NULL,
1568 0x0,
1569 NULL, HFILL
1573 &hf_rdt_timestamp,
1575 "Timestamp",
1576 "rdt.timestamp",
1577 FT_UINT32,
1578 BASE_DEC,
1579 NULL,
1580 0x0,
1581 NULL, HFILL
1585 &hf_rdt_stream_id_ex,
1587 "Stream-id expansion",
1588 "rdt.stream-id-expansion",
1589 FT_UINT16,
1590 BASE_DEC,
1591 NULL,
1592 0x0,
1593 NULL, HFILL
1597 &hf_rdt_asmrule_ex,
1599 "Asm rule expansion",
1600 "rdt.asm-rule-expansion",
1601 FT_UINT16,
1602 BASE_DEC,
1603 NULL,
1604 0x0,
1605 NULL, HFILL
1609 &hf_rdt_total_reliable,
1611 "Total reliable",
1612 "rdt.total-reliable",
1613 FT_UINT16,
1614 BASE_DEC,
1615 NULL,
1616 0x0,
1617 NULL, HFILL
1621 &hf_rdt_data,
1623 "Data",
1624 "rdt.data",
1625 FT_NONE,
1626 BASE_NONE,
1627 NULL,
1628 0x0,
1629 NULL, HFILL
1633 &hf_rdt_aact_reliable_seqno,
1635 "Reliable sequence number",
1636 "rdt.reliable-seq-no",
1637 FT_UINT16,
1638 BASE_DEC,
1639 NULL,
1640 0x0,
1641 NULL, HFILL
1645 &hf_rdt_brpt_interval,
1647 "Bandwidth report interval",
1648 "rdt.bwid-report-interval",
1649 FT_UINT16,
1650 BASE_DEC,
1651 NULL,
1652 0x0,
1653 NULL, HFILL
1657 &hf_rdt_brpt_bandwidth,
1659 "Bandwidth report bandwidth",
1660 "rdt.bwid-report-bandwidth",
1661 FT_UINT32,
1662 BASE_DEC,
1663 NULL,
1664 0x0,
1665 NULL, HFILL
1669 &hf_rdt_brpt_sequence,
1671 "Bandwidth report sequence",
1672 "rdt.bwid-report-sequence",
1673 FT_UINT16,
1674 BASE_DEC,
1675 NULL,
1676 0x0,
1677 NULL, HFILL
1681 &hf_rdt_rtrp_ts_sec,
1683 "Round trip response timestamp seconds",
1684 "rdt.rtrp-ts-sec",
1685 FT_UINT32,
1686 BASE_DEC,
1687 NULL,
1688 0x0,
1689 NULL, HFILL
1693 &hf_rdt_rtrp_ts_usec,
1695 "Round trip response timestamp microseconds",
1696 "rdt.rtrp-ts-usec",
1697 FT_UINT32,
1698 BASE_DEC,
1699 NULL,
1700 0x0,
1701 NULL, HFILL
1705 &hf_rdt_cong_xmit_mult,
1707 "Congestion transmit multiplier",
1708 "rdt.cong-xmit-mult",
1709 FT_UINT32,
1710 BASE_DEC,
1711 NULL,
1712 0x0,
1713 NULL, HFILL
1717 &hf_rdt_cong_recv_mult,
1719 "Congestion receive multiplier",
1720 "rdt.cong-recv-mult",
1721 FT_UINT32,
1722 BASE_DEC,
1723 NULL,
1724 0x0,
1725 NULL, HFILL
1729 &hf_rdt_stre_need_reliable,
1731 "Need reliable",
1732 "rdt.stre-need-reliable",
1733 FT_UINT8,
1734 BASE_DEC,
1735 NULL,
1736 0x80,
1737 NULL, HFILL
1741 &hf_rdt_stre_stream_id,
1743 "Stream id",
1744 "rdt.stre-stream-id",
1745 FT_UINT8,
1746 BASE_DEC,
1747 NULL,
1748 0x7c,
1749 NULL, HFILL
1753 &hf_rdt_stre_packet_sent,
1755 "Packet sent",
1756 "rdt.stre-packet-sent",
1757 FT_UINT8,
1758 BASE_DEC,
1759 NULL,
1760 0x02,
1761 NULL, HFILL
1765 &hf_rdt_stre_ext_flag,
1767 "Ext flag",
1768 "rdt.stre-ext-flag",
1769 FT_UINT8,
1770 BASE_DEC,
1771 NULL,
1772 0x01,
1773 NULL, HFILL
1778 &hf_rdt_stre_seqno,
1780 "Stream end sequence number",
1781 "rdt.stre-seqno",
1782 FT_UINT16,
1783 BASE_DEC,
1784 NULL,
1785 0x0,
1786 NULL, HFILL
1790 &hf_rdt_stre_dummy_flags1,
1792 "Stream end reason dummy flags1",
1793 "rdt.stre-reason-dummy-flags1",
1794 FT_UINT8,
1795 BASE_HEX,
1796 NULL,
1797 0x0,
1798 NULL, HFILL
1802 &hf_rdt_stre_dummy_type,
1804 "Stream end reason dummy type",
1805 "rdt.stre-reason-dummy-type",
1806 FT_UINT16,
1807 BASE_HEX,
1808 NULL,
1809 0x0,
1810 NULL, HFILL
1814 &hf_rdt_stre_reason_code,
1816 "Stream end reason code",
1817 "rdt.stre-reason-code",
1818 FT_UINT32,
1819 BASE_HEX,
1820 NULL,
1821 0x0,
1822 NULL, HFILL
1826 &hf_rdt_lrpt_server_out_time,
1828 "Latency report server out time",
1829 "rdt.lrpt-server-out-time",
1830 FT_UINT32,
1831 BASE_DEC,
1832 NULL,
1833 0x0,
1834 NULL, HFILL
1838 &hf_rdt_tirq_request_rtt_info,
1840 "Transport info request rtt info flag",
1841 "rdt.tirq-request-rtt-info",
1842 FT_UINT8,
1843 BASE_DEC,
1844 NULL,
1845 0x2,
1846 NULL, HFILL
1850 &hf_rdt_tirq_request_buffer_info,
1852 "Transport info request buffer info flag",
1853 "rdt.tirq-request-buffer-info",
1854 FT_UINT8,
1855 BASE_DEC,
1856 NULL,
1857 0x1,
1858 NULL, HFILL
1862 &hf_rdt_tirq_request_time_msec,
1864 "Transport info request time msec",
1865 "rdt.tirq-request-time-msec",
1866 FT_UINT32,
1867 BASE_DEC,
1868 NULL,
1869 0x0,
1870 NULL, HFILL
1874 &hf_rdt_tirp_has_rtt_info,
1876 "Transport info response has rtt info flag",
1877 "rdt.tirp-has-rtt-info",
1878 FT_UINT8,
1879 BASE_DEC,
1880 NULL,
1881 0x4,
1882 NULL, HFILL
1886 &hf_rdt_tirp_is_delayed,
1888 "Transport info response is delayed",
1889 "rdt.tirp-is-delayed",
1890 FT_UINT8,
1891 BASE_DEC,
1892 NULL,
1893 0x2,
1894 NULL, HFILL
1898 &hf_rdt_tirp_has_buffer_info,
1900 "Transport info response has buffer info",
1901 "rdt.tirp-has-buffer-info",
1902 FT_UINT8,
1903 BASE_DEC,
1904 NULL,
1905 0x1,
1906 NULL, HFILL
1910 &hf_rdt_tirp_request_time_msec,
1912 "Transport info request time msec",
1913 "rdt.tirp-request-time-msec",
1914 FT_UINT32,
1915 BASE_DEC,
1916 NULL,
1917 0x0,
1918 NULL, HFILL
1922 &hf_rdt_tirp_response_time_msec,
1924 "Transport info response time msec",
1925 "rdt.tirp-response-time-msec",
1926 FT_UINT32,
1927 BASE_DEC,
1928 NULL,
1929 0x0,
1930 NULL, HFILL
1934 &hf_rdt_tirp_buffer_info_count,
1936 "Transport info buffer into count",
1937 "rdt.tirp-buffer-info-count",
1938 FT_UINT16,
1939 BASE_DEC,
1940 NULL,
1941 0x0,
1942 NULL, HFILL
1946 &hf_rdt_tirp_buffer_info,
1948 "RDT buffer info",
1949 "rdt.tirp-buffer-info",
1950 FT_STRING,
1951 BASE_NONE,
1952 NULL,
1953 0x0,
1954 NULL, HFILL
1958 &hf_rdt_tirp_buffer_info_stream_id,
1960 "Buffer info stream-id",
1961 "rdt.tirp-buffer-info-stream-id",
1962 FT_UINT16,
1963 BASE_DEC,
1964 NULL,
1965 0x0,
1966 NULL, HFILL
1970 &hf_rdt_tirp_buffer_info_lowest_timestamp,
1972 "Lowest timestamp",
1973 "rdt.tirp-buffer-info-lowest-timestamp",
1974 FT_UINT32,
1975 BASE_DEC,
1976 NULL,
1977 0x0,
1978 NULL, HFILL
1982 &hf_rdt_tirp_buffer_info_highest_timestamp,
1984 "Highest timestamp",
1985 "rdt.tirp-buffer-info-highest-timestamp",
1986 FT_UINT32,
1987 BASE_DEC,
1988 NULL,
1989 0x0,
1990 NULL, HFILL
1994 &hf_rdt_tirp_buffer_info_bytes_buffered,
1996 "Bytes buffered",
1997 "rdt.tirp-buffer-info-bytes-buffered",
1998 FT_UINT32,
1999 BASE_DEC,
2000 NULL,
2001 0x0,
2002 NULL, HFILL
2006 &hf_rdt_bwpp_seqno,
2008 "Bandwidth probing packet seqno",
2009 "rdt.bwpp-seqno",
2010 FT_UINT8,
2011 BASE_DEC,
2012 NULL,
2013 0x0,
2014 NULL, HFILL
2018 &hf_rdt_unk_flags1,
2020 "Unknown packet flags",
2021 "rdt.unk-flags1",
2022 FT_UINT8,
2023 BASE_DEC,
2024 NULL,
2025 0x0,
2026 NULL, HFILL
2030 &hf_rdt_setup,
2032 "Stream setup",
2033 "rdt.setup",
2034 FT_STRING,
2035 BASE_NONE,
2036 NULL,
2037 0x0,
2038 "Stream setup, method and frame number", HFILL
2042 &hf_rdt_setup_frame,
2044 "Setup frame",
2045 "rdt.setup-frame",
2046 FT_FRAMENUM,
2047 BASE_NONE,
2048 NULL,
2049 0x0,
2050 "Frame that set up this stream", HFILL
2054 &hf_rdt_setup_method,
2056 "Setup Method",
2057 "rdt.setup-method",
2058 FT_STRING,
2059 BASE_NONE,
2060 NULL,
2061 0x0,
2062 "Method used to set up this stream", HFILL
2066 &hf_rdt_feature_level,
2068 "RDT feature level",
2069 "rdt.feature-level",
2070 FT_INT32,
2071 BASE_DEC,
2072 NULL,
2073 0x0,
2074 NULL, HFILL
2079 static int *ett[] =
2081 &ett_rdt,
2082 &ett_rdt_packet,
2083 &ett_rdt_setup,
2084 &ett_rdt_data_flags1,
2085 &ett_rdt_data_flags2,
2086 &ett_rdt_aact_flags,
2087 &ett_rdt_ack_flags,
2088 &ett_rdt_latency_report_flags,
2089 &ett_rdt_bandwidth_report_flags,
2090 &ett_rdt_stre_flags,
2091 &ett_rdt_rtt_request_flags,
2092 &ett_rdt_rtt_response_flags,
2093 &ett_rdt_congestion_flags,
2094 &ett_rdt_report_flags,
2095 &ett_rdt_tirq_flags,
2096 &ett_rdt_tirp_flags,
2097 &ett_rdt_tirp_buffer_info,
2098 &ett_rdt_bw_probing_flags
2101 static ei_register_info ei[] = {
2102 { &ei_rdt_packet_length, { "rdt.invalid_packet_length", PI_MALFORMED, PI_ERROR, "Packet length invalid", EXPFILL }},
2105 module_t *rdt_module;
2106 expert_module_t* expert_rdt;
2108 /* Register protocol and fields */
2109 proto_rdt = proto_register_protocol("Real Data Transport", "RDT", "rdt");
2110 proto_register_field_array(proto_rdt, hf, array_length(hf));
2111 proto_register_subtree_array(ett, array_length(ett));
2112 expert_rdt = expert_register_protocol(proto_rdt);
2113 expert_register_field_array(expert_rdt, ei, array_length(ei));
2114 rdt_handle = register_dissector("rdt", dissect_rdt, proto_rdt);
2116 /* Preference settings */
2117 rdt_module = prefs_register_protocol(proto_rdt, NULL);
2118 prefs_register_bool_preference(rdt_module, "show_setup_info",
2119 "Show stream setup information",
2120 "Where available, show which protocol and frame caused "
2121 "this RDT stream to be created",
2122 &global_rdt_show_setup_info);
2124 prefs_register_obsolete_preference(rdt_module, "register_udp_port");
2127 void proto_reg_handoff_rdt(void)
2129 dissector_add_uint_with_preference("udp.port", RDT_UDP_PORT, rdt_handle);
2133 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2135 * Local variables:
2136 * c-basic-offset: 4
2137 * tab-width: 8
2138 * indent-tabs-mode: nil
2139 * End:
2141 * vi: set shiftwidth=4 tabstop=8 expandtab:
2142 * :indentSize=4:tabSize=8:noTabs=true: