2 * Routines for Binary Floor Control Protocol(BFCP) dissection
3 * Copyright 2012, Nitinkumar Yemul <nitinkumaryemul@gmail.com>
5 * Updated with attribute dissection
6 * Copyright 2012, Anders Broman <anders.broman@ericsson.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
14 * BFCP Message structure is defined in RFC 8855
18 #include <epan/packet.h>
19 #include <epan/prefs.h>
20 #include <epan/expert.h>
21 #include <epan/conversation.h>
22 #include <epan/proto_data.h>
25 #include "packet-bfcp.h"
27 void proto_register_bfcp(void);
28 void proto_reg_handoff_bfcp(void);
30 /* Initialize protocol and registered fields */
31 static int proto_bfcp
;
33 static int hf_bfcp_version
;
34 static int hf_bfcp_hdr_r_bit
;
35 static int hf_bfcp_hdr_f_bit
;
36 static int hf_bfcp_primitive
;
37 static int hf_bfcp_payload_length
;
38 static int hf_bfcp_conference_id
;
39 static int hf_bfcp_transaction_id
;
40 static int hf_bfcp_user_id
;
41 static int hf_bfcp_fragment_offset
;
42 static int hf_bfcp_fragment_length
;
43 static int hf_bfcp_payload
;
44 static int hf_bfcp_attribute_types
;
45 static int hf_bfcp_attribute_types_m_bit
;
46 static int hf_bfcp_attribute_length
;
47 static int hf_bfcp_beneficiary_id
;
48 static int hf_bfcp_floor_id
;
49 static int hf_bfcp_floor_request_id
;
50 static int hf_bfcp_priority
;
51 static int hf_bfcp_request_status
;
52 static int hf_bfcp_queue_pos
;
53 static int hf_bfcp_error_code
;
54 static int hf_bfcp_error_info_text
;
55 static int hf_bfcp_part_prov_info_text
;
56 static int hf_bfcp_status_info_text
;
57 static int hf_bfcp_supp_attr
;
58 static int hf_bfcp_supp_prim
;
59 static int hf_bfcp_user_disp_name
;
60 static int hf_bfcp_user_uri
;
61 static int hf_bfcp_req_by_id
;
62 static int hf_bfcp_padding
;
63 static int hf_bfcp_error_specific_details
;
64 /* BFCP setup fields */
65 static int hf_bfcp_setup
;
66 static int hf_bfcp_setup_frame
;
67 static int hf_bfcp_setup_method
;
69 /* Initialize subtree pointers */
71 static int ett_bfcp_setup
;
72 static int ett_bfcp_attr
;
74 static expert_field ei_bfcp_attribute_length_too_small
;
76 static dissector_handle_t bfcp_handle
;
78 #define BFCP_HDR_LEN 12
80 /* Initialize BFCP primitives */
81 static const value_string map_bfcp_primitive
[] = {
82 { 0, "<Invalid Primitive>"},
85 { 3, "FloorRequestQuery"},
86 { 4, "FloorRequestStatus"},
92 { 10, "ChairActionAck"},
96 { 14, "FloorRequestStatusAck"},
97 { 15, "FloorStatusAck"},
103 static const value_string map_bfcp_attribute_types
[] = {
104 { 0, "<Invalid Primitive>"},
105 { 1, "BeneficiaryID"},
107 { 3, "FloorRequestID"},
109 { 5, "RequestStatus"},
112 { 8, "ParticipantProvidedInfo"},
114 { 10, "SupportedAttributes"},
115 { 11, "SupportedPrimitives"},
116 { 12, "UserDisplayName"},
118 { 14, "BeneficiaryInformation"},
119 { 15, "FloorRequestInformation"},
120 { 16, "RequestedByInformation"},
121 { 17, "FloorRequestStatus"},
122 { 18, "OverallRequestStatus"},
126 static const value_string map_bfcp_request_status
[] = {
127 { 0, "<Invalid Primitive>"},
138 /* 5.2.6. ERROR-CODE */
139 static const value_string bfcp_error_code_valuse
[] = {
140 { 1, "Conference does not Exist"},
141 { 2, "User does not Exist"},
142 { 3, "Unknown Primitive"},
143 { 4, "Unknown Mandatory Attribute"},
144 { 5, "Unauthorized Operation"},
145 { 6, "Invalid Floor ID"},
146 { 7, "Floor Request ID Does Not Exist"},
147 { 8, "You have Already Reached the Maximum Number of Ongoing Floor Requests for this Floor"},
149 { 10, "Unable to Parse Message"},
151 { 12, "Unsupported Version"},
152 { 13, "Incorrect Message Length"},
153 { 14, "Generic Error"},
158 /*Define offset for fields in BFCP packet */
159 #define BFCP_OFFSET_TRANSACTION_INITIATOR 0
160 #define BFCP_OFFSET_PRIMITIVE 1
161 #define BFCP_OFFSET_PAYLOAD_LENGTH 2
162 #define BFCP_OFFSET_CONFERENCE_ID 4
163 #define BFCP_OFFSET_TRANSACTION_ID 8
164 #define BFCP_OFFSET_USER_ID 10
165 #define BFCP_OFFSET_PAYLOAD 12
167 /* Set up an BFCP conversation using the info given */
169 bfcp_add_address( packet_info
*pinfo
, port_type ptype
,
170 address
*addr
, int port
,
171 const char *setup_method
, uint32_t setup_frame_number
)
174 conversation_t
* p_conv
;
175 struct _bfcp_conversation_info
*p_conv_data
= NULL
;
178 * If this isn't the first time this packet has been processed,
179 * we've already done this work, so we don't need to do it
182 if (PINFO_FD_VISITED(pinfo
)) {
186 clear_address(&null_addr
);
189 * Check if the ip address and port combination is not
190 * already registered as a conversation.
192 p_conv
= find_conversation( pinfo
->num
, addr
, &null_addr
, conversation_pt_to_conversation_type(ptype
), port
, 0,
193 NO_ADDR_B
| NO_PORT_B
);
196 * If not, create a new conversation.
199 p_conv
= conversation_new( pinfo
->num
, addr
, &null_addr
, conversation_pt_to_conversation_type(ptype
),
201 NO_ADDR2
| NO_PORT2
);
205 conversation_set_dissector(p_conv
, bfcp_handle
);
208 * Check if the conversation has data associated with it.
210 p_conv_data
= (struct _bfcp_conversation_info
*)conversation_get_proto_data(p_conv
, proto_bfcp
);
213 * If not, add a new data item.
216 /* Create conversation data */
217 p_conv_data
= wmem_new0(wmem_file_scope(), struct _bfcp_conversation_info
);
218 conversation_add_proto_data(p_conv
, proto_bfcp
, p_conv_data
);
222 * Update the conversation data.
224 p_conv_data
->setup_method_set
= true;
225 (void) g_strlcpy(p_conv_data
->setup_method
, setup_method
, MAX_BFCP_SETUP_METHOD_SIZE
);
226 p_conv_data
->setup_frame_number
= setup_frame_number
;
229 /* Look for conversation info and display any setup info found */
231 show_setup_info(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
233 /* Conversation and current data */
234 conversation_t
*p_conv
= NULL
;
235 struct _bfcp_conversation_info
*p_conv_data
= NULL
;
237 /* Use existing packet data if available */
238 p_conv_data
= (struct _bfcp_conversation_info
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_bfcp
, 0);
241 /* First time, get info from conversation */
242 p_conv
= find_conversation(pinfo
->num
, &pinfo
->net_dst
, &pinfo
->net_src
,
243 conversation_pt_to_conversation_type(pinfo
->ptype
),
244 pinfo
->destport
, pinfo
->srcport
, 0);
247 /* Look for data in conversation */
248 struct _bfcp_conversation_info
*p_conv_packet_data
;
249 p_conv_data
= (struct _bfcp_conversation_info
*)conversation_get_proto_data(p_conv
, proto_bfcp
);
252 /* Save this conversation info into packet info */
253 p_conv_packet_data
= (struct _bfcp_conversation_info
*)wmem_memdup(wmem_file_scope(),
254 p_conv_data
, sizeof(struct _bfcp_conversation_info
));
256 p_add_proto_data(wmem_file_scope(), pinfo
, proto_bfcp
, 0, p_conv_packet_data
);
261 /* Create setup info subtree with summary info. */
262 if (p_conv_data
&& p_conv_data
->setup_method_set
) {
263 proto_tree
*bfcp_setup_tree
;
264 proto_item
*ti
= proto_tree_add_string_format(tree
, hf_bfcp_setup
, tvb
, 0, 0,
266 "Stream setup by %s (frame %u)",
267 p_conv_data
->setup_method
,
268 p_conv_data
->setup_frame_number
);
269 proto_item_set_generated(ti
);
270 bfcp_setup_tree
= proto_item_add_subtree(ti
, ett_bfcp_setup
);
271 if (bfcp_setup_tree
) {
272 /* Add details into subtree */
273 proto_item
* item
= proto_tree_add_uint(bfcp_setup_tree
, hf_bfcp_setup_frame
,
274 tvb
, 0, 0, p_conv_data
->setup_frame_number
);
275 proto_item_set_generated(item
);
276 item
= proto_tree_add_string(bfcp_setup_tree
, hf_bfcp_setup_method
,
277 tvb
, 0, 0, p_conv_data
->setup_method
);
278 proto_item_set_generated(item
);
284 // NOLINTNEXTLINE(misc-no-recursion)
285 dissect_bfcp_attributes(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, int bfcp_payload_length
)
287 proto_item
*ti
, *item
;
288 proto_tree
*bfcp_attr_tree
= NULL
;
289 int attr_start_offset
;
291 uint8_t attribute_type
;
293 uint8_t first_byte
, pad_len
;
295 increment_dissection_depth(pinfo
);
296 while ((tvb_reported_length_remaining(tvb
, offset
) >= 2) &&
297 ((bfcp_payload_length
- read_attr
) >= 2))
300 attr_start_offset
= offset
;
301 first_byte
= tvb_get_uint8(tvb
, offset
);
303 /* Padding so continue to next attribute */
304 if (first_byte
== 0){
309 ti
= proto_tree_add_item(tree
, hf_bfcp_attribute_types
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
310 bfcp_attr_tree
= proto_item_add_subtree(ti
, ett_bfcp_attr
);
311 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_attribute_types_m_bit
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
313 attribute_type
= (first_byte
& 0xFE) >> 1;
316 /* Length: This 8-bit field contains the length of the attribute in
317 * octets, excluding any padding defined for specific attributes. The
318 * length of attributes that are not grouped includes the Type, 'M' bit,
319 * and Length fields. The Length in grouped attributes is the length of
320 * the grouped attribute itself (including Type, 'M' bit, and Length
321 * fields) plus the total length (including padding) of all the included
325 item
= proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_attribute_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
326 length
= tvb_get_uint8(tvb
, offset
);
327 /* At least Type, M bit and Length fields */
329 expert_add_info_format(pinfo
, item
, &ei_bfcp_attribute_length_too_small
,
330 "Attribute length is too small (%d bytes - minimum valid is 2)", length
);
335 switch(attribute_type
){
336 case 1: /* Beneficiary ID */
337 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_beneficiary_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
340 case 2: /* FLOOR-ID */
341 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
344 case 3: /* FLOOR-REQUEST-ID */
345 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_request_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
348 case 4: /* PRIORITY */
349 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_priority
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
352 case 5: /* REQUEST-STATUS */
353 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_request_status
, tvb
, offset
,1, ENC_BIG_ENDIAN
);
356 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_queue_pos
, tvb
, offset
,1, ENC_BIG_ENDIAN
);
359 case 6: /* ERROR-CODE */
360 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_error_code
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
363 /* We have Error Specific Details */
364 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_error_specific_details
, tvb
, offset
, length
-3, ENC_NA
);
366 offset
= offset
+ length
-3;
367 pad_len
= length
& 0x03;
369 pad_len
= 4 - pad_len
;
370 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
372 offset
= offset
+ pad_len
;
374 case 7: /* ERROR-INFO */
375 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_error_info_text
, tvb
, offset
, length
-2, ENC_ASCII
);
376 offset
= offset
+ length
-2;
377 pad_len
= length
& 0x03;
379 pad_len
= 4 - pad_len
;
380 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
382 offset
= offset
+ pad_len
;
384 case 8: /* PARTICIPANT-PROVIDED-INFO */
385 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_part_prov_info_text
, tvb
, offset
, length
-2, ENC_ASCII
);
386 offset
= offset
+ length
-2;
387 pad_len
= length
& 0x03;
389 pad_len
= 4 - pad_len
;
390 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
392 offset
= offset
+ pad_len
;
394 case 9: /* STATUS-INFO */
395 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_status_info_text
, tvb
, offset
, length
-2, ENC_ASCII
);
396 offset
= offset
+ length
-2;
397 pad_len
= length
& 0x03;
399 pad_len
= 4 - pad_len
;
400 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
402 offset
= offset
+ pad_len
;
404 case 10: /* SUPPORTED-ATTRIBUTES */
406 while(offset
< (attr_start_offset
+length
)){
407 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_supp_attr
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
410 pad_len
= length
& 0x03;
412 pad_len
= 4 - pad_len
;
413 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
415 offset
= offset
+ pad_len
;
417 case 11: /* SUPPORTED-PRIMITIVES */
419 while(offset
< (attr_start_offset
+length
)){
420 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_supp_prim
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
423 pad_len
= length
& 0x03;
425 pad_len
= 4 - pad_len
;
426 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
428 offset
= offset
+ pad_len
;
430 case 12: /* USER-DISPLAY-NAME */
431 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_user_disp_name
, tvb
, offset
, length
-2, ENC_ASCII
);
432 offset
= offset
+ length
-2;
433 pad_len
= length
& 0x03;
435 pad_len
= 4 - pad_len
;
436 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
438 offset
= offset
+ pad_len
;
440 case 13: /* USER-URI */
441 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_user_uri
, tvb
, offset
, length
-2, ENC_ASCII
);
442 offset
= offset
+ length
-2;
443 pad_len
= length
& 0x03;
445 pad_len
= 4 - pad_len
;
446 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
448 offset
= offset
+ pad_len
;
450 case 14: /* BENEFICIARY-INFORMATION */
451 /* The BENEFICIARY-INFORMATION attribute is a grouped attribute that
452 * consists of a header, which is referred to as BENEFICIARY-
453 * INFORMATION-HEADER, followed by a sequence of attributes.
455 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_beneficiary_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
457 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
459 case 15: /* FLOOR-REQUEST-INFORMATION */
460 /* The FLOOR-REQUEST-INFORMATION attribute is a grouped attribute that
461 * consists of a header, which is referred to as FLOOR-REQUEST-
462 * INFORMATION-HEADER, followed by a sequence of attributes.
464 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_request_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
466 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
468 case 16: /* REQUESTED-BY-INFORMATION */
469 /* The REQUESTED-BY-INFORMATION attribute is a grouped attribute that
470 * consists of a header, which is referred to as FLOOR-REQUEST-STATUS-
471 * -HEADER, followed by a sequence of attributes.
473 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_req_by_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
475 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
477 case 17: /* FLOOR-REQUEST-STATUS */
478 /* The FLOOR-REQUEST-STATUS attribute is a grouped attribute that
479 * consists of a header, which is referred to as OVERALL-REQUEST-STATUS-
480 * -HEADER, followed by a sequence of attributes.
482 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
484 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
486 case 18: /* OVERALL-REQUEST-STATUS */
487 /* The OVERALL-REQUEST-STATUS attribute is a grouped attribute that
488 * consists of a header, which is referred to as FLOOR-REQUEST-
489 * INFORMATION-HEADER, followed by a sequence of attributes.
491 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_request_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
493 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
497 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_payload
, tvb
, offset
, length
-2, ENC_NA
);
498 /* Advance by any length attributable to payload */
499 offset
= offset
+ length
- 2;
502 read_attr
= read_attr
+ length
;
504 decrement_dissection_depth(pinfo
);
511 dissect_bfcp_heur_check(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
)
518 /* Size of smallest BFCP packet: 12 octets */
519 if (tvb_captured_length(tvb
) < BFCP_HDR_LEN
)
522 /* Check version and reserved bits in first byte */
523 first_byte
= tvb_get_uint8(tvb
, 0);
525 /* If first_byte of bfcp_packet is a combination of the
526 * version, the R-bit and the F-bit. The value must be:
527 * 0x20 || 0x30 || 0x40 || 0x48 || 0x50 || 0x58
528 * if the bit is set, otherwise it is not BFCP.
530 if ((first_byte
!= 0x20) && (first_byte
!= 0x30) && (first_byte
!= 0x40) && (first_byte
!= 0x48) && (first_byte
!= 0x50) && (first_byte
!= 0x58))
533 primitive
= tvb_get_uint8(tvb
, 1);
535 if ((primitive
< 1) || (primitive
> 18))
538 str
= try_val_to_str(primitive
, map_bfcp_primitive
);
545 /* Code to actually dissect BFCP packets */
547 dissect_bfcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
552 int bfcp_payload_length
;
554 proto_tree
*bfcp_tree
;
557 if (!dissect_bfcp_heur_check(tvb
, pinfo
, tree
, data
))
560 primitive
= tvb_get_uint8(tvb
, 1);
561 str
= try_val_to_str(primitive
, map_bfcp_primitive
);
563 /* Make entries in Protocol column and Info column on summary display*/
564 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "BFCP");
565 col_add_str(pinfo
->cinfo
, COL_INFO
, str
);
567 ti
= proto_tree_add_item(tree
, proto_bfcp
, tvb
, 0, -1, ENC_NA
);
568 bfcp_tree
= proto_item_add_subtree(ti
, ett_bfcp
);
569 show_setup_info(tvb
, pinfo
, bfcp_tree
);
571 The following is the format of the common header.
574 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
575 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
576 | Ver |R|F| Res | Primitive | Payload Length |
577 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
579 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
580 | Transaction ID | User ID |
581 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
582 | Fragment Offset (if F is set) | Fragment Length (if F is set) |
583 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
587 /* Add items to BFCP tree */
588 proto_tree_add_item(bfcp_tree
, hf_bfcp_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
589 proto_tree_add_item(bfcp_tree
, hf_bfcp_hdr_r_bit
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
590 proto_tree_add_item_ret_boolean(bfcp_tree
, hf_bfcp_hdr_f_bit
, tvb
, offset
, 1, ENC_BIG_ENDIAN
, &f_bit
);
591 /* Ver should be 1 over a reliable transport (TCP) and 2 over an
592 * unreliable transport (UDP). R and F should only be set on an
593 * unreliable transport. They should be ignored on a reliable
596 * XXX: If it's version 1 and an unreliable transport, it may be
597 * a draft implementation.
598 * ( https://www.ietf.org/archive/id/draft-sandbakken-dispatch-bfcp-udp-03.html )
601 proto_tree_add_item(bfcp_tree
, hf_bfcp_primitive
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
603 proto_tree_add_item(bfcp_tree
, hf_bfcp_payload_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
605 proto_tree_add_item(bfcp_tree
, hf_bfcp_conference_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
607 proto_tree_add_item(bfcp_tree
, hf_bfcp_transaction_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
609 proto_tree_add_item(bfcp_tree
, hf_bfcp_user_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
612 proto_tree_add_item(bfcp_tree
, hf_bfcp_fragment_offset
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
614 proto_tree_add_item(bfcp_tree
, hf_bfcp_fragment_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
618 bfcp_payload_length
= tvb_get_ntohs(tvb
,
619 BFCP_OFFSET_PAYLOAD_LENGTH
) * 4;
621 /*offset = */dissect_bfcp_attributes(tvb
, pinfo
, bfcp_tree
, offset
, bfcp_payload_length
);
623 return tvb_captured_length(tvb
);
627 dissect_bfcp_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
629 if (!dissect_bfcp_heur_check(tvb
, pinfo
, tree
, data
))
632 dissect_bfcp(tvb
, pinfo
, tree
, data
);
636 void proto_register_bfcp(void)
638 module_t
*bfcp_module
;
639 expert_module_t
* expert_bfcp
;
641 static hf_register_info hf
[] = {
644 { "Version(ver)", "bfcp.ver",
645 FT_UINT8
, BASE_DEC
, NULL
, 0xe0,
650 { "Transaction Responder (R)", "bfcp.hdr_r_bit",
651 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x10,
656 { "Fragmentation (F)", "bfcp.hdr_f_bit",
657 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x08,
662 { "Primitive", "bfcp.primitive",
663 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_primitive
), 0x0,
667 &hf_bfcp_payload_length
,
668 { "Payload Length", "bfcp.payload_length",
669 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
670 "Length in 4-octet units, excluding the COMMON-HEADER", HFILL
}
673 &hf_bfcp_conference_id
,
674 { "Conference ID", "bfcp.conference_id",
675 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
679 &hf_bfcp_transaction_id
,
680 { "Transaction ID", "bfcp.transaction_id",
681 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
686 { "User ID", "bfcp.user_id",
687 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
691 &hf_bfcp_fragment_offset
,
692 { "Fragment Offset", "bfcp.fragment_offset",
693 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
694 "Number of 4-octet units contained in previous fragments, excluding the COMMON-HEADER", HFILL
}
697 &hf_bfcp_fragment_length
,
698 { "Fragment Length", "bfcp.fragment_length",
699 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
700 "Number of 4-octet units contained in this fragment, excluding the COMMON-HEADER", HFILL
}
704 { "Payload", "bfcp.payload",
705 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
,
709 &hf_bfcp_attribute_types
,
710 { "Attribute Type", "bfcp.attribute_type",
711 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_attribute_types
), 0xFE,
715 &hf_bfcp_attribute_types_m_bit
,
716 { "Mandatory bit(M)", "bfcp.attribute_types_m_bit",
717 FT_BOOLEAN
, 8, NULL
, 0x01,
721 &hf_bfcp_attribute_length
,
722 { "Attribute Length", "bfcp.attribute_length",
723 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
727 &hf_bfcp_beneficiary_id
,
728 { "BENEFICIARY-ID", "bfcp.beneficiary_id",
729 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
734 { "FLOOR-ID", "bfcp.floor_id",
735 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
739 &hf_bfcp_floor_request_id
,
740 { "FLOOR-REQUEST-ID", "bfcp.floorrequest_id",
741 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
746 { "FLOOR-REQUEST-ID", "bfcp.priority",
747 FT_UINT16
, BASE_DEC
, NULL
, 0xe000,
751 &hf_bfcp_request_status
,
752 { "Request Status", "bfcp.request_status",
753 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_request_status
), 0x0,
758 { "Queue Position", "bfcp.queue_pos",
759 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
764 { "Error Code", "bfcp.error_code",
765 FT_UINT8
, BASE_DEC
, VALS(bfcp_error_code_valuse
), 0x0,
769 &hf_bfcp_error_info_text
,
770 { "Text", "bfcp.error_info_text",
771 FT_STRING
, BASE_NONE
, NULL
, 0x0,
775 &hf_bfcp_part_prov_info_text
,
776 { "Text", "bfcp.part_prov_info_text",
777 FT_STRING
, BASE_NONE
, NULL
, 0x0,
781 &hf_bfcp_status_info_text
,
782 { "Text", "bfcp.status_info_text",
783 FT_STRING
, BASE_NONE
, NULL
, 0x0,
788 { "Supported Attribute", "bfcp.supp_attr",
789 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_attribute_types
), 0xFE,
794 { "Supported Primitive", "bfcp.supp_primitive",
795 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_primitive
), 0x0,
799 &hf_bfcp_user_disp_name
,
800 { "Name", "bfcp.user_disp_name",
801 FT_STRING
, BASE_NONE
, NULL
, 0x0,
806 { "URI", "bfcp.user_uri",
807 FT_STRING
, BASE_NONE
, NULL
, 0x0,
812 { "Requested-by ID", "bfcp.req_by_i",
813 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
818 { "Padding", "bfcp.padding",
819 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
823 &hf_bfcp_error_specific_details
,
824 { "Error Specific Details", "bfcp.error_specific_details",
825 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
829 { "Stream setup", "bfcp.setup",
830 FT_STRING
, BASE_NONE
, NULL
, 0x0,
831 "Stream setup, method and frame number", HFILL
}
833 { &hf_bfcp_setup_frame
,
834 { "Setup frame", "bfcp.setup-frame",
835 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
836 "Frame that set up this stream", HFILL
}
838 { &hf_bfcp_setup_method
,
839 { "Setup Method", "bfcp.setup-method",
840 FT_STRING
, BASE_NONE
, NULL
, 0x0,
841 "Method used to set up this stream", HFILL
}
845 static int *ett
[] = {
851 static ei_register_info ei
[] = {
852 { &ei_bfcp_attribute_length_too_small
, { "bfcp.attribute_length.too_small", PI_MALFORMED
, PI_ERROR
, "Attribute length is too small", EXPFILL
}},
855 /* Register protocol name and description */
856 proto_bfcp
= proto_register_protocol("Binary Floor Control Protocol", "BFCP", "bfcp");
858 bfcp_handle
= register_dissector("bfcp", dissect_bfcp
, proto_bfcp
);
860 bfcp_module
= prefs_register_protocol(proto_bfcp
, NULL
);
862 prefs_register_obsolete_preference(bfcp_module
, "enable");
864 /* Register field and subtree array */
865 proto_register_field_array(proto_bfcp
, hf
, array_length(hf
));
866 proto_register_subtree_array(ett
, array_length(ett
));
868 expert_bfcp
= expert_register_protocol(proto_bfcp
);
869 expert_register_field_array(expert_bfcp
, ei
, array_length(ei
));
872 void proto_reg_handoff_bfcp(void)
874 /* "Decode As" is always available;
875 * Heuristic dissection in disabled by default since
876 * the heuristic is quite weak.
878 heur_dissector_add("tcp", dissect_bfcp_heur
, "BFCP over TCP", "bfcp_tcp", proto_bfcp
, HEURISTIC_DISABLE
);
879 heur_dissector_add("udp", dissect_bfcp_heur
, "BFCP over UDP", "bfcp_udp", proto_bfcp
, HEURISTIC_DISABLE
);
880 dissector_add_for_decode_as_with_preference("tcp.port", bfcp_handle
);
881 dissector_add_for_decode_as_with_preference("udp.port", bfcp_handle
);
885 * Editor modelines - https://www.wireshark.org/tools/modelines.html
890 * indent-tabs-mode: t
893 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
894 * :indentSize=8:tabSize=8:noTabs=false: