Picking off "easy" dissectors that only have one or two exit points at most.
Change-Id: I96aa9cf53533cbb07105aa400d42922baf3016b3
Reviewed-on: https://code.wireshark.org/review/11860
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
{ 0, NULL }
};
-static void
-dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
+static int
+dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
proto_item *it;
proto_tree *tr;
}
}
+ return tvb_captured_length(tvb);
}
/* Register all the bits needed with the filtering engine */
static dissector_handle_t ms_nonstd_handle;
- ms_nonstd_handle = create_dissector_handle(dissect_ms_nonstd, proto_nonstd);
+ ms_nonstd_handle = new_create_dissector_handle(dissect_ms_nonstd, proto_nonstd);
dissector_add_uint("h245.nsp.h221",0xb500534c, ms_nonstd_handle);
dissector_add_uint("h225.nsp.h221",0xb500534c, ms_nonstd_handle);
return tvb_captured_length(tvb);
}
-static void
-dissect_h223(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_h223(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_h223_common(tvb, pinfo, tree, CT_NONE, 0);
+ return tvb_captured_length(tvb);
}
/* H.223 specifies that the least-significant bit is transmitted first;
data_handle = find_dissector("data");
srp_handle = find_dissector("srp");
- dissector_add_for_decode_as("tcp.port", create_dissector_handle( dissect_h223, proto_h223));
+ dissector_add_for_decode_as("tcp.port", new_create_dissector_handle( dissect_h223, proto_h223));
dissector_add_for_decode_as("tcp.port", h223_bitswapped);
dissector_add_string("rtp_dyn_payload_type","CLEARMODE", h223_bitswapped);
dissector_add_uint("iax2.dataformat", AST_DATAFORMAT_H223_H245, new_create_dissector_handle(dissect_h223_bitswapped_circuit_data, proto_h223_bitswapped));
/* H.261 fields defining a sub tree */
static gint ett_h261 = -1;
-static void
-dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
+static int
+dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
{
proto_item *ti = NULL;
proto_tree *h261_tree = NULL;
/* The rest of the packet is the H.261 stream */
proto_tree_add_item( h261_tree, hf_h261_data, tvb, offset, -1, ENC_NA );
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t h261_handle;
- h261_handle = create_dissector_handle(dissect_h261, proto_h261);
+ h261_handle = new_create_dissector_handle(dissect_h261, proto_h261);
dissector_add_uint("rtp.pt", PT_H261, h261_handle);
dissector_add_uint("iax2.codec", AST_FORMAT_H261, h261_handle);
}
return last;
}
-static void dissect_hcrt(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree)
+static int dissect_hcrt(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_)
{
guint8 type;
proto_item* ti;
while (!dissect_hcrt_message(tvb, pinfo, hcrt_tree, &offset, b0_first, i)) {
i++;
}
+ return tvb_captured_length(tvb);
}
void proto_register_hcrt(void)
static gint hcrt_ethertype;
if (!hcrt_prefs_initialized) {
- hcrt_handle = create_dissector_handle(dissect_hcrt, proto_hcrt);
+ hcrt_handle = new_create_dissector_handle(dissect_hcrt, proto_hcrt);
/* Also register as a dissector that can be selected by a TCP port number via
"decode as" */
dissector_add_for_decode_as("tcp.port", hcrt_handle);
}
}
-static void
-dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_hip_common(tvb, pinfo, tree, FALSE);
+ return tvb_captured_length(tvb);
}
-static void
-dissect_hip_in_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hip_in_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- guint32 nullbytes;
- nullbytes = tvb_get_ntohl(tvb, 0);
- if (nullbytes == 0)
- {
- tvbuff_t *newtvb = tvb_new_subset_remaining(tvb, 4);
- dissect_hip_common(newtvb, pinfo, tree, TRUE);
- }
+ guint32 nullbytes;
+ tvbuff_t *newtvb;
+
+ if (tvb_captured_length(tvb) < 4)
+ return 0;
+
+ nullbytes = tvb_get_ntohl(tvb, 0);
+ if (nullbytes != 0)
+ return 0;
+
+ newtvb = tvb_new_subset_remaining(tvb, 4);
+ dissect_hip_common(newtvb, pinfo, tree, TRUE);
+
+ return tvb_captured_length(tvb);
}
dissector_handle_t hip_handle;
dissector_handle_t hip_handle2;
- hip_handle = create_dissector_handle(dissect_hip, proto_hip);
+ hip_handle = new_create_dissector_handle(dissect_hip, proto_hip);
dissector_add_uint("ip.proto", IP_PROTO_HIP, hip_handle);
- hip_handle2 = create_dissector_handle(dissect_hip_in_udp, proto_hip);
+ hip_handle2 = new_create_dissector_handle(dissect_hip_in_udp, proto_hip);
dissector_add_uint("udp.port", 10500, hip_handle2);
}
/*
return;
}
-static void
-dissect_homeplug_av(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_homeplug_av(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *homeplug_av_tree;
}
ptvcursor_free(cursor);
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t homeplug_av_handle;
- homeplug_av_handle = create_dissector_handle(dissect_homeplug_av, proto_homeplug_av);
+ homeplug_av_handle = new_create_dissector_handle(dissect_homeplug_av, proto_homeplug_av);
dissector_add_uint("ethertype", ETHERTYPE_HOMEPLUG_AV, homeplug_av_handle);
}
return TVB_LEN_GREATEST;
}
-static void
-dissect_homeplug(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
+static int
+dissect_homeplug(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
{
proto_item * it;
proto_tree * homeplug_tree;
}
ptvcursor_free(cursor);
+ return tvb_captured_length(tvb);
}
static void
{
dissector_handle_t homeplug_handle;
- homeplug_handle = create_dissector_handle(dissect_homeplug, proto_homeplug);
+ homeplug_handle = new_create_dissector_handle(dissect_homeplug, proto_homeplug);
dissector_add_uint("ethertype", ETHERTYPE_HOMEPLUG, homeplug_handle);
}
static dissector_handle_t eth_withoutfcs_handle;
-static void
-dissect_hp_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hp_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *hp_erm_tree;
eth_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(eth_withoutfcs_handle, eth_tvb, pinfo, tree);
+ return tvb_captured_length(tvb);
}
void
if (!initialized) {
eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
- hp_erm_handle = create_dissector_handle(dissect_hp_erm, proto_hp_erm);
+ hp_erm_handle = new_create_dissector_handle(dissect_hp_erm, proto_hp_erm);
initialized = TRUE;
} else {
if (hp_erm_udp_port != 0)
static gint ett_hsr_prp_supervision = -1;
/* Code to actually dissect the packets */
-static void
-dissect_hsr_prp_supervision(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hsr_prp_supervision(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *hsr_prp_supervision_tree;
/* Adjust the length of this tvbuff to include only the supervision data.
This allows the rest to be marked as padding. */
tvb_set_reported_length(tvb, offset);
+ return tvb_captured_length(tvb);
}
void proto_reg_handoff_hsr_prp_supervision(void)
{
dissector_handle_t hsr_prp_supervision_handle;
- hsr_prp_supervision_handle = create_dissector_handle(dissect_hsr_prp_supervision, proto_hsr_prp_supervision);
+ hsr_prp_supervision_handle = new_create_dissector_handle(dissect_hsr_prp_supervision, proto_hsr_prp_supervision);
dissector_add_uint("ethertype", ETHERTYPE_PRP, hsr_prp_supervision_handle);
}
static dissector_handle_t data_handle;
/* Code to actually dissect the packets */
-static void
-dissect_hsr_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_hsr_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *hsr_tree;
if (!dissector_try_uint(ethertype_subdissector_table, etype, next_tvb, pinfo, tree))
call_dissector(data_handle, next_tvb, pinfo, hsr_tree);
+ return tvb_captured_length(tvb);
}
void proto_reg_handoff_hsr(void)
{
dissector_handle_t hsr_frame_handle;
- hsr_frame_handle = create_dissector_handle(dissect_hsr_frame, proto_hsr);
+ hsr_frame_handle = new_create_dissector_handle(dissect_hsr_frame, proto_hsr);
dissector_add_uint("ethertype", ETHERTYPE_HSR, hsr_frame_handle);
ethertype_subdissector_table = find_dissector_table("ethertype");
return FALSE;
}
-static void
-dissect_ssdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ssdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
conversation_t *conversation;
http_conv_t *conv_data;
conv_data = get_http_conversation_data(pinfo, &conversation);
dissect_http_message(tvb, 0, pinfo, tree, conv_data, "SSDP", proto_ssdp);
+ return tvb_captured_length(tvb);
}
static void
* XXX - is there anything to dissect in the body of an SSDP
* request or reply? I.e., should there be an SSDP dissector?
*/
- ssdp_handle = create_dissector_handle(dissect_ssdp, proto_ssdp);
+ ssdp_handle = new_create_dissector_handle(dissect_ssdp, proto_ssdp);
dissector_add_uint("udp.port", UDP_PORT_SSDP, ssdp_handle);
ntlmssp_handle = find_dissector("ntlmssp");
static gint proto_message_http = -1;
static gint ett_message_http = -1;
-static void
-dissect_message_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_message_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *subtree;
proto_item *ti;
offset = next_offset;
}
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t message_http_handle;
- message_http_handle = create_dissector_handle(dissect_message_http,
+ message_http_handle = new_create_dissector_handle(dissect_message_http,
proto_message_http);
dissector_add_string("media_type", "message/http", message_http_handle);
return desc;
}
-static void
-dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *i2c_tree;
call_dissector(data_handle, tvb, pinfo, tree);
}
}
+ return tvb_captured_length(tvb);
}
void
data_handle = find_dissector("data");
- i2c_handle = create_dissector_handle(dissect_i2c, proto_i2c);
+ i2c_handle = new_create_dissector_handle(dissect_i2c, proto_i2c);
dissector_add_uint("wtap_encap", WTAP_ENCAP_I2C, i2c_handle);
}
}
/* code to dissect an IAPP packet */
-static void
-dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_iapp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti, *pduitem;
proto_tree *iapp_tree, *pdutree;
codestrval = val_to_str_const(ia_type, iapp_vals, "Unknown Packet");
col_add_fstr(pinfo->cinfo, COL_INFO, "%s(%d) (version=%d)", codestrval, ia_type, ia_version);
- if (tree)
- {
- ti = proto_tree_add_item(tree, proto_iapp, tvb, 0, -1, ENC_NA);
- iapp_tree = proto_item_add_subtree(ti, ett_iapp);
+ ti = proto_tree_add_item(tree, proto_iapp, tvb, 0, -1, ENC_NA);
+ iapp_tree = proto_item_add_subtree(ti, ett_iapp);
- /* common header for all IAPP frames */
+ /* common header for all IAPP frames */
- proto_tree_add_item(iapp_tree, hf_iapp_version, tvb, 0, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(iapp_tree, hf_iapp_type, tvb, 1, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(iapp_tree, hf_iapp_version, tvb, 0, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(iapp_tree, hf_iapp_type, tvb, 1, 1, ENC_BIG_ENDIAN);
- pdutree = proto_tree_add_subtree(iapp_tree, tvb, 2, -1,
- ett_iapp_pdu, &pduitem, "Protocol data units");
+ pdutree = proto_tree_add_subtree(iapp_tree, tvb, 2, -1,
+ ett_iapp_pdu, &pduitem, "Protocol data units");
- dissect_pdus(tvb, pinfo, 2, pdutree, pduitem,
- tvb_captured_length_remaining(tvb, 2));
- }
+ dissect_pdus(tvb, pinfo, 2, pdutree, pduitem,
+ tvb_captured_length_remaining(tvb, 2));
+
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t iapp_handle;
- iapp_handle = create_dissector_handle(dissect_iapp, proto_iapp);
+ iapp_handle = new_create_dissector_handle(dissect_iapp, proto_iapp);
dissector_add_uint("udp.port", UDP_PORT_IAPP, iapp_handle);
}
/*
#define TCP_PORT_ICAP 1344
static int is_icap_message(const guchar *data, int linelen, icap_type_t *type);
-static void
-dissect_icap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_icap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *icap_tree = NULL;
proto_item *ti = NULL;
call_dissector(http_handle, new_tvb, pinfo, icap_tree);
}
}
+
+ return tvb_captured_length(tvb);
}
data_handle = find_dissector("data");
http_handle = find_dissector("http");
- icap_handle = create_dissector_handle(dissect_icap, proto_icap);
+ icap_handle = new_create_dissector_handle(dissect_icap, proto_icap);
dissector_add_uint("tcp.port", TCP_PORT_ICAP, icap_handle);
}
}
}
-static void dissect_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_icp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *icp_tree , *payload_tree;
proto_item *ti;
val_to_str_const(opcode, opcode_vals, "Unknown"), opcode,
request_number);
+ ti = proto_tree_add_item(tree,proto_icp, tvb, 0, message_length, ENC_NA);
+ icp_tree = proto_item_add_subtree(ti, ett_icp);
+
if (tree)
{
-
- ti = proto_tree_add_item(tree,proto_icp, tvb, 0, message_length, ENC_NA);
- icp_tree = proto_item_add_subtree(ti, ett_icp);
-
proto_tree_add_uint(icp_tree,hf_icp_opcode, tvb, 0, 1, opcode);
proto_tree_add_item(icp_tree,hf_icp_version, tvb, 1, 1, ENC_BIG_ENDIAN);
}
proto_tree_add_item(icp_tree, hf_icp_sender_host_ip_address, tvb, 16, 4, ENC_BIG_ENDIAN);
+ }
- payload_tree = proto_tree_add_subtree(icp_tree, tvb,
+ payload_tree = proto_tree_add_subtree(icp_tree, tvb,
20, message_length - 20,
ett_icp_payload, NULL, "Payload");
- dissect_icp_payload(tvb, pinfo, 20, payload_tree, opcode);
- }
+ dissect_icp_payload(tvb, pinfo, 20, payload_tree, opcode);
+
+ return tvb_captured_length(tvb);
}
+
void
proto_register_icp(void)
{
{
dissector_handle_t icp_handle;
- icp_handle = create_dissector_handle(dissect_icp, proto_icp);
+ icp_handle = new_create_dissector_handle(dissect_icp, proto_icp);
dissector_add_uint("udp.port", UDP_PORT_ICP, icp_handle);
}
{ 0, NULL }
};
-static void
-dissect_idp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_idp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *idp_tree;
proto_item *ti;
/*
* Hand off to the dissector for the packet type.
*/
- if (dissector_try_uint(idp_type_dissector_table, type, next_tvb,
- pinfo, tree))
- return;
-
- call_dissector(data_handle, next_tvb, pinfo, tree);
+ if (!dissector_try_uint(idp_type_dissector_table, type, next_tvb,
+ pinfo, tree))
+ {
+ call_dissector(data_handle, next_tvb, pinfo, tree);
+ }
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t idp_handle;
- idp_handle = create_dissector_handle(dissect_idp, proto_idp);
+ idp_handle = new_create_dissector_handle(dissect_idp, proto_idp);
dissector_add_uint("ethertype", ETHERTYPE_XNS_IDP, idp_handle);
dissector_add_uint("chdlc.protocol", ETHERTYPE_XNS_IDP, idp_handle);
/* Is is called twice: For 'Packet List' and for 'Packet Details' */
-static void dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_iec104asdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint Len = tvb_reported_length(tvb);
guint8 Bytex;
/* check length */
if(Len < (guint)(offset + 3)) {
expert_add_info(pinfo, itSignal, &ei_iec104_short_asdu);
- return;
+ return offset;
}
get_InfoObjectAddress(&asdu_info_obj_addr, tvb, &offset, trSignal);
} else {
/* check length */
if(Len < (guint)(offset + 3)) {
expert_add_info(pinfo, itSignal, &ei_iec104_short_asdu);
- return;
+ return offset;
}
get_InfoObjectAddress(&asdu_info_obj_addr, tvb, &offset, trSignal);
}
/* check length */
if(Len < (guint)(offset + asduh.DataLength)) {
expert_add_info(pinfo, itSignal, &ei_iec104_short_asdu);
- return;
+ return offset;
}
switch (asduh.TypeId) {
break;
} /* end 'switch (asdu_typeid)' */
+ return tvb_captured_length(tvb);
}
dissector_handle_t iec104apci_handle;
iec104apci_handle = new_create_dissector_handle(dissect_iec104reas, proto_iec104apci);
- iec104asdu_handle = create_dissector_handle(dissect_iec104asdu, proto_iec104asdu);
+ iec104asdu_handle = new_create_dissector_handle(dissect_iec104asdu, proto_iec104asdu);
dissector_add_uint("tcp.port", IEC104_PORT, iec104apci_handle);
}
static dissector_table_t avb_dissector_table;
-static void
-dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_1722(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *ieee1722_tree = NULL;
col_set_str(pinfo->cinfo, COL_INFO, "AVB Transportation Protocol");
- if (tree) {
- ti = proto_tree_add_item(tree, proto_1722, tvb, 0, -1, ENC_NA);
-
- ieee1722_tree = proto_item_add_subtree(ti, ett_1722);
+ ti = proto_tree_add_item(tree, proto_1722, tvb, 0, -1, ENC_NA);
+ ieee1722_tree = proto_item_add_subtree(ti, ett_1722);
+ if (tree) {
/* Add the CD and Subtype fields
* CD field is 1 bit
* Subtype field is 7 bits
subtype &= 0x7F;
/* call any registered subtype dissectors which use only the common AVTPDU (e.g. 1722.1 and MAAP) */
- if (dissector_try_uint(avb_dissector_table, subtype, tvb, pinfo, tree)) return;
+ if (dissector_try_uint(avb_dissector_table, subtype, tvb, pinfo, tree))
+ return tvb_captured_length(tvb);
if (tree) {
proto_tree_add_item(ieee1722_tree, hf_1722_mrfield, tvb, IEEE_1722_VERSION_OFFSET, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(ieee1722_tree, hf_1722_syt, tvb,
IEEE_1722_SYT_OFFSET, 2, ENC_BIG_ENDIAN);
+ }
- /* Calculate the remaining size by subtracting the CIP header size
+ /* Calculate the remaining size by subtracting the CIP header size
from the value in the packet data length field */
- datalen = tvb_get_ntohs(tvb, IEEE_1722_PKT_DATA_LENGTH_OFFSET);
- datalen -= IEEE_1722_CIP_HEADER_SIZE;
-
- /* Make the Audio sample tree. */
- ti = proto_tree_add_item(ieee1722_tree, hf_1722_data, tvb,
- IEEE_1722_DATA_OFFSET, datalen, ENC_NA);
+ datalen = tvb_get_ntohs(tvb, IEEE_1722_PKT_DATA_LENGTH_OFFSET);
+ datalen -= IEEE_1722_CIP_HEADER_SIZE;
- audio_tree = proto_item_add_subtree(ti, ett_1722_audio);
+ /* Make the Audio sample tree. */
+ ti = proto_tree_add_item(ieee1722_tree, hf_1722_data, tvb,
+ IEEE_1722_DATA_OFFSET, datalen, ENC_NA);
- /* Need to get the offset of where the audio data starts */
- offset = IEEE_1722_DATA_OFFSET;
- dbs = tvb_get_guint8(tvb, IEEE_1722_DBS_OFFSET);
+ audio_tree = proto_item_add_subtree(ti, ett_1722_audio);
- /* If the DBS is ever 0 for whatever reason, then just add the rest of packet as unknown */
- if(dbs == 0)
- expert_add_info(pinfo, ti, &ei_1722_incorrect_dbs);
+ /* Need to get the offset of where the audio data starts */
+ offset = IEEE_1722_DATA_OFFSET;
+ dbs = tvb_get_guint8(tvb, IEEE_1722_DBS_OFFSET);
- else {
+ /* If the DBS is ever 0 for whatever reason, then just add the rest of packet as unknown */
+ if(dbs == 0)
+ expert_add_info(pinfo, ti, &ei_1722_incorrect_dbs);
+ else {
+ if (audio_tree) {
/* Loop through all samples and add them to the audio tree. */
for (j = 0; j < (datalen / (dbs*4)); j++) {
sample_tree = proto_tree_add_subtree_format(audio_tree, tvb, offset, 1, ett_1722_sample, NULL, "Sample %d", j+1);
}
}
}
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
{
dissector_handle_t avbtp_handle;
- avbtp_handle = create_dissector_handle(dissect_1722, proto_1722);
+ avbtp_handle = new_create_dissector_handle(dissect_1722, proto_1722);
dissector_add_uint("ethertype", ETHERTYPE_AVBTP, avbtp_handle);
}
proto_tree_add_item(acmp_tree, hf_acmp_vlan_id, tvb, ACMP_VLAN_ID_OFFSET, 2, ENC_BIG_ENDIAN);
}
-static void
-dissect_17221(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_17221(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 subtype = 0;
proto_item *ieee17221_item;
{
/* Shouldn't get here */
col_set_str(pinfo->cinfo, COL_INFO, "1722.1 Unknown");
- return;
+ return 0;
}
}
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
/* avb17221_handle = find_dissector("ieee1722"); */
- avb17221_handle = create_dissector_handle(dissect_17221, proto_17221);
+ avb17221_handle = new_create_dissector_handle(dissect_17221, proto_17221);
dissector_add_uint("ieee1722.subtype", 0x7A, avb17221_handle);
dissector_add_uint("ieee1722.subtype", 0x7B, avb17221_handle);
dissector_add_uint("ieee1722.subtype", 0x7C, avb17221_handle);
static expert_field ei_clock_reference_type = EI_INIT;
-static void dissect_1722a (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_1722a (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti = NULL;
proto_tree *ieee1722a_tree = NULL;
DISSECTOR_ASSERT_NOT_REACHED();
break;
}
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
{
dissector_handle_t avb1722a_handle;
- avb1722a_handle = create_dissector_handle(dissect_1722a, proto_1722a);
+ avb1722a_handle = new_create_dissector_handle(dissect_1722a, proto_1722a);
dissector_add_uint("ieee1722.subtype", IEEE_1722A_SUBTYPE_AVTP_AUDIO, avb1722a_handle);
dissector_add_uint("ieee1722.subtype", IEEE_1722A_SUBTYPE_CRF, avb1722a_handle);
}
static gint ett_airopeek = -1;
-static void
-dissect_airopeek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_airopeek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *airopeek_tree = NULL;
proto_item *ti;
col_add_fstr(pinfo->cinfo, COL_TX_RATE, "%u.%u",
data_rate / 2,
data_rate & 1 ? 5 : 0);
- if (tree) {
- proto_tree_add_uint64_format_value(airopeek_tree, hf_data_rate, tvb, 0, 1,
+
+ proto_tree_add_uint64_format_value(airopeek_tree, hf_data_rate, tvb, 0, 1,
(guint64)data_rate * 500000,
"%u.%u Mb/s",
data_rate / 2,
data_rate & 1 ? 5 : 0);
- }
phdr.channel = tvb_get_guint8(tvb, 1);
- if (tree)
- proto_tree_add_item(airopeek_tree, hf_channel, tvb, 1, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(airopeek_tree, hf_channel, tvb, 1, 1, ENC_BIG_ENDIAN);
signal_level = tvb_get_guint8(tvb, 2);
/*
pinfo->current_proto = "IEEE 802.11";
next_tvb = tvb_new_subset_remaining(tvb, 4);
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr);
+ return tvb_captured_length(tvb);
}
void proto_register_ieee80211_airopeek(void)
dissector_handle_t airopeek_handle;
/* Register handoff to airopeek-header dissectors */
- airopeek_handle = create_dissector_handle(dissect_airopeek, proto_airopeek);
+ airopeek_handle = new_create_dissector_handle(dissect_airopeek, proto_airopeek);
dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_AIROPEEK,
airopeek_handle);
ieee80211_radio_handle = find_dissector("wlan_radio");
return tvb_get_letohl(tvb, offset);
}
-static void
-dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- proto_tree *prism_tree = NULL, *prism_did_tree = NULL;
+ proto_tree *prism_tree, *prism_did_tree = NULL;
proto_item *ti = NULL, *ti_did = NULL;
tvbuff_t *next_tvb;
int offset;
if ((msgcode == WLANCAP_MAGIC_COOKIE_V1) ||
(msgcode == WLANCAP_MAGIC_COOKIE_V2)) {
call_dissector(wlancap_handle, tvb, pinfo, tree);
- return;
+ return tvb_captured_length(tvb);
}
/*
} else {
/* neither matched - try it as just 802.11 with no Prism header */
call_dissector(ieee80211_handle, tvb, pinfo, tree);
- return;
+ return tvb_captured_length(tvb);
}
/* We don't have any 802.11 metadata yet. */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Prism");
col_clear(pinfo->cinfo, COL_INFO);
- if(tree) {
- ti = proto_tree_add_item(tree, proto_prism, tvb, 0, 144, ENC_NA);
- prism_tree = proto_item_add_subtree(ti, ett_prism);
- }
+ ti = proto_tree_add_item(tree, proto_prism, tvb, 0, 144, ENC_NA);
+ prism_tree = proto_item_add_subtree(ti, ett_prism);
/* Message Code */
- if(tree) {
- proto_tree_add_item(prism_tree, hf_ieee80211_prism_msgcode, tvb, offset, 4, byte_order);
- }
+ proto_tree_add_item(prism_tree, hf_ieee80211_prism_msgcode, tvb, offset, 4, byte_order);
msgcode = tvb_get_enctohl(tvb, offset, byte_order);
offset += 4;
/* Message Length */
- if(tree) {
- proto_tree_add_item(prism_tree, hf_ieee80211_prism_msglen, tvb, offset, 4, byte_order);
- }
+ proto_tree_add_item(prism_tree, hf_ieee80211_prism_msglen, tvb, offset, 4, byte_order);
msglen = tvb_get_enctohl(tvb, offset, byte_order);
offset += 4;
/* Device Name */
- if(tree) {
- proto_tree_add_item(prism_tree, hf_ieee80211_prism_devname, tvb, offset, 16, ENC_ASCII|ENC_NA);
- }
+ proto_tree_add_item(prism_tree, hf_ieee80211_prism_devname, tvb, offset, 16, ENC_ASCII|ENC_NA);
devname_p = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 16, ENC_ASCII);
offset += 16;
/* Status */
status = tvb_get_enctohs(tvb, offset, byte_order);
- if(tree) {
- proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_status, tvb, offset, 2, byte_order);
- }
+ proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_status, tvb, offset, 2, byte_order);
offset += 2;
/* Length */
- if(tree) {
- proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_length, tvb, offset, 2, byte_order);
- }
+ proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_length, tvb, offset, 2, byte_order);
offset += 2;
/* Data, if present... */
break;
default:
- if(tree){
- proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_unknown, tvb, offset, 4, byte_order);
- }
+ proto_tree_add_item(prism_did_tree, hf_ieee80211_prism_did_unknown, tvb, offset, 4, byte_order);
break;
}
}
/* dissect the 802.11 header next */
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, (void *)&phdr);
+ return tvb_captured_length(tvb);
}
static hf_register_info hf_prism[] = {
{
dissector_handle_t prism_handle;
- prism_handle = create_dissector_handle(dissect_prism, proto_prism);
+ prism_handle = new_create_dissector_handle(dissect_prism, proto_prism);
dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11_PRISM, prism_handle);
ieee80211_handle = find_dissector("wlan");
ieee80211_radio_handle = find_dissector("wlan_radio");
* is already decrypted. I added a test in the code to accomodate this.
* For TKIP it seems to stay encrypted.
*/
-static void
-dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
struct ieee_802_11_phdr phdr;
phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags = 0;
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, TRUE, &phdr);
+ return tvb_captured_length(tvb);
}
/*
}
-static void
-dissect_data_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_data_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
guint8 type;
}
break;
}
+ return tvb_captured_length(tvb);
}
void
ieee80211_handle = find_dissector("wlan");
dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11, ieee80211_handle);
- centrino_handle = create_dissector_handle( dissect_ieee80211_centrino, proto_centrino );
+ centrino_handle = new_create_dissector_handle( dissect_ieee80211_centrino, proto_centrino );
dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, centrino_handle);
/* Register handoff to Aruba GRE */
dissector_add_uint("gre.proto", GRE_ARUBA_8360, ieee80211_handle);
dissector_add_uint("gre.proto", GRE_ARUBA_8370, ieee80211_handle);
- data_encap_handle = create_dissector_handle(dissect_data_encap, proto_wlan);
+ data_encap_handle = new_create_dissector_handle(dissect_data_encap, proto_wlan);
dissector_add_uint("ethertype", ETHERTYPE_IEEE80211_DATA_ENCAP,
data_encap_handle);
/* Dissector *************************************************************/
static
-void
-dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree)
+int dissect_ieee8021ad(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, void* data _U_)
{
proto_tree *ptree = NULL;
proto_tree *tagtree = NULL;
(tci >> 13), ((tci >> 12) & 1), (tci & 0xFFF));
/* create the protocol tree */
- ieee8021ad_tree = NULL;
-
- if (tree) {
- ptree = proto_tree_add_item(tree, proto_tree_index, tvb, 0, IEEE8021AD_LEN, ENC_NA);
- ieee8021ad_tree = proto_item_add_subtree(ptree, ett_ieee8021ad);
- }
+ ptree = proto_tree_add_item(tree, proto_tree_index, tvb, 0, IEEE8021AD_LEN, ENC_NA);
+ ieee8021ad_tree = proto_item_add_subtree(ptree, ett_ieee8021ad);
encap_proto = tvb_get_ntohs(tvb, IEEE8021AD_LEN - 2);
ethertype_data.fh_tree = ieee8021ad_tree;
dissect_ieee8021ah_common(next_tvb, pinfo, tree, NULL, proto_tree_index);
}
- return;
} else if (encap_proto == ETHERTYPE_IEEE_802_1AD) {
/* two VLAN tags (i.e. Q-in-Q) */
ctci = tvb_get_ntohs(tvb, IEEE8021AD_LEN);
dissector based on ethertype */
call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, ðertype_data);
}
+ return tvb_captured_length(tvb);
}
void
}
static
-void
-dissect_ieee8021ah(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree)
+int dissect_ieee8021ah(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, void* data _U_)
{
proto_item *pi;
guint32 tci;
} else {
dissect_ieee8021ah_common(tvb, pinfo, tree, NULL, proto_tree_index);
}
+ return tvb_captured_length(tvb);
}
/* Protocol Registration **************************************************/
if (!prefs_initialized){
dissector_handle_t ieee8021ad_handle;
- ieee8021ah_handle = create_dissector_handle(dissect_ieee8021ah,
+ ieee8021ah_handle = new_create_dissector_handle(dissect_ieee8021ah,
proto_ieee8021ah);
- ieee8021ad_handle = create_dissector_handle(dissect_ieee8021ad,
+ ieee8021ad_handle = new_create_dissector_handle(dissect_ieee8021ad,
proto_ieee8021ad);
dissector_add_uint("ethertype", ETHERTYPE_IEEE_802_1AD, ieee8021ad_handle);
ethertype_handle = find_dissector("ethertype");
g_hash_table_insert(oui_info_table, GUINT_TO_POINTER(oui), new_info);
}
-static void
-dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ieee802a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *ieee802a_tree;
proto_item *ti;
hf = hf_ieee802a_pid;
subdissector_table = NULL;
}
- if (tree)
- proto_tree_add_uint(ieee802a_tree, hf, tvb, 3, 2, pid);
+
+ proto_tree_add_uint(ieee802a_tree, hf, tvb, 3, 2, pid);
next_tvb = tvb_new_subset_remaining(tvb, 5);
- if (subdissector_table != NULL) {
+ if ((subdissector_table == NULL) ||
/* do lookup with the subdissector table */
- if (dissector_try_uint(subdissector_table, pid, next_tvb,
- pinfo, tree))
- return;
+ (!dissector_try_uint(subdissector_table, pid, next_tvb, pinfo, tree))) {
+ call_dissector(data_handle, next_tvb, pinfo, tree);
}
- call_dissector(data_handle, next_tvb, pinfo, tree);
+ return tvb_captured_length(tvb);
}
void
data_handle = find_dissector("data");
- ieee802a_handle = create_dissector_handle(dissect_ieee802a,
+ ieee802a_handle = new_create_dissector_handle(dissect_ieee802a,
proto_ieee802a);
dissector_add_uint("ethertype", ETHERTYPE_IEEE802_OUI_EXTENDED,
ieee802a_handle);
return offset;
}
-static void
-dissect_igmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int
+dissect_igmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
{
int offset = 0;
unsigned char type;
{
dissect_igmp_unknown(tvb, pinfo, parent_tree);
}
+ return tvb_captured_length(tvb);
}
void
igmp_mquery_handle, igmp_mtrace_handle, igmp_report_handle;
range_t *igmpv0_range = NULL;
- igmp_handle = create_dissector_handle(dissect_igmp, proto_igmp);
+ igmp_handle = new_create_dissector_handle(dissect_igmp, proto_igmp);
dissector_add_uint("ip.proto", IP_PROTO_IGMP, igmp_handle);
/* IGMP v0 */
static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network);
-static void dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 ver_and_opcode,version,opcode,network;
gint offset=IGRP_HEADER_LENGTH;
ver_and_opcode = tvb_get_guint8(tvb,0);
-
switch (ver_and_opcode) {
case 0x11:
col_set_str(pinfo->cinfo, COL_INFO, "Response" );
}
-
-
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_igrp, tvb, 0, -1,
"Cisco IGRP");
proto_tree_add_item(igrp_tree, hf_igrp_checksum, tvb, 10, 2, ENC_BIG_ENDIAN);
}
+ return tvb_captured_length(tvb);
}
static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network)
{
dissector_handle_t igrp_handle;
- igrp_handle = create_dissector_handle(dissect_igrp, proto_igrp);
+ igrp_handle = new_create_dissector_handle(dissect_igrp, proto_igrp);
dissector_add_uint("ip.proto", IP_PROTO_IGRP, igrp_handle);
}
/* Forward-declarations */
-static void dissect_roce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static void dissect_rroce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
static void dissect_infiniband_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ib_packet_start_header starts_with);
static gint32 find_next_header_sequence(struct infinibandinfo* ibInfo);
static gboolean contains(guint32 value, guint32* arr, int length);
/* Helper dissector for correctly dissecting RRoCE packets (encapsulated within an IP */
/* frame). The only difference from regular IB packets is that RRoCE packets do not contain */
/* a LRH, and always start with a BTH. */
-static void
-dissect_rroce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_rroce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* this is a RRoCE packet, so signal the IB dissector not to look for LRH/GRH */
dissect_infiniband_common(tvb, pinfo, tree, IB_PACKET_STARTS_WITH_BTH);
+ return tvb_captured_length(tvb);
}
/* Helper dissector for correctly dissecting RoCE packets (encapsulated within an Ethernet */
/* frame). The only difference from regular IB packets is that RoCE packets do not contain */
/* a LRH, and always start with a GRH. */
-static void
-dissect_roce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_roce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* this is a RoCE packet, so signal the IB dissector not to look for LRH */
dissect_infiniband_common(tvb, pinfo, tree, IB_PACKET_STARTS_WITH_GRH);
+ return tvb_captured_length(tvb);
}
static int
dissector_add_uint("erf.types.type", ERF_TYPE_INFINIBAND_LINK, ib_link_handle);
/* create and announce an anonymous RoCE dissector */
- roce_handle = create_dissector_handle(dissect_roce, proto_infiniband);
+ roce_handle = new_create_dissector_handle(dissect_roce, proto_infiniband);
dissector_add_uint("ethertype", ETHERTYPE_ROCE, roce_handle);
/* create and announce an anonymous RRoCE dissector */
- rroce_handle = create_dissector_handle(dissect_rroce, proto_infiniband);
+ rroce_handle = new_create_dissector_handle(dissect_rroce, proto_infiniband);
if (!initialized)
{
initialized = TRUE;
capture_llc(pd, 16, len, ld);
}
-static void
-dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
next_tvb = tvb_new_subset_remaining (tvb, 16);
call_dissector(llc_handle, next_tvb, pinfo, tree);
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
{
dissector_handle_t ipfc_handle;
- ipfc_handle = create_dissector_handle (dissect_ipfc, proto_ipfc);
+ ipfc_handle = new_create_dissector_handle (dissect_ipfc, proto_ipfc);
dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_FC, ipfc_handle);
llc_handle = find_dissector ("llc");
{ 0, NULL }
};
-static void
-dissect_ipnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *fh_tree;
proto_item *ti;
default:
break;
}
+ return tvb_captured_length(tvb);
}
void
ip_handle = find_dissector("ip");
ipv6_handle = find_dissector("ipv6");
- ipnet_handle = create_dissector_handle(dissect_ipnet, proto_ipnet);
+ ipnet_handle = new_create_dissector_handle(dissect_ipnet, proto_ipnet);
dissector_add_uint("wtap_encap", WTAP_ENCAP_IPNET, ipnet_handle);
}
static dissector_handle_t ip_handle;
static dissector_handle_t ipv6_handle;
-static void
-dissect_ipoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *fh_tree;
proto_item *ti;
default:
break;
}
+ return tvb_captured_length(tvb);
}
void
ip_handle = find_dissector("ip");
ipv6_handle = find_dissector("ipv6");
- ipoib_handle = create_dissector_handle(dissect_ipoib, proto_ipoib);
+ ipoib_handle = new_create_dissector_handle(dissect_ipoib, proto_ipoib);
dissector_add_uint("wtap_encap", WTAP_ENCAP_IP_OVER_IB, ipoib_handle);
}
static int add_value_head(const gchar *tag_desc, proto_tree *tree,
tvbuff_t *tvb, int offset, int name_length, int value_length, char **name_val);
-static void
-dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *ipp_tree;
proto_item *ti;
else
col_set_str(pinfo->cinfo, COL_INFO, "IPP response");
- if (tree) {
- ti = proto_tree_add_item(tree, proto_ipp, tvb, offset, -1, ENC_NA);
- ipp_tree = proto_item_add_subtree(ti, ett_ipp);
+ ti = proto_tree_add_item(tree, proto_ipp, tvb, offset, -1, ENC_NA);
+ ipp_tree = proto_item_add_subtree(ti, ett_ipp);
- proto_tree_add_item(ipp_tree, hf_ipp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
- offset += 2;
+ proto_tree_add_item(ipp_tree, hf_ipp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
- if (is_request) {
- proto_tree_add_item(ipp_tree, hf_ipp_operation_id, tvb, offset, 2, ENC_BIG_ENDIAN);
- } else {
- status_code = tvb_get_ntohs(tvb, offset);
- switch (status_code & STATUS_TYPE_MASK) {
+ if (is_request) {
+ proto_tree_add_item(ipp_tree, hf_ipp_operation_id, tvb, offset, 2, ENC_BIG_ENDIAN);
+ } else {
+ status_code = tvb_get_ntohs(tvb, offset);
+ switch (status_code & STATUS_TYPE_MASK) {
- case STATUS_SUCCESSFUL:
- status_type = "Successful";
- break;
+ case STATUS_SUCCESSFUL:
+ status_type = "Successful";
+ break;
- case STATUS_INFORMATIONAL:
- status_type = "Informational";
- break;
+ case STATUS_INFORMATIONAL:
+ status_type = "Informational";
+ break;
- case STATUS_REDIRECTION:
- status_type = "Redirection";
- break;
+ case STATUS_REDIRECTION:
+ status_type = "Redirection";
+ break;
- case STATUS_CLIENT_ERROR:
- status_type = "Client error";
- break;
+ case STATUS_CLIENT_ERROR:
+ status_type = "Client error";
+ break;
- case STATUS_SERVER_ERROR:
- status_type = "Server error";
- break;
+ case STATUS_SERVER_ERROR:
+ status_type = "Server error";
+ break;
- default:
- status_type = "Unknown";
- break;
- }
- proto_tree_add_uint_format_value(ipp_tree, hf_ipp_status_code, tvb, offset, 2, status_code,
- "%s (%s)", status_type, val_to_str(status_code, status_vals, "0x804x"));
+ default:
+ status_type = "Unknown";
+ break;
}
- offset += 2;
+ proto_tree_add_uint_format_value(ipp_tree, hf_ipp_status_code, tvb, offset, 2, status_code,
+ "%s (%s)", status_type, val_to_str(status_code, status_vals, "0x804x"));
+ }
+ offset += 2;
- proto_tree_add_item(ipp_tree, hf_ipp_request_id, tvb, offset, 4, ENC_BIG_ENDIAN);
- offset += 4;
+ proto_tree_add_item(ipp_tree, hf_ipp_request_id, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
- offset = parse_attributes(tvb, offset, ipp_tree);
+ offset = parse_attributes(tvb, offset, ipp_tree);
- if (tvb_offset_exists(tvb, offset)) {
- call_dissector(data_handle,
- tvb_new_subset_remaining(tvb, offset), pinfo,
- ipp_tree);
- }
+ if (tvb_offset_exists(tvb, offset)) {
+ call_dissector(data_handle,
+ tvb_new_subset_remaining(tvb, offset), pinfo,
+ ipp_tree);
}
+ return tvb_captured_length(tvb);
}
#define TAG_TYPE(x) ((x) & 0xF0)
/*
* Register ourselves as running atop HTTP and using port 631.
*/
- ipp_handle = create_dissector_handle(dissect_ipp, proto_ipp);
+ ipp_handle = new_create_dissector_handle(dissect_ipp, proto_ipp);
http_dissector_add(631, ipp_handle);
dissector_add_string("media_type", "application/ipp", ipp_handle);
data_handle = find_dissector("data");
* UDP Encapsulation of IPsec Packets
* draft-ietf-ipsec-udp-encaps-06.txt
*/
-static void
-dissect_udpencap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_udpencap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
tvbuff_t *next_tvb;
proto_tree *udpencap_tree;
call_dissector(esp_handle, tvb, pinfo, tree);
}
}
+ return tvb_captured_length(tvb);
}
void
esp_handle = find_dissector("esp");
isakmp_handle = find_dissector("isakmp");
- udpencap_handle = create_dissector_handle(dissect_udpencap, proto_udpencap);
+ udpencap_handle = new_create_dissector_handle(dissect_udpencap, proto_udpencap);
dissector_add_uint("udp.port", 4500, udpencap_handle);
}
}
-static void
-dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipcomp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissector_data _U_)
{
proto_tree *ipcomp_tree;
proto_item *ti;
const char *p;
dissector_handle_t dissector_handle;
guint32 saved_match_uint;
+ tvbuff_t *data, *decomp;
/*
* load the top pane info. This should be overwritten by
* populate a tree in the second pane with the status of the link layer
* (ie none)
*/
- if (tree) {
- tvbuff_t *data, *decomp;
-
ti = proto_tree_add_item(tree, proto_ipcomp, tvb, 0, -1, ENC_NA);
ipcomp_tree = proto_item_add_subtree(ti, ett_ipcomp);
call_dissector(dissector_handle, decomp, pinfo, tree);
pinfo->match_uint = saved_match_uint;
}
- }
+
+ return tvb_captured_length(tvb);
}
static void ipsec_init_protocol(void)
dissector_add_uint("ip.proto", IP_PROTO_AH, ah_handle);
esp_handle = find_dissector("esp");
dissector_add_uint("ip.proto", IP_PROTO_ESP, esp_handle);
- ipcomp_handle = create_dissector_handle(dissect_ipcomp, proto_ipcomp);
+ ipcomp_handle = new_create_dissector_handle(dissect_ipcomp, proto_ipcomp);
dissector_add_uint("ip.proto", IP_PROTO_IPCOMP, ipcomp_handle);
ipv6_ah_handle = new_create_dissector_handle(dissect_ah_header, proto_ah );
dissector_add_uint("ipv6.nxt", IP_PROTO_AH, ipv6_ah_handle);
static gint ett_ipsictl = -1;
static gint ett_ipsictl_pdu = -1;
-static void dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_ipsictl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *ipsictl_tree;
if (!haspdus)
{
- if (tree) {
- proto_tree_add_item(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, ENC_NA);
- }
+ proto_tree_add_item(ipsictl_tree, hf_ipsictl_data, tvb, offset, -1, ENC_NA);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPSICTL");
col_set_str(pinfo->cinfo, COL_INFO, "Initialization");
}
+ return tvb_captured_length(tvb);
} /* dissect_ipsictl */
dissector_handle_t ipsictl_handle = NULL;
- ipsictl_handle = create_dissector_handle(dissect_ipsictl, proto_ipsictl);
+ ipsictl_handle = new_create_dissector_handle(dissect_ipsictl, proto_ipsictl);
dissector_add_uint("tcp.port", IPSICTL_PORT, ipsictl_handle);
};
-static void
-dissect_ipvs_syncd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+static int
+dissect_ipvs_syncd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_)
{
proto_tree *tree;
proto_item *item;
}
}
+
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t ipvs_syncd_handle;
- ipvs_syncd_handle = create_dissector_handle(dissect_ipvs_syncd, proto_ipvs_syncd);
+ ipvs_syncd_handle = new_create_dissector_handle(dissect_ipvs_syncd, proto_ipvs_syncd);
dissector_add_uint("udp.port", IPVS_SYNCD_PORT, ipvs_syncd_handle);
}
{ 0, NULL }
};
-static void
-dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *ipxwan_tree = NULL;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPX WAN");
col_clear(pinfo->cinfo, COL_INFO);
- if (tree) {
- ti = proto_tree_add_item(tree, proto_ipxwan, tvb, 0, -1,
- ENC_NA);
- ipxwan_tree = proto_item_add_subtree(ti, ett_ipxwan);
- }
+ ti = proto_tree_add_item(tree, proto_ipxwan, tvb, 0, -1,
+ ENC_NA);
+ ipxwan_tree = proto_item_add_subtree(ti, ett_ipxwan);
- if (tree) {
- proto_tree_add_item(ipxwan_tree, hf_ipxwan_identifier, tvb,
+ proto_tree_add_item(ipxwan_tree, hf_ipxwan_identifier, tvb,
offset, 4, ENC_ASCII|ENC_NA);
- }
+
offset += 4;
packet_type = tvb_get_guint8(tvb, offset);
col_add_str(pinfo->cinfo, COL_INFO,
val_to_str(packet_type, ipxwan_packet_type_vals,
"Unknown packet type %u"));
- if (tree) {
- proto_tree_add_uint(ipxwan_tree, hf_ipxwan_packet_type, tvb,
- offset, 1, packet_type);
- offset += 1;
- proto_tree_add_item(ipxwan_tree, hf_ipxwan_node_id, tvb,
- offset, 4, ENC_BIG_ENDIAN);
- offset += 4;
- proto_tree_add_item(ipxwan_tree, hf_ipxwan_sequence_number, tvb,
- offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_uint(ipxwan_tree, hf_ipxwan_packet_type, tvb,
+ offset, 1, packet_type);
+ offset += 1;
+ proto_tree_add_item(ipxwan_tree, hf_ipxwan_node_id, tvb,
+ offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ proto_tree_add_item(ipxwan_tree, hf_ipxwan_sequence_number, tvb,
+ offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ num_options = tvb_get_guint8(tvb, offset);
+ proto_tree_add_uint(ipxwan_tree, hf_ipxwan_num_options, tvb,
+ offset, 1, num_options);
+ offset += 1;
+
+ while (num_options != 0) {
+ option_number = tvb_get_guint8(tvb, offset);
+ option_tree = proto_tree_add_subtree_format(ipxwan_tree, tvb, offset, -1,
+ ett_ipxwan_option, &ti, "Option: %s",
+ val_to_str(option_number, ipxwan_option_num_vals,
+ "Unknown (%u)"));
+
+ proto_tree_add_uint(option_tree, hf_ipxwan_option_num,
+ tvb, offset, 1, option_number);
offset += 1;
- num_options = tvb_get_guint8(tvb, offset);
- proto_tree_add_uint(ipxwan_tree, hf_ipxwan_num_options, tvb,
- offset, 1, num_options);
+ proto_tree_add_item(option_tree, hf_ipxwan_accept_option,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
-
- while (num_options != 0) {
- option_number = tvb_get_guint8(tvb, offset);
- option_tree = proto_tree_add_subtree_format(ipxwan_tree, tvb, offset, -1,
- ett_ipxwan_option, &ti, "Option: %s",
- val_to_str(option_number, ipxwan_option_num_vals,
- "Unknown (%u)"));
-
- proto_tree_add_uint(option_tree, hf_ipxwan_option_num,
- tvb, offset, 1, option_number);
- offset += 1;
- proto_tree_add_item(option_tree, hf_ipxwan_accept_option,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- offset += 1;
- option_data_len = tvb_get_ntohs(tvb, offset);
- proto_tree_add_uint(option_tree, hf_ipxwan_option_data_len,
- tvb, offset, 2, option_data_len);
- offset += 2;
- proto_item_set_len(ti, option_data_len+4);
- switch (option_number) {
-
- case OPT_ROUTING_TYPE:
- if (option_data_len != 1) {
- expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
- "Bogus length: %u, should be 1", option_data_len);
- } else {
- proto_tree_add_item(option_tree,
- hf_ipxwan_routing_type, tvb,
- offset, 1, ENC_BIG_ENDIAN);
- }
- break;
-
- case OPT_RIP_SAP_INFO_EXCHANGE:
- if (option_data_len != 54) {
- expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
- "Bogus length: %u, should be 54", option_data_len);
- } else {
- wan_link_delay = tvb_get_ntohs(tvb,
- offset);
- proto_tree_add_uint_format_value(option_tree,
- hf_ipxwan_wan_link_delay, tvb,
- offset, 2, wan_link_delay,
- "%ums",
- wan_link_delay);
- proto_tree_add_item(option_tree,
- hf_ipxwan_common_network_number,
- tvb, offset+2, 4, ENC_NA);
- proto_tree_add_item(option_tree,
- hf_ipxwan_router_name, tvb,
- offset+6, 48, ENC_ASCII|ENC_NA);
- }
- break;
-
- case OPT_NLSP_INFORMATION:
- if (option_data_len != 8) {
- expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
- "Bogus length: %u, should be 8", option_data_len);
- } else {
- delay = tvb_get_ntohl(tvb, offset);
- proto_tree_add_uint_format_value(option_tree,
- hf_ipxwan_delay, tvb,
- offset, 4, delay,
- "%uus", delay);
- throughput = tvb_get_ntohl(tvb, offset);
- proto_tree_add_uint_format_value(option_tree,
- hf_ipxwan_throughput, tvb,
- offset, 4, throughput,
- "%uus",
- throughput);
- }
- break;
-
- case OPT_NLSP_RAW_THROUGHPUT_DATA:
- if (option_data_len != 8) {
- expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
- "Bogus length: %u, should be 8", option_data_len);
- } else {
- proto_tree_add_item(option_tree,
- hf_ipxwan_request_size, tvb,
- offset, 4, ENC_BIG_ENDIAN);
- delta_time = tvb_get_ntohl(tvb, offset);
- proto_tree_add_uint_format_value(option_tree,
- hf_ipxwan_delta_time, tvb,
- offset, 4, delta_time,
- "%uus",
- delta_time);
- }
- break;
-
- case OPT_EXTENDED_NODE_ID:
- if (option_data_len != 4) {
- expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
- "Bogus length: %u, should be 4", option_data_len);
- } else {
- proto_tree_add_item(option_tree,
- hf_ipxwan_extended_node_id, tvb,
- offset, 4, ENC_NA);
- }
- break;
-
- case OPT_NODE_NUMBER:
- if (option_data_len != 6) {
- expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
- "Bogus length: %u, should be 6", option_data_len);
- } else {
- proto_tree_add_item(option_tree,
- hf_ipxwan_node_number, tvb,
- offset, 6, ENC_NA);
- }
- break;
-
- case OPT_COMPRESSION:
- if (option_data_len < 1) {
- expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
- "Bogus length: %u, should be >= 1", option_data_len);
- } else {
- compression_type = tvb_get_guint8(tvb,
- offset);
- ti = proto_tree_add_uint(option_tree,
- hf_ipxwan_compression_type, tvb,
- offset, 1, compression_type);
- switch (compression_type) {
-
- case COMP_TYPE_TELEBIT:
- if (option_data_len < 3) {
- expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
- "Bogus length: %u, should be >= 3", option_data_len);
- } else {
- proto_tree_add_item(option_tree, hf_ipxwan_compression_options,
- tvb, offset+1, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(option_tree, hf_ipxwan_compression_slots,
- tvb, offset+2, 1, ENC_BIG_ENDIAN);
- }
- break;
-
- default:
- proto_tree_add_item(option_tree, hf_ipxwan_compression_parameters,
- tvb, offset+1, option_data_len-1, ENC_NA);
- break;
+ option_data_len = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_uint(option_tree, hf_ipxwan_option_data_len,
+ tvb, offset, 2, option_data_len);
+ offset += 2;
+ proto_item_set_len(ti, option_data_len+4);
+ switch (option_number) {
+
+ case OPT_ROUTING_TYPE:
+ if (option_data_len != 1) {
+ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
+ "Bogus length: %u, should be 1", option_data_len);
+ } else {
+ proto_tree_add_item(option_tree,
+ hf_ipxwan_routing_type, tvb,
+ offset, 1, ENC_BIG_ENDIAN);
+ }
+ break;
+
+ case OPT_RIP_SAP_INFO_EXCHANGE:
+ if (option_data_len != 54) {
+ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
+ "Bogus length: %u, should be 54", option_data_len);
+ } else {
+ wan_link_delay = tvb_get_ntohs(tvb,
+ offset);
+ proto_tree_add_uint_format_value(option_tree,
+ hf_ipxwan_wan_link_delay, tvb,
+ offset, 2, wan_link_delay,
+ "%ums",
+ wan_link_delay);
+ proto_tree_add_item(option_tree,
+ hf_ipxwan_common_network_number,
+ tvb, offset+2, 4, ENC_NA);
+ proto_tree_add_item(option_tree,
+ hf_ipxwan_router_name, tvb,
+ offset+6, 48, ENC_ASCII|ENC_NA);
+ }
+ break;
+
+ case OPT_NLSP_INFORMATION:
+ if (option_data_len != 8) {
+ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
+ "Bogus length: %u, should be 8", option_data_len);
+ } else {
+ delay = tvb_get_ntohl(tvb, offset);
+ proto_tree_add_uint_format_value(option_tree,
+ hf_ipxwan_delay, tvb,
+ offset, 4, delay,
+ "%uus", delay);
+ throughput = tvb_get_ntohl(tvb, offset);
+ proto_tree_add_uint_format_value(option_tree,
+ hf_ipxwan_throughput, tvb,
+ offset, 4, throughput,
+ "%uus",
+ throughput);
+ }
+ break;
+
+ case OPT_NLSP_RAW_THROUGHPUT_DATA:
+ if (option_data_len != 8) {
+ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
+ "Bogus length: %u, should be 8", option_data_len);
+ } else {
+ proto_tree_add_item(option_tree,
+ hf_ipxwan_request_size, tvb,
+ offset, 4, ENC_BIG_ENDIAN);
+ delta_time = tvb_get_ntohl(tvb, offset);
+ proto_tree_add_uint_format_value(option_tree,
+ hf_ipxwan_delta_time, tvb,
+ offset, 4, delta_time,
+ "%uus",
+ delta_time);
+ }
+ break;
+
+ case OPT_EXTENDED_NODE_ID:
+ if (option_data_len != 4) {
+ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
+ "Bogus length: %u, should be 4", option_data_len);
+ } else {
+ proto_tree_add_item(option_tree,
+ hf_ipxwan_extended_node_id, tvb,
+ offset, 4, ENC_NA);
+ }
+ break;
+
+ case OPT_NODE_NUMBER:
+ if (option_data_len != 6) {
+ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
+ "Bogus length: %u, should be 6", option_data_len);
+ } else {
+ proto_tree_add_item(option_tree,
+ hf_ipxwan_node_number, tvb,
+ offset, 6, ENC_NA);
+ }
+ break;
+
+ case OPT_COMPRESSION:
+ if (option_data_len < 1) {
+ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
+ "Bogus length: %u, should be >= 1", option_data_len);
+ } else {
+ compression_type = tvb_get_guint8(tvb,
+ offset);
+ ti = proto_tree_add_uint(option_tree,
+ hf_ipxwan_compression_type, tvb,
+ offset, 1, compression_type);
+ switch (compression_type) {
+
+ case COMP_TYPE_TELEBIT:
+ if (option_data_len < 3) {
+ expert_add_info_format(pinfo, ti, &ei_ipxwan_option_data_len,
+ "Bogus length: %u, should be >= 3", option_data_len);
+ } else {
+ proto_tree_add_item(option_tree, hf_ipxwan_compression_options,
+ tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(option_tree, hf_ipxwan_compression_slots,
+ tvb, offset+2, 1, ENC_BIG_ENDIAN);
}
- }
- break;
-
- case OPT_PAD:
- proto_tree_add_item(option_tree, hf_ipxwan_padding,
- tvb, offset, option_data_len, ENC_NA);
- break;
+ break;
- default:
- proto_tree_add_item(option_tree, hf_ipxwan_option_value,
- tvb, offset, option_data_len, ENC_NA);
- break;
+ default:
+ proto_tree_add_item(option_tree, hf_ipxwan_compression_parameters,
+ tvb, offset+1, option_data_len-1, ENC_NA);
+ break;
+ }
}
+ break;
- offset += option_data_len;
- num_options--;
+ case OPT_PAD:
+ proto_tree_add_item(option_tree, hf_ipxwan_padding,
+ tvb, offset, option_data_len, ENC_NA);
+ break;
+
+ default:
+ proto_tree_add_item(option_tree, hf_ipxwan_option_value,
+ tvb, offset, option_data_len, ENC_NA);
+ break;
}
+
+ offset += option_data_len;
+ num_options--;
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t ipxwan_handle;
- ipxwan_handle = create_dissector_handle(dissect_ipxwan,
+ ipxwan_handle = new_create_dissector_handle(dissect_ipxwan,
proto_ipxwan);
dissector_add_uint("ipx.socket", IPX_SOCKET_IPXWAN, ipxwan_handle);
}
}
}
-static void
-dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_irc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *irc_tree, *ti;
gint offset = 0;
}
offset = next_offset;
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t irc_handle;
- irc_handle = create_dissector_handle(dissect_irc, proto_irc);
+ irc_handle = new_create_dissector_handle(dissect_irc, proto_irc);
dissector_add_uint("tcp.port", TCP_PORT_IRC, irc_handle);
dissector_add_uint("tcp.port", TCP_PORT_DIRCPROXY, irc_handle);
}
{ 0, NULL }
};
-static void
-dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_isdn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *isdn_tree;
proto_item *ti;
if (!try_circuit_dissector(CT_ISDN, pinfo->pseudo_header->isdn.channel,
pinfo->fd->num, tvb, pinfo, tree, NULL))
call_dissector(data_handle, tvb, pinfo, tree);
+
+ return tvb_captured_length(tvb);
}
void
v120_handle = find_dissector("v120");
data_handle = find_dissector("data");
- isdn_handle = create_dissector_handle(dissect_isdn, proto_isdn);
+ isdn_handle = new_create_dissector_handle(dissect_isdn, proto_isdn);
dissector_add_uint("wtap_encap", WTAP_ENCAP_ISDN, isdn_handle);
}
static expert_field ei_isi_len = EI_INIT;
static expert_field ei_isi_unsupported_packet = EI_INIT;
-static void dissect_isi_sim_auth(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) {
+static int dissect_isi_sim_auth(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) {
proto_item *item;
proto_tree *tree;
guint8 cmd, code;
col_set_str(pinfo->cinfo, COL_INFO, "unknown SIM Authentication packet");
break;
}
+ return tvb_captured_length(tvb);
}
-static void dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) {
+static int dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) {
proto_item *item;
proto_tree *tree;
guint8 cmd, code;
col_set_str(pinfo->cinfo, COL_INFO, "Unknown type");
break;
}
+ return tvb_captured_length(tvb);
}
-static void dissect_isi_gss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) {
+static int dissect_isi_gss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) {
proto_item *item;
proto_tree *tree;
guint8 cmd, code;
col_set_str(pinfo->cinfo, COL_INFO, "Unknown type");
break;
}
+ return tvb_captured_length(tvb);
}
static void dissect_isi_gps_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_item *item _U_, proto_tree *tree)
}
-static void dissect_isi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree)
+static int dissect_isi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_)
{
proto_item *item;
proto_tree *tree;
col_add_fstr(pinfo->cinfo, COL_INFO, "unknown GPS packet (0x%02x)", cmd);
break;
}
+ return tvb_captured_length(tvb);
}
-static void dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree)
+static int dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_)
{
proto_item *item;
proto_tree *tree;
col_set_str(pinfo->cinfo, COL_INFO, "Unknown type");
break;
}
+ return tvb_captured_length(tvb);
}
static void dissect_isi_network_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_item *item _U_, proto_tree *tree)
}
}
-static void dissect_isi_network(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) {
+static int dissect_isi_network(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) {
proto_item *item;
proto_tree *tree;
guint8 cmd;
expert_add_info(pinfo, item, &ei_isi_unsupported_packet);
break;
}
+ return tvb_captured_length(tvb);
}
-static void dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) {
+static int dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree, void* data _U_) {
proto_item *item = NULL;
proto_tree *tree = NULL;
guint8 cmd, code;
col_set_str(pinfo->cinfo, COL_INFO, "Unknown type");
break;
}
+ return tvb_captured_length(tvb);
}
-static void dissect_isi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+static int dissect_isi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
proto_tree *isi_tree;
proto_item *item, *item_len;
tvbuff_t *content_tvb;
/* Call subdissector depending on the resource ID */
if (!dissector_try_uint(isi_resource_dissector_table, resource, content_tvb, pinfo, isi_tree))
call_dissector(data_handle, content_tvb, pinfo, isi_tree);
+
+ return tvb_captured_length(tvb);
}
/* Experimental approach based upon the one used for PPP*/
return FALSE;
next_tvb = tvb_new_subset_remaining(tvb, 1);
- dissect_isi(next_tvb, pinfo, tree);
+ dissect_isi(next_tvb, pinfo, tree, data);
return TRUE;
}
if(!initialized) {
data_handle = find_dissector("data");
- dissector_add_uint("sll.ltype", LINUX_SLL_P_ISI, create_dissector_handle(dissect_isi, proto_isi));
+ dissector_add_uint("sll.ltype", LINUX_SLL_P_ISI, new_create_dissector_handle(dissect_isi, proto_isi));
heur_dissector_add("usb.bulk", dissect_usb_isi, "ISI bulk endpoint", "usb_bulk_isi", proto_isi, HEURISTIC_DISABLE);
- dissector_add_uint("isi.resource", 0x02, create_dissector_handle(dissect_isi_sms, proto_isi));
- dissector_add_uint("isi.resource", 0x06, create_dissector_handle(dissect_isi_ss, proto_isi));
- dissector_add_uint("isi.resource", 0x08, create_dissector_handle(dissect_isi_sim_auth, proto_isi));
- dissector_add_uint("isi.resource", 0x09, create_dissector_handle(dissect_isi_sim, proto_isi));
- dissector_add_uint("isi.resource", 0x0a, create_dissector_handle(dissect_isi_network, proto_isi));
- dissector_add_uint("isi.resource", 0x32, create_dissector_handle(dissect_isi_gss, proto_isi));
- dissector_add_uint("isi.resource", 0x54, create_dissector_handle(dissect_isi_gps, proto_isi));
+ dissector_add_uint("isi.resource", 0x02, new_create_dissector_handle(dissect_isi_sms, proto_isi));
+ dissector_add_uint("isi.resource", 0x06, new_create_dissector_handle(dissect_isi_ss, proto_isi));
+ dissector_add_uint("isi.resource", 0x08, new_create_dissector_handle(dissect_isi_sim_auth, proto_isi));
+ dissector_add_uint("isi.resource", 0x09, new_create_dissector_handle(dissect_isi_sim, proto_isi));
+ dissector_add_uint("isi.resource", 0x0a, new_create_dissector_handle(dissect_isi_network, proto_isi));
+ dissector_add_uint("isi.resource", 0x32, new_create_dissector_handle(dissect_isi_gss, proto_isi));
+ dissector_add_uint("isi.resource", 0x54, new_create_dissector_handle(dissect_isi_gps, proto_isi));
}
}
*/
/* dissect_ismacryp_v11 gets called if rtp_dyn_payload_type = "enc-mpeg4-generic" i.e. is set via SDP */
-static void dissect_ismacryp_v11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_ismacryp_v11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* display ISMACryp version */
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_11);
col_set_str(pinfo->cinfo, COL_INFO, "(PT=enc-mpeg4-generic)");
dissect_ismacryp_common( tvb, pinfo, tree, V11);
+ return tvb_captured_length(tvb);
}
/* dissect_ismacryp_v20 gets called if rtp_dyn_payload_type = "enc-isoff-generic" i.e. is set via SDP */
-static void dissect_ismacryp_v20(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_ismacryp_v20(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* display ISMACryp version */
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_20);
col_set_str(pinfo->cinfo, COL_INFO, "(PT=enc-isoff-generic)");
dissect_ismacryp_common( tvb, pinfo, tree, V20);
+ return tvb_captured_length(tvb);
}
-static void dissect_ismacryp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_ismacryp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
col_set_str(pinfo->cinfo, COL_INFO, "Manual version");
dissect_ismacryp_common( tvb, pinfo, tree, version_type); /* Unknown version type: Use preference */
+ return tvb_captured_length(tvb);
}
static void dissect_ismacryp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint ismacryp_version)
if (!ismacryp_prefs_initialized) {
dissector_handle_t ismacryp_v11_handle;
dissector_handle_t ismacryp_v20_handle;
- ismacryp_handle = create_dissector_handle(dissect_ismacryp, proto_ismacryp);
- ismacryp_v11_handle = create_dissector_handle(dissect_ismacryp_v11, proto_ismacryp);
- ismacryp_v20_handle = create_dissector_handle(dissect_ismacryp_v20, proto_ismacryp);
+ ismacryp_handle = new_create_dissector_handle(dissect_ismacryp, proto_ismacryp);
+ ismacryp_v11_handle = new_create_dissector_handle(dissect_ismacryp_v11, proto_ismacryp);
+ ismacryp_v20_handle = new_create_dissector_handle(dissect_ismacryp_v20, proto_ismacryp);
ismacryp_prefs_initialized = TRUE;
dissector_add_string("rtp_dyn_payload_type", "ISMACRYP", ismacryp_handle);
dissector_add_string("rtp_dyn_payload_type", "enc-mpeg4-generic", ismacryp_v11_handle);
/* Code to actually dissect the packets */
-static void
-dissect_ismp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ismp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
guint16 message_type = 0;
/* if Enterasys Discover Protocol, dissect it */
if(message_type == ISMPTYPE_EDP)
dissect_ismp_edp(tvb, pinfo, offset, tree);
+
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t ismp_handle;
- ismp_handle = create_dissector_handle(dissect_ismp,
+ ismp_handle = new_create_dissector_handle(dissect_ismp,
proto_ismp);
dissector_add_uint("ethertype", ETHERTYPE_ISMP, ismp_handle);
}
/* JPEG fields defining a sub tree */
static gint ett_jpeg = -1;
-static void
-dissect_jpeg( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
+static int
+dissect_jpeg( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
{
proto_item *ti = NULL;
proto_tree *jpeg_tree = NULL;
/* The rest of the packet is the JPEG data */
proto_tree_add_item( jpeg_tree, &hfi_rtp_jpeg_payload, tvb, offset, -1, ENC_NA );
}
+ return tvb_captured_length(tvb);
}
void
proto_register_fields(proto_jpeg, hfi, array_length(hfi));
proto_register_subtree_array(ett, array_length(ett));
- jpeg_handle = create_dissector_handle(dissect_jpeg, proto_jpeg);
+ jpeg_handle = new_create_dissector_handle(dissect_jpeg, proto_jpeg);
/* RFC 2798 */
register_ber_oid_dissector_handle("0.9.2342.19200300.100.1.60", jpeg_handle, proto_jpeg, "jpegPhoto");
/* wrapper for passing the PIC type to the generic ATM dissector */
-static void
-dissect_juniper_atm1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_juniper_atm1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_juniper_atm(tvb,pinfo,tree, JUNIPER_PIC_ATM1);
+ return tvb_captured_length(tvb);
}
/* wrapper for passing the PIC type to the generic ATM dissector */
-static void
-dissect_juniper_atm2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_juniper_atm2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_juniper_atm(tvb,pinfo,tree, JUNIPER_PIC_ATM2);
+ return tvb_captured_length(tvb);
}
/* generic ATM dissector */
ipv4_handle = find_dissector("ip");
data_handle = find_dissector("data");
- juniper_atm2_handle = create_dissector_handle(dissect_juniper_atm2, proto_juniper);
- juniper_atm1_handle = create_dissector_handle(dissect_juniper_atm1, proto_juniper);
+ juniper_atm2_handle = new_create_dissector_handle(dissect_juniper_atm2, proto_juniper);
+ juniper_atm1_handle = new_create_dissector_handle(dissect_juniper_atm1, proto_juniper);
juniper_pppoe_handle = create_dissector_handle(dissect_juniper_pppoe, proto_juniper);
juniper_mlppp_handle = create_dissector_handle(dissect_juniper_mlppp, proto_juniper);
juniper_mlfr_handle = create_dissector_handle(dissect_juniper_mlfr, proto_juniper);
static int hf_kdp_bcst_flag = -1;
static int hf_kdp_dup_flag = -1;
-static void dissect_kdp(tvbuff_t *tvb,
+static int dissect_kdp(tvbuff_t *tvb,
packet_info *pinfo,
- proto_tree *tree) {
+ proto_tree *tree, void* data _U_) {
proto_item *ti;
proto_tree *kdp_tree;
guint body_len;
src_flowid_string,
packet_errors);
}
+
+ return tvb_captured_length(tvb);
}
void proto_register_kdp(void) {
void
proto_reg_handoff_kdp(void) {
dissector_handle_t kdp_handle;
- kdp_handle = create_dissector_handle(dissect_kdp, proto_kdp);
+ kdp_handle = new_create_dissector_handle(dissect_kdp, proto_kdp);
dissector_add_uint("udp.port", KDP_PORT, kdp_handle);
}
#endif
/* This function is dissecting the kink header. */
-static void
-dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){
+static int
+dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_){
proto_item *ti = NULL;
proto_tree *kink_tree = NULL;
guint8 type;
control_payload(pinfo, tvb, offset, next_payload, kink_tree);
+ return tvb_captured_length(tvb);
}
/* This part call the dissect payload function by next_payload value.
dissector_handle_t kink_handle = NULL;
- kink_handle = create_dissector_handle(dissect_kink, proto_kink);
+ kink_handle = new_create_dissector_handle(dissect_kink, proto_kink);
dissector_add_uint("udp.port", KINK_PORT, kink_handle);
}
-static void
-dissect_kpasswd_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_kpasswd_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_kpasswd_common(tvb, pinfo, tree, FALSE);
+ return tvb_captured_length(tvb);
}
static int
dissector_handle_t kpasswd_handle_udp;
dissector_handle_t kpasswd_handle_tcp;
- kpasswd_handle_udp = create_dissector_handle(dissect_kpasswd_udp, proto_kpasswd);
+ kpasswd_handle_udp = new_create_dissector_handle(dissect_kpasswd_udp, proto_kpasswd);
kpasswd_handle_tcp = new_create_dissector_handle(dissect_kpasswd_tcp, proto_kpasswd);
dissector_add_uint("udp.port", UDP_PORT_KPASSWD, kpasswd_handle_udp);
dissector_add_uint("tcp.port", TCP_PORT_KPASSWD, kpasswd_handle_tcp);
* or process_l2tpv3_data_ip for Data Messages over IP, based on the
* Session ID
*/
-static void
-dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int idx = 0;
guint32 sid; /* Session ID */
process_l2tpv3_data_ip(tvb, pinfo, tree, l2tp_conv);
}
- return;
+ return tvb_captured_length(tvb);
}
static int dissect_atm_oam_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
l2tp_udp_handle = new_create_dissector_handle(dissect_l2tp_udp, proto_l2tp);
dissector_add_uint("udp.port", UDP_PORT_L2TP, l2tp_udp_handle);
- l2tp_ip_handle = create_dissector_handle(dissect_l2tp_ip, proto_l2tp);
+ l2tp_ip_handle = new_create_dissector_handle(dissect_l2tp_ip, proto_l2tp);
dissector_add_uint("ip.proto", IP_PROTO_L2TP, l2tp_ip_handle);
/*
*
* Notes:
*/
-static void
-dissect_lacp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lacp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
guint16 raw_word;
proto_tree_add_item(lacpdu_tree, hf_lacp_term_reserved, tvb,
offset, 50, ENC_NA);
}
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
{
dissector_handle_t lacp_handle;
- lacp_handle = create_dissector_handle(dissect_lacp, proto_lacp);
+ lacp_handle = new_create_dissector_handle(dissect_lacp, proto_lacp);
dissector_add_uint("slow.subtype", LACP_SUBTYPE, lacp_handle);
}
static dissector_handle_t lapb_handle;
-static void
-dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lapbether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *lapbether_tree, *ti;
int len;
next_tvb = tvb_new_subset_length(tvb, 2, len);
call_dissector(lapb_handle, next_tvb, pinfo, tree);
+ return tvb_captured_length(tvb);
}
void
*/
lapb_handle = find_dissector("lapb");
- lapbether_handle = create_dissector_handle(dissect_lapbether,
+ lapbether_handle = new_create_dissector_handle(dissect_lapbether,
proto_lapbether);
dissector_add_uint("ethertype", ETHERTYPE_DEC, lapbether_handle);
/*
* dissect_lbmpdm_tcp - The dissector for LBMPDM over TCP
*/
-static void dissect_lbmpdm_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
+static int dissect_lbmpdm_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
{
char * tag_name = NULL;
col_set_fence(pinfo->cinfo, COL_INFO);
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, lbmpdm_get_minimum_length(), /* Need at least the msglen */
get_lbmpdm_tcp_pdu_length, dissect_lbmpdm_tcp_pdu, NULL);
+ return tvb_captured_length(tvb);
}
static gboolean test_lbmpdm_tcp_packet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * user_data _U_)
{
if (lbmpdm_tcp_tag_find(pinfo) != NULL)
{
- dissect_lbmpdm_tcp(tvb, pinfo, tree);
+ dissect_lbmpdm_tcp(tvb, pinfo, tree, user_data);
return (TRUE);
}
else
return (FALSE);
}
/* One of ours. Probably. */
- dissect_lbmpdm_tcp(tvb, pinfo, tree);
+ dissect_lbmpdm_tcp(tvb, pinfo, tree, user_data);
return (TRUE);
}
if (!already_registered)
{
- lbmpdm_tcp_dissector_handle = create_dissector_handle(dissect_lbmpdm_tcp, lbmpdm_tcp_protocol_handle);
+ lbmpdm_tcp_dissector_handle = new_create_dissector_handle(dissect_lbmpdm_tcp, lbmpdm_tcp_protocol_handle);
dissector_add_for_decode_as("tcp.port", lbmpdm_tcp_dissector_handle);
heur_dissector_add("tcp", test_lbmpdm_tcp_packet, "LBMPDM over TCP", "lbmpdm_tcp", lbmpdm_tcp_protocol_handle, HEURISTIC_ENABLE);
}
#define LGEMON_PROTO_HEADER_LENGTH 12
/* Code to actually dissect the packets */
-static void
-dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
guint32 lge_monitor_proto_id;
break;
case 2: /* SCTP */
call_dissector(sctp_handle, next_tvb, pinfo, tree);
- return;
+ break;
case 3: /* M3UA */
call_dissector(m3ua_handle, next_tvb, pinfo, tree);
- return;
+ break;
default:
proto_tree_add_item(lge_monitor_tree, hf_lge_monitor_data, tvb, offset, -1, ENC_NA);
break;
}
- return;
+ return tvb_captured_length(tvb);
}
static gboolean lge_monitor_prefs_initialized = FALSE;
if (!lge_monitor_prefs_initialized) {
- lge_monitor_handle = create_dissector_handle(dissect_lge_monitor, proto_lge_monitor);
+ lge_monitor_handle = new_create_dissector_handle(dissect_lge_monitor, proto_lge_monitor);
dissector_add_for_decode_as("udp.port", lge_monitor_handle);
mtp3_handle = find_dissector("mtp3");
m3ua_handle = find_dissector("m3ua");
{ 0, NULL}
};
-static void
-dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_linx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint32 dword;
int offset = 0;
}
}
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t linx_handle;
- linx_handle = create_dissector_handle(dissect_linx, proto_linx);
+ linx_handle = new_create_dissector_handle(dissect_linx, proto_linx);
dissector_add_uint("ethertype", ETHERTYPE_LINX, linx_handle);
}
/* Default the port to zero */
static guint linx_tcp_port = 0;
-static void
-dissect_linx_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_linx_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint32 dword;
int offset = 0;
}
}
}
+ return tvb_captured_length(tvb);
}
void
if (!linx_tcp_prefs_initialized) {
- linx_tcp_handle = create_dissector_handle(dissect_linx_tcp, proto_linx_tcp);
+ linx_tcp_handle = new_create_dissector_handle(dissect_linx_tcp, proto_linx_tcp);
dissector_add_uint("tcp.port", linx_tcp_port, linx_tcp_handle);
linx_tcp_prefs_initialized = TRUE;
}
static gint ett_llt = -1;
/* Code to actually dissect the packets */
-static void
-dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_llt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
proto_tree_add_item(llt_tree, hf_llt_sequence_num, tvb, 24, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(llt_tree, hf_llt_message_time, tvb, 40, 4, ENC_BIG_ENDIAN);
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
static guint preference_alternate_ethertype_last;
if (!initialized) {
- llt_handle = create_dissector_handle(dissect_llt, proto_llt);
+ llt_handle = new_create_dissector_handle(dissect_llt, proto_llt);
dissector_add_uint("ethertype", ETHERTYPE_LLT, llt_handle);
initialized = TRUE;
} else {
proto_tree_add_uint(tree, hf_lmi_act, tvb, offset, 1, tvb_get_guint8( tvb, offset));
}
-static void
-dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *lmi_tree, *lmi_subtree;
proto_item *ti;
dissect_lmi_pvc_status( tvb, offset, lmi_subtree);
offset += len;
}
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t lmi_handle;
- lmi_handle = create_dissector_handle(dissect_lmi, proto_lmi);
+ lmi_handle = new_create_dissector_handle(dissect_lmi, proto_lmi);
dissector_add_uint("fr.nlpid", NLPID_LMI, lmi_handle);
}
{ 0, NULL }
};
-static void
-dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *loop_tree = NULL;
proto_item *ti;
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(data_handle, next_tvb, pinfo, tree);
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t loop_handle;
- loop_handle = create_dissector_handle(dissect_loop, proto_loop);
+ loop_handle = new_create_dissector_handle(dissect_loop, proto_loop);
dissector_add_uint("ethertype", ETHERTYPE_LOOP, loop_handle);
{ 0, NULL }
};
-static void
-dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *lpd_tree;
proto_item *ti, *hidden_item;
else {
call_dissector(data_handle,tvb, pinfo, lpd_tree);
}
+
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t lpd_handle;
- lpd_handle = create_dissector_handle(dissect_lpd, proto_lpd);
+ lpd_handle = new_create_dissector_handle(dissect_lpd, proto_lpd);
dissector_add_uint("tcp.port", TCP_PORT_PRINTER, lpd_handle);
data_handle = find_dissector("data");
}
* the start of the packet, so it simply re-calls the ethernet
* dissector on the packet.
*/
-static void
+static int
dissect_lwapp_l3(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree)
+ proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "LWAPP-L3");
col_set_str(pinfo->cinfo, COL_INFO, "802.3 Packets over Layer 3");
- if (tree) {
- /* create display subtree for the protocol */
- ti = proto_tree_add_item(tree, proto_lwapp_l3, tvb, offset,
- -1, ENC_NA);
- lwapp_tree = proto_item_add_subtree(ti, ett_lwapp_l3);
- } else {
- lwapp_tree = NULL;
- }
+ /* create display subtree for the protocol */
+ ti = proto_tree_add_item(tree, proto_lwapp_l3, tvb, offset,
+ -1, ENC_NA);
+ lwapp_tree = proto_item_add_subtree(ti, ett_lwapp_l3);
+
/* Dissect as Ethernet */
next_client = tvb_new_subset_remaining(tvb, 0);
call_dissector(eth_withoutfcs_handle, next_client, pinfo, lwapp_tree);
- return;
+
+ return tvb_captured_length(tvb);
} /* dissect_lwapp_l3*/
* lwapp payload in the data, and doesn't care whether the data was
* from a UDP packet, or a Layer 2 one.
*/
-static void
+static int
dissect_lwapp(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree)
+ proto_tree *tree, void* data _U_)
{
LWAPP_Header header;
guint8 slotId;
} else {
dissect_control(next_client, pinfo, tree);
}
- return;
+ return tvb_captured_length(tvb);
} /* dissect_lwapp*/
data_handle = find_dissector("data");
/* This dissector assumes lwapp packets in an 802.3 frame */
- lwapp_l3_handle = create_dissector_handle(dissect_lwapp_l3, proto_lwapp_l3);
+ lwapp_l3_handle = new_create_dissector_handle(dissect_lwapp_l3, proto_lwapp_l3);
/* This dissector assumes a lwapp packet */
- lwapp_handle = create_dissector_handle(dissect_lwapp, proto_lwapp);
+ lwapp_handle = new_create_dissector_handle(dissect_lwapp, proto_lwapp);
/*
* Ok, the following deserves some comments. We have four
dissect_rdata_response(tvb, lwres_tree);
}
-static void
-dissect_lwres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_lwres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint16 version, flags, authtype, authlength ;
guint32 length, opcode, result, recvlength, serial;
}
if(tree == NULL)
- return;
+ return tvb_captured_length(tvb);
lwres_item = proto_tree_add_item(tree,proto_lwres, tvb,0, -1, ENC_NA);
lwres_tree = proto_item_add_subtree(lwres_item, ett_lwres);
break;
}
}
+ return tvb_captured_length(tvb);
}
static guint lwres_port;
if(!lwres_prefs_initialized) {
- lwres_handle = create_dissector_handle(dissect_lwres, proto_lwres);
+ lwres_handle = new_create_dissector_handle(dissect_lwres, proto_lwres);
lwres_prefs_initialized = TRUE;
}
else {
}
/* M2tp */
-static void
-dissect_m2tp(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_m2tp(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *m2tp_item;
proto_tree *m2tp_tree;
/* dissect the message */
dissect_m2tp_message(message_tvb, pinfo, m2tp_item, m2tp_tree, tree);
+ return tvb_captured_length(message_tvb);
}
/* Register the protocol with Wireshark */
{
dissector_handle_t m2tp_handle;
mtp2_handle = find_dissector("mtp2");
- m2tp_handle = create_dissector_handle(dissect_m2tp, proto_m2tp);
+ m2tp_handle = new_create_dissector_handle(dissect_m2tp, proto_m2tp);
dissector_add_uint("sctp.ppi", M2TP_PAYLOAD_PROTOCOL_ID, m2tp_handle);
dissector_add_uint("sctp.port", SCTP_PORT_M2TP, m2tp_handle);
}
dissect_parameters(parameters_tvb, pinfo, tree, m2ua_tree);
}
-static void
-dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_m2ua(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *m2ua_item;
proto_tree *m2ua_tree;
/* dissect the message */
dissect_message(message_tvb, pinfo, tree, m2ua_tree);
+ return tvb_captured_length(message_tvb);
}
/* Register the protocol with Wireshark */
dissector_handle_t m2ua_handle;
mtp3_handle = find_dissector("mtp3");
- m2ua_handle = create_dissector_handle(dissect_m2ua, proto_m2ua);
+ m2ua_handle = new_create_dissector_handle(dissect_m2ua, proto_m2ua);
dissector_add_uint("sctp.ppi", M2UA_PAYLOAD_PROTOCOL_ID, m2ua_handle);
dissector_add_uint("sctp.port", SCTP_PORT_M2UA, m2ua_handle);
}
/* Initialize the subtree pointers */
static int ett_maap = -1;
-static void
-dissect_maap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_maap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 maap_msg_type;
proto_item *maap_item = NULL;
proto_tree_add_item(maap_tree, hf_maap_conflict_start_addr, tvb, MAAP_CONFLICT_START_ADDR_OFFSET, 6, ENC_NA);
proto_tree_add_item(maap_tree, hf_maap_conflict_count, tvb, MAAP_CONFLICT_COUNT_OFFSET, 2, ENC_BIG_ENDIAN);
}
+
+ return tvb_captured_length(tvb);
} /* end dissect_maap() */
/* Register the protocol with Wireshark */
{
dissector_handle_t maap_handle;
- maap_handle = create_dissector_handle(dissect_maap, proto_maap);
+ maap_handle = new_create_dissector_handle(dissect_maap, proto_maap);
dissector_add_uint("ieee1722.subtype", 0x7E, maap_handle);
}
static const guint8 dst_addr[] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x01};
static const address macctrl_dst_address = { AT_ETHER, 6, dst_addr};
-static void
-dissect_macctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_macctrl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti, *opcode_item;
proto_tree *macctrl_tree = NULL;
expert_add_info(pinfo, opcode_item, &ei_macctrl_opcode);
break;
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t macctrl_handle;
- macctrl_handle = create_dissector_handle(dissect_macctrl, proto_macctrl);
+ macctrl_handle = new_create_dissector_handle(dissect_macctrl, proto_macctrl);
dissector_add_uint("ethertype", ETHERTYPE_MAC_CONTROL, macctrl_handle);
}
static expert_field ei_manolito_type = EI_INIT;
/* Code to actually dissect the packets */
-static void
-dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dissector_data _U_)
{
unsigned int offset;
{
col_set_str(pinfo->cinfo, COL_INFO, packet_type);
}
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t manolito_handle;
- manolito_handle = create_dissector_handle(dissect_manolito,
+ manolito_handle = new_create_dissector_handle(dissect_manolito,
proto_manolito);
dissector_add_uint("udp.port", 41170, manolito_handle);
}
* Dominique Bastien (dbastien@accedian.com)
* + add support for MARKER and MARKER Response PDUs.
*/
-static void
-dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_marker(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
guint8 raw_octet;
offset += 2;
}
}
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
{
dissector_handle_t marker_handle;
- marker_handle = create_dissector_handle(dissect_marker, proto_marker);
+ marker_handle = new_create_dissector_handle(dissect_marker, proto_marker);
dissector_add_uint("slow.subtype", MARKER_SUBTYPE, marker_handle);
}
{0, NULL},
};
-static void
-dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
else {
call_dissector(data_handle, next_tvb, pinfo, tree);
}
+ return tvb_captured_length(tvb);
}
* ethertype ETHERTYPE_FCFT, and fetch the data and Fibre
* Channel handles.
*/
- mdshdr_handle = create_dissector_handle(dissect_mdshdr, proto_mdshdr);
+ mdshdr_handle = new_create_dissector_handle(dissect_mdshdr, proto_mdshdr);
dissector_add_uint("ethertype", ETHERTYPE_FCFT, mdshdr_handle);
data_handle = find_dissector("data");
fc_dissector_handle = find_dissector("fc");
* dissect_megaco_text over TCP, there will be a TPKT header there
*
*/
-static void dissect_megaco_text_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_megaco_text_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int lv_tpkt_len;
}
dissect_tpkt_encap(tvb, pinfo, tree, TRUE,
megaco_text_handle);
+
+ return tvb_captured_length(tvb);
}
#define ERRORTOKEN 1
data_handle = find_dissector("data");
megaco_text_handle = find_dissector("megaco");
- megaco_text_tcp_handle = create_dissector_handle(dissect_megaco_text_tcp, proto_megaco);
+ megaco_text_tcp_handle = new_create_dissector_handle(dissect_megaco_text_tcp, proto_megaco);
dissector_add_uint("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, megaco_text_handle);
return;
}
-static void dissect_mih(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_mih(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti = NULL;
int offset = 0;
switch (service)
{
case 1 :/*for Service Management..*/
- if(mid_tree)
- proto_tree_add_item(mid_tree, hf_mih_serv_actionid, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(mid_tree, hf_mih_serv_actionid, tvb, offset, 2, ENC_BIG_ENDIAN);
col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\"", val_to_str(action, serv_act_id_values, "Unknown"));
break;
case 2 :/*for event services..*/
- if(mid_tree)
- proto_tree_add_item(mid_tree, hf_mih_event_actionid, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(mid_tree, hf_mih_event_actionid, tvb, offset, 2, ENC_BIG_ENDIAN);
col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\"", val_to_str(action, event_act_id_values, "Unknown"));
break;
case 3 :/*for Command Services..*/
- if(mid_tree)
- proto_tree_add_item(mid_tree, hf_mih_command_actionid, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(mid_tree, hf_mih_command_actionid, tvb, offset, 2, ENC_BIG_ENDIAN);
col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\"", val_to_str(action, command_act_id_values, "Unknown"));
break;
case 4 :/*for Information Services..*/
- if(mid_tree)
- proto_tree_add_item(mid_tree, hf_mih_info_actionid, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(mid_tree, hf_mih_info_actionid, tvb, offset, 2, ENC_BIG_ENDIAN);
col_append_fstr(pinfo->cinfo, COL_INFO, "\"%s\"", val_to_str(action, info_act_id_values, "Unknown"));
break;
}
offset += (guint32)len;
payload_length -= (1 + len_of_len + (guint32)len);
}else{
- return;
+ return offset;
}
}
else
}
if(fragment!=0)
proto_tree_add_item(mih_tree, hf_fragmented_tlv, tvb, offset, -1, ENC_NA);
+
+ return tvb_captured_length(tvb);
}
/*dissector initialistaion*/
{
dissector_handle_t mih_handle;
- mih_handle = create_dissector_handle(dissect_mih, proto_mih);
+ mih_handle = new_create_dissector_handle(dissect_mih, proto_mih);
/*Layer 3 handle*/
dissector_add_uint("udp.port", MIH_PORT, mih_handle);
dissector_add_uint("tcp.port", MIH_PORT, mih_handle);
}
/* Function that dissects the whole MIPv6 packet */
-static void
-dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *mip6_tree = NULL;
guint8 type, pproto;
if (offset < len) {
if (len < (offset - start_offset)) {
expert_add_info(pinfo, header_item, &ei_mip6_bogus_header_length);
- return;
+ return offset;
}
len -= (offset - start_offset);
dissect_mip6_options(tvb, mip6_tree, offset, len, pinfo);
col_set_str(pinfo->cinfo, COL_INFO, "Fast Binding Acknowledgment");
}
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
dissector_handle_t mip6_handle;
/* mip6_handle = find_dissector("mipv6"); */
- mip6_handle = create_dissector_handle(dissect_mip6, proto_mip6);
+ mip6_handle = new_create_dissector_handle(dissect_mip6, proto_mip6);
dissector_add_uint("ip.proto", IP_PROTO_MIPV6_OLD, mip6_handle);
dissector_add_uint("ip.proto", IP_PROTO_MIPV6, mip6_handle);
/* Add support for PMIPv6 control messages over IPV4 */
/*
* Forward declarations
*/
-static void dissect_mmse_standalone(tvbuff_t *, packet_info *, proto_tree *);
+static int dissect_mmse_standalone(tvbuff_t *, packet_info *, proto_tree *, void*);
static void dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint8 pdut, const char *message_type);
if ((tvb_get_guint8(tvb, 2) != MM_TID_HDR) &&
(tvb_get_guint8(tvb, 2) != MM_VERSION_HDR))
return FALSE;
- dissect_mmse_standalone(tvb, pinfo, tree);
+ dissect_mmse_standalone(tvb, pinfo, tree, data);
return TRUE;
}
-static void
-dissect_mmse_standalone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mmse_standalone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 pdut;
const char *message_type;
col_add_fstr(pinfo->cinfo, COL_INFO, "MMS %s", message_type);
dissect_mmse(tvb, pinfo, tree, pdut, message_type);
+ return tvb_captured_length(tvb);
}
-static void
-dissect_mmse_encapsulated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mmse_encapsulated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint8 pdut;
const char *message_type;
message_type);
dissect_mmse(tvb, pinfo, tree, pdut, message_type);
+ return tvb_captured_length(tvb);
}
static void
dissector_handle_t mmse_encapsulated_handle;
heur_dissector_add("wsp", dissect_mmse_heur, "MMS Message Encapsulation over WSP", "mmse_wsp", proto_mmse, HEURISTIC_ENABLE);
- mmse_standalone_handle = create_dissector_handle(
+ mmse_standalone_handle = new_create_dissector_handle(
dissect_mmse_standalone, proto_mmse);
- mmse_encapsulated_handle = create_dissector_handle(
+ mmse_encapsulated_handle = new_create_dissector_handle(
dissect_mmse_encapsulated, proto_mmse);
/* As the media types for WSP and HTTP are the same, the WSP dissector
* uses the same string dissector table as the HTTP protocol. */
};
-static void
-dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mpeg_ca(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
-
guint offset = 0, length = 0;
proto_item *ti;
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_ca_tree, 0, offset);
proto_item_set_len(ti, offset);
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t mpeg_ca_handle;
- mpeg_ca_handle = create_dissector_handle(dissect_mpeg_ca, proto_mpeg_ca);
+ mpeg_ca_handle = new_create_dissector_handle(dissect_mpeg_ca, proto_mpeg_ca);
dissector_add_uint("mpeg_sect.tid", MPEG_CA_TID, mpeg_ca_handle);
}
};
-static void
-dissect_mpeg_pat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mpeg_pat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
-
guint offset = 0, length = 0;
guint16 prog_num, prog_pid;
offset += 1;
if (offset >= length)
- return;
+ return offset;
/* Parse all the programs */
offset += packet_mpeg_sect_crc(tvb, pinfo, mpeg_pat_tree, 0, offset);
proto_item_set_len(ti, offset);
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t mpeg_pat_handle;
- mpeg_pat_handle = create_dissector_handle(dissect_mpeg_pat, proto_mpeg_pat);
+ mpeg_pat_handle = new_create_dissector_handle(dissect_mpeg_pat, proto_mpeg_pat);
dissector_add_uint("mpeg_sect.tid", MPEG_PAT_TID, mpeg_pat_handle);
}
{ 0, NULL },
};
-static void
-dissect_mpeg1( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
+static int
+dissect_mpeg1( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
{
proto_item *ti;
proto_tree *mpg_tree;
/* The rest of the packet is the MPEG-1 stream */
proto_tree_add_item( mpg_tree, hf_rtp_mpg_data, tvb, offset, -1, ENC_NA );
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t mpeg1_handle;
- mpeg1_handle = create_dissector_handle(dissect_mpeg1, proto_mpg);
+ mpeg1_handle = new_create_dissector_handle(dissect_mpeg1, proto_mpg);
dissector_add_uint("rtp.pt", PT_MPV, mpeg1_handle);
}
}
}
-static void
-dissect_mpls_pm_dlm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mpls_pm_dlm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* the message formats for direct and inferred LM are identical */
dissect_mpls_pm_loss(tvb, pinfo, tree, DLM);
+ return tvb_captured_length(tvb);
}
-static void
-dissect_mpls_pm_ilm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mpls_pm_ilm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* the message formats for direct and inferred LM are identical */
dissect_mpls_pm_loss(tvb, pinfo, tree, ILM);
+ return tvb_captured_length(tvb);
}
-static void
-dissect_mpls_pm_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mpls_pm_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *pm_tree;
"DM",
&query, &response, &class_specific, &sid, &code);
- if (!tree) {
- return;
- }
-
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_mpls_pm_dm, tvb, 0, -1, ENC_NA);
pm_tree = proto_item_add_subtree(ti, ett_mpls_pm);
mpls_pm_dissect_timestamp(tvb, pm_tree, offset, qtf, rtf, query, i);
offset += 8;
}
+ return tvb_captured_length(tvb);
}
static void
}
}
-static void
-dissect_mpls_pm_dlm_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mpls_pm_dlm_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* the formats of the DLM+DM and ILM+DM messages are also identical */
dissect_mpls_pm_combined(tvb, pinfo, tree, DLMDM);
+ return tvb_captured_length(tvb);
}
-static void
-dissect_mpls_pm_ilm_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mpls_pm_ilm_dm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* the formats of the DLM+DM and ILM+DM messages are also identical */
dissect_mpls_pm_combined(tvb, pinfo, tree, ILMDM);
+ return tvb_captured_length(tvb);
}
void
dissector_handle_t mpls_pm_dlm_handle, mpls_pm_ilm_handle, mpls_pm_dm_handle,
mpls_pm_dlm_dm_handle, mpls_pm_ilm_dm_handle;
- mpls_pm_dlm_handle = create_dissector_handle( dissect_mpls_pm_dlm, proto_mpls_pm_dlm );
+ mpls_pm_dlm_handle = new_create_dissector_handle( dissect_mpls_pm_dlm, proto_mpls_pm_dlm );
dissector_add_uint("pwach.channel_type", 0x000A, mpls_pm_dlm_handle); /* FF: MPLS PM, RFC 6374, DLM */
- mpls_pm_ilm_handle = create_dissector_handle( dissect_mpls_pm_ilm, proto_mpls_pm_ilm );
+ mpls_pm_ilm_handle = new_create_dissector_handle( dissect_mpls_pm_ilm, proto_mpls_pm_ilm );
dissector_add_uint("pwach.channel_type", 0x000B, mpls_pm_ilm_handle); /* FF: MPLS PM, RFC 6374, ILM */
- mpls_pm_dm_handle = create_dissector_handle( dissect_mpls_pm_delay, proto_mpls_pm_dm );
+ mpls_pm_dm_handle = new_create_dissector_handle( dissect_mpls_pm_delay, proto_mpls_pm_dm );
dissector_add_uint("pwach.channel_type", 0x000C, mpls_pm_dm_handle); /* FF: MPLS PM, RFC 6374, DM */
- mpls_pm_dlm_dm_handle = create_dissector_handle( dissect_mpls_pm_dlm_dm, proto_mpls_pm_dlm_dm );
+ mpls_pm_dlm_dm_handle = new_create_dissector_handle( dissect_mpls_pm_dlm_dm, proto_mpls_pm_dlm_dm );
dissector_add_uint("pwach.channel_type", 0x000D, mpls_pm_dlm_dm_handle); /* FF: MPLS PM, RFC 6374, DLM+DM */
- mpls_pm_ilm_dm_handle = create_dissector_handle( dissect_mpls_pm_ilm_dm, proto_mpls_pm_ilm_dm );
+ mpls_pm_ilm_dm_handle = new_create_dissector_handle( dissect_mpls_pm_ilm_dm, proto_mpls_pm_ilm_dm );
dissector_add_uint("pwach.channel_type", 0x000E, mpls_pm_ilm_dm_handle); /* FF: MPLS PM, RFC 6374, ILM+DM */
}
{ 0, 0, NULL }
};
-static void
-dissect_mpls_psc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mpls_psc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *psc_tree;
fpath, path);
if (!tree) {
- return;
+ return tvb_captured_length(tvb);
}
/* create display subtree for the protocol */
offset += 1;
/* tlv len */
proto_tree_add_item(psc_tree, hf_mpls_psc_tlvlen, tvb, offset, 1, ENC_BIG_ENDIAN);
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t mpls_psc_handle;
- mpls_psc_handle = create_dissector_handle( dissect_mpls_psc, proto_mpls_psc );
+ mpls_psc_handle = new_create_dissector_handle( dissect_mpls_psc, proto_mpls_psc );
dissector_add_uint("pwach.channel_type", 0x0024, mpls_psc_handle); /* FF: PSC, RFC 6378 */
}
}
/* Dissector for MPLS-TP LI protocol: RFC 6435 */
-static void
-dissect_mplstp_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mplstp_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *lock_tree;
col_clear(pinfo->cinfo, COL_INFO);
if (!tree)
- return;
+ return tvb_captured_length(tvb);
ti = proto_tree_add_item(tree, proto_mplstp_lock, tvb, 0, -1, ENC_NA);
next_tvb = tvb_new_subset_remaining (tvb, offset);
dissect_bfd_mep (next_tvb, tree, proto_mplstp_lock);
- return;
+ return tvb_captured_length(tvb);
}
/* Dissector for MPLS-TP FM protocol: RFC 6427 */
-static void
-dissect_mplstp_fm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mplstp_fm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti, *ti_flags;
proto_tree *fm_tree, *fm_flags;
tlv_len = tvb_get_guint8 (tvb, (offset + 4));
if (!tree)
- return;
+ return tvb_captured_length(tvb);
ti = proto_tree_add_item(tree, proto_mplstp_fm, tvb, 0, (tlv_len + 5), ENC_NA);
fm_tree = proto_item_add_subtree (ti, ett_mplstp_fm);
next_tvb = tvb_new_subset_remaining (tvb, offset);
dissect_mplstp_fm_tlv (next_tvb, tree);
}
- return;
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t mplstp_lock_handle;
- mplstp_lock_handle = create_dissector_handle( dissect_mplstp_lock, proto_mplstp_lock );
+ mplstp_lock_handle = new_create_dissector_handle( dissect_mplstp_lock, proto_mplstp_lock );
dissector_add_uint("pwach.channel_type", 0x0026, mplstp_lock_handle); /* KM: MPLSTP LOCK, RFC 6435 */
}
{
dissector_handle_t mplstp_fm_handle;
- mplstp_fm_handle = create_dissector_handle( dissect_mplstp_fm, proto_mplstp_fm );
+ mplstp_fm_handle = new_create_dissector_handle( dissect_mplstp_fm, proto_mplstp_fm );
dissector_add_uint("pwach.channel_type", 0x0058, mplstp_fm_handle); /* KM: MPLSTP FM, RFC 6427 */
}
static int dissect_mq_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
tcp_dissect_pdus(tvb, pinfo, tree, mq_desegment, 28, get_mq_pdu_len, reassemble_mq, data);
- return tvb_reported_length(tvb);
+ return tvb_captured_length(tvb);
}
-static void dissect_mq_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_mq_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Since SPX has no standard desegmentation, MQ cannot be performed as well */
dissect_mq_pdu(tvb, pinfo, tree);
+ return tvb_captured_length(tvb);
}
static gboolean dissect_mq_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint iProto, void *data)
* known port number, the MQ applications are most often specific to a business application */
mq_tcp_handle = new_create_dissector_handle(dissect_mq_tcp, proto_mq);
- mq_spx_handle = create_dissector_handle(dissect_mq_spx, proto_mq);
+ mq_spx_handle = new_create_dissector_handle(dissect_mq_spx, proto_mq);
dissector_add_for_decode_as("tcp.port", mq_tcp_handle);
heur_dissector_add("tcp", dissect_mq_heur_tcp, "WebSphere MQ over TCP", "mq_tcp", proto_mq, HEURISTIC_ENABLE);
}
/* Dissect a complete MQTT-SN message. */
-static void dissect_mqttsn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_mqttsn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Various variables. */
int offset = 0;
/* Dissect a MQTT-SN packet. */
dissect_mqttsn_packet(tvb, pinfo, tree, offset);
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark. */
proto_mqttsn = proto_register_protocol("MQ Telemetry Transport Protocol for Sensor Networks", "MQTT-SN", "mqttsn");
/* Create the dissector handle. */
- mqttsn_handle = create_dissector_handle(dissect_mqttsn, proto_mqttsn);
+ mqttsn_handle = new_create_dissector_handle(dissect_mqttsn, proto_mqttsn);
/* Register fields and subtrees. */
proto_register_field_array(proto_mqttsn, hf_mqttsn, array_length(hf_mqttsn));
*
* main dissect function that calls the other functions listed above as necessary
*/
-static void
-dissect_mmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-{
+static int
+dissect_mmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
/* Set up structures needed to add the protocol subtrees and manage them */
proto_item *ti, *msg_ti, *attr_list_ti, *vect_attr_ti;
proto_tree *mmrp_tree, *msg_tree, *attr_list_tree, *vect_attr_tree;
proto_tree_add_item(mmrp_tree, hf_mmrp_end_mark, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* Message EndMark */
}
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t mmrp_handle;
- mmrp_handle = create_dissector_handle(dissect_mmrp, proto_mmrp);
+ mmrp_handle = new_create_dissector_handle(dissect_mmrp, proto_mmrp);
dissector_add_uint("ethertype", ETHERTYPE_MMRP, mmrp_handle);
}
*
* main dissect function that calls the other functions listed above as necessary
*/
-static void
-dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtrees and manage them */
proto_item *ti, *msg_ti, *attr_list_ti, *vect_attr_ti, *first_value_ti;
} /* Multiple Message while() */
proto_tree_add_item(msrp_tree, hf_msrp_end_mark, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* Message EndMark */
}
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t msrp_handle;
- msrp_handle = create_dissector_handle(dissect_msrp, proto_msrp);
+ msrp_handle = new_create_dissector_handle(dissect_msrp, proto_msrp);
dissector_add_uint("ethertype", ETHERTYPE_MSRP, msrp_handle);
}
*
* main dissect function that calls the other functions listed above as necessary
*/
-static void
-dissect_mvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtrees and manage them */
proto_item *ti, *msg_ti, *attr_list_ti, *vect_attr_ti, *first_value_ti;
proto_tree_add_item(mvrp_tree, hf_mvrp_end_mark, tvb, offset+2, 2, ENC_BIG_ENDIAN); /* Message EndMark */
}
}
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t mvrp_handle;
- mvrp_handle = create_dissector_handle(dissect_mvrp, proto_mvrp);
+ mvrp_handle = new_create_dissector_handle(dissect_mvrp, proto_mvrp);
dissector_add_uint("ethertype", ETHERTYPE_MVRP, mvrp_handle);
}
/*
dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, guint16 tlv_len);
-static void
-dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *msdp_tree;
if (tvb_reported_length_remaining(tvb, offset) > 0)
proto_tree_add_item(msdp_tree, hf_msdp_trailing_junk, tvb, offset, -1, ENC_NA);
- return;
+ return tvb_captured_length(tvb);
}
/* Both Source-Active and Source-Active Response have the same format
* sent back.
*/
next_tvb = tvb_new_subset_remaining(tvb, *offset);
- dissect_msdp(next_tvb, pinfo, tree);
+ dissect_msdp(next_tvb, pinfo, tree, NULL);
}
break;
case FSM_ERROR:
{
dissector_handle_t msdp_handle;
- msdp_handle = create_dissector_handle(dissect_msdp, proto_msdp);
+ msdp_handle = new_create_dissector_handle(dissect_msdp, proto_msdp);
dissector_add_uint("tcp.port", 639, msdp_handle);
ip_handle = find_dissector("ip");
#define TCP_PORT_MSNMS 1863
-static void
-dissect_msnms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_msnms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *msnms_tree;
proto_item *ti;
offset = next_offset;
}
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t msnms_handle;
- msnms_handle = create_dissector_handle(dissect_msnms, proto_msnms);
+ msnms_handle = new_create_dissector_handle(dissect_msnms, proto_msnms);
dissector_add_uint("tcp.port", TCP_PORT_MSNMS, msnms_handle);
/*
* For MSN Messenger Protocol over HTTP
g_snprintf(result, ITEM_LABEL_LENGTH, "%d.%d", (version >> 8) & 0xFF, (version & 0xFF));
}
-static void
-dissect_msnlb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_msnlb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *msnlb_tree = NULL, *msnlb_subtree;
break;
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t msnlb_handle;
- msnlb_handle = create_dissector_handle(dissect_msnlb, proto_msnlb);
+ msnlb_handle = new_create_dissector_handle(dissect_msnlb, proto_msnlb);
dissector_add_uint("ethertype", ETHERTYPE_MS_NLB_HEARTBEAT, msnlb_handle);
}
/************** negotiated conversation hash stuff ***************/
-static void msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree) {
+static int msproxy_sub_dissector( tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, void* data _U_) {
/* Conversation dissector called from TCP or UDP dissector. Decode and */
/* display the msproxy header, the pass the rest of the data to the tcp */
pinfo->destport, -1);
*ptr = redirect_info->server_int_port;
+ return tvb_captured_length(tvb);
}
-static void dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
-
+static int dissect_msproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
proto_tree *msproxy_tree;
proto_item *ti;
dissect_msproxy_response( tvb, pinfo, msproxy_tree, hash_info);
else
dissect_msproxy_request( tvb, pinfo, msproxy_tree, hash_info);
+
+ return tvb_captured_length(tvb);
}
expert_msproxy = expert_register_protocol(proto_msproxy);
expert_register_field_array(expert_msproxy, ei, array_length(ei));
- msproxy_sub_handle = create_dissector_handle(msproxy_sub_dissector,
+ msproxy_sub_handle = new_create_dissector_handle(msproxy_sub_dissector,
proto_msproxy);
}
dissector_handle_t msproxy_handle;
- msproxy_handle = create_dissector_handle(dissect_msproxy,
+ msproxy_handle = new_create_dissector_handle(dissect_msproxy,
proto_msproxy);
dissector_add_uint("udp.port", UDP_PORT_MSPROXY, msproxy_handle);
}
}
/* Dissect MTP2 frame without CRC16 and with a pseudo-header */
-static void
-dissect_mtp2_with_phdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_mtp2_with_phdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
if (pinfo->pseudo_header->mtp2.annex_a_used == MTP2_ANNEX_A_USED_UNKNOWN)
dissect_mtp2_common(tvb, pinfo, tree, FALSE, use_extended_sequence_numbers_default);
else
dissect_mtp2_common(tvb, pinfo, tree, FALSE,
(pinfo->pseudo_header->mtp2.annex_a_used == MTP2_ANNEX_A_USED));
+
+ return tvb_captured_length(tvb);
}
/* Dissect MTP2 frame with CRC16 included at end of payload */
dissector_handle_t mtp2_with_phdr_handle;
dissector_add_uint("wtap_encap", WTAP_ENCAP_MTP2, mtp2_handle);
- mtp2_with_phdr_handle = create_dissector_handle(dissect_mtp2_with_phdr,
+ mtp2_with_phdr_handle = new_create_dissector_handle(dissect_mtp2_with_phdr,
proto_mtp2);
dissector_add_uint("wtap_encap", WTAP_ENCAP_MTP2_WITH_PHDR,
mtp2_with_phdr_handle);
}
/* ---------------------------- */
-static void
-dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nasdaq_soup(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *nasdaq_soup_tree = NULL;
*/
pinfo->desegment_offset = offset;
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
- return;
+ return tvb_captured_length(tvb);
}
nasdaq_soup_type = tvb_get_guint8(tvb, offset);
dissect_nasdaq_soup_packet(tvb, pinfo, tree, nasdaq_soup_tree, offset, linelen);
offset = next_offset;
}
+ return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
void
proto_reg_handoff_nasdaq_soup(void)
{
- nasdaq_soup_handle = create_dissector_handle(dissect_nasdaq_soup, proto_nasdaq_soup);
+ nasdaq_soup_handle = new_create_dissector_handle(dissect_nasdaq_soup, proto_nasdaq_soup);
nasdaq_itch_handle = find_dissector("nasdaq-itch");
dissector_add_for_decode_as("tcp.port", nasdaq_soup_handle);
}
static gint ett_nmpi_name_type_flags = -1;
-static void
-dissect_nmpi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nmpi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *nmpi_tree = NULL;
proto_item *ti;
next_tvb = tvb_new_subset_remaining(tvb, offset);
dissect_netbios_payload(next_tvb, pinfo, tree);
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t nmpi_handle;
- nmpi_handle = create_dissector_handle(dissect_nmpi, proto_nmpi);
+ nmpi_handle = new_create_dissector_handle(dissect_nmpi, proto_nmpi);
dissector_add_uint("ipx.socket", IPX_SOCKET_NWLINK_SMB_NAMEQUERY,
nmpi_handle);
dissector_add_uint("ipx.socket", IPX_SOCKET_NWLINK_SMB_MAILSLOT,
return cur_off - start_off;
}
-static void
-dissect_nbns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nbns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
int nbns_data_offset;
nbns_data_offset,
add, NULL, nbns_tree, opcode,
"Additional records");
+
+ return tvb_captured_length(tvb);
}
static heur_dissector_list_t netbios_heur_subdissector_list;
{ 0x00, NULL }
};
-static void
-dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nbdgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
proto_tree *nbdgm_tree = NULL;
proto_item_set_len(ti, offset);
break;
}
+ return tvb_captured_length(tvb);
}
/*
{
dissector_handle_t nbns_handle, nbdgm_handle, nbss_handle;
- nbns_handle = create_dissector_handle(dissect_nbns, proto_nbns);
+ nbns_handle = new_create_dissector_handle(dissect_nbns, proto_nbns);
dissector_add_uint("udp.port", UDP_PORT_NBNS, nbns_handle);
- nbdgm_handle = create_dissector_handle(dissect_nbdgm, proto_nbdgm);
+ nbdgm_handle = new_create_dissector_handle(dissect_nbdgm, proto_nbdgm);
dissector_add_uint("udp.port", UDP_PORT_NBDGM, nbdgm_handle);
nbss_handle = new_create_dissector_handle(dissect_nbss, proto_nbss);
}
}
-static void
-dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
dissect_ncp_common(tvb, pinfo, tree, FALSE);
+ return tvb_captured_length(tvb);
}
static guint
dissector_handle_t ncp_handle;
dissector_handle_t ncp_tcp_handle;
- ncp_handle = create_dissector_handle(dissect_ncp, proto_ncp);
+ ncp_handle = new_create_dissector_handle(dissect_ncp, proto_ncp);
ncp_tcp_handle = new_create_dissector_handle(dissect_ncp_tcp, proto_ncp);
dissector_add_uint("tcp.port", TCP_PORT_NCP, ncp_tcp_handle);
dissector_add_uint("udp.port", UDP_PORT_NCP, ncp_handle);
static int hf_panning_id = -1;
static int hf_incarnation = -1;
-static void
-dissect_ncs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ncs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *ncs_tree;
proto_item *ti;
proto_tree_add_item(ncs_tree, hf_panning_id, tvb, 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(ncs_tree, hf_incarnation, tvb, 8, 4, ENC_BIG_ENDIAN);
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t ncs_handle;
- ncs_handle = create_dissector_handle(dissect_ncs, proto_ncs);
+ ncs_handle = new_create_dissector_handle(dissect_ncs, proto_ncs);
dissector_add_uint("ip.proto", IP_PROTO_NCS_HEARTBEAT, ncs_handle);
}
/* Ethernet capture mode */
-static void
-dissect_netanalyzer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_netanalyzer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
tvbuff_t *next_tvb;
proto_tree_add_expert_format(tree, pinfo, &ei_netanalyzer_header_version_none, tvb, 4, -1,
"netANALYZER - No netANALYZER header found");
}
+ return tvb_captured_length(tvb);
}
/* Transparent capture mode */
-static void
-dissect_netanalyzer_transparent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_netanalyzer_transparent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *transparent_payload_tree = NULL;
tvbuff_t *next_tvb;
proto_tree_add_expert_format(tree, pinfo, &ei_netanalyzer_header_version_none, tvb, 4, -1,
"netANALYZER transparent mode - No netANALYZER header found");
}
+ return tvb_captured_length(tvb);
}
eth_dissector_handle = find_dissector("eth_withfcs");
data_dissector_handle = find_dissector("data");
- netana_handle = create_dissector_handle(dissect_netanalyzer, proto_netanalyzer);
- netana_handle_transparent = create_dissector_handle(dissect_netanalyzer_transparent, proto_netanalyzer);
+ netana_handle = new_create_dissector_handle(dissect_netanalyzer, proto_netanalyzer);
+ netana_handle_transparent = new_create_dissector_handle(dissect_netanalyzer_transparent, proto_netanalyzer);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NETANALYZER, netana_handle);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NETANALYZER_TRANSPARENT, netana_handle_transparent);
}
/* Code to actually dissect the packets */
-static void
-dissect_netdump(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_netdump(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
-
- /* Check that there's enough data */
- if (tvb_reported_length(tvb) == 0)
- return;
-
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Netdump");
/* Clear out stuff in the info column */
col_clear(pinfo->cinfo, COL_INFO);
proto_tree_add_item(netdump_tree, hf_netdump_payload, tvb, 13, -1, ENC_NA);
}
}
+ return tvb_captured_length(tvb);
}
void proto_register_netdump(void)
static int CurrentPort;
if (!initalized) {
- netdump_handle = create_dissector_handle(dissect_netdump,
+ netdump_handle = new_create_dissector_handle(dissect_netdump,
proto_netdump);
dissector_add_for_decode_as("udp.port", netdump_handle);
}
/* Code to actually dissect the packets */
-static void
-dissect_netrom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_netrom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
if ( tvb_get_guint8( tvb, 0 ) == 0xff )
dissect_netrom_routing( tvb, pinfo, tree );
else
dissect_netrom_proto( tvb, pinfo, tree );
+
+ return tvb_captured_length(tvb);
}
void
void
proto_reg_handoff_netrom(void)
{
- dissector_add_uint( "ax25.pid", AX25_P_NETROM, create_dissector_handle( dissect_netrom, proto_netrom ) );
+ dissector_add_uint( "ax25.pid", AX25_P_NETROM, new_create_dissector_handle( dissect_netrom, proto_netrom ) );
ip_handle = find_dissector( "ip" );
data_handle = find_dissector( "data" );
/* Code to actually dissect the nettl record headers */
-static void
-dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nettl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- pinfo->current_proto = "nettl";
-
if (tree) {
proto_tree *nettl_tree;
proto_item *nettl_item;
val_to_str_ext_const(pinfo->pseudo_header->nettl.subsys, &subsystem_ext, "Unknown"));
call_dissector(data_handle, tvb, pinfo, tree);
}
+ return tvb_captured_length(tvb);
}
ip_proto_dissector_table = find_dissector_table("ip.proto");
tcp_subdissector_table = find_dissector_table("tcp.port");
- nettl_handle = create_dissector_handle(dissect_nettl, proto_nettl);
+ nettl_handle = new_create_dissector_handle(dissect_nettl, proto_nettl);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NETTL_ETHERNET, nettl_handle);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NETTL_TOKEN_RING, nettl_handle);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NETTL_FDDI, nettl_handle);
}
/* SVR4: checked with ReliantUNIX (5.43, 5.44, 5.45), OpenSolaris (build 101a) */
-static void
-dissect_fhandle_data_SVR4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree)
+static int
+dissect_fhandle_data_SVR4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
guint encoding = ENC_BIG_ENDIAN; /* We support little endian and big endian. Default is big endian*/
gboolean have_flag = FALSE; /* The flag field at the end is optional. Assume no flag is there */
/* flag */
if (have_flag)
proto_tree_add_item(tree, hf_nfs_fh_flag, tvb, nof, 4, encoding);
+
+ return tvb_captured_length(tvb);
}
/* Checked with RedHat Linux 6.2 (kernel 2.2.14 knfsd) */
-static void
-dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree)
+static int
+dissect_fhandle_data_LINUX_KNFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
if (tree) {
int offset = 0;
proto_tree_add_item(tree, hf_nfs_fh_xfn_inode, tvb, offset+20, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(tree, hf_nfs_fh_fn_generation, tvb, offset+24, 4, ENC_LITTLE_ENDIAN);
}
+ return tvb_captured_length(tvb);
}
/* Checked with RedHat Linux 5.2 (nfs-server 2.2beta47 user-land nfsd) */
-static void
-dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree)
+static int
+dissect_fhandle_data_LINUX_NFSD_LE(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
int offset = 0;
proto_tree_add_item(hash_tree, hf_nfs_fh_hp_key, tvb, offset+5, hashlen, ENC_NA);
}
}
+ return tvb_captured_length(tvb);
}
-static void
-dissect_fhandle_data_NETAPP(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree)
+static int
+dissect_fhandle_data_NETAPP(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
int offset = 0;
static const int * flags[] = {
tvb, offset + 31, 1,
export_snapgen >> 24);
}
+ return tvb_captured_length(tvb);
}
static const value_string handle_type_strings[] = {
{ 0, NULL }
};
-static void
-dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree)
+static int
+dissect_fhandle_data_NETAPP_V4(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
static const int * flags[] = {
&hf_nfs_fh_file_flag_mntpoint,
};
if (tree == NULL)
- return;
+ return tvb_captured_length(tvb);
{
int offset = 0;
proto_tree_add_item(subtree, hf_nfs_fh_fsid, tvb, offset + 20, 4, encoding);
proto_tree_add_item(tree, hf_nfs_fh_handle_type, tvb, offset+24, 4, encoding);
}
+ return tvb_captured_length(tvb);
}
#define NETAPP_GX_FH3_LENGTH 44
#define SPINNP_FH_FLAG_SNAPDIR_MASK 0x02
#define SPINNP_FH_FLAG_STREAMDIR_MASK 0x01
-static void
-dissect_fhandle_data_NETAPP_GX_v3(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree)
+static int
+dissect_fhandle_data_NETAPP_GX_v3(tvbuff_t* tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
if (tree) {
proto_item *tf;
proto_tree_add_item(tree, hf_nfs3_gxfh_exportptuid, tvb, offset+40, 4, ENC_LITTLE_ENDIAN);
} /* end of (tree) */
+ return tvb_captured_length(tvb);
}
/* Checked with SuSE 7.1 (kernel 2.4.0 knfsd) */
}
-static void
-dissect_fhandle_data_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
+static int
+dissect_fhandle_data_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
{
guint fhlen = tvb_reported_length(tvb);
proto_tree_add_item(tree, hf_nfs_fh_fhandle_data, tvb, 0, fhlen, ENC_NA);
+ return tvb_captured_length(tvb);
}
have a unique identifier to determine subdissector */
fh_tvb = tvb_new_subset(tvb, offset, fhlen, fhlen);
if (!dissector_try_uint(nfs_fhandle_table, 0, fh_tvb, pinfo, tree))
- dissect_fhandle_data_unknown(fh_tvb, pinfo, tree);
+ dissect_fhandle_data_unknown(fh_tvb, pinfo, tree, NULL);
}
}
rpc_init_prog(proto_nfs, NFS_CB_PROGRAM, ett_nfs,
G_N_ELEMENTS(nfs_cb_vers_info), nfs_cb_vers_info);
- fhandle_handle = create_dissector_handle(dissect_fhandle_data_SVR4, proto_nfs_svr4);
+ fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_SVR4, proto_nfs_svr4);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
- fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_LE, proto_nfs_knfsd_le);
+ fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_LE, proto_nfs_knfsd_le);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
- fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_NFSD_LE, proto_nfs_nfsd_le);
+ fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_LINUX_NFSD_LE, proto_nfs_nfsd_le);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
fhandle_handle = create_dissector_handle(dissect_fhandle_data_LINUX_KNFSD_NEW, proto_nfs_knfsd_new);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
- fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP, proto_nfs_ontap_v3);
+ fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_NETAPP, proto_nfs_ontap_v3);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
- fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP_V4, proto_nfs_ontap_v4);
+ fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_NETAPP_V4, proto_nfs_ontap_v4);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
- fhandle_handle = create_dissector_handle(dissect_fhandle_data_NETAPP_GX_v3, proto_nfs_ontap_gx_v3);
+ fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_NETAPP_GX_v3, proto_nfs_ontap_gx_v3);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
fhandle_handle = create_dissector_handle(dissect_fhandle_data_CELERRA_VNX, proto_nfs_celerra_vnx);
fhandle_handle = create_dissector_handle(dissect_fhandle_data_DCACHE, proto_nfs_dcache);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
- fhandle_handle = create_dissector_handle(dissect_fhandle_data_unknown, proto_nfs_unknown);
+ fhandle_handle = new_create_dissector_handle(dissect_fhandle_data_unknown, proto_nfs_unknown);
dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle);
}
*pOffset = extEnd;
}
-static void dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
_dissect_nhrp(tvb, pinfo, tree, FALSE, TRUE);
+ return tvb_captured_length(tvb);
}
static void _dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
osinl_excl_subdissector_table = find_dissector_table("osinl.excl");
ethertype_subdissector_table = find_dissector_table("ethertype");
- nhrp_handle = create_dissector_handle(dissect_nhrp, proto_nhrp);
+ nhrp_handle = new_create_dissector_handle(dissect_nhrp, proto_nhrp);
dissector_add_uint("ip.proto", IP_PROTO_NARP, nhrp_handle);
dissector_add_uint("gre.proto", GRE_NHRP, nhrp_handle);
dissector_add_uint("llc.iana_pid", IANA_PID_MARS_NHRP_CONTROL, nhrp_handle);
* Output:
* void, but we will add to the proto_tree if it is not NULL.
*/
-static void
-dissect_nlsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nlsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti, *type_item;
proto_tree *nlsp_tree;
default:
expert_add_info(pinfo, type_item, &ei_nlsp_type);
}
+ return tvb_captured_length(tvb);
}
/*
{
dissector_handle_t nlsp_handle;
- nlsp_handle = create_dissector_handle(dissect_nlsp, proto_nlsp);
+ nlsp_handle = new_create_dissector_handle(dissect_nlsp, proto_nlsp);
dissector_add_uint("ipx.socket", IPX_SOCKET_NLSP, nlsp_handle);
}
#define TCP_PORT_NNTP 119
-static void
-dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
const gchar *type;
proto_tree *nntp_tree;
offset = next_offset;
}
}
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t nntp_handle;
- nntp_handle = create_dissector_handle(dissect_nntp, proto_nntp);
+ nntp_handle = new_create_dissector_handle(dissect_nntp, proto_nntp);
dissector_add_uint("tcp.port", TCP_PORT_NNTP, nntp_handle);
}
static gint ett_nsrp = -1;
/* Code to actually dissect the packets */
-static void
-dissect_nsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *nsrp_tree = NULL;
}
+ return tvb_captured_length(tvb);
}
{
dissector_handle_t nsrp_handle;
- nsrp_handle = create_dissector_handle(dissect_nsrp, proto_nsrp);
+ nsrp_handle = new_create_dissector_handle(dissect_nsrp, proto_nsrp);
dissector_add_uint("ethertype", ETHERTYPE_NSRP, nsrp_handle);
}
#define VMNAMERECOFFSET(field) (guint)(offsetof(nspr_rec_vmname_t, field))
#define SSLRECOFFSET(field) (guint)(offsetof(nspr_rec_ssl_t, field))
#define MPTCPRECOFFSET(field) (guint)(offsetof(nspr_rec_mptcp_t, field))
-static void
-dissect_nstrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_nstrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *ns_tree = NULL, *flagtree = NULL;
proto_item *ti = NULL, *flagitem = NULL;
next_tvb_eth_client = tvb_new_subset_remaining(tvb, offset);
call_dissector(eth_withoutfcs_handle, next_tvb_eth_client, pinfo, tree);
}
+
+ return tvb_captured_length(tvb);
}
void add35records(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *ns_tree)
eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
- nstrace_handle = create_dissector_handle(dissect_nstrace, proto_nstrace);
+ nstrace_handle = new_create_dissector_handle(dissect_nstrace, proto_nstrace);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NSTRACE_1_0, nstrace_handle);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NSTRACE_2_0, nstrace_handle);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NSTRACE_3_0, nstrace_handle);
* pinfo - packet info
* proto_tree - resolved protocol tree
*/
-static void
-dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_ntp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *ntp_tree;
proto_item *ti = NULL;
/* Dissect according to mode */
(*dissector)(tvb, pinfo, ntp_tree);
+ return tvb_captured_length(tvb);
}
void
{
dissector_handle_t ntp_handle;
- ntp_handle = create_dissector_handle(dissect_ntp, proto_ntp);
+ ntp_handle = new_create_dissector_handle(dissect_ntp, proto_ntp);
dissector_add_uint("udp.port", UDP_PORT_NTP, ntp_handle);
dissector_add_uint("tcp.port", TCP_PORT_NTP, ntp_handle);
}
}
}
-static void
-dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_null(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint32 null_header;
proto_tree *fh_tree;
}
}
}
+ return tvb_captured_length(tvb);
}
/*
* OpenBSD DLT_LOOP; like DLT_NULL, but with the first 4 byte *always*
* being a *big-endian* type.
*/
-static void
-dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
guint32 loop_family;
proto_tree *fh_tree;
/* No sub-dissector found. Label rest of packet as "Data" */
call_dissector(data_handle,next_tvb, pinfo, tree);
}
+ return tvb_captured_length(tvb);
}
void
ethertype_dissector_table = find_dissector_table("ethertype");
- null_handle = create_dissector_handle(dissect_null, proto_null);
+ null_handle = new_create_dissector_handle(dissect_null, proto_null);
dissector_add_uint("wtap_encap", WTAP_ENCAP_NULL, null_handle);
- loop_handle = create_dissector_handle(dissect_loop, proto_null);
+ loop_handle = new_create_dissector_handle(dissect_loop, proto_null);
dissector_add_uint("wtap_encap", WTAP_ENCAP_LOOP, loop_handle);
}