forked from osmocom/wireshark
Convert more dissectors to use hfinfo instead of hfindex.
svn path=/trunk/; revision=51478
This commit is contained in:
parent
75f4fa5b4b
commit
401cdb009e
|
@ -61,6 +61,8 @@
|
|||
** Mark Lewis - 20th June 2006
|
||||
*/
|
||||
|
||||
#define NEW_PROTO_TREE_API
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <epan/packet.h>
|
||||
|
@ -70,26 +72,96 @@
|
|||
void proto_register_2dparityfec(void);
|
||||
void proto_reg_handoff_2dparityfec(void);
|
||||
|
||||
static dissector_handle_t handle_2dparityfec = NULL;
|
||||
|
||||
static gboolean dissect_fec = FALSE;
|
||||
|
||||
static int proto_2dparityfec = -1;
|
||||
static int fec_rtp_payload_type = 96;
|
||||
static gint ett_2dparityfec = -1;
|
||||
|
||||
static int hf_2dparityfec_snbase_low = -1;
|
||||
static int hf_2dparityfec_length_recovery = -1;
|
||||
static int hf_2dparityfec_rfc2733_ext = -1;
|
||||
static int hf_2dparityfec_pt_recovery = -1;
|
||||
static int hf_2dparityfec_mask = -1;
|
||||
static int hf_2dparityfec_ts_recovery = -1;
|
||||
static int hf_2dparityfec_ts_pro_mpeg_ext = -1;
|
||||
static int hf_2dparityfec_row_flag = -1;
|
||||
static int hf_2dparityfec_type = -1;
|
||||
static int hf_2dparityfec_index = -1;
|
||||
static int hf_2dparityfec_offset = -1;
|
||||
static int hf_2dparityfec_na = -1;
|
||||
static int hf_2dparityfec_snbase_ext = -1;
|
||||
static int hf_2dparityfec_payload = -1;
|
||||
static header_field_info *hfi_2dparityfec = NULL;
|
||||
|
||||
#define _2DPARITYFEC_HFI_INIT HFI_INIT(proto_2dparityfec)
|
||||
|
||||
static header_field_info hfi_2dparityfec_snbase_low _2DPARITYFEC_HFI_INIT =
|
||||
{ "SNBase low",
|
||||
"2dparityfec.snbase_low",
|
||||
FT_UINT16,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_length_recovery _2DPARITYFEC_HFI_INIT =
|
||||
{ "Length recovery",
|
||||
"2dparityfec.lr",
|
||||
FT_UINT16,
|
||||
BASE_HEX,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_rfc2733_ext _2DPARITYFEC_HFI_INIT =
|
||||
{ "RFC2733 Extension (E)",
|
||||
"2dparityfec.e",
|
||||
FT_BOOLEAN,
|
||||
8,
|
||||
NULL,
|
||||
0x80,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_pt_recovery _2DPARITYFEC_HFI_INIT =
|
||||
{ "Payload Type recovery",
|
||||
"2dparityfec.ptr",
|
||||
FT_UINT8,
|
||||
BASE_HEX,
|
||||
NULL,
|
||||
0x7f,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_mask _2DPARITYFEC_HFI_INIT =
|
||||
{ "Mask",
|
||||
"2dparityfec.mask",
|
||||
/*FT_UINT32*/FT_UINT24,
|
||||
BASE_HEX,
|
||||
NULL,
|
||||
/*0x00ffffff*/0x0,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_ts_recovery _2DPARITYFEC_HFI_INIT =
|
||||
{ "Timestamp recovery",
|
||||
"2dparityfec.tsr",
|
||||
FT_UINT32,
|
||||
BASE_HEX,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_ts_pro_mpeg_ext _2DPARITYFEC_HFI_INIT =
|
||||
{ "Pro-MPEG Extension (X)",
|
||||
"2dparityfec.x",
|
||||
FT_BOOLEAN,
|
||||
8,
|
||||
NULL,
|
||||
0x80,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_row_flag _2DPARITYFEC_HFI_INIT =
|
||||
{ "Row FEC (D)",
|
||||
"2dparityfec.d",
|
||||
FT_BOOLEAN,
|
||||
8,
|
||||
NULL,
|
||||
0x40,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static const value_string fec_type_names[] = {
|
||||
{0, "XOR"},
|
||||
|
@ -98,6 +170,67 @@ static const value_string fec_type_names[] = {
|
|||
{0, NULL}
|
||||
};
|
||||
|
||||
static header_field_info hfi_2dparityfec_type _2DPARITYFEC_HFI_INIT =
|
||||
{ "Type",
|
||||
"2dparityfec.type",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
VALS(fec_type_names),
|
||||
0x38,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_index _2DPARITYFEC_HFI_INIT =
|
||||
{ "Index",
|
||||
"2dparityfec.index",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x07,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_offset _2DPARITYFEC_HFI_INIT =
|
||||
{ "Offset",
|
||||
"2dparityfec.offset",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_na _2DPARITYFEC_HFI_INIT =
|
||||
{ "NA",
|
||||
"2dparityfec.na",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_snbase_ext _2DPARITYFEC_HFI_INIT =
|
||||
{ "SNBase ext",
|
||||
"2dparityfec.snbase_ext",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
static header_field_info hfi_2dparityfec_payload _2DPARITYFEC_HFI_INIT =
|
||||
{ "FEC Payload",
|
||||
"2dparityfec.payload",
|
||||
FT_BYTES,
|
||||
BASE_NONE,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL};
|
||||
|
||||
|
||||
static void dissect_2dparityfec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
{
|
||||
guint8 OffsetField;
|
||||
|
@ -138,23 +271,23 @@ static void dissect_2dparityfec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
|
|||
proto_tree *tree_2dparityfec = NULL;
|
||||
gint offset = 0;
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_2dparityfec, tvb, 0, -1, ENC_NA);
|
||||
ti = proto_tree_add_item(tree, hfi_2dparityfec, tvb, 0, -1, ENC_NA);
|
||||
tree_2dparityfec = proto_item_add_subtree(ti, ett_2dparityfec);
|
||||
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_snbase_low, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_length_recovery, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_rfc2733_ext, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_pt_recovery, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_mask, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 3;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_ts_recovery, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_ts_pro_mpeg_ext, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_row_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_index, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_offset, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_na, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_snbase_ext, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, hf_2dparityfec_payload, tvb, offset, -1, ENC_NA);
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_snbase_low, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_length_recovery, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_rfc2733_ext, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_pt_recovery, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_mask, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 3;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_ts_recovery, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_ts_pro_mpeg_ext, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_row_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_index, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_offset, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_na, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_snbase_ext, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
|
||||
proto_tree_add_item(tree_2dparityfec, &hfi_2dparityfec_payload, tvb, offset, -1, ENC_NA);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,148 +296,21 @@ void proto_register_2dparityfec(void)
|
|||
module_t *module_2dparityfec;
|
||||
|
||||
/* Payload type definitions */
|
||||
static hf_register_info hf[] = {
|
||||
{&hf_2dparityfec_snbase_low,
|
||||
{ "SNBase low",
|
||||
"2dparityfec.snbase_low",
|
||||
FT_UINT16,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_length_recovery,
|
||||
{ "Length recovery",
|
||||
"2dparityfec.lr",
|
||||
FT_UINT16,
|
||||
BASE_HEX,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_rfc2733_ext,
|
||||
{ "RFC2733 Extension (E)",
|
||||
"2dparityfec.e",
|
||||
FT_BOOLEAN,
|
||||
8,
|
||||
NULL,
|
||||
0x80,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_pt_recovery,
|
||||
{ "Payload Type recovery",
|
||||
"2dparityfec.ptr",
|
||||
FT_UINT8,
|
||||
BASE_HEX,
|
||||
NULL,
|
||||
0x7f,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_mask,
|
||||
{ "Mask",
|
||||
"2dparityfec.mask",
|
||||
/*FT_UINT32*/FT_UINT24,
|
||||
BASE_HEX,
|
||||
NULL,
|
||||
/*0x00ffffff*/0x0,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_ts_recovery,
|
||||
{ "Timestamp recovery",
|
||||
"2dparityfec.tsr",
|
||||
FT_UINT32,
|
||||
BASE_HEX,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_ts_pro_mpeg_ext,
|
||||
{ "Pro-MPEG Extension (X)",
|
||||
"2dparityfec.x",
|
||||
FT_BOOLEAN,
|
||||
8,
|
||||
NULL,
|
||||
0x80,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_row_flag,
|
||||
{ "Row FEC (D)",
|
||||
"2dparityfec.d",
|
||||
FT_BOOLEAN,
|
||||
8,
|
||||
NULL,
|
||||
0x40,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_type,
|
||||
{ "Type",
|
||||
"2dparityfec.type",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
VALS(fec_type_names),
|
||||
0x38,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_index,
|
||||
{ "Index",
|
||||
"2dparityfec.index",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x07,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_offset,
|
||||
{ "Offset",
|
||||
"2dparityfec.offset",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_na,
|
||||
{ "NA",
|
||||
"2dparityfec.na",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_snbase_ext,
|
||||
{ "SNBase ext",
|
||||
"2dparityfec.snbase_ext",
|
||||
FT_UINT8,
|
||||
BASE_DEC,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL} },
|
||||
|
||||
{&hf_2dparityfec_payload,
|
||||
{ "FEC Payload",
|
||||
"2dparityfec.payload",
|
||||
FT_BYTES,
|
||||
BASE_NONE,
|
||||
NULL,
|
||||
0x0,
|
||||
NULL,
|
||||
HFILL} }
|
||||
|
||||
|
||||
static header_field_info *hfi[] = {
|
||||
&hfi_2dparityfec_snbase_low,
|
||||
&hfi_2dparityfec_length_recovery,
|
||||
&hfi_2dparityfec_rfc2733_ext,
|
||||
&hfi_2dparityfec_pt_recovery,
|
||||
&hfi_2dparityfec_mask,
|
||||
&hfi_2dparityfec_ts_recovery,
|
||||
&hfi_2dparityfec_ts_pro_mpeg_ext,
|
||||
&hfi_2dparityfec_row_flag,
|
||||
&hfi_2dparityfec_type,
|
||||
&hfi_2dparityfec_index,
|
||||
&hfi_2dparityfec_offset,
|
||||
&hfi_2dparityfec_na,
|
||||
&hfi_2dparityfec_snbase_ext,
|
||||
&hfi_2dparityfec_payload,
|
||||
};
|
||||
|
||||
/* Setup protocol subtree array */
|
||||
|
@ -312,12 +318,15 @@ void proto_register_2dparityfec(void)
|
|||
&ett_2dparityfec,
|
||||
};
|
||||
|
||||
int proto_2dparityfec;
|
||||
|
||||
proto_2dparityfec = proto_register_protocol(
|
||||
"Pro-MPEG Code of Practice #3 release 2 FEC Protocol", /* name */
|
||||
"2dparityfec", /* short name */
|
||||
"2dparityfec"); /* abbrev */
|
||||
hfi_2dparityfec = proto_registrar_get_nth(proto_2dparityfec);
|
||||
|
||||
proto_register_field_array(proto_2dparityfec, hf, array_length(hf));
|
||||
proto_register_fields(proto_2dparityfec, hfi, array_length(hfi));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
module_2dparityfec = prefs_register_protocol(proto_2dparityfec,
|
||||
|
@ -329,17 +338,12 @@ void proto_register_2dparityfec(void)
|
|||
"as FEC data corresponding to Pro-MPEG Code of Practice #3 release 2",
|
||||
&dissect_fec);
|
||||
|
||||
handle_2dparityfec = create_dissector_handle(dissect_2dparityfec,
|
||||
proto_2dparityfec);
|
||||
}
|
||||
|
||||
void proto_reg_handoff_2dparityfec(void)
|
||||
{
|
||||
static dissector_handle_t handle_2dparityfec = NULL;
|
||||
|
||||
if (!handle_2dparityfec) {
|
||||
handle_2dparityfec = create_dissector_handle(dissect_2dparityfec,
|
||||
proto_2dparityfec);
|
||||
}
|
||||
|
||||
if (dissect_fec) {
|
||||
dissector_add_uint("rtp.pt", fec_rtp_payload_type, handle_2dparityfec);
|
||||
} else {
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#define NEW_PROTO_TREE_API
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
@ -36,9 +38,22 @@
|
|||
void proto_register_acap(void);
|
||||
void proto_reg_handoff_acap(void);
|
||||
|
||||
static int proto_acap = -1;
|
||||
static int hf_acap_response = -1;
|
||||
static int hf_acap_request = -1;
|
||||
static dissector_handle_t acap_handle;
|
||||
|
||||
static header_field_info *hfi_acap = NULL;
|
||||
|
||||
#define HFI_ACAP HFI_INIT(proto_acap)
|
||||
|
||||
static header_field_info hfi_acap_response HFI_ACAP =
|
||||
{ "Response", "acap.response",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"TRUE if ACAP response", HFILL };
|
||||
|
||||
static header_field_info hfi_acap_request HFI_ACAP =
|
||||
{ "Request", "acap.request",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"TRUE if ACAP request", HFILL };
|
||||
|
||||
|
||||
static gint ett_acap = -1;
|
||||
static gint ett_acap_reqresp = -1;
|
||||
|
@ -84,17 +99,17 @@ dissect_acap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
format_text(line, linelen));
|
||||
|
||||
if (tree) {
|
||||
ti = proto_tree_add_item(tree, proto_acap, tvb, offset, -1,
|
||||
ti = proto_tree_add_item(tree, hfi_acap, tvb, offset, -1,
|
||||
ENC_NA);
|
||||
acap_tree = proto_item_add_subtree(ti, ett_acap);
|
||||
|
||||
if (is_request) {
|
||||
hidden_item = proto_tree_add_boolean(acap_tree,
|
||||
hf_acap_request, tvb, 0, 0, TRUE);
|
||||
&hfi_acap_request, tvb, 0, 0, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
} else {
|
||||
hidden_item = proto_tree_add_boolean(acap_tree,
|
||||
hf_acap_response, tvb, 0, 0, TRUE);
|
||||
&hfi_acap_response, tvb, 0, 0, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
}
|
||||
|
||||
|
@ -159,33 +174,30 @@ dissect_acap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
void
|
||||
proto_register_acap(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_acap_response,
|
||||
{ "Response", "acap.response",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"TRUE if ACAP response", HFILL }},
|
||||
|
||||
{ &hf_acap_request,
|
||||
{ "Request", "acap.request",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"TRUE if ACAP request", HFILL }}
|
||||
static header_field_info *hfi[] = {
|
||||
&hfi_acap_response,
|
||||
&hfi_acap_request,
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_acap,
|
||||
&ett_acap_reqresp,
|
||||
};
|
||||
|
||||
int proto_acap;
|
||||
|
||||
proto_acap = proto_register_protocol("Application Configuration Access Protocol",
|
||||
"ACAP", "acap");
|
||||
proto_register_field_array(proto_acap, hf, array_length(hf));
|
||||
hfi_acap = proto_registrar_get_nth(proto_acap);
|
||||
|
||||
proto_register_fields(proto_acap, hfi, array_length(hfi));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
acap_handle = create_dissector_handle(dissect_acap, proto_acap);
|
||||
}
|
||||
|
||||
void
|
||||
proto_reg_handoff_acap(void)
|
||||
{
|
||||
dissector_handle_t acap_handle;
|
||||
|
||||
acap_handle = create_dissector_handle(dissect_acap, proto_acap);
|
||||
dissector_add_uint("tcp.port", TCP_PORT_ACAP, acap_handle);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#define NEW_PROTO_TREE_API
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
@ -40,10 +42,19 @@ void proto_register_data(void);
|
|||
|
||||
int proto_data = -1;
|
||||
|
||||
static int hf_data_data = -1;
|
||||
static int hf_data_text = -1;
|
||||
static int hf_data_len = -1;
|
||||
static int hf_data_md5_hash = -1;
|
||||
#define DATA_HFI_INIT HFI_INIT(proto_data)
|
||||
|
||||
static header_field_info hfi_data_data DATA_HFI_INIT =
|
||||
{ "Data", "data.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
||||
|
||||
static header_field_info hfi_data_text DATA_HFI_INIT =
|
||||
{ "Text", "data.text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
||||
|
||||
static header_field_info hfi_data_len DATA_HFI_INIT =
|
||||
{ "Length", "data.len", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL };
|
||||
|
||||
static header_field_info hfi_data_md5_hash DATA_HFI_INIT =
|
||||
{ "Payload MD5 hash", "data.md5_hash", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL };
|
||||
|
||||
static gboolean new_pane = FALSE;
|
||||
static gboolean show_as_text = FALSE;
|
||||
|
@ -76,10 +87,10 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
|
|||
plurality(bytes, "", "s"));
|
||||
data_tree = proto_item_add_subtree(ti, ett_data);
|
||||
|
||||
proto_tree_add_item(data_tree, hf_data_data, data_tvb, 0, bytes, ENC_NA);
|
||||
proto_tree_add_item(data_tree, &hfi_data_data, data_tvb, 0, bytes, ENC_NA);
|
||||
|
||||
if (show_as_text) {
|
||||
proto_tree_add_item(data_tree, hf_data_text, data_tvb, 0, bytes, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_item(data_tree, &hfi_data_text, data_tvb, 0, bytes, ENC_ASCII|ENC_NA);
|
||||
}
|
||||
|
||||
if(generate_md5_hash) {
|
||||
|
@ -95,11 +106,11 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
|
|||
md5_finish(&md_ctx, digest);
|
||||
|
||||
digest_string = bytestring_to_str(digest, 16, '\0');
|
||||
ti = proto_tree_add_string(data_tree, hf_data_md5_hash, tvb, 0, 0, digest_string);
|
||||
ti = proto_tree_add_string(data_tree, &hfi_data_md5_hash, tvb, 0, 0, digest_string);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
}
|
||||
|
||||
ti = proto_tree_add_int(data_tree, hf_data_len, data_tvb, 0, 0, bytes);
|
||||
ti = proto_tree_add_int(data_tree, &hfi_data_len, data_tvb, 0, 0, bytes);
|
||||
PROTO_ITEM_SET_GENERATED (ti);
|
||||
}
|
||||
}
|
||||
|
@ -108,15 +119,11 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
|
|||
void
|
||||
proto_register_data(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_data_data,
|
||||
{ "Data", "data.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_data_text,
|
||||
{ "Text", "data.text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_data_md5_hash,
|
||||
{ "Payload MD5 hash", "data.md5_hash", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_data_len,
|
||||
{ "Length", "data.len", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }
|
||||
static header_field_info *hfi[] = {
|
||||
&hfi_data_data,
|
||||
&hfi_data_text,
|
||||
&hfi_data_md5_hash,
|
||||
&hfi_data_len,
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
|
@ -133,7 +140,7 @@ proto_register_data(void)
|
|||
|
||||
register_dissector("data", dissect_data, proto_data);
|
||||
|
||||
proto_register_field_array(proto_data, hf, array_length(hf));
|
||||
proto_register_fields(proto_data, hfi, array_length(hfi));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
module_data = prefs_register_protocol( proto_data, NULL);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#define NEW_PROTO_TREE_API
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <epan/packet.h>
|
||||
|
@ -32,8 +34,16 @@
|
|||
void proto_register_daytime(void);
|
||||
void proto_reg_handoff_daytime(void);
|
||||
|
||||
static int proto_daytime = -1;
|
||||
static int hf_daytime_string = -1;
|
||||
static dissector_handle_t daytime_handle;
|
||||
|
||||
static header_field_info *hfi_daytime = NULL;
|
||||
|
||||
#define DAYTIME_HFI_INIT HFI_INIT(proto_daytime)
|
||||
|
||||
static header_field_info hfi_daytime_string DAYTIME_HFI_INIT =
|
||||
{ "Daytime", "daytime.string",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
"String containing time and date", HFILL };
|
||||
|
||||
static gint ett_daytime = -1;
|
||||
|
||||
|
@ -53,13 +63,13 @@ dissect_daytime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
|
||||
if (tree) {
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_daytime, tvb, 0, -1, ENC_NA);
|
||||
ti = proto_tree_add_item(tree, hfi_daytime, tvb, 0, -1, ENC_NA);
|
||||
daytime_tree = proto_item_add_subtree(ti, ett_daytime);
|
||||
|
||||
proto_tree_add_text(daytime_tree, tvb, 0, 0,
|
||||
pinfo->srcport==DAYTIME_PORT ? "Type: Response":"Type: Request");
|
||||
if (pinfo->srcport == DAYTIME_PORT) {
|
||||
proto_tree_add_item(daytime_tree, hf_daytime_string, tvb, 0, -1, ENC_ASCII|ENC_NA);
|
||||
proto_tree_add_item(daytime_tree, &hfi_daytime_string, tvb, 0, -1, ENC_ASCII|ENC_NA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,28 +77,28 @@ dissect_daytime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
void
|
||||
proto_register_daytime(void)
|
||||
{
|
||||
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_daytime_string,
|
||||
{ "Daytime", "daytime.string",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||
"String containing time and date", HFILL }}
|
||||
static header_field_info *hfi[] = {
|
||||
&hfi_daytime_string,
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_daytime,
|
||||
};
|
||||
|
||||
int proto_daytime;
|
||||
|
||||
proto_daytime = proto_register_protocol("Daytime Protocol", "DAYTIME", "daytime");
|
||||
proto_register_field_array(proto_daytime, hf, array_length(hf));
|
||||
hfi_daytime = proto_registrar_get_nth(proto_daytime);
|
||||
|
||||
proto_register_fields(proto_daytime, hfi, array_length(hfi));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
daytime_handle = create_dissector_handle(dissect_daytime, proto_daytime);
|
||||
}
|
||||
|
||||
void
|
||||
proto_reg_handoff_daytime(void)
|
||||
{
|
||||
dissector_handle_t daytime_handle;
|
||||
|
||||
daytime_handle = create_dissector_handle(dissect_daytime, proto_daytime);
|
||||
dissector_add_uint("udp.port", DAYTIME_PORT, daytime_handle);
|
||||
dissector_add_uint("tcp.port", DAYTIME_PORT, daytime_handle);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,6 +23,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define NEW_PROTO_TREE_API
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
@ -32,17 +34,10 @@
|
|||
#include <epan/llcsaps.h>
|
||||
#include "packet-hpext.h"
|
||||
|
||||
static dissector_handle_t hpext_handle;
|
||||
|
||||
static dissector_table_t subdissector_table;
|
||||
|
||||
static dissector_handle_t data_handle;
|
||||
|
||||
static int proto_hpext = -1;
|
||||
|
||||
static int hf_hpext_dxsap = -1;
|
||||
static int hf_hpext_sxsap = -1;
|
||||
|
||||
static gint ett_hpext = -1;
|
||||
|
||||
static const value_string xsap_vals[] = {
|
||||
{ HPEXT_DXSAP, "RBOOT Destination Service Access Point" },
|
||||
{ HPEXT_SXSAP, "RBOOT Source Service Access Point" },
|
||||
|
@ -51,6 +46,24 @@ static const value_string xsap_vals[] = {
|
|||
{ 0x00, NULL }
|
||||
};
|
||||
|
||||
|
||||
static header_field_info *hfi_hpext = NULL;
|
||||
|
||||
#define HPEXT_HFI_INIT HFI_INIT(proto_hpext)
|
||||
|
||||
static header_field_info hfi_hpext_dxsap HPEXT_HFI_INIT =
|
||||
{ "DXSAP", "hpext.dxsap", FT_UINT16, BASE_HEX,
|
||||
VALS(xsap_vals), 0x0, NULL, HFILL };
|
||||
|
||||
static header_field_info hfi_hpext_sxsap HPEXT_HFI_INIT =
|
||||
{ "SXSAP", "hpext.sxsap", FT_UINT16, BASE_HEX,
|
||||
VALS(xsap_vals), 0x0, NULL, HFILL };
|
||||
|
||||
|
||||
static gint ett_hpext = -1;
|
||||
|
||||
static dissector_handle_t data_handle;
|
||||
|
||||
static void
|
||||
dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
{
|
||||
|
@ -65,12 +78,12 @@ dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
sxsap = tvb_get_ntohs(tvb, 5);
|
||||
|
||||
if (tree) {
|
||||
ti = proto_tree_add_item(tree, proto_hpext, tvb, 0, 7, ENC_NA);
|
||||
ti = proto_tree_add_item(tree, hfi_hpext, tvb, 0, 7, ENC_NA);
|
||||
hpext_tree = proto_item_add_subtree(ti, ett_hpext);
|
||||
proto_tree_add_text(hpext_tree, tvb, 0, 3, "Reserved");
|
||||
proto_tree_add_uint(hpext_tree, hf_hpext_dxsap, tvb, 3,
|
||||
proto_tree_add_uint(hpext_tree, &hfi_hpext_dxsap, tvb, 3,
|
||||
2, dxsap);
|
||||
proto_tree_add_uint(hpext_tree, hf_hpext_sxsap, tvb, 5,
|
||||
proto_tree_add_uint(hpext_tree, &hfi_hpext_sxsap, tvb, 5,
|
||||
2, sxsap);
|
||||
}
|
||||
|
||||
|
@ -91,38 +104,35 @@ dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
void
|
||||
proto_register_hpext(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_hpext_dxsap,
|
||||
{ "DXSAP", "hpext.dxsap", FT_UINT16, BASE_HEX,
|
||||
VALS(xsap_vals), 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_hpext_sxsap,
|
||||
{ "SXSAP", "hpext.sxsap", FT_UINT16, BASE_HEX,
|
||||
VALS(xsap_vals), 0x0, NULL, HFILL }}
|
||||
static header_field_info *hfi[] = {
|
||||
&hfi_hpext_dxsap,
|
||||
&hfi_hpext_sxsap,
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
&ett_hpext
|
||||
};
|
||||
|
||||
int proto_hpext;
|
||||
|
||||
proto_hpext = proto_register_protocol(
|
||||
"HP Extended Local-Link Control", "HPEXT", "hpext");
|
||||
proto_register_field_array(proto_hpext, hf, array_length(hf));
|
||||
hfi_hpext = proto_registrar_get_nth(proto_hpext);
|
||||
|
||||
proto_register_fields(proto_hpext, hfi, array_length(hfi));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
/* subdissector code */
|
||||
subdissector_table = register_dissector_table("hpext.dxsap",
|
||||
"HPEXT XSAP", FT_UINT16, BASE_HEX);
|
||||
|
||||
register_dissector("hpext", dissect_hpext, proto_hpext);
|
||||
hpext_handle = register_dissector("hpext", dissect_hpext, proto_hpext);
|
||||
}
|
||||
|
||||
void
|
||||
proto_reg_handoff_hpext(void)
|
||||
{
|
||||
dissector_handle_t hpext_handle;
|
||||
|
||||
data_handle = find_dissector("data");
|
||||
|
||||
hpext_handle = find_dissector("hpext");
|
||||
dissector_add_uint("llc.dsap", SAP_HPEXT, hpext_handle);
|
||||
}
|
||||
|
|
|
@ -2122,6 +2122,9 @@ proto_custom_set(proto_tree* tree, const int field_id,
|
|||
#define proto_tree_add_time(tree, hfinfo, tvb, start, length, value) \
|
||||
proto_tree_add_time(tree, (hfinfo)->id, tvb, start, length, value)
|
||||
|
||||
#define proto_tree_add_int(tree, hfinfo, tvb, start, length, value) \
|
||||
proto_tree_add_int(tree, (hfinfo)->id, tvb, start, length, value)
|
||||
|
||||
#define proto_tree_add_uint(tree, hfinfo, tvb, start, length, value) \
|
||||
proto_tree_add_uint(tree, (hfinfo)->id, tvb, start, length, value)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue