aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-brp.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2011-10-05 16:06:01 +0000
committerBill Meier <wmeier@newsguy.com>2011-10-05 16:06:01 +0000
commita5c09a54e35318bd85e011889e9d8bb2b4d49308 (patch)
tree5414d7bfe32dc2204369df62a308efce3a544855 /epan/dissectors/packet-brp.c
parent4c7f166dbbf6536f47baaabe4fa8ea6640b7f27a (diff)
Various cleanup:
- Add Gerald Combs copyright; - Use correct address for FSF; - Move proto_reg_handoff...() to the end of the file per convention; - Remove unneeded check_col() and col_clear(); - Localize brp_handle; - Whitespace cleanup ("4 space tabs" ==> spaces; remove trailing spaces). svn path=/trunk/; revision=39271
Diffstat (limited to 'epan/dissectors/packet-brp.c')
-rw-r--r--epan/dissectors/packet-brp.c460
1 files changed, 229 insertions, 231 deletions
diff --git a/epan/dissectors/packet-brp.c b/epan/dissectors/packet-brp.c
index 848a9fbe12..8e93b0315a 100644
--- a/epan/dissectors/packet-brp.c
+++ b/epan/dissectors/packet-brp.c
@@ -1,19 +1,25 @@
/* packet-brp.c
-* $Id$
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -22,19 +28,16 @@
#include <glib.h>
#include <epan/packet.h>
-#define PROTO_TAG_BRP "BRP"
+#define PROTO_TAG_BRP "BRP"
/* Wireshark ID of the BRP protocol */
static int proto_brp = -1;
-static dissector_handle_t brp_handle;
-void dissect_brp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-
/*static int global_brp_port = 1958; *//* The port is registered for another protocol */
static const value_string brp_packettype_names[] = {
- { 0, "BRP" },
- { 1, "Setup Request - BRC -> BRS" },
+ { 0, "BRP" },
+ { 1, "Setup Request - BRC -> BRS" },
{ 2, "Setup Response - BRS -> BRC" },
{ 3, "Teardown Request - BRC -> BRS" },
{ 4, "Teardown Response - BRS -> BRC" },
@@ -49,12 +52,12 @@ static const value_string brp_packettype_names[] = {
{ 13, "Flow Get Next Request - BRC -> BRS" },
{ 14, "Flow Get Next Response - BRS -> BRC" },
{ 15, "Flow Abort - BRS -> BRC" },
- { 0, NULL }
+ { 0, NULL }
};
static const value_string brp_stat_vals[] = {
- { 0, "OK" },
- { 1, "Comm Error - Network connectivity has been lost (Client Message)." },
+ { 0, "OK" },
+ { 1, "Comm Error - Network connectivity has been lost (Client Message)." },
{ 2, "No Bandwidth - There is insufficient bandwidth available in the network to honor the request (Server Message)." },
{ 3, "Insufficient Resource - Either there is insufficient memory or resource available to transmit the request or, insufficient resources existed at the server to complete the request. Note that insufficient bandwidth in the network is handled by the previous status value. This is the catchall for all other resource deficiencies (Client/Server Message)." },
{ 4, "No Such - The requested flow does not exist (Server Message)." },
@@ -68,7 +71,7 @@ static const value_string brp_stat_vals[] = {
{ 12, "Invalid Message - Input message is not defined or malformed (Client/Server Message)." },
{ 13, "Unsupported Version - The requested version (in a setup) is not supported (Server Message)." },
{ 14, "Pending - The requested operation is proceeding and a status will be returned with the final result shortly (Server Message)." },
- { 0, NULL }
+ { 0, NULL }
};
/* The following hf_* variables are used to hold the Wireshark IDs of
@@ -109,213 +112,210 @@ void
dissect_brp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- proto_item *brp_item = NULL;
- proto_tree *brp_tree = NULL;
+ proto_item *brp_item = NULL;
+ proto_tree *brp_tree = NULL;
gint offset = 0;
guint8 type = 0;
guint8 packet_type = tvb_get_guint8(tvb, 0);
-
+
/* If there is a "tree" requested, we handle that request. */
- if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_BRP);
- /* Clear out stuff in the info column */
- if(check_col(pinfo->cinfo,COL_INFO)){
- col_clear(pinfo->cinfo,COL_INFO);
- /* We add some snazzy bizness to the info field to quickly ascertain
- what type of message was sent to/from the BRS/BRC. */
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_BRP);
+ if(check_col(pinfo->cinfo,COL_INFO)){
+ /* We add some snazzy bizness to the info field to quickly ascertain
+ what type of message was sent to/from the BRS/BRC. */
col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type - %s",
- val_to_str(packet_type, brp_packettype_names, "Unknown (0x%02x)"));
- }
+ val_to_str(packet_type, brp_packettype_names, "Unknown (0x%02x)"));
+ }
/* This call adds our tree to the main dissection tree. */
- if (tree) { /* we are being asked for details */
+ if (tree) { /* we are being asked for details */
/* Here we add our tree/subtree so we can have a collapsible branch. */
brp_item = proto_tree_add_item( tree, proto_brp, tvb, 0, -1, ENC_BIG_ENDIAN );
- brp_tree = proto_item_add_subtree( brp_item, ett_brp);
+ brp_tree = proto_item_add_subtree( brp_item, ett_brp);
/* We use tvb_get_guint8 to get our type value out. */
type = tvb_get_guint8(tvb, offset);
- offset += 0;
-
- /* Now let's break down each packet and display it in the collapsible branch */
- switch(type)
+ offset += 0;
+
+ /* Now let's break down each packet and display it in the collapsible branch */
+ switch(type)
{
case 1: /* Setup Request */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_ver, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_ver, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 2: /* Setup Response */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_uint( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_uint( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 3: /* Teardown Request */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
break;
case 4: /* Teardown Response */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
break;
case 5: /* Heartbeat Request */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
break;
case 6: /* Heartbeat Response */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
break;
case 7: /* Uni Flow Create Request */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_srcip, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_dstip, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_dstuport, tvb, offset, 2, ENC_BIG_ENDIAN );
- offset +=2;
- proto_tree_add_item( brp_tree, hf_brp_mbz, tvb, offset, 2, ENC_BIG_ENDIAN );
- offset +=2;
- proto_tree_add_item( brp_tree, hf_brp_bw, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_life, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_srcip, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_dstip, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_dstuport, tvb, offset, 2, ENC_BIG_ENDIAN );
+ offset +=2;
+ proto_tree_add_item( brp_tree, hf_brp_mbz, tvb, offset, 2, ENC_BIG_ENDIAN );
+ offset +=2;
+ proto_tree_add_item( brp_tree, hf_brp_bw, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_life, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 8: /* Flow Create Response */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 9: /* Flow Delete Request */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 10: /* Flow Delete Response */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 11: /* Flow Get Request */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 12: /* Flow Get Response */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_rmttl, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_srcip, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_dstip, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_dstuport, tvb, offset, 2, ENC_BIG_ENDIAN );
- offset +=2;
- proto_tree_add_item( brp_tree, hf_brp_mbz, tvb, offset, 2, ENC_BIG_ENDIAN );
- offset +=2;
- proto_tree_add_item( brp_tree, hf_brp_fltype, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset +=1;
- proto_tree_add_item( brp_tree, hf_brp_bw, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset +=3;
- proto_tree_add_item( brp_tree, hf_brp_life, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_rmttl, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_srcip, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_dstip, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_dstuport, tvb, offset, 2, ENC_BIG_ENDIAN );
+ offset +=2;
+ proto_tree_add_item( brp_tree, hf_brp_mbz, tvb, offset, 2, ENC_BIG_ENDIAN );
+ offset +=2;
+ proto_tree_add_item( brp_tree, hf_brp_fltype, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset +=1;
+ proto_tree_add_item( brp_tree, hf_brp_bw, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset +=3;
+ proto_tree_add_item( brp_tree, hf_brp_life, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 13: /* Flow Get Next Request */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 14: /* Flow Get Next Response */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset += 3;
- proto_tree_add_item( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_rmttl, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_srcip, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_dstip, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_dstuport, tvb, offset, 2, ENC_BIG_ENDIAN );
- offset +=2;
- proto_tree_add_item( brp_tree, hf_brp_mbz, tvb, offset, 2, ENC_BIG_ENDIAN );
- offset +=2;
- proto_tree_add_item( brp_tree, hf_brp_fltype, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset +=1;
- proto_tree_add_item( brp_tree, hf_brp_bw, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset +=3;
- proto_tree_add_item( brp_tree, hf_brp_life, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
- proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_trans, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset += 3;
+ proto_tree_add_item( brp_tree, hf_brp_stat, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_rmttl, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_srcip, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_dstip, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_dstuport, tvb, offset, 2, ENC_BIG_ENDIAN );
+ offset +=2;
+ proto_tree_add_item( brp_tree, hf_brp_mbz, tvb, offset, 2, ENC_BIG_ENDIAN );
+ offset +=2;
+ proto_tree_add_item( brp_tree, hf_brp_fltype, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset +=1;
+ proto_tree_add_item( brp_tree, hf_brp_bw, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset +=3;
+ proto_tree_add_item( brp_tree, hf_brp_life, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
case 15: /* Flow Abort */
- proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
- offset += 1;
- proto_tree_add_item( brp_tree, hf_brp_mbz, tvb, offset, 3, ENC_BIG_ENDIAN );
- offset +=3;
- proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
- offset +=4;
+ proto_tree_add_item( brp_tree, hf_brp_type, tvb, offset, 1, ENC_BIG_ENDIAN );
+ offset += 1;
+ proto_tree_add_item( brp_tree, hf_brp_mbz, tvb, offset, 3, ENC_BIG_ENDIAN );
+ offset +=3;
+ proto_tree_add_item( brp_tree, hf_brp_flid, tvb, offset, 4, ENC_BIG_ENDIAN );
+ offset +=4;
break;
default:
@@ -324,80 +324,67 @@ dissect_brp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
}
- }
-}
-
-/*--- proto_reg_handoff_brp -------------------------------------------*/
-void proto_reg_handoff_brp(void)
-{
- static gboolean initialized=FALSE;
-
- if (!initialized) {
- brp_handle = create_dissector_handle(dissect_brp, proto_brp);
- /*dissector_add("udp.port", global_brp_port, brp_handle);*/
- dissector_add_handle("udp.port", brp_handle); /* For 'Decoode as' */
- }
-
+ }
}
/*--- proto_register_brp ----------------------------------------------*/
void proto_register_brp (void)
{
- /* A data field is something you can search/filter on.
- *
- * We create a structure to register our fields. It consists of an
- * array of hf_register_info structures, each of which are of the format
- * {&(field id), {name, abbrev, type, display, strings, bitmask, blurb, HFILL}}.
- */
- static hf_register_info hf[] = {
+ /* A data field is something you can search/filter on.
+ *
+ * We create a structure to register our fields. It consists of an
+ * array of hf_register_info structures, each of which are of the format
+ * {&(field id), {name, abbrev, type, display, strings, bitmask, blurb, HFILL}}.
+ */
+ static hf_register_info hf[] = {
{ &hf_brp_type,
- { "Type", "brp.type", FT_UINT8, BASE_DEC, VALS(brp_packettype_names), 0x0,
- NULL, HFILL }},
+ { "Type", "brp.type", FT_UINT8, BASE_DEC, VALS(brp_packettype_names), 0x0,
+ NULL, HFILL }},
{ &hf_brp_trans,
- { "Transaction ID", "brp.trans", FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Transaction ID", "brp.trans", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_ver,
- { "Version", "brp.ver", FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Version", "brp.ver", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_stat,
- { "Status", "brp.stat", FT_UINT8, BASE_DEC, VALS(brp_stat_vals), 0x0,
- NULL, HFILL }},
+ { "Status", "brp.stat", FT_UINT8, BASE_DEC, VALS(brp_stat_vals), 0x0,
+ NULL, HFILL }},
{ &hf_brp_srcip,
- { "Source IP Address", "brp.srcip", FT_IPv4, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Source IP Address", "brp.srcip", FT_IPv4, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_dstip,
- { "Destination IP Address", "brp.dstip", FT_IPv4, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Destination IP Address", "brp.dstip", FT_IPv4, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_dstuport,
- { "Destination UDP Port", "brp.dstuport", FT_UINT16, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Destination UDP Port", "brp.dstuport", FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_mbz,
- { "MBZ", "brp.mbz", FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "MBZ", "brp.mbz", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_bw,
- { "Bandwidth - Kbytes/sec", "brp.bw", FT_UINT32, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Bandwidth - Kbytes/sec", "brp.bw", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_life,
- { "Lifetime", "brp.life", FT_UINT32, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Lifetime", "brp.life", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_flid,
- { "Flow Identifier", "brp.flid", FT_UINT16, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Flow Identifier", "brp.flid", FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_fltype,
- { "Flow Type", "brp.fltype", FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Flow Type", "brp.fltype", FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_brp_rmttl,
- { "Remaining TTL", "brp.rmttl", FT_UINT32, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
- };
- static gint *ett[] = {
- &ett_brp,
- &ett_brp_type,
+ { "Remaining TTL", "brp.rmttl", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+ };
+ static gint *ett[] = {
+ &ett_brp,
+ &ett_brp_type,
&ett_brp_trans,
&ett_brp_ver,
&ett_brp_stat,
- &ett_brp_srcip,
- &ett_brp_dstip,
+ &ett_brp_srcip,
+ &ett_brp_dstip,
&ett_brp_dstuport,
&ett_brp_mbz,
&ett_brp_bw,
@@ -406,9 +393,20 @@ void proto_register_brp (void)
&ett_brp_fltype,
&ett_brp_rmttl
- };
- proto_brp = proto_register_protocol ("BRP Protocol", "BRP", "brp");
- proto_register_field_array (proto_brp, hf, array_length (hf));
- proto_register_subtree_array (ett, array_length (ett));
- register_dissector("brp", dissect_brp, proto_brp);
+ };
+ proto_brp = proto_register_protocol ("BRP Protocol", "BRP", "brp");
+ proto_register_field_array (proto_brp, hf, array_length (hf));
+ proto_register_subtree_array (ett, array_length (ett));
+ register_dissector("brp", dissect_brp, proto_brp);
+}
+
+/*--- proto_reg_handoff_brp -------------------------------------------*/
+void proto_reg_handoff_brp(void)
+{
+ dissector_handle_t brp_handle;
+
+ brp_handle = create_dissector_handle(dissect_brp, proto_brp);
+ /*dissector_add("udp.port", global_brp_port, brp_handle);*/
+ dissector_add_handle("udp.port", brp_handle); /* For 'Decoode as' */
}
+