2 * Routines for MSRP (MRP Multiple Stream Reservation Protocol) dissection
3 * Copyright 2010, Torrey Atcitty <tatcitty@harman.com>
4 * Craig Gunther <craig.gunther@harman.com>
6 * Based on the code from packet-mmrp.c (MMRP) from
7 * Markus Seehofer <mseehofe@nt.hirschmann.de> Copyright 2001
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
15 * The MSRP Protocol specification can be found at the following:
16 * http://www.ieee802.org/1/files/private/at-drafts/d6/802-1at-d6-0.pdf
22 #include <epan/packet.h>
23 #include <epan/expert.h>
24 #include <epan/etypes.h>
26 void proto_register_mrp_msrp(void);
27 void proto_reg_handoff_mrp_msrp(void);
29 static dissector_handle_t msrp_handle
;
31 /* MSRP End Mark Sequence */
32 #define MSRP_END_MARK 0x0000
34 /**********************************************************/
35 /* Offsets of fields within an MSRP packet */
36 /**********************************************************/
37 #define MSRP_PROTOCOL_VERSION_OFFSET 0
39 /* Next comes the MSRP Message group */
40 #define MSRP_MESSAGE_GROUP_OFFSET (MSRP_PROTOCOL_VERSION_OFFSET + 1) /* Message is a group of fields */
41 #define MSRP_ATTRIBUTE_TYPE_OFFSET (MSRP_MESSAGE_GROUP_OFFSET)
42 #define MSRP_ATTRIBUTE_LENGTH_OFFSET (MSRP_ATTRIBUTE_TYPE_OFFSET + 1)
43 #define MSRP_ATTRIBUTE_LIST_LENGTH_OFFSET (MSRP_ATTRIBUTE_LENGTH_OFFSET + 1)
45 /* Next comes the MSRP AttributeList group */
46 #define MSRP_ATTRIBUTE_LIST_GROUP_OFFSET (MSRP_ATTRIBUTE_LIST_LENGTH_OFFSET + 2) /* AttributeList is a group of fields */
48 /* Next comes the MSRP VectorAttribute group */
49 #define MSRP_VECTOR_ATTRIBUTE_GROUP_OFFSET (MSRP_ATTRIBUTE_LIST_GROUP_OFFSET) /* VectorAttribute is a group of fields */
50 #define MSRP_VECTOR_HEADER_OFFSET (MSRP_VECTOR_ATTRIBUTE_GROUP_OFFSET) /* contains the following two fields */
51 #define MSRP_LEAVE_ALL_EVENT_OFFSET (MSRP_VECTOR_HEADER_OFFSET)
52 #define MSRP_LEAVE_ALL_EVENT_MASK 0xE000
53 #define MSRP_NUMBER_OF_VALUES_OFFSET (MSRP_VECTOR_HEADER_OFFSET)
54 #define MSRP_NUMBER_OF_VALUES_MASK 0x1fff
56 /* Next comes the MSRP FirstValue group */
57 #define MSRP_FIRST_VALUE_GROUP_OFFSET (MSRP_VECTOR_HEADER_OFFSET + 2) /* FirstValue is a group of fields */
58 #define MSRP_STREAM_ID_OFFSET (MSRP_FIRST_VALUE_GROUP_OFFSET)
59 #define MSRP_STREAM_DA_OFFSET (MSRP_STREAM_ID_OFFSET + 8)
60 #define MSRP_VLAN_ID_OFFSET (MSRP_STREAM_DA_OFFSET + 6)
61 #define MSRP_TSPEC_MAX_FRAME_SIZE_OFFSET (MSRP_VLAN_ID_OFFSET + 2)
62 #define MSRP_TSPEC_MAX_INTERVAL_FRAMES_OFFSET (MSRP_TSPEC_MAX_FRAME_SIZE_OFFSET + 2)
63 #define MSRP_PRIORITY_AND_RANK_OFFSET (MSRP_TSPEC_MAX_INTERVAL_FRAMES_OFFSET + 2) /* contains the following two fields */
64 #define MSRP_PRIORITY_OFFSET (MSRP_PRIORITY_AND_RANK_OFFSET)
65 #define MSRP_PRIORITY_MASK 0xe0
66 #define MSRP_RANK_OFFSET (MSRP_PRIORITY_AND_RANK_OFFSET)
67 #define MSRP_RANK_MASK 0x10
68 #define MSRP_RESERVED_OFFSET (MSRP_PRIORITY_AND_RANK_OFFSET)
69 #define MSRP_RESERVED_MASK 0x0F
70 #define MSRP_ACCUMULATED_LATENCY_OFFSET (MSRP_PRIORITY_AND_RANK_OFFSET + 1)
71 #define MSRP_FAILURE_BRIDGE_ID_OFFSET (MSRP_ACCUMULATED_LATENCY_OFFSET + 4)
72 #define MSRP_FAILURE_CODE_OFFSET (MSRP_FAILURE_BRIDGE_ID_OFFSET + 8)
74 #define MSRP_DOMAIN_THREE_PACKED_OFFSET (MSRP_FIRST_VALUE_GROUP_OFFSET + 4)
75 #define MSRP_LISTENER_THREE_PACKED_OFFSET (MSRP_STREAM_ID_OFFSET + 8)
76 #define MSRP_TALKER_ADVERTISE_THREE_PACKED_OFFSET (MSRP_ACCUMULATED_LATENCY_OFFSET + 4)
77 #define MSRP_TALKER_FAILED_THREE_PACKED_OFFSET (MSRP_FAILURE_CODE_OFFSET + 1)
79 /**********************************************************/
80 /* Valid field contents */
81 /**********************************************************/
83 /* Attribute Type definitions */
84 #define MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE 0x01
85 #define MSRP_ATTRIBUTE_TYPE_TALKER_FAILED 0x02
86 #define MSRP_ATTRIBUTE_TYPE_LISTENER 0x03
87 #define MSRP_ATTRIBUTE_TYPE_DOMAIN 0x04
88 static const value_string attribute_type_vals
[] = {
89 { MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE
, "Talker Advertise" },
90 { MSRP_ATTRIBUTE_TYPE_TALKER_FAILED
, "Talker Failed" },
91 { MSRP_ATTRIBUTE_TYPE_LISTENER
, "Listener" },
92 { MSRP_ATTRIBUTE_TYPE_DOMAIN
, "Domain" },
96 /* Leave All Event definitions */
97 #define MSRP_NULLLEAVEALL 0
98 #define MSRP_LEAVEALL 1
99 static const value_string leave_all_vals
[] = {
100 { MSRP_NULLLEAVEALL
, "Null" },
101 { MSRP_LEAVEALL
, "Leave All" },
105 /* Priority definitions */
106 #define MSRP_TRAFFIC_CLASS_A 3
107 #define MSRP_TRAFFIC_CLASS_B 2
109 static const value_string priority_vals
[] = {
110 { MSRP_TRAFFIC_CLASS_A
, "Traffic Class A" },
111 { MSRP_TRAFFIC_CLASS_B
, "Traffic Class B" },
115 /* Rank definitions */
116 static const value_string rank_vals
[] = {
118 { 1, "Non-emergency" },
121 static const value_string reserved_vals
[] = {
132 { 10, "Reserved-10" },
133 { 11, "Reserved-11" },
134 { 12, "Reserved-12" },
135 { 13, "Reserved-13" },
136 { 14, "Reserved-14" },
137 { 15, "Reserved-15" },
141 /* Failure Code definitions */
142 static const value_string failure_vals
[] = {
143 { 1, "Insufficient Bandwidth" },
144 { 2, "Insufficient Bridge resources" },
145 { 3, "Insufficient Bandwidth for Traffic Class" },
146 { 4, "Stream ID in use by another Talker" },
147 { 5, "Stream destination_address already in use" },
148 { 6, "Stream preempted by higher rank" },
149 { 7, "Reported latency has changed" },
150 { 8, "Egress port in not AVB capable" },
151 { 9, "Use a different destination address (i.e. MAC DA hash table full)" },
152 { 10, "Out of MSRP resources" },
153 { 11, "Out of MMRP resources" },
154 { 12, "Cannot store destination_address (i.e. Bridge is out of MAC resources)" },
155 { 13, "Requested priority not an SR Class (3.3) priority" },
156 { 14, "MaxFrameSize (35.2.2.8.4(a)) is too large for media" },
157 { 15, "msrpMaxFanInPorts (35.2.1.4(f)) limit has been reached" },
158 { 16, "Changes in FirstValue for a registered StreamID" },
159 { 17, "VLAN is blocked on this egress port (Registration Forbidden)" },
160 { 18, "VLAN tagging is disabled on this egress port (untagged set)" },
161 { 19, "SR class priority mismatch" },
165 /* SR class ID definitions */
166 #define MSRP_SR_CLASS_A 6
167 #define MSRP_SR_CLASS_B 5
168 #define MSRP_SR_CLASS_C 4
169 #define MSRP_SR_CLASS_D 3
170 #define MSRP_SR_CLASS_E 2
171 #define MSRP_SR_CLASS_F 1
172 #define MSRP_SR_CLASS_G 0
174 static const value_string sr_class_vals
[] = {
175 { MSRP_SR_CLASS_A
, "SR Class A" },
176 { MSRP_SR_CLASS_B
, "SR Class B" },
177 { MSRP_SR_CLASS_C
, "SR Class C" },
178 { MSRP_SR_CLASS_D
, "SR Class D" },
179 { MSRP_SR_CLASS_E
, "SR Class E" },
180 { MSRP_SR_CLASS_F
, "SR Class F" },
181 { MSRP_SR_CLASS_G
, "SR Class G" },
185 /* Three Packed Event definitions */
186 static const value_string three_packed_vals
[] = {
196 /* Four Packed Event definitions */
197 static const value_string four_packed_vals
[] = {
199 { 1, "Asking Failed" },
201 { 3, "Ready Failed" },
205 /**********************************************************/
206 /* Initialize the protocol and registered fields */
207 /**********************************************************/
208 static int proto_msrp
;
209 static int hf_msrp_proto_id
;
210 static int hf_msrp_message
; /* Message is a group of fields */
211 static int hf_msrp_attribute_type
;
212 static int hf_msrp_attribute_length
;
213 static int hf_msrp_attribute_list_length
;
214 static int hf_msrp_attribute_list
; /* AttributeList is a group of fields */
215 static int hf_msrp_vector_attribute
; /* VectorAttribute is a group of fields */
217 /* The following VectorHeader contains the LeaveAllEvent and NumberOfValues */
218 static int hf_msrp_vector_header
;
219 static int hf_msrp_leave_all_event
;
220 static int hf_msrp_number_of_values
;
221 static int ett_vector_header
;
222 static int * const vector_header_fields
[] = {
223 &hf_msrp_leave_all_event
,
224 &hf_msrp_number_of_values
,
228 static int hf_msrp_first_value
; /* FirstValue is a group of fields */
229 static int hf_msrp_stream_id
;
230 static int hf_msrp_stream_da
;
231 static int hf_msrp_vlan_id
;
232 static int hf_msrp_tspec_max_frame_size
;
233 static int hf_msrp_tspec_max_interval_frames
;
234 static int hf_msrp_priority_and_rank
;
235 static int hf_msrp_priority
;
236 static int hf_msrp_rank
;
237 static int hf_msrp_reserved
;
238 static int ett_priority_and_rank
;
239 static int * const priority_and_rank_fields
[] = {
246 static int hf_msrp_sr_class_id
;
247 static int hf_msrp_sr_class_priority
;
248 static int hf_msrp_sr_class_vid
;
250 static int hf_msrp_accumulated_latency
;
251 static int hf_msrp_failure_bridge_id
;
252 static int hf_msrp_failure_code
;
254 static int hf_msrp_three_packed_event
;
255 static int hf_msrp_four_packed_event
;
257 static int hf_msrp_end_mark
;
259 /* Initialize the subtree pointers */
262 static int ett_attr_list
;
263 static int ett_vect_attr
;
264 static int ett_first_value
;
266 static expert_field ei_msrp_attribute_type
;
268 /**********************************************************/
269 /* Dissector starts here */
270 /**********************************************************/
272 /* dissect_msrp_common1 (called from dissect_msrp)
274 * dissect the following fields which are common to all MSRP attributes:
277 * Attribute List Length
280 dissect_msrp_common1(proto_tree
*msg_tree
, tvbuff_t
*tvb
, int msg_offset
)
282 proto_tree_add_item(msg_tree
, hf_msrp_attribute_type
, tvb
,
283 MSRP_ATTRIBUTE_TYPE_OFFSET
+ msg_offset
, 1, ENC_BIG_ENDIAN
);
284 proto_tree_add_item(msg_tree
, hf_msrp_attribute_length
, tvb
,
285 MSRP_ATTRIBUTE_LENGTH_OFFSET
+ msg_offset
, 1, ENC_BIG_ENDIAN
);
286 proto_tree_add_item(msg_tree
, hf_msrp_attribute_list_length
, tvb
,
287 MSRP_ATTRIBUTE_LIST_LENGTH_OFFSET
+ msg_offset
, 2, ENC_BIG_ENDIAN
);
291 /* dissect_msrp_common2 (called from dissect_msrp)
293 * dissect the following fields which are common to all MSRP attributes:
295 * Number of Values fields
298 dissect_msrp_common2(proto_tree
*vect_attr_tree
, tvbuff_t
*tvb
, int msg_offset
)
300 proto_tree_add_bitmask(vect_attr_tree
, tvb
, MSRP_VECTOR_HEADER_OFFSET
+ msg_offset
,
301 hf_msrp_vector_header
, ett_vector_header
, vector_header_fields
, ENC_BIG_ENDIAN
);
305 /* dissect_msrp_talker_common (called from dissect_msrp)
307 * dissect the following fields which are common to all MSRP Talker attributes:
312 * Priority (Traffic Class)
314 * Accumulated Latency
317 dissect_msrp_talker_common(proto_tree
*first_value_tree
, tvbuff_t
*tvb
, int msg_offset
)
320 proto_tree_add_item(first_value_tree
, hf_msrp_stream_da
, tvb
,
321 MSRP_STREAM_DA_OFFSET
+ msg_offset
, 6, ENC_NA
);
322 proto_tree_add_item(first_value_tree
, hf_msrp_vlan_id
, tvb
,
323 MSRP_VLAN_ID_OFFSET
+ msg_offset
, 2, ENC_BIG_ENDIAN
);
324 proto_tree_add_item(first_value_tree
, hf_msrp_tspec_max_frame_size
, tvb
,
325 MSRP_TSPEC_MAX_FRAME_SIZE_OFFSET
+ msg_offset
, 2, ENC_BIG_ENDIAN
);
326 proto_tree_add_item(first_value_tree
, hf_msrp_tspec_max_interval_frames
, tvb
,
327 MSRP_TSPEC_MAX_INTERVAL_FRAMES_OFFSET
+ msg_offset
, 2, ENC_BIG_ENDIAN
);
328 proto_tree_add_bitmask(first_value_tree
, tvb
, MSRP_PRIORITY_AND_RANK_OFFSET
+ msg_offset
,
329 hf_msrp_priority_and_rank
, ett_priority_and_rank
, priority_and_rank_fields
, ENC_BIG_ENDIAN
);
330 proto_tree_add_item(first_value_tree
, hf_msrp_accumulated_latency
, tvb
,
331 MSRP_ACCUMULATED_LATENCY_OFFSET
+ msg_offset
, 4, ENC_BIG_ENDIAN
);
335 /* dissect_msrp_talker_failed (called from dissect_msrp)
337 * dissect the following fields which are common to all MSRP Talker Failed attributes:
338 * Failure Information: Bridge ID
339 * Failure Information: Failure Code
342 dissect_msrp_talker_failed(proto_tree
*first_value_tree
, tvbuff_t
*tvb
, int msg_offset
)
345 proto_tree_add_item(first_value_tree
, hf_msrp_failure_bridge_id
, tvb
,
346 MSRP_FAILURE_BRIDGE_ID_OFFSET
+ msg_offset
, 8, ENC_BIG_ENDIAN
);
347 proto_tree_add_item(first_value_tree
, hf_msrp_failure_code
, tvb
,
348 MSRP_FAILURE_CODE_OFFSET
+ msg_offset
, 1, ENC_BIG_ENDIAN
);
352 /* dissect_msrp_three_packed_event (called from dissect_msrp)
354 * dissect one or more ThreePackedEvents
357 dissect_msrp_three_packed_event(proto_tree
*vect_attr_tree
, tvbuff_t
*tvb
, unsigned offset
, uint16_t number_of_values
)
361 for ( counter
= 0; counter
< number_of_values
; ) {
363 uint8_t three_packed_event
[3];
365 value
= tvb_get_uint8(tvb
, offset
);
366 three_packed_event
[0] = value
/ 36;
367 value
-= 36 * three_packed_event
[0];
368 three_packed_event
[1] = value
/ 6;
369 value
-= 6 * three_packed_event
[1];
370 three_packed_event
[2] = value
;
372 proto_tree_add_uint(vect_attr_tree
, hf_msrp_three_packed_event
, tvb
, offset
, sizeof(uint8_t),
373 three_packed_event
[0]);
375 if ( counter
< number_of_values
) {
376 proto_tree_add_uint(vect_attr_tree
, hf_msrp_three_packed_event
, tvb
, offset
, sizeof(uint8_t),
377 three_packed_event
[1]);
380 if ( counter
< number_of_values
) {
381 proto_tree_add_uint(vect_attr_tree
, hf_msrp_three_packed_event
, tvb
, offset
, sizeof(uint8_t),
382 three_packed_event
[2]);
392 /* dissect_msrp_four_packed_event (called from dissect_msrp)
394 * dissect one or more FourPackedEvents
397 dissect_msrp_four_packed_event(proto_tree
*vect_attr_tree
, tvbuff_t
*tvb
, unsigned offset
, uint16_t number_of_values
)
401 for ( counter
= 0; counter
< number_of_values
; ) {
403 uint8_t four_packed_event
[4];
405 value
= tvb_get_uint8(tvb
, offset
);
406 four_packed_event
[0] = (value
& 0xc0) >> 6;
407 four_packed_event
[1] = (value
& 0x30) >> 4;
408 four_packed_event
[2] = (value
& 0x0c) >> 2;
409 four_packed_event
[3] = (value
& 0x03);
411 proto_tree_add_uint(vect_attr_tree
, hf_msrp_four_packed_event
, tvb
, offset
, sizeof(uint8_t),
412 four_packed_event
[0]);
414 if ( counter
< number_of_values
) {
415 proto_tree_add_uint(vect_attr_tree
, hf_msrp_four_packed_event
, tvb
, offset
, sizeof(uint8_t),
416 four_packed_event
[1]);
419 if ( counter
< number_of_values
) {
420 proto_tree_add_uint(vect_attr_tree
, hf_msrp_four_packed_event
, tvb
, offset
, sizeof(uint8_t),
421 four_packed_event
[2]);
424 if ( counter
< number_of_values
) {
425 proto_tree_add_uint(vect_attr_tree
, hf_msrp_four_packed_event
, tvb
, offset
, sizeof(uint8_t),
426 four_packed_event
[3]);
438 * main dissect function that calls the other functions listed above as necessary
441 dissect_msrp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
443 /* Set up structures needed to add the protocol subtrees and manage them */
444 proto_item
*ti
, *msg_ti
, *attr_list_ti
, *vect_attr_ti
, *first_value_ti
;
445 proto_tree
*msrp_tree
, *msg_tree
, *attr_list_tree
, *vect_attr_tree
, *first_value_tree
;
447 /* Make entries in Protocol column and Info column on summary display */
448 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "MRP-MSRP");
450 col_set_str(pinfo
->cinfo
, COL_INFO
, "Multiple Stream Reservation Protocol");
453 uint8_t attribute_type
;
454 uint8_t attribute_length
;
455 uint16_t number_of_values
;
456 uint16_t attribute_list_length
;
459 int msg_length
; /* Length of MSRP/MRP Message */
460 int msg_offset
; /* Use when handling multiple messages. This points to current msg being decoded. */
461 int vect_offset
; /* Use when handling multiple vector attributes. This points to the current vector attribute being decoded. */
463 ti
= proto_tree_add_item(tree
, proto_msrp
, tvb
, 0, -1, ENC_NA
);
464 msrp_tree
= proto_item_add_subtree(ti
, ett_msrp
);
466 proto_tree_add_item(msrp_tree
, hf_msrp_proto_id
, tvb
, MSRP_PROTOCOL_VERSION_OFFSET
, 1, ENC_BIG_ENDIAN
);
468 /* MSRP supports multiple MRP Messages per frame. Handle those Messages in
469 * the following while() loop. You will know you are at the end of the list
470 * of messages when the EndMark (0x0000) is encountered instead of an
471 * Attribute Type and Attribute Length (guaranteed to not be 0x0000).
474 while (tvb_get_ntohs(tvb
, MSRP_ATTRIBUTE_TYPE_OFFSET
+ msg_offset
) != MSRP_END_MARK
) {
476 attribute_type
= tvb_get_uint8(tvb
, MSRP_ATTRIBUTE_TYPE_OFFSET
+ msg_offset
);
477 attribute_length
= tvb_get_uint8(tvb
, MSRP_ATTRIBUTE_LENGTH_OFFSET
+ msg_offset
);
478 attribute_list_length
= tvb_get_ntohs(tvb
, MSRP_ATTRIBUTE_LIST_LENGTH_OFFSET
+ msg_offset
);
480 /* MSRP Message is a group of fields
482 * Contains AttributeType (1 byte)
483 * + AttributeLength (1 byte)
484 * + AttributeListLength (2 bytes)
485 * + AttributeList (AttributeListLength bytes)
488 msg_length
= 1 + 1 + 2 + attribute_list_length
;
489 msg_ti
= proto_tree_add_item(msrp_tree
, hf_msrp_message
, tvb
,
490 MSRP_MESSAGE_GROUP_OFFSET
+ msg_offset
,
492 msg_tree
= proto_item_add_subtree(msg_ti
, ett_msg
);
494 /* Append AttributeType description to the end of the "Message" heading */
495 proto_item_append_text(msg_tree
, ": %s (%d)",
496 val_to_str_const(attribute_type
, attribute_type_vals
, "<Unknown>"),
499 dissect_msrp_common1(msg_tree
, tvb
, msg_offset
);
501 /* MSRP AttributeList is a group of fields
503 * Contains AttributeListLength bytes of data
505 attr_list_ti
= proto_tree_add_item(msg_tree
, hf_msrp_attribute_list
, tvb
,
506 MSRP_ATTRIBUTE_LIST_GROUP_OFFSET
+ msg_offset
,
507 attribute_list_length
, ENC_NA
);
508 attr_list_tree
= proto_item_add_subtree(attr_list_ti
, ett_attr_list
);
511 /* MSRP supports multiple MRP Vector Attributes per Attribute List. Handle those
512 * Vector Attributes in the following while() loop. You will know you are at the
513 * end of the list of Vector Attributes when the EndMark (0x0000) is encountered
514 * instead of a Vector Header (guaranteed to not be 0x0000).
517 while (tvb_get_ntohs(tvb
, MSRP_VECTOR_HEADER_OFFSET
+ msg_offset
+ vect_offset
) != MSRP_END_MARK
) {
518 /* MSRP VectorAttribute is a group of fields
520 * Contains VectorHeader (2 bytes)
521 * + FirstValue (AttributeLength bytes)
522 * + VectorThreePacked (NumberOfValues @ 3/vector bytes)
523 * + VectorFourPacked (NumberOfValues @ 4/vector bytes only for Listener attributes)
526 number_of_values
= tvb_get_ntohs(tvb
, MSRP_NUMBER_OF_VALUES_OFFSET
+ msg_offset
+ vect_offset
)
527 & MSRP_NUMBER_OF_VALUES_MASK
;
529 vect_attr_len
= 2 + attribute_length
+ (number_of_values
+ 2)/3; /* stores 3 values per byte */
530 if (attribute_type
== MSRP_ATTRIBUTE_TYPE_LISTENER
)
531 vect_attr_len
+= (number_of_values
+ 3)/4; /* stores 4 values per byte */
533 vect_attr_ti
= proto_tree_add_item(attr_list_tree
, hf_msrp_vector_attribute
, tvb
,
534 MSRP_VECTOR_ATTRIBUTE_GROUP_OFFSET
+ msg_offset
+ vect_offset
,
535 vect_attr_len
, ENC_NA
);
537 vect_attr_tree
= proto_item_add_subtree(vect_attr_ti
, ett_vect_attr
);
539 dissect_msrp_common2(vect_attr_tree
, tvb
, msg_offset
+ vect_offset
);
541 if(attribute_type
== MSRP_ATTRIBUTE_TYPE_DOMAIN
) {
542 /* MSRP Domain FirstValue is a group of fields
544 * Contains SRclassID (1 byte)
545 * + SRclassPriority (1 byte)
546 * + SRclassVID (2 bytes)
549 first_value_ti
= proto_tree_add_item(vect_attr_tree
, hf_msrp_first_value
, tvb
,
550 MSRP_FIRST_VALUE_GROUP_OFFSET
+ msg_offset
+ vect_offset
,
551 attribute_length
, ENC_NA
);
552 first_value_tree
= proto_item_add_subtree(first_value_ti
, ett_first_value
);
554 /* Add Domain components to First Value tree */
555 proto_tree_add_item(first_value_tree
, hf_msrp_sr_class_id
, tvb
,
556 MSRP_FIRST_VALUE_GROUP_OFFSET
+ msg_offset
+ vect_offset
, 1, ENC_BIG_ENDIAN
);
557 proto_tree_add_item(first_value_tree
, hf_msrp_sr_class_priority
, tvb
,
558 MSRP_FIRST_VALUE_GROUP_OFFSET
+ msg_offset
+ vect_offset
+ 1, 1, ENC_BIG_ENDIAN
);
559 proto_tree_add_item(first_value_tree
, hf_msrp_sr_class_vid
, tvb
,
560 MSRP_FIRST_VALUE_GROUP_OFFSET
+ msg_offset
+ vect_offset
+ 2, 2, ENC_BIG_ENDIAN
);
562 /* Decode three packed events. */
563 offset
= dissect_msrp_three_packed_event(vect_attr_tree
, tvb
,
564 MSRP_DOMAIN_THREE_PACKED_OFFSET
+ msg_offset
+ vect_offset
,
569 /* MSRP Stream Reservations FirstValue is a group of fields
571 * Contains StreamID (8 bytes)
572 * + DataFrameParameters (8 bytes on Talker attributes)
573 * + TSpec (8 bytes on Talker attributes)
574 * + PriorityAndRank (1 byte on Talker attributes)
575 * + AccumulatedLatency (4 bytes on Talker attributes)
576 * + FailureInformation (9 bytes on Talker Failed attributes)
579 first_value_ti
= proto_tree_add_item(vect_attr_tree
, hf_msrp_first_value
, tvb
,
580 MSRP_FIRST_VALUE_GROUP_OFFSET
+ msg_offset
+ vect_offset
,
581 attribute_length
, ENC_NA
);
582 first_value_tree
= proto_item_add_subtree(first_value_ti
, ett_first_value
);
584 /* Decode StreamID */
585 proto_tree_add_item(first_value_tree
, hf_msrp_stream_id
, tvb
,
586 MSRP_STREAM_ID_OFFSET
+ msg_offset
+ vect_offset
, 8, ENC_BIG_ENDIAN
);
588 switch ( attribute_type
) {
589 case MSRP_ATTRIBUTE_TYPE_LISTENER
:
590 offset
= dissect_msrp_three_packed_event(vect_attr_tree
, tvb
,
591 MSRP_LISTENER_THREE_PACKED_OFFSET
+ msg_offset
+ vect_offset
,
593 offset
= dissect_msrp_four_packed_event(vect_attr_tree
, tvb
, offset
, number_of_values
);
595 case MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE
:
596 dissect_msrp_talker_common(first_value_tree
, tvb
, msg_offset
+ vect_offset
);
597 offset
= dissect_msrp_three_packed_event(vect_attr_tree
, tvb
,
598 MSRP_TALKER_ADVERTISE_THREE_PACKED_OFFSET
+ msg_offset
+ vect_offset
,
601 case MSRP_ATTRIBUTE_TYPE_TALKER_FAILED
:
602 dissect_msrp_talker_common(first_value_tree
, tvb
, msg_offset
+ vect_offset
);
603 dissect_msrp_talker_failed(first_value_tree
, tvb
, msg_offset
+ vect_offset
);
604 offset
= dissect_msrp_three_packed_event(vect_attr_tree
, tvb
,
605 MSRP_TALKER_FAILED_THREE_PACKED_OFFSET
+ msg_offset
+ vect_offset
,
609 proto_tree_add_expert(first_value_tree
, pinfo
, &ei_msrp_attribute_type
, tvb
, msg_offset
+ vect_offset
, vect_attr_len
);
613 vect_offset
+= vect_attr_len
; /* Move to next Vector Attribute, if there is one */
614 } /* Multiple VectorAttribute while() */
616 proto_tree_add_item(attr_list_tree
, hf_msrp_end_mark
, tvb
, offset
, 2, ENC_BIG_ENDIAN
); /* VectorAttribute EndMark */
618 msg_offset
+= msg_length
; /* Move to next Message, if there is one */
619 } /* Multiple Message while() */
620 proto_tree_add_item(msrp_tree
, hf_msrp_end_mark
, tvb
, offset
+2, 2, ENC_BIG_ENDIAN
); /* Message EndMark */
622 return tvb_captured_length(tvb
);
626 /* Register the protocol with Wireshark */
628 proto_register_mrp_msrp(void)
630 static hf_register_info hf
[] = {
632 { "Protocol Version", "mrp-msrp.protocol_version",
633 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
635 { &hf_msrp_message
, /* Message is a group of fields */
636 { "Message", "mrp-msrp.message",
637 FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
639 { &hf_msrp_attribute_type
,
640 { "Attribute Type", "mrp-msrp.attribute_type",
641 FT_UINT8
, BASE_DEC
, VALS(attribute_type_vals
), 0x0, NULL
, HFILL
}
643 { &hf_msrp_attribute_length
,
644 { "Attribute Length", "mrp-msrp.attribute_length",
645 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
647 { &hf_msrp_attribute_list_length
,
648 { "Attribute List Length", "mrp-msrp.attribute_list_length",
649 FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
651 { &hf_msrp_attribute_list
, /* AttributeList is a group of fields */
652 { "Attribute List", "mrp-msrp.attribute_list",
653 FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
655 { &hf_msrp_vector_attribute
, /* VectorAttribute is a group of fields */
656 { "Vector Attribute", "mrp-msrp.vector_attribute",
657 FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
659 { &hf_msrp_vector_header
,
660 { "Vector Header", "mrp-msrp.vector_header",
661 FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
663 { &hf_msrp_leave_all_event
,
664 { "Leave All Event", "mrp-msrp.leave_all_event",
665 FT_UINT16
, BASE_DEC
, VALS(leave_all_vals
), MSRP_LEAVE_ALL_EVENT_MASK
, NULL
, HFILL
}
667 { &hf_msrp_number_of_values
,
668 { "Number of Values", "mrp-msrp.number_of_values",
669 FT_UINT16
, BASE_DEC
, NULL
, MSRP_NUMBER_OF_VALUES_MASK
, NULL
, HFILL
}
671 { &hf_msrp_first_value
, /* FirstValue is a group of fields */
672 { "First Value", "mrp-msrp.first_value",
673 FT_NONE
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
675 { &hf_msrp_stream_id
,
676 { "Stream ID", "mrp-msrp.stream_id",
677 FT_UINT64
, BASE_HEX
, NULL
, 0x00, NULL
, HFILL
}
679 { &hf_msrp_stream_da
,
680 { "Stream DA", "mrp-msrp.stream_da",
681 FT_ETHER
, BASE_NONE
, NULL
, 0x00, NULL
, HFILL
}
684 { "VLAN ID", "mrp-msrp.vlan_id",
685 FT_UINT16
, BASE_HEX
, NULL
, 0x00, NULL
, HFILL
}
687 { &hf_msrp_tspec_max_frame_size
,
688 { "TSpec Max Frame Size", "mrp-msrp.tspec_max_frame_size",
689 FT_UINT16
, BASE_DEC
, NULL
, 0x00, NULL
, HFILL
}
691 { &hf_msrp_tspec_max_interval_frames
,
692 { "TSpec Max Frame Interval", "mrp-msrp.tspec_max_interval_frames",
693 FT_UINT16
, BASE_DEC
, NULL
, 0x00, NULL
, HFILL
}
695 { &hf_msrp_priority_and_rank
,
696 { "Priority and Rank", "mrp-msrp.priority_and_rank",
697 FT_UINT8
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
700 { "Priority", "mrp-msrp.priority",
701 FT_UINT8
, BASE_DEC
, VALS(priority_vals
), MSRP_PRIORITY_MASK
, NULL
, HFILL
}
704 { "Rank", "mrp-msrp.rank",
705 FT_UINT8
, BASE_DEC
, VALS(rank_vals
), MSRP_RANK_MASK
, NULL
, HFILL
}
708 { "Reserved", "mrp-msrp.reserved",
709 FT_UINT8
, BASE_DEC
, VALS(reserved_vals
), MSRP_RESERVED_MASK
, NULL
, HFILL
}
711 { &hf_msrp_accumulated_latency
,
712 { "Accumulated Latency", "mrp-msrp.accumulated_latency",
713 FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
715 { &hf_msrp_failure_bridge_id
,
716 { "Failure Bridge ID", "mrp-msrp.failure_bridge_id",
717 FT_UINT64
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
719 { &hf_msrp_failure_code
,
720 { "Failure Code", "mrp-msrp.failure_code",
721 FT_UINT8
, BASE_DEC
, VALS(failure_vals
), 0x0, NULL
, HFILL
}
723 { &hf_msrp_sr_class_id
,
724 { "SR Class ID", "mrp-msrp.sr_class_id",
725 FT_UINT8
, BASE_DEC
, VALS(sr_class_vals
), 0x0, NULL
, HFILL
}
727 { &hf_msrp_sr_class_priority
,
728 { "SR Class Priority", "mrp-msrp.sr_class_priority",
729 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
731 { &hf_msrp_sr_class_vid
,
732 { "SR Class VID", "mrp-msrp.sr_class_vid",
733 FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
735 { &hf_msrp_three_packed_event
,
736 { "Attribute Event", "mrp-msrp.three_packed_event",
737 FT_UINT8
, BASE_DEC
, VALS(three_packed_vals
), 0x0, NULL
, HFILL
}
739 { &hf_msrp_four_packed_event
,
740 { "Declaration Type", "mrp-msrp.four_packed_event",
741 FT_UINT8
, BASE_DEC
, VALS(four_packed_vals
), 0x0, NULL
, HFILL
}
744 { "End Mark", "mrp-msrp.end_mark",
745 FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
749 /* Setup protocol subtree array */
750 static int *ett
[] = {
757 &ett_priority_and_rank
760 static ei_register_info ei
[] = {
761 { &ei_msrp_attribute_type
, { "mrp-msrp.attribute_type.unknown", PI_PROTOCOL
, PI_WARN
, "Malformed TCP/IP Status", EXPFILL
}},
764 expert_module_t
* expert_msrp
;
766 /* Register the protocol name and description */
767 proto_msrp
= proto_register_protocol("Multiple Stream Reservation Protocol",
768 "MRP-MSRP", "mrp-msrp");
770 /* Required function calls to register the header fields and subtrees used */
771 proto_register_field_array(proto_msrp
, hf
, array_length(hf
));
772 proto_register_subtree_array(ett
, array_length(ett
));
773 expert_msrp
= expert_register_protocol(proto_msrp
);
774 expert_register_field_array(expert_msrp
, ei
, array_length(ei
));
776 /* Register the dissector */
777 msrp_handle
= register_dissector("mrp-msrp", dissect_msrp
, proto_msrp
);
781 proto_reg_handoff_mrp_msrp(void)
783 dissector_add_uint("ethertype", ETHERTYPE_MSRP
, msrp_handle
);
787 * Editor modelines - https://www.wireshark.org/tools/modelines.html
792 * indent-tabs-mode: nil
795 * vi: set shiftwidth=4 tabstop=8 expandtab:
796 * :indentSize=4:tabSize=8:noTabs=true: