}
next_tvb = tvb_new_subset(tvb, 2, len, reported_len);
- call_dissector(fc_dissector_handle, next_tvb, pinfo, tree);
+ call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, GUINT_TO_POINTER((guint)ETHERTYPE_BRDWALK));
}
static void
/* Code to actually dissect the packets */
static int
-dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_eplpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean udpencap)
{
guint8 epl_mtyp, epl_src, epl_dest;
const gchar *src_str, *dest_str;
- gboolean udpencap = FALSE;
/* static epl_info_t mi; */
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
}
/* Make entries in Protocol column and Info column on summary display */
- if (pinfo->ethertype == ETHERTYPE_EPL_V2)
+ if (!udpencap)
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "EPL");
- udpencap = FALSE;
}
else
{
/* guess that this is an EPL frame encapsulated into an UDP datagram */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "EPL/UDP");
- udpencap = TRUE;
}
/*
return offset;
}
+static int
+dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+{
+ return dissect_eplpdu(tvb, pinfo, tree, FALSE);
+}
+
+static int
+dissect_epludp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+{
+ return dissect_eplpdu(tvb, pinfo, tree, TRUE);
+}
const gchar*
void
proto_reg_handoff_epl(void)
{
+ dissector_handle_t epl_udp_handle = new_create_dissector_handle( dissect_epludp, proto_epl );
+
dissector_add_uint("ethertype", ETHERTYPE_EPL_V2, epl_handle);
- dissector_add_uint("udp.port", UDP_PORT_EPL, epl_handle);
+ dissector_add_uint("udp.port", UDP_PORT_EPL, epl_udp_handle);
}
/*
/* Code to actually dissect the packets */
static void
-dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_ifcp)
+dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_ifcp, guint ethertype)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti=NULL, *hidden_item;
* and are never fragmented and so we ignore the frag_size assertion for
* these frames.
*/
- if ((pinfo->ethertype == ETHERTYPE_UNK) || (pinfo->ethertype == ETHERTYPE_FCFT)) {
+ if ((ethertype == ETHERTYPE_UNK) || (ethertype == ETHERTYPE_FCFT)) {
if ((frag_size < MDSHDR_TRAILER_SIZE) ||
((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) &&
(ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS)))
THROW(ReportedBoundsError);
frag_size -= MDSHDR_TRAILER_SIZE;
- } else if (pinfo->ethertype == ETHERTYPE_BRDWALK) {
+ } else if (ethertype == ETHERTYPE_BRDWALK) {
if ((frag_size <= 8) ||
((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) &&
(ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS)))
tap_queue_packet(fc_tap, pinfo, &fchdr);
}
-static void
-dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
- dissect_fc_helper (tvb, pinfo, tree, FALSE);
+ dissect_fc_helper (tvb, pinfo, tree, FALSE, GPOINTER_TO_UINT(data));
+ return tvb_length(tvb);
}
+
static void
dissect_fc_ifcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- dissect_fc_helper (tvb, pinfo, tree, TRUE);
+ dissect_fc_helper (tvb, pinfo, tree, TRUE, 0);
}
static void
/* Register the protocol name and description */
proto_fc = proto_register_protocol ("Fibre Channel", "FC", "fc");
- fc_handle = register_dissector ("fc", dissect_fc, proto_fc);
+ fc_handle = new_register_dissector ("fc", dissect_fc, proto_fc);
register_dissector ("fc_ifcp", dissect_fc_ifcp, proto_fc);
fc_tap = register_tap("fc");
dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, gboolean fixed_length_header, gint fcs_len,
gboolean wlan_broken_fc, gboolean datapad,
- gboolean is_ht)
+ gboolean is_ht, gboolean is_centrino)
{
guint16 fcf, flags, frame_type_subtype, ctrl_fcf, ctrl_type_subtype;
guint16 seq_control;
}
/* Davide Schiera (2006-11-21) ---------------------------------- */
- if ((pinfo->ethertype != ETHERTYPE_CENTRINO_PROMISC) && (wlan_ignore_wep == WLAN_IGNORE_WEP_NO)) {
+ if ((!is_centrino) && (wlan_ignore_wep == WLAN_IGNORE_WEP_NO)) {
/* Some wireless drivers (such as Centrino) WEP payload already decrypted */
call_dissector(data_handle, next_tvb, pinfo, tree);
goto end_of_wlan;
dissect_ieee80211 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
- pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE);
+ pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE, FALSE);
+}
+
+/*
+ * Dissect 802.11 with a variable-length link-layer header.
+ */
+static void
+dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
+ pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE, TRUE);
}
/*
dissect_ieee80211_datapad (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
- pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, TRUE, FALSE);
+ pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, TRUE, FALSE, FALSE);
}
/*
static void
dissect_ieee80211_bsfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- dissect_ieee80211_common (tvb, pinfo, tree, FALSE, 0, TRUE, FALSE, FALSE);
+ dissect_ieee80211_common (tvb, pinfo, tree, FALSE, 0, TRUE, FALSE, FALSE, FALSE);
}
/*
static void
dissect_ieee80211_fixed (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- dissect_ieee80211_common (tvb, pinfo, tree, TRUE, 0, FALSE, FALSE, FALSE);
+ dissect_ieee80211_common (tvb, pinfo, tree, TRUE, 0, FALSE, FALSE, FALSE, FALSE);
}
/*
dissect_ieee80211_ht (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_ieee80211_common (tvb, pinfo, tree, FALSE,
- pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, TRUE);
+ pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, TRUE, FALSE);
}
static void
void
proto_reg_handoff_ieee80211(void)
{
- dissector_handle_t data_encap_handle;
+ dissector_handle_t data_encap_handle, centrino_handle;
/*
* Get handles for the LLC, IPX and Ethernet dissectors.
ieee80211_handle = find_dissector("wlan");
dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11, ieee80211_handle);
- dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, ieee80211_handle);
+
+ centrino_handle = create_dissector_handle( dissect_ieee80211_centrino, proto_wlan );
+ dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, centrino_handle);
/* Register handoff to Aruba GRE */
dissector_add_uint("gre.proto", GRE_ARUBA_8200, ieee80211_handle);
/* Call the Fibre Channel dissector */
if (fc_dissector_handle) {
- call_dissector(fc_dissector_handle, next_tvb, pinfo, tree);
+ call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, GUINT_TO_POINTER((guint)ETHERTYPE_FCFT));
}
else {
call_dissector(data_handle, next_tvb, pinfo, tree);
dissector_handle_t ptpIP_handle;
- /* Use new_create_dissector_handle() to indicate that dissect_wol()
+ /* Use new_create_dissector_handle() to indicate that dissect_ptpIP()
* returns the number of bytes it dissected (or 0 if it thinks the packet
* does not belong to PROTONAME).
*/
#include <epan/addr_resolv.h>
#include <epan/etypes.h>
-/* IF PROTO exposes code to other dissectors, then it must be exported
- in a header file. If not, a header file is not needed at all. */
-/* #include "packet-wol.h" */
-
/* Initialize the protocol and registered fields */
static int proto_wol = -1;
static int hf_wol_sync = -1;
static int hf_wol_mac = -1;
static int hf_wol_passwd = -1;
-/* Global sample preference ("controls" display of numbers) */
-/* static gboolean gPREF_HEX = FALSE; */
-
/* Initialize the subtree pointers */
static gint ett_wol = -1;
static gint ett_wol_macblock = -1;
/* Code to actually dissect the packets */
static int
-dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+dissect_wol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint len;
gint offset;
6, passwd, "%s", passwd);
}
-/* If this protocol has a sub-dissector call it here, see section 1.8 */
+ return (len);
+}
-/* Return the amount of data this dissector was able to dissect */
- if ( pinfo->ethertype == ETHERTYPE_WOL )
- return (len);
+static int
+dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+{
+ return dissect_wol_pdu(tvb, pinfo, tree, data);
+}
- /* Heuristic dissectors return TRUE/FALSE. */
- return (TRUE);
+static gboolean
+dissect_wolheur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
+{
+ if (dissect_wol_pdu(tvb, pinfo, tree, data) > 0)
+ return TRUE;
+
+ return FALSE;
}
proto_register_subtree_array(ett, array_length(ett));
}
-
/* If this dissector uses sub-dissector registration add a registration routine.
This exact format is required because a script is used to find these
routines and create the code that calls these routines.
* we'll miss some, but how else to do this ... add a thousand of
* these dissector_add_uint()'s and heur_dissector_add()'s??? */
dissector_add_uint("ethertype", ETHERTYPE_WOL, wol_handle);
- heur_dissector_add("udp", dissect_wol, proto_wol);
+ heur_dissector_add("udp", dissect_wolheur, proto_wol);
}
/*