diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-11-24 17:06:08 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-11-24 17:06:08 +0000 |
commit | dff339dd1e72a54b8f52ac72f3768855d9b71480 (patch) | |
tree | 820972cd3c0b8ac3ccfe0a10d6a21254f6c38589 /epan/dissectors/packet-bfcp.c | |
parent | 535a8887d77b46106ff7654837af49303238adb8 (diff) |
Set up BFCP conversations
svn path=/trunk/; revision=46165
Diffstat (limited to 'epan/dissectors/packet-bfcp.c')
-rw-r--r-- | epan/dissectors/packet-bfcp.c | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/epan/dissectors/packet-bfcp.c b/epan/dissectors/packet-bfcp.c index 497991cf22..956075c5b5 100644 --- a/epan/dissectors/packet-bfcp.c +++ b/epan/dissectors/packet-bfcp.c @@ -381,40 +381,18 @@ dissect_bfcp_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int return offset; } - /* Code to actually dissect BFCP packets */ -static gboolean dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +static void +dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; guint8 primitive; const gchar *str; gint bfcp_payload_length; proto_tree *bfcp_tree = NULL; - guint8 first_byte; - - - /* Size of smallest BFCP packet: 12 octets */ - if (tvb_length(tvb) < 12) - return FALSE; - - /* Check version and reserved bits in first byte */ - first_byte = tvb_get_guint8(tvb, 0); - - /* If first_byte of bfcp_packet is a combination of the - * version and the I bit. The value must be either 0x20 or 0x30 - * if the bit is set, otherwise it is not BFCP. - */ - if ((first_byte != 0x20) && (first_byte != 0x30)) - return FALSE; primitive = tvb_get_guint8(tvb, 1); - - if ((primitive < 1) || (primitive > 18)) - return FALSE; - str = match_strval(primitive, map_bfcp_primitive); - if (NULL == str) - return FALSE; /* Make entries in Protocol column and Info column on summary display*/ col_set_str(pinfo->cinfo, COL_PROTOCOL, "BFCP"); @@ -464,6 +442,40 @@ static gboolean dissect_bfcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree offset = dissect_bfcp_attributes(tvb, pinfo, bfcp_tree, offset, bfcp_payload_length); } /* if(tree) */ +} + +static gboolean +dissect_bfcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + guint8 primitive; + guint8 first_byte; + const gchar *str; + + + /* Size of smallest BFCP packet: 12 octets */ + if (tvb_length(tvb) < 12) + return FALSE; + + /* Check version and reserved bits in first byte */ + first_byte = tvb_get_guint8(tvb, 0); + + /* If first_byte of bfcp_packet is a combination of the + * version and the I bit. The value must be either 0x20 or 0x30 + * if the bit is set, otherwise it is not BFCP. + */ + if ((first_byte != 0x20) && (first_byte != 0x30)) + return FALSE; + + primitive = tvb_get_guint8(tvb, 1); + + if ((primitive < 1) || (primitive > 18)) + return FALSE; + + str = match_strval(primitive, map_bfcp_primitive); + if (NULL == str) + return FALSE; + + dissect_bfcp(tvb, pinfo, tree); return TRUE; } @@ -647,6 +659,8 @@ void proto_register_bfcp(void) proto_bfcp = proto_register_protocol("Binary Floor Control Protocol", "BFCP", "bfcp"); + register_dissector("bfcp", dissect_bfcp, proto_bfcp); + bfcp_module = prefs_register_protocol(proto_bfcp, proto_reg_handoff_bfcp); @@ -672,17 +686,17 @@ void proto_reg_handoff_bfcp(void) { dissector_handle_t bfcp_handle; - heur_dissector_add("tcp", dissect_bfcp, proto_bfcp); - heur_dissector_add("udp", dissect_bfcp, proto_bfcp); - bfcp_handle = new_create_dissector_handle(dissect_bfcp, proto_bfcp); + heur_dissector_add("tcp", dissect_bfcp_heur, proto_bfcp); + heur_dissector_add("udp", dissect_bfcp_heur, proto_bfcp); + bfcp_handle = create_dissector_handle(dissect_bfcp, proto_bfcp); dissector_add_handle("tcp.port", bfcp_handle); dissector_add_handle("udp.port", bfcp_handle); prefs_initialized = TRUE; } - heur_dissector_set_enabled("tcp", dissect_bfcp, proto_bfcp, + heur_dissector_set_enabled("tcp", dissect_bfcp_heur, proto_bfcp, bfcp_enable_heuristic_dissection); - heur_dissector_set_enabled("udp", dissect_bfcp, proto_bfcp, + heur_dissector_set_enabled("udp", dissect_bfcp_heur, proto_bfcp, bfcp_enable_heuristic_dissection); } |