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"},
98 { 16, "FloorStatusAck"},
104 static const value_string map_bfcp_attribute_types
[] = {
105 { 0, "<Invalid Primitive>"},
106 { 1, "BeneficiaryID"},
108 { 3, "FloorRequestID"},
110 { 5, "RequestStatus"},
113 { 8, "ParticipantProvidedInfo"},
115 { 10, "SupportedAttributes"},
116 { 11, "SupportedPrimitives"},
117 { 12, "UserDisplayName"},
119 { 14, "BeneficiaryInformation"},
120 { 15, "FloorRequestInformation"},
121 { 16, "RequestedByInformation"},
122 { 17, "FloorRequestStatus"},
123 { 18, "OverallRequestStatus"},
127 static const value_string map_bfcp_request_status
[] = {
128 { 0, "<Invalid Primitive>"},
139 /* 5.2.6. ERROR-CODE */
140 static const value_string bfcp_error_code_valuse
[] = {
141 { 1, "Conference does not Exist"},
142 { 2, "User does not Exist"},
143 { 3, "Unknown Primitive"},
144 { 4, "Unknown Mandatory Attribute"},
145 { 5, "Unauthorized Operation"},
146 { 6, "Invalid Floor ID"},
147 { 7, "Floor Request ID Does Not Exist"},
148 { 8, "You have Already Reached the Maximum Number of Ongoing Floor Requests for this Floor"},
150 { 10, "Unable to Parse Message"},
152 { 12, "Unsupported Version"},
153 { 13, "Incorrect Message Length"},
154 { 14, "Generic Error"},
159 /*Define offset for fields in BFCP packet */
160 #define BFCP_OFFSET_TRANSACTION_INITIATOR 0
161 #define BFCP_OFFSET_PRIMITIVE 1
162 #define BFCP_OFFSET_PAYLOAD_LENGTH 2
163 #define BFCP_OFFSET_CONFERENCE_ID 4
164 #define BFCP_OFFSET_TRANSACTION_ID 8
165 #define BFCP_OFFSET_USER_ID 10
166 #define BFCP_OFFSET_PAYLOAD 12
168 /* Set up an BFCP conversation using the info given */
170 bfcp_add_address( packet_info
*pinfo
, port_type ptype
,
171 address
*addr
, int port
,
172 const char *setup_method
, uint32_t setup_frame_number
)
175 conversation_t
* p_conv
;
176 struct _bfcp_conversation_info
*p_conv_data
= NULL
;
179 * If this isn't the first time this packet has been processed,
180 * we've already done this work, so we don't need to do it
183 if (PINFO_FD_VISITED(pinfo
)) {
187 clear_address(&null_addr
);
190 * Check if the ip address and port combination is not
191 * already registered as a conversation.
193 p_conv
= find_conversation( pinfo
->num
, addr
, &null_addr
, conversation_pt_to_conversation_type(ptype
), port
, 0,
194 NO_ADDR_B
| NO_PORT_B
);
197 * If not, create a new conversation.
200 p_conv
= conversation_new( pinfo
->num
, addr
, &null_addr
, conversation_pt_to_conversation_type(ptype
),
202 NO_ADDR2
| NO_PORT2
);
206 conversation_set_dissector(p_conv
, bfcp_handle
);
209 * Check if the conversation has data associated with it.
211 p_conv_data
= (struct _bfcp_conversation_info
*)conversation_get_proto_data(p_conv
, proto_bfcp
);
214 * If not, add a new data item.
217 /* Create conversation data */
218 p_conv_data
= wmem_new0(wmem_file_scope(), struct _bfcp_conversation_info
);
219 conversation_add_proto_data(p_conv
, proto_bfcp
, p_conv_data
);
223 * Update the conversation data.
225 p_conv_data
->setup_method_set
= true;
226 (void) g_strlcpy(p_conv_data
->setup_method
, setup_method
, MAX_BFCP_SETUP_METHOD_SIZE
);
227 p_conv_data
->setup_frame_number
= setup_frame_number
;
230 /* Look for conversation info and display any setup info found */
232 show_setup_info(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
234 /* Conversation and current data */
235 conversation_t
*p_conv
= NULL
;
236 struct _bfcp_conversation_info
*p_conv_data
= NULL
;
238 /* Use existing packet data if available */
239 p_conv_data
= (struct _bfcp_conversation_info
*)p_get_proto_data(wmem_file_scope(), pinfo
, proto_bfcp
, 0);
242 /* First time, get info from conversation */
243 p_conv
= find_conversation(pinfo
->num
, &pinfo
->net_dst
, &pinfo
->net_src
,
244 conversation_pt_to_conversation_type(pinfo
->ptype
),
245 pinfo
->destport
, pinfo
->srcport
, 0);
248 /* Look for data in conversation */
249 struct _bfcp_conversation_info
*p_conv_packet_data
;
250 p_conv_data
= (struct _bfcp_conversation_info
*)conversation_get_proto_data(p_conv
, proto_bfcp
);
253 /* Save this conversation info into packet info */
254 p_conv_packet_data
= (struct _bfcp_conversation_info
*)wmem_memdup(wmem_file_scope(),
255 p_conv_data
, sizeof(struct _bfcp_conversation_info
));
257 p_add_proto_data(wmem_file_scope(), pinfo
, proto_bfcp
, 0, p_conv_packet_data
);
262 /* Create setup info subtree with summary info. */
263 if (p_conv_data
&& p_conv_data
->setup_method_set
) {
264 proto_tree
*bfcp_setup_tree
;
265 proto_item
*ti
= proto_tree_add_string_format(tree
, hf_bfcp_setup
, tvb
, 0, 0,
267 "Stream setup by %s (frame %u)",
268 p_conv_data
->setup_method
,
269 p_conv_data
->setup_frame_number
);
270 proto_item_set_generated(ti
);
271 bfcp_setup_tree
= proto_item_add_subtree(ti
, ett_bfcp_setup
);
272 if (bfcp_setup_tree
) {
273 /* Add details into subtree */
274 proto_item
* item
= proto_tree_add_uint(bfcp_setup_tree
, hf_bfcp_setup_frame
,
275 tvb
, 0, 0, p_conv_data
->setup_frame_number
);
276 proto_item_set_generated(item
);
277 item
= proto_tree_add_string(bfcp_setup_tree
, hf_bfcp_setup_method
,
278 tvb
, 0, 0, p_conv_data
->setup_method
);
279 proto_item_set_generated(item
);
285 // NOLINTNEXTLINE(misc-no-recursion)
286 dissect_bfcp_attributes(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, int offset
, int bfcp_payload_length
)
288 proto_item
*ti
, *item
;
289 proto_tree
*bfcp_attr_tree
= NULL
;
290 int attr_start_offset
;
292 uint8_t attribute_type
;
294 uint8_t first_byte
, pad_len
;
296 increment_dissection_depth(pinfo
);
297 while ((tvb_reported_length_remaining(tvb
, offset
) >= 2) &&
298 ((bfcp_payload_length
- read_attr
) >= 2))
301 attr_start_offset
= offset
;
302 first_byte
= tvb_get_uint8(tvb
, offset
);
304 /* Padding so continue to next attribute */
305 if (first_byte
== 0){
310 ti
= proto_tree_add_item(tree
, hf_bfcp_attribute_types
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
311 bfcp_attr_tree
= proto_item_add_subtree(ti
, ett_bfcp_attr
);
312 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_attribute_types_m_bit
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
314 attribute_type
= (first_byte
& 0xFE) >> 1;
317 /* Length: This 8-bit field contains the length of the attribute in
318 * octets, excluding any padding defined for specific attributes. The
319 * length of attributes that are not grouped includes the Type, 'M' bit,
320 * and Length fields. The Length in grouped attributes is the length of
321 * the grouped attribute itself (including Type, 'M' bit, and Length
322 * fields) plus the total length (including padding) of all the included
326 item
= proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_attribute_length
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
327 length
= tvb_get_uint8(tvb
, offset
);
328 /* At least Type, M bit and Length fields */
330 expert_add_info_format(pinfo
, item
, &ei_bfcp_attribute_length_too_small
,
331 "Attribute length is too small (%d bytes - minimum valid is 2)", length
);
336 switch(attribute_type
){
337 case 1: /* Beneficiary ID */
338 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_beneficiary_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
341 case 2: /* FLOOR-ID */
342 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
345 case 3: /* FLOOR-REQUEST-ID */
346 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_request_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
349 case 4: /* PRIORITY */
350 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_priority
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
353 case 5: /* REQUEST-STATUS */
354 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_request_status
, tvb
, offset
,1, ENC_BIG_ENDIAN
);
357 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_queue_pos
, tvb
, offset
,1, ENC_BIG_ENDIAN
);
360 case 6: /* ERROR-CODE */
361 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_error_code
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
364 /* We have Error Specific Details */
365 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_error_specific_details
, tvb
, offset
, length
-3, ENC_NA
);
367 offset
= offset
+ length
-3;
368 pad_len
= length
& 0x03;
370 pad_len
= 4 - pad_len
;
371 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
373 offset
= offset
+ pad_len
;
375 case 7: /* ERROR-INFO */
376 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_error_info_text
, tvb
, offset
, length
-2, ENC_ASCII
);
377 offset
= offset
+ length
-2;
378 pad_len
= length
& 0x03;
380 pad_len
= 4 - pad_len
;
381 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
383 offset
= offset
+ pad_len
;
385 case 8: /* PARTICIPANT-PROVIDED-INFO */
386 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_part_prov_info_text
, tvb
, offset
, length
-2, ENC_ASCII
);
387 offset
= offset
+ length
-2;
388 pad_len
= length
& 0x03;
390 pad_len
= 4 - pad_len
;
391 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
393 offset
= offset
+ pad_len
;
395 case 9: /* STATUS-INFO */
396 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_status_info_text
, tvb
, offset
, length
-2, ENC_ASCII
);
397 offset
= offset
+ length
-2;
398 pad_len
= length
& 0x03;
400 pad_len
= 4 - pad_len
;
401 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
403 offset
= offset
+ pad_len
;
405 case 10: /* SUPPORTED-ATTRIBUTES */
407 while(offset
< (attr_start_offset
+length
)){
408 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_supp_attr
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
411 pad_len
= length
& 0x03;
413 pad_len
= 4 - pad_len
;
414 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
416 offset
= offset
+ pad_len
;
418 case 11: /* SUPPORTED-PRIMITIVES */
420 while(offset
< (attr_start_offset
+length
)){
421 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_supp_prim
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
424 pad_len
= length
& 0x03;
426 pad_len
= 4 - pad_len
;
427 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
429 offset
= offset
+ pad_len
;
431 case 12: /* USER-DISPLAY-NAME */
432 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_user_disp_name
, tvb
, offset
, length
-2, ENC_ASCII
);
433 offset
= offset
+ length
-2;
434 pad_len
= length
& 0x03;
436 pad_len
= 4 - pad_len
;
437 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
439 offset
= offset
+ pad_len
;
441 case 13: /* USER-URI */
442 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_user_uri
, tvb
, offset
, length
-2, ENC_ASCII
);
443 offset
= offset
+ length
-2;
444 pad_len
= length
& 0x03;
446 pad_len
= 4 - pad_len
;
447 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_padding
, tvb
, offset
, pad_len
, ENC_NA
);
449 offset
= offset
+ pad_len
;
451 case 14: /* BENEFICIARY-INFORMATION */
452 /* The BENEFICIARY-INFORMATION attribute is a grouped attribute that
453 * consists of a header, which is referred to as BENEFICIARY-
454 * INFORMATION-HEADER, followed by a sequence of attributes.
456 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_beneficiary_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
458 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
460 case 15: /* FLOOR-REQUEST-INFORMATION */
461 /* The FLOOR-REQUEST-INFORMATION attribute is a grouped attribute that
462 * consists of a header, which is referred to as FLOOR-REQUEST-
463 * INFORMATION-HEADER, followed by a sequence of attributes.
465 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_request_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
467 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
469 case 16: /* REQUESTED-BY-INFORMATION */
470 /* The REQUESTED-BY-INFORMATION attribute is a grouped attribute that
471 * consists of a header, which is referred to as FLOOR-REQUEST-STATUS-
472 * -HEADER, followed by a sequence of attributes.
474 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_req_by_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
476 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
478 case 17: /* FLOOR-REQUEST-STATUS */
479 /* The FLOOR-REQUEST-STATUS attribute is a grouped attribute that
480 * consists of a header, which is referred to as OVERALL-REQUEST-STATUS-
481 * -HEADER, followed by a sequence of attributes.
483 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
485 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
487 case 18: /* OVERALL-REQUEST-STATUS */
488 /* The OVERALL-REQUEST-STATUS attribute is a grouped attribute that
489 * consists of a header, which is referred to as FLOOR-REQUEST-
490 * INFORMATION-HEADER, followed by a sequence of attributes.
492 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_floor_request_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
494 offset
= dissect_bfcp_attributes(tvb
, pinfo
, bfcp_attr_tree
, offset
, length
-4);
498 proto_tree_add_item(bfcp_attr_tree
, hf_bfcp_payload
, tvb
, offset
, length
-2, ENC_NA
);
499 /* Advance by any length attributable to payload */
500 offset
= offset
+ length
- 2;
503 read_attr
= read_attr
+ length
;
505 decrement_dissection_depth(pinfo
);
512 dissect_bfcp_heur_check(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
)
519 /* Size of smallest BFCP packet: 12 octets */
520 if (tvb_captured_length(tvb
) < BFCP_HDR_LEN
)
523 /* Check version and reserved bits in first byte */
524 first_byte
= tvb_get_uint8(tvb
, 0);
526 /* If first_byte of bfcp_packet is a combination of the
527 * version, the R-bit and the F-bit. The value must be:
528 * 0x20 || 0x30 || 0x40 || 0x48 || 0x50 || 0x58
529 * if the bit is set, otherwise it is not BFCP.
531 if ((first_byte
!= 0x20) && (first_byte
!= 0x30) && (first_byte
!= 0x40) && (first_byte
!= 0x48) && (first_byte
!= 0x50) && (first_byte
!= 0x58))
534 primitive
= tvb_get_uint8(tvb
, 1);
536 if ((primitive
< 1) || (primitive
> 18))
539 str
= try_val_to_str(primitive
, map_bfcp_primitive
);
546 /* Code to actually dissect BFCP packets */
548 dissect_bfcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
553 int bfcp_payload_length
;
555 proto_tree
*bfcp_tree
;
558 if (!dissect_bfcp_heur_check(tvb
, pinfo
, tree
, data
))
561 primitive
= tvb_get_uint8(tvb
, 1);
562 str
= try_val_to_str(primitive
, map_bfcp_primitive
);
564 /* Make entries in Protocol column and Info column on summary display*/
565 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "BFCP");
566 col_add_str(pinfo
->cinfo
, COL_INFO
, str
);
568 ti
= proto_tree_add_item(tree
, proto_bfcp
, tvb
, 0, -1, ENC_NA
);
569 bfcp_tree
= proto_item_add_subtree(ti
, ett_bfcp
);
570 show_setup_info(tvb
, pinfo
, bfcp_tree
);
572 The following is the format of the common header.
575 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
576 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
577 | Ver |R|F| Res | Primitive | Payload Length |
578 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
580 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
581 | Transaction ID | User ID |
582 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
583 | Fragment Offset (if F is set) | Fragment Length (if F is set) |
584 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
588 /* Add items to BFCP tree */
589 proto_tree_add_item(bfcp_tree
, hf_bfcp_version
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
590 proto_tree_add_item(bfcp_tree
, hf_bfcp_hdr_r_bit
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
591 proto_tree_add_item_ret_boolean(bfcp_tree
, hf_bfcp_hdr_f_bit
, tvb
, offset
, 1, ENC_BIG_ENDIAN
, &f_bit
);
592 /* Ver should be 1 over a reliable transport (TCP) and 2 over an
593 * unreliable transport (UDP). R and F should only be set on an
594 * unreliable transport. They should be ignored on a reliable
597 * XXX: If it's version 1 and an unreliable transport, it may be
598 * a draft implementation.
599 * ( https://www.ietf.org/archive/id/draft-sandbakken-dispatch-bfcp-udp-03.html )
602 proto_tree_add_item(bfcp_tree
, hf_bfcp_primitive
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
604 proto_tree_add_item(bfcp_tree
, hf_bfcp_payload_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
606 proto_tree_add_item(bfcp_tree
, hf_bfcp_conference_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
608 proto_tree_add_item(bfcp_tree
, hf_bfcp_transaction_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
610 proto_tree_add_item(bfcp_tree
, hf_bfcp_user_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
613 proto_tree_add_item(bfcp_tree
, hf_bfcp_fragment_offset
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
615 proto_tree_add_item(bfcp_tree
, hf_bfcp_fragment_length
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
619 bfcp_payload_length
= tvb_get_ntohs(tvb
,
620 BFCP_OFFSET_PAYLOAD_LENGTH
) * 4;
622 /*offset = */dissect_bfcp_attributes(tvb
, pinfo
, bfcp_tree
, offset
, bfcp_payload_length
);
624 return tvb_captured_length(tvb
);
628 dissect_bfcp_heur(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
630 if (!dissect_bfcp_heur_check(tvb
, pinfo
, tree
, data
))
633 dissect_bfcp(tvb
, pinfo
, tree
, data
);
637 void proto_register_bfcp(void)
639 module_t
*bfcp_module
;
640 expert_module_t
* expert_bfcp
;
642 static hf_register_info hf
[] = {
645 { "Version(ver)", "bfcp.ver",
646 FT_UINT8
, BASE_DEC
, NULL
, 0xe0,
651 { "Transaction Responder (R)", "bfcp.hdr_r_bit",
652 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x10,
657 { "Fragmentation (F)", "bfcp.hdr_f_bit",
658 FT_BOOLEAN
, 8, TFS(&tfs_set_notset
), 0x08,
663 { "Primitive", "bfcp.primitive",
664 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_primitive
), 0x0,
668 &hf_bfcp_payload_length
,
669 { "Payload Length", "bfcp.payload_length",
670 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
671 "Length in 4-octet units, excluding the COMMON-HEADER", HFILL
}
674 &hf_bfcp_conference_id
,
675 { "Conference ID", "bfcp.conference_id",
676 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
680 &hf_bfcp_transaction_id
,
681 { "Transaction ID", "bfcp.transaction_id",
682 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
687 { "User ID", "bfcp.user_id",
688 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
692 &hf_bfcp_fragment_offset
,
693 { "Fragment Offset", "bfcp.fragment_offset",
694 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
695 "Number of 4-octet units contained in previous fragments, excluding the COMMON-HEADER", HFILL
}
698 &hf_bfcp_fragment_length
,
699 { "Fragment Length", "bfcp.fragment_length",
700 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
701 "Number of 4-octet units contained in this fragment, excluding the COMMON-HEADER", HFILL
}
705 { "Payload", "bfcp.payload",
706 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
,
710 &hf_bfcp_attribute_types
,
711 { "Attribute Type", "bfcp.attribute_type",
712 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_attribute_types
), 0xFE,
716 &hf_bfcp_attribute_types_m_bit
,
717 { "Mandatory bit(M)", "bfcp.attribute_types_m_bit",
718 FT_BOOLEAN
, 8, NULL
, 0x01,
722 &hf_bfcp_attribute_length
,
723 { "Attribute Length", "bfcp.attribute_length",
724 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
728 &hf_bfcp_beneficiary_id
,
729 { "BENEFICIARY-ID", "bfcp.beneficiary_id",
730 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
735 { "FLOOR-ID", "bfcp.floor_id",
736 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
740 &hf_bfcp_floor_request_id
,
741 { "FLOOR-REQUEST-ID", "bfcp.floorrequest_id",
742 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
747 { "FLOOR-REQUEST-ID", "bfcp.priority",
748 FT_UINT16
, BASE_DEC
, NULL
, 0xe000,
752 &hf_bfcp_request_status
,
753 { "Request Status", "bfcp.request_status",
754 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_request_status
), 0x0,
759 { "Queue Position", "bfcp.queue_pos",
760 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
765 { "Error Code", "bfcp.error_code",
766 FT_UINT8
, BASE_DEC
, VALS(bfcp_error_code_valuse
), 0x0,
770 &hf_bfcp_error_info_text
,
771 { "Text", "bfcp.error_info_text",
772 FT_STRING
, BASE_NONE
, NULL
, 0x0,
776 &hf_bfcp_part_prov_info_text
,
777 { "Text", "bfcp.part_prov_info_text",
778 FT_STRING
, BASE_NONE
, NULL
, 0x0,
782 &hf_bfcp_status_info_text
,
783 { "Text", "bfcp.status_info_text",
784 FT_STRING
, BASE_NONE
, NULL
, 0x0,
789 { "Supported Attribute", "bfcp.supp_attr",
790 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_attribute_types
), 0xFE,
795 { "Supported Primitive", "bfcp.supp_primitive",
796 FT_UINT8
, BASE_DEC
, VALS(map_bfcp_primitive
), 0x0,
800 &hf_bfcp_user_disp_name
,
801 { "Name", "bfcp.user_disp_name",
802 FT_STRING
, BASE_NONE
, NULL
, 0x0,
807 { "URI", "bfcp.user_uri",
808 FT_STRING
, BASE_NONE
, NULL
, 0x0,
813 { "Requested-by ID", "bfcp.req_by_i",
814 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
819 { "Padding", "bfcp.padding",
820 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
824 &hf_bfcp_error_specific_details
,
825 { "Error Specific Details", "bfcp.error_specific_details",
826 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
830 { "Stream setup", "bfcp.setup",
831 FT_STRING
, BASE_NONE
, NULL
, 0x0,
832 "Stream setup, method and frame number", HFILL
}
834 { &hf_bfcp_setup_frame
,
835 { "Setup frame", "bfcp.setup-frame",
836 FT_FRAMENUM
, BASE_NONE
, NULL
, 0x0,
837 "Frame that set up this stream", HFILL
}
839 { &hf_bfcp_setup_method
,
840 { "Setup Method", "bfcp.setup-method",
841 FT_STRING
, BASE_NONE
, NULL
, 0x0,
842 "Method used to set up this stream", HFILL
}
846 static int *ett
[] = {
852 static ei_register_info ei
[] = {
853 { &ei_bfcp_attribute_length_too_small
, { "bfcp.attribute_length.too_small", PI_MALFORMED
, PI_ERROR
, "Attribute length is too small", EXPFILL
}},
856 /* Register protocol name and description */
857 proto_bfcp
= proto_register_protocol("Binary Floor Control Protocol", "BFCP", "bfcp");
859 bfcp_handle
= register_dissector("bfcp", dissect_bfcp
, proto_bfcp
);
861 bfcp_module
= prefs_register_protocol(proto_bfcp
, NULL
);
863 prefs_register_obsolete_preference(bfcp_module
, "enable");
865 /* Register field and subtree array */
866 proto_register_field_array(proto_bfcp
, hf
, array_length(hf
));
867 proto_register_subtree_array(ett
, array_length(ett
));
869 expert_bfcp
= expert_register_protocol(proto_bfcp
);
870 expert_register_field_array(expert_bfcp
, ei
, array_length(ei
));
873 void proto_reg_handoff_bfcp(void)
875 /* "Decode As" is always available;
876 * Heuristic dissection in disabled by default since
877 * the heuristic is quite weak.
879 heur_dissector_add("tcp", dissect_bfcp_heur
, "BFCP over TCP", "bfcp_tcp", proto_bfcp
, HEURISTIC_DISABLE
);
880 heur_dissector_add("udp", dissect_bfcp_heur
, "BFCP over UDP", "bfcp_udp", proto_bfcp
, HEURISTIC_DISABLE
);
881 dissector_add_for_decode_as_with_preference("tcp.port", bfcp_handle
);
882 dissector_add_for_decode_as_with_preference("udp.port", bfcp_handle
);
886 * Editor modelines - https://www.wireshark.org/tools/modelines.html
891 * indent-tabs-mode: t
894 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
895 * :indentSize=8:tabSize=8:noTabs=false: