diff options
-rw-r--r-- | capture_info.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-ppi.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-ppi.h | 29 | ||||
-rw-r--r-- | epan/libwireshark.def | 1 |
4 files changed, 77 insertions, 4 deletions
diff --git a/capture_info.c b/capture_info.c index a5e9431d5f..e847297558 100644 --- a/capture_info.c +++ b/capture_info.c @@ -46,6 +46,7 @@ #include <epan/dissectors/packet-fddi.h> #include <epan/dissectors/packet-fr.h> #include <epan/dissectors/packet-null.h> +#include <epan/dissectors/packet-ppi.h> #include <epan/dissectors/packet-ppp.h> #include <epan/dissectors/packet-raw.h> #include <epan/dissectors/packet-sll.h> @@ -328,6 +329,9 @@ capture_info_packet(packet_counts *counts, gint wtap_linktype, const guchar *pd, case WTAP_ENCAP_ENC: capture_enc(pd, caplen, counts); break; + case WTAP_ENCAP_PPI: + capture_ppi(pd, caplen, counts); + break; /* XXX - some ATM drivers on FreeBSD might prepend a 4-byte ATM pseudo-header to DLT_ATM_RFC1483, with LLC header following; we might have to implement that at some point. */ diff --git a/epan/dissectors/packet-ppi.c b/epan/dissectors/packet-ppi.c index 252708ab22..7f186fccab 100644 --- a/epan/dissectors/packet-ppi.c +++ b/epan/dissectors/packet-ppi.c @@ -59,6 +59,8 @@ #include <wiretap/wtap-capture.h> #include "packet-frame.h" +#include "packet-eth.h" +#include "packet-ieee80211.h" /* * Per-Packet Information (PPI) header. @@ -360,14 +362,51 @@ static void dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); void -capture_ppi(const guchar *pd _U_, int offset, int len, packet_counts *ld) +capture_ppi(const guchar *pd, int len, packet_counts *ld) { - if(!BYTES_ARE_IN_FRAME(offset, len, PPI_V0_HEADER_LEN)) { - ld->other ++; + guint32 dlt; + guint ppi_len, data_type, data_len; + guint offset = PPI_V0_HEADER_LEN; + gboolean is_htc = FALSE; + + ppi_len = pletohs(pd+2); + if(ppi_len < PPI_V0_HEADER_LEN || !BYTES_ARE_IN_FRAME(0, len, ppi_len)) { + ld->other++; return; } - /* call appropriate capture_* routine */ + dlt = pletohl(pd+4); + + /* Figure out if we're +HTC */ + while (offset < ppi_len) { + data_type = pletohs(pd+offset); + data_len = pletohs(pd+offset+2) + 4; + offset += data_len; + + if (data_type == PPI_80211N_MAC || data_type == PPI_80211N_MAC_PHY) { + is_htc = TRUE; + break; + } + } + + /* XXX - We should probably combine this with capture_info.c:capture_info_packet() */ + switch(dlt) { + case 1: /* DLT_EN10MB */ + capture_eth(pd, ppi_len, len, ld); + return; + break; + case 105: /* DLT_DLT_IEEE802_11 */ + if (is_htc) + capture_ieee80211_ht(pd, ppi_len, len, ld); + else + capture_ieee80211(pd, ppi_len, len, ld); + return; + break; + default: + break; + } + + ld->other++; } static void ptvcursor_add_invalid_check(ptvcursor_t *csr, int hf, gint len, guint64 invalid_val) { diff --git a/epan/dissectors/packet-ppi.h b/epan/dissectors/packet-ppi.h new file mode 100644 index 0000000000..bd1415915d --- /dev/null +++ b/epan/dissectors/packet-ppi.h @@ -0,0 +1,29 @@ +/* packet-ppi.h + * + * $Id$ + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __PACKET_PPI_H__ +#define __PACKET_PPI_H__ + +void capture_ppi(const guchar *pd, int len, packet_counts *ld); + +#endif diff --git a/epan/libwireshark.def b/epan/libwireshark.def index f052624f4b..6cb7320337 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -55,6 +55,7 @@ capture_ieee80211 capture_ipfc capture_llap capture_null +capture_ppi capture_ppp_hdlc capture_prism capture_radiotap |