aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/packet-redback.c113
-rw-r--r--epan/dissectors/packet-rsync.c125
-rw-r--r--epan/dissectors/packet-rwall.c56
-rw-r--r--epan/dissectors/packet-stat.c222
-rw-r--r--epan/dissectors/packet-tali.c48
-rw-r--r--epan/dissectors/packet-udp.c10
-rw-r--r--epan/dissectors/packet-xcsl.c118
7 files changed, 374 insertions, 318 deletions
diff --git a/epan/dissectors/packet-redback.c b/epan/dissectors/packet-redback.c
index 17f67f9340..30232fef71 100644
--- a/epan/dissectors/packet-redback.c
+++ b/epan/dissectors/packet-redback.c
@@ -23,13 +23,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define NEW_PROTO_TREE_API
+
#include "config.h"
#include <glib.h>
#include <epan/packet.h>
#include "packet-ip.h"
-static int proto_redback = -1;
+static dissector_handle_t redback_handle;
+
static gint ett_redback = -1;
static dissector_table_t osinl_incl_subdissector_table;
@@ -43,15 +46,36 @@ static dissector_handle_t ppp_handle;
static dissector_handle_t ppphdlc_handle;
static dissector_handle_t data_handle;
-static int hf_redback_context = -1;
-static int hf_redback_flags = -1;
-static int hf_redback_circuit = -1;
-static int hf_redback_length = -1;
-static int hf_redback_protocol = -1;
-static int hf_redback_l3offset = -1;
-static int hf_redback_dataoffset = -1;
-static int hf_redback_padding = -1;
-static int hf_redback_unknown = -1;
+static header_field_info *hfi_redback = NULL;
+
+#define REDBACK_HFI_INIT HFI_INIT(proto_redback)
+
+static header_field_info hfi_redback_context REDBACK_HFI_INIT =
+ { "Context", "redback.context", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_redback_flags REDBACK_HFI_INIT =
+ { "Flags", "redback.flags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_redback_circuit REDBACK_HFI_INIT =
+ { "Circuit", "redback.circuit", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_redback_length REDBACK_HFI_INIT =
+ { "Length", "redback.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_redback_protocol REDBACK_HFI_INIT =
+ { "Protocol", "redback.protocol", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_redback_l3offset REDBACK_HFI_INIT =
+ { "Layer 3 Offset", "redback.l3offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_redback_dataoffset REDBACK_HFI_INIT =
+ { "Data Offset", "redback.dataoffset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_redback_padding REDBACK_HFI_INIT =
+ { "Padding", "redback.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_redback_unknown REDBACK_HFI_INIT =
+ { "Unknown", "redback.unknown", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL };
static void
dissect_redback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -67,19 +91,19 @@ dissect_redback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
l3off = tvb_get_ntohs(tvb, 22);
if (tree) {
- ti = proto_tree_add_item(tree, proto_redback, tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, hfi_redback, tvb, 0, -1, ENC_NA);
rbtree = proto_item_add_subtree(ti, ett_redback);
- proto_tree_add_item(rbtree, hf_redback_context, tvb, 0, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(rbtree, hf_redback_flags, tvb, 4, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(rbtree, hf_redback_circuit, tvb, 8, 8, ENC_BIG_ENDIAN);
- proto_tree_add_item(rbtree, hf_redback_length, tvb, 16, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(rbtree, hf_redback_protocol, tvb, 18, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(rbtree, hf_redback_dataoffset, tvb, 20, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(rbtree, hf_redback_l3offset, tvb, 22, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(rbtree, &hfi_redback_context, tvb, 0, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(rbtree, &hfi_redback_flags, tvb, 4, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(rbtree, &hfi_redback_circuit, tvb, 8, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(rbtree, &hfi_redback_length, tvb, 16, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(rbtree, &hfi_redback_protocol, tvb, 18, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(rbtree, &hfi_redback_dataoffset, tvb, 20, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(rbtree, &hfi_redback_l3offset, tvb, 22, 2, ENC_BIG_ENDIAN);
if (dataoff > 24) {
- proto_tree_add_item(rbtree, hf_redback_padding, tvb, 24, dataoff-24, ENC_NA);
+ proto_tree_add_item(rbtree, &hfi_redback_padding, tvb, 24, dataoff-24, ENC_NA);
}
}
@@ -134,7 +158,7 @@ dissect_redback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset_remaining(tvb, dataoff);
} else {
if (tree)
- proto_tree_add_item(rbtree, hf_redback_unknown, tvb, dataoff, 4, ENC_NA);
+ proto_tree_add_item(rbtree, &hfi_redback_unknown, tvb, dataoff, 4, ENC_NA);
next_tvb = tvb_new_subset_remaining(tvb, dataoff+4);
}
@@ -162,50 +186,36 @@ dissect_redback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
void
proto_register_redback(void)
{
- static hf_register_info hf[] = {
- { &hf_redback_context,
- { "Context", "redback.context", FT_UINT32, BASE_HEX, NULL, 0x0,
- NULL, HFILL }},
- { &hf_redback_flags,
- { "Flags", "redback.flags", FT_UINT32, BASE_HEX, NULL, 0x0,
- NULL, HFILL }},
- { &hf_redback_circuit,
- { "Circuit", "redback.circuit", FT_UINT64, BASE_HEX, NULL, 0x0,
- NULL, HFILL }},
- { &hf_redback_length,
- { "Length", "redback.length", FT_UINT16, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
- { &hf_redback_protocol,
- { "Protocol", "redback.protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
- { &hf_redback_l3offset,
- { "Layer 3 Offset", "redback.l3offset", FT_UINT16, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
- { &hf_redback_dataoffset,
- { "Data Offset", "redback.dataoffset", FT_UINT16, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
- { &hf_redback_padding,
- { "Padding", "redback.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
- { &hf_redback_unknown,
- { "Unknown", "redback.unknown", FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }}
+ static header_field_info *hfi[] = {
+ &hfi_redback_context,
+ &hfi_redback_flags,
+ &hfi_redback_circuit,
+ &hfi_redback_length,
+ &hfi_redback_protocol,
+ &hfi_redback_l3offset,
+ &hfi_redback_dataoffset,
+ &hfi_redback_padding,
+ &hfi_redback_unknown,
};
static gint *ett[] = {
&ett_redback
};
+ int proto_redback;
+
proto_redback = proto_register_protocol("Redback", "Redback", "redback");
- proto_register_field_array(proto_redback, hf, array_length(hf));
+ hfi_redback = proto_registrar_get_nth(proto_redback);
+
+ proto_register_fields(proto_redback, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
+
+ redback_handle = create_dissector_handle(dissect_redback, proto_redback);
}
void
proto_reg_handoff_redback(void)
{
- dissector_handle_t redback_handle;
-
osinl_incl_subdissector_table = find_dissector_table("osinl.incl");
osinl_excl_subdissector_table = find_dissector_table("osinl.excl");
@@ -217,7 +227,6 @@ proto_reg_handoff_redback(void)
ppp_handle = find_dissector("ppp");
ppphdlc_handle = find_dissector("ppp_hdlc");
- redback_handle = create_dissector_handle(dissect_redback, proto_redback);
dissector_add_uint("wtap_encap", WTAP_ENCAP_REDBACK, redback_handle);
}
diff --git a/epan/dissectors/packet-rsync.c b/epan/dissectors/packet-rsync.c
index 8602aea563..5f649a871c 100644
--- a/epan/dissectors/packet-rsync.c
+++ b/epan/dissectors/packet-rsync.c
@@ -24,6 +24,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define NEW_PROTO_TREE_API
+
#include "config.h"
#include <string.h>
@@ -76,16 +78,41 @@ struct rsync_frame_data {
rsync_state_t state;
};
-static int proto_rsync = -1;
+static header_field_info *hfi_rsync = NULL;
+
+#define RSYNC_HF_INIT HFI_INIT(proto_rsync)
+
+static header_field_info hfi_rsync_hdr_magic RSYNC_HF_INIT =
+ {"Magic Header", "rsync.hdr_magic",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_rsync_hdr_version RSYNC_HF_INIT =
+ {"Header Version", "rsync.hdr_version",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_rsync_query_string RSYNC_HF_INIT =
+ {"Client Query String", "rsync.query",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
-static int hf_rsync_hdr_magic = -1;
-static int hf_rsync_hdr_version = -1;
-static int hf_rsync_query_string = -1;
-static int hf_rsync_motd_string = -1;
-static int hf_rsync_module_list_string = -1;
-static int hf_rsync_rsyncdok_string = -1;
-static int hf_rsync_command_string = -1;
-static int hf_rsync_data = -1;
+static header_field_info hfi_rsync_motd_string RSYNC_HF_INIT =
+ {"Server MOTD String", "rsync.motd",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_rsync_module_list_string RSYNC_HF_INIT =
+ {"Server Module List", "rsync.module_list",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_rsync_rsyncdok_string RSYNC_HF_INIT =
+ {"RSYNCD Response String", "rsync.response",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_rsync_command_string RSYNC_HF_INIT =
+ {"Client Command String", "rsync.command",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
+
+static header_field_info hfi_rsync_data RSYNC_HF_INIT =
+ {"rsync data", "rsync.data",
+ FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL };
static gint ett_rsync = -1;
@@ -101,10 +128,10 @@ dissect_rsync_version_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *rsyn
{
int offset = 0;
gchar version[5]; /* 2 digits for main version; '.'; 1 digit for sub version; NULL */
- proto_tree_add_item(rsync_tree, hf_rsync_hdr_magic, tvb, offset, RSYNCD_MAGIC_HEADER_LEN, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_hdr_magic, tvb, offset, RSYNCD_MAGIC_HEADER_LEN, ENC_ASCII|ENC_NA);
offset += RSYNCD_MAGIC_HEADER_LEN;
offset++; /* skip the space */
- proto_tree_add_item(rsync_tree, hf_rsync_hdr_version, tvb, offset, sizeof(version)-1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_hdr_version, tvb, offset, sizeof(version)-1, ENC_ASCII|ENC_NA);
tvb_get_nstringz0(tvb, offset, sizeof(version), version);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s Initialisation (Version %s)", (me == SERVER ? "Server" : "Client"), version);
@@ -132,27 +159,27 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
conversation = find_or_create_conversation(pinfo);
- conversation_data = (struct rsync_conversation_data *)conversation_get_proto_data(conversation, proto_rsync);
+ conversation_data = (struct rsync_conversation_data *)conversation_get_proto_data(conversation, hfi_rsync->id);
if (conversation_data == NULL) { /* new conversation */
conversation_data = wmem_new(wmem_file_scope(), struct rsync_conversation_data);
conversation_data->client_state = RSYNC_INIT;
conversation_data->server_state = RSYNC_SERV_INIT;
- conversation_add_proto_data(conversation, proto_rsync, conversation_data);
+ conversation_add_proto_data(conversation, hfi_rsync->id, conversation_data);
}
conversation_set_dissector(conversation, rsync_handle);
- ti = proto_tree_add_item(tree, proto_rsync, tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, hfi_rsync, tvb, 0, -1, ENC_NA);
rsync_tree = proto_item_add_subtree(ti, ett_rsync);
- rsync_frame_data_p = (struct rsync_frame_data *)p_get_proto_data(pinfo->fd, proto_rsync, 0);
+ rsync_frame_data_p = (struct rsync_frame_data *)p_get_proto_data(pinfo->fd, hfi_rsync->id, 0);
if (!rsync_frame_data_p) {
/* then we haven't seen this frame before */
rsync_frame_data_p = wmem_new(wmem_file_scope(), struct rsync_frame_data);
rsync_frame_data_p->state = (me == SERVER) ? conversation_data->server_state : conversation_data->client_state;
- p_add_proto_data(pinfo->fd, proto_rsync, 0, rsync_frame_data_p);
+ p_add_proto_data(pinfo->fd, hfi_rsync->id, 0, rsync_frame_data_p);
}
if (me == SERVER) {
@@ -165,7 +192,7 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case RSYNC_SERV_MOTD:
- proto_tree_add_item(rsync_tree, hf_rsync_motd_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_motd_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
col_set_str(pinfo->cinfo, COL_INFO, "Server MOTD");
@@ -177,14 +204,14 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* there are two cases - file list, or authentication */
if (0 == tvb_strneql(tvb, offset, RSYNCD_AUTHREQD, RSYNCD_AUTHREQD_LEN)) {
/* matches, so we assume its an authentication message */
- proto_tree_add_item(rsync_tree, hf_rsync_rsyncdok_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_rsyncdok_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
col_set_str(pinfo->cinfo, COL_INFO, "Authentication");
conversation_data->server_state = RSYNC_DATA;
} else { /* it didn't match, so it is probably a module list */
- proto_tree_add_item(rsync_tree, hf_rsync_module_list_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_module_list_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
/* we need to check the end of the buffer for magic string */
buff_length = tvb_length_remaining(tvb, offset);
@@ -202,7 +229,7 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case RSYNC_DATA:
- proto_tree_add_item(rsync_tree, hf_rsync_data, tvb, offset, -1, ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_data, tvb, offset, -1, ENC_NA);
col_set_str(pinfo->cinfo, COL_INFO, "Data");
@@ -224,7 +251,7 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case RSYNC_CLIENT_QUERY:
- proto_tree_add_item(rsync_tree, hf_rsync_query_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_query_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
col_set_str(pinfo->cinfo, COL_INFO, "Client Query");
@@ -241,7 +268,7 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case RSYNC_COMMAND:
/* then we are still sending commands */
- proto_tree_add_item(rsync_tree, hf_rsync_command_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_command_string, tvb, offset, -1, ENC_ASCII|ENC_NA);
col_set_str(pinfo->cinfo, COL_INFO, "Client Command");
@@ -251,7 +278,7 @@ dissect_rsync_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case RSYNC_DATA:
/* then we are still sending commands */
- proto_tree_add_item(rsync_tree, hf_rsync_data, tvb, offset, -1, ENC_NA);
+ proto_tree_add_item(rsync_tree, &hfi_rsync_data, tvb, offset, -1, ENC_NA);
col_set_str(pinfo->cinfo, COL_INFO, "Data");
@@ -281,40 +308,15 @@ void proto_reg_handoff_rsync(void);
void
proto_register_rsync(void)
{
- static hf_register_info hf[] = {
- {&hf_rsync_hdr_magic,
- {"Magic Header", "rsync.hdr_magic",
- FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
- },
- {&hf_rsync_hdr_version,
- {"Header Version", "rsync.hdr_version",
- FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
- },
- {&hf_rsync_query_string,
- {"Client Query String", "rsync.query",
- FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
- },
- {&hf_rsync_module_list_string,
- {"Server Module List", "rsync.module_list",
- FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
- },
- {&hf_rsync_motd_string,
- {"Server MOTD String", "rsync.motd",
- FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
- },
- {&hf_rsync_rsyncdok_string,
- {"RSYNCD Response String", "rsync.response",
- FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
- },
- {&hf_rsync_command_string,
- {"Client Command String", "rsync.command",
- FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
- },
- {&hf_rsync_data,
- {"rsync data", "rsync.data",
- FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
- },
-
+ static header_field_info *hfi[] = {
+ &hfi_rsync_hdr_magic,
+ &hfi_rsync_hdr_version,
+ &hfi_rsync_query_string,
+ &hfi_rsync_module_list_string,
+ &hfi_rsync_motd_string,
+ &hfi_rsync_rsyncdok_string,
+ &hfi_rsync_command_string,
+ &hfi_rsync_data,
};
static gint *ett[] = {
@@ -323,9 +325,13 @@ proto_register_rsync(void)
module_t *rsync_module;
+ int proto_rsync;
+
proto_rsync = proto_register_protocol("RSYNC File Synchroniser",
"RSYNC", "rsync");
- proto_register_field_array(proto_rsync, hf, array_length(hf));
+ hfi_rsync = proto_registrar_get_nth(proto_rsync);
+
+ proto_register_fields(proto_rsync, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
rsync_module = prefs_register_protocol(proto_rsync, proto_reg_handoff_rsync);
@@ -339,6 +345,8 @@ proto_register_rsync(void)
"Whether the RSYNC dissector should reassemble messages spanning multiple TCP segments."
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&rsync_desegment);
+
+ rsync_handle = new_create_dissector_handle(dissect_rsync, proto_rsync);
}
void
proto_reg_handoff_rsync(void)
@@ -347,7 +355,6 @@ proto_reg_handoff_rsync(void)
static guint saved_rsync_tcp_port;
if (!initialized) {
- rsync_handle = new_create_dissector_handle(dissect_rsync, proto_rsync);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", saved_rsync_tcp_port, rsync_handle);
diff --git a/epan/dissectors/packet-rwall.c b/epan/dissectors/packet-rwall.c
index 0a3df1180b..d9496ae519 100644
--- a/epan/dissectors/packet-rwall.c
+++ b/epan/dissectors/packet-rwall.c
@@ -21,57 +21,63 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
+#define NEW_PROTO_TREE_API
+#include "config.h"
#include "packet-rpc.h"
#include "packet-rwall.h"
-static int proto_rwall = -1;
-static int hf_rwall_procedure_v1 = -1;
-static int hf_rwall_message = -1;
+static header_field_info *hfi_rwall = NULL;
+
+#define RWALL_HFI_INIT HFI_INIT(proto_rwall)
+
+static const value_string rwall1_proc_vals[] = {
+ { RWALL_WALL, "RWALL" },
+ { 0, NULL }
+};
+
+static header_field_info hfi_rwall_procedure_v1 RWALL_HFI_INIT = {
+ "V1 Procedure", "rwall.procedure_v1", FT_UINT32, BASE_DEC,
+ VALS(rwall1_proc_vals), 0, NULL, HFILL };
+
+static header_field_info hfi_rwall_message RWALL_HFI_INIT = {
+ "Message", "rwall.message", FT_STRING, BASE_NONE,
+ NULL, 0, NULL, HFILL };
static gint ett_rwall = -1;
static int
dissect_rwall_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_rpc_string(tvb, tree, hf_rwall_message, offset, NULL);
+ offset = dissect_rpc_string(tvb, tree, hfi_rwall_message.id, offset, NULL);
return offset;
}
static const vsff rwall1_proc[] = {
- { RWALL_WALL, "RWALL",
- dissect_rwall_call, NULL },
+ { RWALL_WALL, "RWALL", dissect_rwall_call, NULL },
{ 0, NULL, NULL, NULL }
};
-static const value_string rwall1_proc_vals[] = {
- { RWALL_WALL, "RWALL" },
- { 0, NULL }
-};
-
void
proto_register_rwall(void)
{
- static hf_register_info hf[] = {
- { &hf_rwall_procedure_v1, {
- "V1 Procedure", "rwall.procedure_v1", FT_UINT32, BASE_DEC,
- VALS(rwall1_proc_vals), 0, NULL, HFILL }},
- { &hf_rwall_message, {
- "Message", "rwall.message", FT_STRING, BASE_NONE,
- NULL, 0, NULL, HFILL }}
+ static header_field_info *hfi[] = {
+ &hfi_rwall_procedure_v1,
+ &hfi_rwall_message,
};
static gint *ett[] = {
&ett_rwall,
};
- proto_rwall = proto_register_protocol("Remote Wall protocol",
- "RWALL", "rwall");
- proto_register_field_array(proto_rwall, hf, array_length(hf));
+ int proto_rwall;
+
+ proto_rwall = proto_register_protocol("Remote Wall protocol", "RWALL", "rwall");
+ hfi_rwall = proto_registrar_get_nth(proto_rwall);
+
+ proto_register_fields(proto_rwall, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
}
@@ -79,9 +85,9 @@ void
proto_reg_handoff_rwall(void)
{
/* Register the protocol as RPC */
- rpc_init_prog(proto_rwall, RWALL_PROGRAM, ett_rwall);
+ rpc_init_prog(hfi_rwall->id, RWALL_PROGRAM, ett_rwall);
/* Register the procedure tables */
- rpc_init_proc_table(RWALL_PROGRAM, 1, rwall1_proc, hf_rwall_procedure_v1);
+ rpc_init_proc_table(RWALL_PROGRAM, 1, rwall1_proc, hfi_rwall_procedure_v1.id);
}
diff --git a/epan/dissectors/packet-stat.c b/epan/dissectors/packet-stat.c
index 16844c59a7..e9843476d4 100644
--- a/epan/dissectors/packet-stat.c
+++ b/epan/dissectors/packet-stat.c
@@ -27,28 +27,95 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
+#define NEW_PROTO_TREE_API
+#include "config.h"
#include "packet-rpc.h"
#include "packet-stat.h"
-static int proto_stat = -1;
-static int hf_stat_procedure_v1 = -1;
-static int hf_stat_mon_name = -1;
-static int hf_stat_stat_res = -1;
-static int hf_stat_stat_res_res = -1;
-static int hf_stat_stat_res_state = -1;
-static int hf_stat_state = -1;
-static int hf_stat_mon = -1;
-static int hf_stat_mon_id_name = -1;
-static int hf_stat_my_id = -1;
-static int hf_stat_my_id_hostname = -1;
-static int hf_stat_my_id_prog = -1;
-static int hf_stat_my_id_vers = -1;
-static int hf_stat_my_id_proc = -1;
-static int hf_stat_priv = -1;
-static int hf_stat_stat_chge = -1;
+static header_field_info *hfi_stat = NULL;
+
+#define STAT_HFI_INIT HFI_INIT(proto_stat)
+
+static const value_string stat1_proc_vals[] = {
+ { 0, "NULL" },
+ { STATPROC_STAT, "STAT" },
+ { STATPROC_MON, "MON" },
+ { STATPROC_UNMON, "UNMON" },
+ { STATPROC_UNMON_ALL, "UNMON_ALL" },
+ { STATPROC_SIMU_CRASH, "SIMU_CRASH" },
+ { STATPROC_NOTIFY, "NOTIFY" },
+ { 0, NULL }
+};
+
+static header_field_info hfi_stat_procedure_v1 STAT_HFI_INIT = {
+ "V1 Procedure", "stat.procedure_v1", FT_UINT32, BASE_DEC,
+ VALS(stat1_proc_vals), 0, NULL, HFILL };
+
+static header_field_info hfi_stat_mon_name STAT_HFI_INIT = {
+ "Name", "stat.name", FT_STRING, BASE_NONE,
+ NULL, 0, NULL, HFILL };
+
+static header_field_info hfi_stat_stat_res STAT_HFI_INIT = {
+ "Status Result", "stat.stat_res", FT_NONE,BASE_NONE,
+ NULL, 0, NULL, HFILL };
+
+static const value_string stat_res[] =
+{
+ { 0, "STAT_SUCC" },
+ { 1, "STAT_FAIL" },
+ { 0, NULL }
+};
+
+static header_field_info hfi_stat_stat_res_res STAT_HFI_INIT = {
+ "Result", "stat.stat_res.res", FT_UINT32, BASE_DEC,
+ VALS(stat_res), 0, NULL, HFILL };
+
+static header_field_info hfi_stat_stat_res_state STAT_HFI_INIT = {
+ "State", "stat.stat_res.state", FT_UINT32, BASE_DEC,
+ NULL, 0, NULL, HFILL };
+
+static header_field_info hfi_stat_state STAT_HFI_INIT = {
+ "State", "stat.state", FT_UINT32, BASE_DEC,
+ NULL, 0, "State of local NSM", HFILL };
+
+static header_field_info hfi_stat_mon STAT_HFI_INIT = {
+ "Monitor", "stat.mon", FT_NONE, BASE_NONE,
+ NULL, 0, "Monitor Host", HFILL };
+
+static header_field_info hfi_stat_mon_id_name STAT_HFI_INIT = {
+ "Monitor ID Name", "stat.mon_id.name", FT_STRING, BASE_NONE,
+ NULL, 0, NULL, HFILL };
+
+static header_field_info hfi_stat_my_id STAT_HFI_INIT = {
+ "My ID", "stat.my_id", FT_NONE,BASE_NONE,
+ NULL, 0, "My_ID structure", HFILL };
+
+static header_field_info hfi_stat_my_id_hostname STAT_HFI_INIT = {
+ "Hostname", "stat.my_id.hostname", FT_STRING, BASE_NONE,
+ NULL, 0, "My_ID Host to callback", HFILL };
+
+static header_field_info hfi_stat_my_id_prog STAT_HFI_INIT = {
+ "Program", "stat.my_id.prog", FT_UINT32, BASE_DEC,
+ NULL, 0, "My_ID Program to callback", HFILL };
+
+static header_field_info hfi_stat_my_id_vers STAT_HFI_INIT = {
+ "Version", "stat.my_id.vers", FT_UINT32, BASE_DEC,
+ NULL, 0, "My_ID Version of callback", HFILL };
+
+static header_field_info hfi_stat_my_id_proc STAT_HFI_INIT = {
+ "Procedure", "stat.my_id.proc", FT_UINT32, BASE_DEC,
+ NULL, 0, "My_ID Procedure to callback", HFILL };
+
+static header_field_info hfi_stat_priv STAT_HFI_INIT = {
+ "Priv", "stat.priv", FT_BYTES, BASE_NONE,
+ NULL, 0, "Private client supplied opaque data", HFILL };
+
+static header_field_info hfi_stat_stat_chge STAT_HFI_INIT = {
+ "Status Change", "stat.stat_chge", FT_NONE, BASE_NONE,
+ NULL, 0, "Status Change structure", HFILL };
+
static gint ett_stat = -1;
static gint ett_stat_stat_res = -1;
@@ -59,13 +126,6 @@ static gint ett_stat_stat_chge = -1;
#define STAT_SUCC 0
#define STAT_FAIL 1
-static const value_string stat_res[] =
-{
- { 0, "STAT_SUCC" },
- { 1, "STAT_FAIL" },
- { 0, NULL }
-};
-
/* Calculate length (including padding) of my_id structure.
* First read the length of the string and round it upwards to nearest
* multiple of 4, then add 16 (4*uint32)
@@ -108,7 +168,7 @@ dissect_stat_stat(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree
{
if (tree)
{
- offset = dissect_rpc_string(tvb,tree,hf_stat_mon_name,offset,NULL);
+ offset = dissect_rpc_string(tvb,tree,hfi_stat_mon_name.id,offset,NULL);
}
return offset;
@@ -122,17 +182,17 @@ dissect_stat_stat_res(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_t
gint32 res;
if (tree) {
- sub_item = proto_tree_add_item(tree, hf_stat_stat_res, tvb,
+ sub_item = proto_tree_add_item(tree, &hfi_stat_stat_res, tvb,
offset, -1, ENC_NA);
if (sub_item)
sub_tree = proto_item_add_subtree(sub_item, ett_stat_stat_res);
}
res = tvb_get_ntohl(tvb, offset);
- offset = dissect_rpc_uint32(tvb,sub_tree,hf_stat_stat_res_res,offset);
+ offset = dissect_rpc_uint32(tvb,sub_tree,hfi_stat_stat_res_res.id,offset);
if (res==STAT_SUCC) {
- offset = dissect_rpc_uint32(tvb,sub_tree,hf_stat_stat_res_state,offset);
+ offset = dissect_rpc_uint32(tvb,sub_tree,hfi_stat_stat_res_state.id,offset);
} else {
offset += 4;
}
@@ -147,16 +207,16 @@ dissect_stat_my_id(tvbuff_t *tvb, int offset, proto_tree *tree)
proto_tree* sub_tree = NULL;
if (tree) {
- sub_item = proto_tree_add_item(tree, hf_stat_my_id, tvb,
+ sub_item = proto_tree_add_item(tree, &hfi_stat_my_id, tvb,
offset, my_id_len(tvb,offset), ENC_NA);
if (sub_item)
sub_tree = proto_item_add_subtree(sub_item, ett_stat_my_id);
}
- offset = dissect_rpc_string(tvb,sub_tree,hf_stat_my_id_hostname,offset,NULL);
- offset = dissect_rpc_uint32(tvb,sub_tree,hf_stat_my_id_prog,offset);
- offset = dissect_rpc_uint32(tvb,sub_tree,hf_stat_my_id_vers,offset);
- offset = dissect_rpc_uint32(tvb,sub_tree,hf_stat_my_id_proc,offset);
+ offset = dissect_rpc_string(tvb,sub_tree,hfi_stat_my_id_hostname.id,offset,NULL);
+ offset = dissect_rpc_uint32(tvb,sub_tree,hfi_stat_my_id_prog.id,offset);
+ offset = dissect_rpc_uint32(tvb,sub_tree,hfi_stat_my_id_vers.id,offset);
+ offset = dissect_rpc_uint32(tvb,sub_tree,hfi_stat_my_id_proc.id,offset);
return offset;
}
@@ -168,14 +228,14 @@ dissect_stat_mon_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
proto_tree* sub_tree = NULL;
if (tree) {
- sub_item = proto_tree_add_item(tree, hf_stat_mon, tvb,
+ sub_item = proto_tree_add_item(tree, &hfi_stat_mon, tvb,
offset, mon_id_len(tvb,offset), ENC_NA);
if (sub_item)
sub_tree = proto_item_add_subtree(sub_item, ett_stat_mon);
}
- offset = dissect_rpc_string(tvb,sub_tree,hf_stat_mon_id_name,offset,NULL);
+ offset = dissect_rpc_string(tvb,sub_tree,hfi_stat_mon_id_name.id,offset,NULL);
offset = dissect_stat_my_id(tvb,offset,sub_tree);
@@ -185,7 +245,7 @@ dissect_stat_mon_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
static int
dissect_stat_priv(tvbuff_t *tvb, int offset, proto_tree *tree)
{
- proto_tree_add_item(tree, hf_stat_priv, tvb, offset, 16, ENC_NA);
+ proto_tree_add_item(tree, &hfi_stat_priv, tvb, offset, 16, ENC_NA);
offset += 16;
return offset;
@@ -204,7 +264,7 @@ dissect_stat_mon(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree
static int
dissect_stat_state(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_rpc_uint32(tvb,tree,hf_stat_state,offset);
+ offset = dissect_rpc_uint32(tvb,tree,hfi_stat_state.id,offset);
return offset;
}
@@ -217,15 +277,15 @@ dissect_stat_notify(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
int start_offset = offset;
if (tree) {
- sub_item = proto_tree_add_item(tree, hf_stat_stat_chge, tvb,
+ sub_item = proto_tree_add_item(tree, &hfi_stat_stat_chge, tvb,
offset, -1, ENC_NA);
if (sub_item)
sub_tree = proto_item_add_subtree(sub_item, ett_stat_stat_chge);
}
- offset = dissect_rpc_string(tvb,sub_tree,hf_stat_mon_id_name,offset,NULL);
+ offset = dissect_rpc_string(tvb,sub_tree,hfi_stat_mon_id_name.id,offset,NULL);
- offset = dissect_rpc_uint32(tvb,tree,hf_stat_state,offset);
+ offset = dissect_rpc_uint32(tvb,tree,hfi_stat_state.id,offset);
if(sub_item)
proto_item_set_len(sub_item, offset - start_offset);
@@ -260,68 +320,28 @@ static const vsff stat1_proc[] = {
dissect_stat_notify, NULL },
{ 0, NULL, NULL, NULL }
};
-static const value_string stat1_proc_vals[] = {
- { 0, "NULL" },
- { STATPROC_STAT, "STAT" },
- { STATPROC_MON, "MON" },
- { STATPROC_UNMON, "UNMON" },
- { STATPROC_UNMON_ALL, "UNMON_ALL" },
- { STATPROC_SIMU_CRASH, "SIMU_CRASH" },
- { STATPROC_NOTIFY, "NOTIFY" },
- { 0, NULL }
-};
/* end of stat version 1 */
void
proto_register_stat(void)
{
- static hf_register_info hf[] = {
- { &hf_stat_procedure_v1, {
- "V1 Procedure", "stat.procedure_v1", FT_UINT32, BASE_DEC,
- VALS(stat1_proc_vals), 0, NULL, HFILL }},
- { &hf_stat_mon_name, {
- "Name", "stat.name", FT_STRING, BASE_NONE,
- NULL, 0, NULL, HFILL }},
- { &hf_stat_stat_res, {
- "Status Result", "stat.stat_res", FT_NONE,BASE_NONE,
- NULL, 0, NULL, HFILL }},
- { &hf_stat_stat_res_res, {
- "Result", "stat.stat_res.res", FT_UINT32, BASE_DEC,
- VALS(stat_res), 0, NULL, HFILL }},
- { &hf_stat_stat_res_state, {
- "State", "stat.stat_res.state", FT_UINT32, BASE_DEC,
- NULL, 0, NULL, HFILL }},
- { &hf_stat_mon, {
- "Monitor", "stat.mon", FT_NONE, BASE_NONE,
- NULL, 0, "Monitor Host", HFILL }},
- { &hf_stat_mon_id_name, {
- "Monitor ID Name", "stat.mon_id.name", FT_STRING, BASE_NONE,
- NULL, 0, NULL, HFILL }},
- { &hf_stat_my_id, {
- "My ID", "stat.my_id", FT_NONE,BASE_NONE,
- NULL, 0, "My_ID structure", HFILL }},
- { &hf_stat_my_id_hostname, {
- "Hostname", "stat.my_id.hostname", FT_STRING, BASE_NONE,
- NULL, 0, "My_ID Host to callback", HFILL }},
- { &hf_stat_my_id_prog, {
- "Program", "stat.my_id.prog", FT_UINT32, BASE_DEC,
- NULL, 0, "My_ID Program to callback", HFILL }},
- { &hf_stat_my_id_vers, {
- "Version", "stat.my_id.vers", FT_UINT32, BASE_DEC,
- NULL, 0, "My_ID Version of callback", HFILL }},
- { &hf_stat_my_id_proc, {
- "Procedure", "stat.my_id.proc", FT_UINT32, BASE_DEC,
- NULL, 0, "My_ID Procedure to callback", HFILL }},
- { &hf_stat_priv, {
- "Priv", "stat.priv", FT_BYTES, BASE_NONE,
- NULL, 0, "Private client supplied opaque data", HFILL }},
- { &hf_stat_state, {
- "State", "stat.state", FT_UINT32, BASE_DEC,
- NULL, 0, "State of local NSM", HFILL }},
- { &hf_stat_stat_chge, {
- "Status Change", "stat.stat_chge", FT_NONE, BASE_NONE,
- NULL, 0, "Status Change structure", HFILL }},
+ static header_field_info *hfi[] = {
+ &hfi_stat_procedure_v1,
+ &hfi_stat_mon_name,
+ &hfi_stat_stat_res,
+ &hfi_stat_stat_res_res,
+ &hfi_stat_stat_res_state,
+ &hfi_stat_mon,
+ &hfi_stat_mon_id_name,
+ &hfi_stat_my_id,
+ &hfi_stat_my_id_hostname,
+ &hfi_stat_my_id_prog,
+ &hfi_stat_my_id_vers,
+ &hfi_stat_my_id_proc,
+ &hfi_stat_priv,
+ &hfi_stat_state,
+ &hfi_stat_stat_chge,
};
static gint *ett[] = {
@@ -332,8 +352,12 @@ proto_register_stat(void)
&ett_stat_stat_chge,
};
+ int proto_stat;
+
proto_stat = proto_register_protocol("Network Status Monitor Protocol", "STAT", "stat");
- proto_register_field_array(proto_stat, hf, array_length(hf));
+ hfi_stat = proto_registrar_get_nth(proto_stat);
+
+ proto_register_fields(proto_stat, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
}
@@ -341,7 +365,7 @@ void
proto_reg_handoff_stat(void)
{
/* Register the protocol as RPC */
- rpc_init_prog(proto_stat, STAT_PROGRAM, ett_stat);
+ rpc_init_prog(hfi_stat->id, STAT_PROGRAM, ett_stat);
/* Register the procedure tables */
- rpc_init_proc_table(STAT_PROGRAM, 1, stat1_proc, hf_stat_procedure_v1);
+ rpc_init_proc_table(STAT_PROGRAM, 1, stat1_proc, hfi_stat_procedure_v1.id);
}
diff --git a/epan/dissectors/packet-tali.c b/epan/dissectors/packet-tali.c
index 16a49cf593..cb8c873db9 100644
--- a/epan/dissectors/packet-tali.c
+++ b/epan/dissectors/packet-tali.c
@@ -31,6 +31,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+
+#define NEW_PROTO_TREE_API
+
#include "config.h"
#include <string.h>
@@ -63,13 +66,21 @@ static gint ett_tali_sync = -1;
static gint ett_tali_opcode = -1;
static gint ett_tali_msu_length = -1;
-static int proto_tali = -1;
-static dissector_table_t tali_dissector_table;
+static header_field_info *hfi_tali = NULL;
+
+#define TALI_HFI_INIT HFI_INIT(proto_tali)
/* Initialize the protocol and registered fields */
-static int hf_tali_sync_indicator = -1;
-static int hf_tali_opcode_indicator = -1;
-static int hf_tali_length_indicator = -1;
+static header_field_info hfi_tali_sync_indicator TALI_HFI_INIT =
+ { "Sync", "tali.sync", FT_STRING, BASE_NONE, NULL, 0x00, "TALI SYNC", HFILL };
+
+static header_field_info hfi_tali_opcode_indicator TALI_HFI_INIT =
+ { "Opcode", "tali.opcode", FT_STRING, BASE_NONE, NULL, 0x00, "TALI Operation Code", HFILL };
+
+static header_field_info hfi_tali_length_indicator TALI_HFI_INIT =
+ { "Length", "tali.msu_length", FT_UINT16, BASE_DEC, NULL, 0x00, "TALI MSU Length", HFILL };
+
+static dissector_table_t tali_dissector_table;
static dissector_handle_t data_handle;
@@ -109,11 +120,11 @@ dissect_tali_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (tree) {
/* create display subtree for the protocol */
- tali_item = proto_tree_add_item(tree, proto_tali, tvb, 0, TALI_HEADER_LENGTH, ENC_NA);
+ tali_item = proto_tree_add_item(tree, hfi_tali, tvb, 0, TALI_HEADER_LENGTH, ENC_NA);
tali_tree = proto_item_add_subtree(tali_item, ett_tali);
- proto_tree_add_string(tali_tree, hf_tali_sync_indicator, tvb, 0, TALI_SYNC_LENGTH, TALI_SYNC);
- proto_tree_add_string(tali_tree, hf_tali_opcode_indicator, tvb, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH, opcode);
- proto_tree_add_uint(tali_tree, hf_tali_length_indicator, tvb, TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH, TALI_MSU_LENGTH, length);
+ proto_tree_add_string(tali_tree, &hfi_tali_sync_indicator, tvb, 0, TALI_SYNC_LENGTH, TALI_SYNC);
+ proto_tree_add_string(tali_tree, &hfi_tali_opcode_indicator, tvb, TALI_SYNC_LENGTH, TALI_OPCODE_LENGTH, opcode);
+ proto_tree_add_uint(tali_tree, &hfi_tali_length_indicator, tvb, TALI_SYNC_LENGTH + TALI_OPCODE_LENGTH, TALI_MSU_LENGTH, length);
}
if (length > 0) {
@@ -169,13 +180,10 @@ dissect_tali_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
void
proto_register_tali(void)
{
- static hf_register_info hf[] = {
- { &hf_tali_sync_indicator,
- { "Sync", "tali.sync", FT_STRING, BASE_NONE, NULL, 0x00, "TALI SYNC", HFILL }},
- { &hf_tali_opcode_indicator,
- { "Opcode", "tali.opcode", FT_STRING, BASE_NONE, NULL, 0x00, "TALI Operation Code", HFILL }},
- { &hf_tali_length_indicator,
- { "Length", "tali.msu_length", FT_UINT16, BASE_DEC, NULL, 0x00, "TALI MSU Length", HFILL }}
+ static header_field_info *hfi[] = {
+ &hfi_tali_sync_indicator,
+ &hfi_tali_opcode_indicator,
+ &hfi_tali_length_indicator
};
/* Setup protocol subtree array */
@@ -187,12 +195,16 @@ proto_register_tali(void)
};
module_t *tali_module;
+ int proto_tali;
+
/* Register the protocol name and description */
proto_tali = proto_register_protocol("Transport Adapter Layer Interface v1.0, RFC 3094", "TALI", "tali");
+ hfi_tali = proto_registrar_get_nth(proto_tali);
+
register_dissector("tali", dissect_tali, proto_tali);
/* Required function calls to register the header fields and subtrees used */
- proto_register_field_array(proto_tali, hf, array_length(hf));
+ proto_register_fields(proto_tali, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
tali_dissector_table = register_dissector_table("tali.opcode", "Tali OPCODE", FT_STRING, BASE_NONE);
@@ -208,7 +220,7 @@ proto_register_tali(void)
void
proto_reg_handoff_tali(void)
{
- heur_dissector_add("tcp", dissect_tali_heur, proto_tali);
+ heur_dissector_add("tcp", dissect_tali_heur, hfi_tali->id);
data_handle = find_dissector("data");
}
diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c
index d285ddc211..5192e3d3be 100644
--- a/epan/dissectors/packet-udp.c
+++ b/epan/dissectors/packet-udp.c
@@ -53,8 +53,6 @@ void proto_reg_handoff_udp(void);
static dissector_handle_t udp_handle;
static dissector_handle_t udplite_handle;
-static int proto_udp;
-
static int udp_tap = -1;
static int udp_follow_tap = -1;
@@ -289,7 +287,7 @@ decode_udp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
gboolean prev_heur_found = FALSE;
if (pinfo->fd->flags.visited) {
- udp_p_info = (udp_p_info_t*)p_get_proto_data(pinfo->fd, proto_udp, pinfo->curr_layer_num);
+ udp_p_info = (udp_p_info_t*)p_get_proto_data(pinfo->fd, hfi_udp->id, pinfo->curr_layer_num);
if (udp_p_info) {
prev_heur_found = udp_p_info->found_heuristic;
}
@@ -334,7 +332,7 @@ decode_udp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
udp_p_info = wmem_new0(wmem_file_scope(), udp_p_info_t);
udp_p_info->found_heuristic = TRUE;
/* pinfo->curr_layer_num-1 because the heuristic dissector added one */
- p_add_proto_data(pinfo->fd, proto_udp, pinfo->curr_layer_num-1, udp_p_info);
+ p_add_proto_data(pinfo->fd, hfi_udp->id, pinfo->curr_layer_num-1, udp_p_info);
}
return;
}
@@ -377,7 +375,7 @@ decode_udp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
udp_p_info = wmem_new0(wmem_file_scope(), udp_p_info_t);
udp_p_info->found_heuristic = TRUE;
/* pinfo->curr_layer_num-1 because the heuristic dissector added one */
- p_add_proto_data(pinfo->fd, proto_udp, pinfo->curr_layer_num-1, udp_p_info);
+ p_add_proto_data(pinfo->fd, hfi_udp->id, pinfo->curr_layer_num-1, udp_p_info);
}
return;
}
@@ -753,7 +751,7 @@ proto_register_udp(void)
{ &ei_udp_checksum_bad, { "udp.checksum_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
};
- int proto_udplite;
+ int proto_udp, proto_udplite;
proto_udp = proto_register_protocol("User Datagram Protocol",
"UDP", "udp");
diff --git a/epan/dissectors/packet-xcsl.c b/epan/dissectors/packet-xcsl.c
index e9f07c04a2..136e2a4155 100644
--- a/epan/dissectors/packet-xcsl.c
+++ b/epan/dissectors/packet-xcsl.c
@@ -25,6 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define NEW_PROTO_TREE_API
#include "config.h"
@@ -40,13 +41,45 @@
#define MAXLEN 4096
/* Initialize the protocol and registered fields */
-static int proto_xcsl = -1;
-static int hf_xcsl_protocol_version = -1;
-static int hf_xcsl_transaction_id = -1;
-static int hf_xcsl_command = -1;
-static int hf_xcsl_result = -1;
-static int hf_xcsl_information = -1;
-static int hf_xcsl_parameter = -1;
+static header_field_info *hfi_xcsl = NULL;
+
+#define XCSL_HFI_INIT HFI_INIT(proto_xcsl)
+
+static header_field_info hfi_xcsl_protocol_version XCSL_HFI_INIT =
+ { "Protocol Version", "xcsl.protocol_version",
+ FT_STRING, BASE_NONE,NULL,0x0,
+ NULL, HFILL
+ };
+
+static header_field_info hfi_xcsl_transaction_id XCSL_HFI_INIT =
+ { "Transaction ID", "xcsl.transacion_id",
+ FT_STRING, BASE_NONE,NULL,0x0,
+ NULL, HFILL
+ };
+
+static header_field_info hfi_xcsl_command XCSL_HFI_INIT =
+ { "Command", "xcsl.command",
+ FT_STRING, BASE_NONE,NULL,0x0,
+ NULL, HFILL
+ };
+
+static header_field_info hfi_xcsl_result XCSL_HFI_INIT =
+ { "Result", "xcsl.result",
+ FT_STRING, BASE_NONE,NULL, 0x0,
+ NULL, HFILL
+ };
+
+static header_field_info hfi_xcsl_information XCSL_HFI_INIT =
+ { "Information", "xcsl.information",
+ FT_STRING, BASE_NONE,NULL,0x0,
+ NULL, HFILL
+ };
+
+static header_field_info hfi_xcsl_parameter XCSL_HFI_INIT =
+ { "Parameter", "xcsl.parameter",
+ FT_STRING, BASE_NONE,NULL,0x0,
+ NULL, HFILL
+ };
/* Initialize the subtree pointers */
static gint ett_xcsl = -1;
@@ -130,7 +163,7 @@ static void dissect_xcsl_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* Create display tree for the xcsl protocol */
if (tree) {
proto_item *xcsl_item;
- xcsl_item = proto_tree_add_item(tree, proto_xcsl, tvb, offset, -1, ENC_NA);
+ xcsl_item = proto_tree_add_item(tree, hfi_xcsl, tvb, offset, -1, ENC_NA);
xcsl_tree = proto_item_add_subtree(xcsl_item, ett_xcsl);
}
@@ -194,15 +227,15 @@ static void dissect_xcsl_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* This is the protocol item */
case 0:
- proto_tree_add_item(xcsl_tree, hf_xcsl_protocol_version, tvb, offset, len, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(xcsl_tree, &hfi_xcsl_protocol_version, tvb, offset, len, ENC_ASCII|ENC_NA);
break;
/* This should be the transaction ID, if non-digit, it is treated as info */
case 1:
if ( isdigit(str[0]) ) {
- proto_tree_add_item(xcsl_tree, hf_xcsl_transaction_id, tvb, offset, len, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(xcsl_tree, &hfi_xcsl_transaction_id, tvb, offset, len, ENC_ASCII|ENC_NA);
} else {
- proto_tree_add_item(xcsl_tree, hf_xcsl_information, tvb, offset, len, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(xcsl_tree, &hfi_xcsl_information, tvb, offset, len, ENC_ASCII|ENC_NA);
}
col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",str);
break;
@@ -220,7 +253,7 @@ static void dissect_xcsl_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
code = val_to_str(result, xcsl_action_vals, "Unknown: %d");
/* Print result code and description */
- xcsl_item = proto_tree_add_item(xcsl_tree, hf_xcsl_result, tvb, offset, len, ENC_ASCII|ENC_NA);
+ xcsl_item = proto_tree_add_item(xcsl_tree, &hfi_xcsl_result, tvb, offset, len, ENC_ASCII|ENC_NA);
proto_item_append_text(xcsl_item, " (%s)", code);
if (result != 0)
@@ -229,7 +262,7 @@ static void dissect_xcsl_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
} else {
request = TRUE;
- proto_tree_add_item(xcsl_tree, hf_xcsl_command, tvb, offset, len, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(xcsl_tree, &hfi_xcsl_command, tvb, offset, len, ENC_ASCII|ENC_NA);
col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", str);
@@ -238,7 +271,7 @@ static void dissect_xcsl_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/* This is a command parameter */
default:
- proto_tree_add_item(xcsl_tree, hf_xcsl_parameter, tvb, offset, len, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(xcsl_tree, &hfi_xcsl_parameter, tvb, offset, len, ENC_ASCII|ENC_NA);
if ( request == TRUE ) {
col_append_fstr(pinfo->cinfo, COL_INFO, ": %s ",str);
@@ -291,49 +324,13 @@ static gboolean dissect_xcsl_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_t
/* register the various xcsl protocol filters */
void proto_register_xcsl(void) {
- static hf_register_info hf[] = {
-
- { &hf_xcsl_protocol_version,
- { "Protocol Version", "xcsl.protocol_version",
- FT_STRING, BASE_NONE,NULL,0x0,
- NULL, HFILL
- }
- },
-
- { &hf_xcsl_transaction_id,
- { "Transaction ID", "xcsl.transacion_id",
- FT_STRING, BASE_NONE,NULL,0x0,
- NULL, HFILL
- }
- },
-
- { &hf_xcsl_command,
- { "Command", "xcsl.command",
- FT_STRING, BASE_NONE,NULL,0x0,
- NULL, HFILL
- }
- },
-
- { &hf_xcsl_result,
- { "Result", "xcsl.result",
- FT_STRING, BASE_NONE,NULL, 0x0,
- NULL, HFILL
- }
- },
-
- { &hf_xcsl_parameter,
- { "Parameter", "xcsl.parameter",
- FT_STRING, BASE_NONE,NULL,0x0,
- NULL, HFILL
- }
- },
-
- { &hf_xcsl_information,
- { "Information", "xcsl.information",
- FT_STRING, BASE_NONE,NULL,0x0,
- NULL, HFILL
- }
- }
+ static header_field_info *hfi[] = {
+ &hfi_xcsl_protocol_version,
+ &hfi_xcsl_transaction_id,
+ &hfi_xcsl_command,
+ &hfi_xcsl_result,
+ &hfi_xcsl_parameter,
+ &hfi_xcsl_information,
};
/* Setup protocol subtree array */
@@ -341,15 +338,18 @@ void proto_register_xcsl(void) {
&ett_xcsl
};
+ int proto_xcsl;
+
/* Register the protocol name and description */
proto_xcsl = proto_register_protocol("Call Specification Language (Xcsl)", "XCSL", "xcsl");
+ hfi_xcsl = proto_registrar_get_nth(proto_xcsl);
/* Required function calls to register the header fields and subtrees used */
- proto_register_field_array(proto_xcsl, hf, array_length(hf));
+ proto_register_fields(proto_xcsl, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
}
/* In case it concerns TCP, try to match on the xcsl header */
void proto_reg_handoff_xcsl(void) {
- heur_dissector_add("tcp", dissect_xcsl_tcp_heur, proto_xcsl);
+ heur_dissector_add("tcp", dissect_xcsl_tcp_heur, hfi_xcsl->id);
}