Clean up capture_enc(), export it, and use it in the capture window.
svn path=/trunk/; revision=16709
This commit is contained in:
parent
d00581f430
commit
0b1f2585c5
|
@ -54,8 +54,7 @@
|
|||
#include <epan/dissectors/packet-prism.h>
|
||||
#include <epan/dissectors/packet-ipfc.h>
|
||||
#include <epan/dissectors/packet-arcnet.h>
|
||||
|
||||
|
||||
#include <epan/dissectors/packet-enc.h>
|
||||
|
||||
static void capture_info_packet(
|
||||
packet_counts *counts, gint wtap_linktype, const guchar *pd, guint32 caplen, union wtap_pseudo_header *pseudo_header);
|
||||
|
@ -216,6 +215,9 @@ capture_info_packet(packet_counts *counts, gint wtap_linktype, const guchar *pd,
|
|||
case WTAP_ENCAP_FRELAY_WITH_PHDR:
|
||||
capture_fr(pd, 0, caplen, counts);
|
||||
break;
|
||||
case WTAP_ENCAP_ENC:
|
||||
capture_enc(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. */
|
||||
|
|
|
@ -728,6 +728,7 @@ DISSECTOR_INCLUDES = \
|
|||
packet-dvmrp.h \
|
||||
packet-e164.h \
|
||||
packet-edonkey.h \
|
||||
packet-enc.h \
|
||||
packet-esis.h \
|
||||
packet-ess.h \
|
||||
packet-eth.h \
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <epan/packet.h>
|
||||
#include <epan/etypes.h>
|
||||
#include <epan/addr_resolv.h>
|
||||
#include "packet-enc.h"
|
||||
#include "packet-ip.h"
|
||||
#include "packet-ipv6.h"
|
||||
|
||||
|
@ -67,33 +68,26 @@ static int hf_enc_flags = -1;
|
|||
|
||||
static gint ett_enc = -1;
|
||||
|
||||
static void
|
||||
capture_enc(const guchar *pd, int offset, int len, packet_counts *ld)
|
||||
void
|
||||
capture_enc(const guchar *pd, int len, packet_counts *ld)
|
||||
{
|
||||
struct enchdr ench;
|
||||
guint32 af;
|
||||
|
||||
if (!BYTES_ARE_IN_FRAME(offset, len, (int)ENC_HDRLEN)) {
|
||||
if (!BYTES_ARE_IN_FRAME(0, len, (int)ENC_HDRLEN)) {
|
||||
ld->other++;
|
||||
return;
|
||||
}
|
||||
|
||||
offset += ENC_HDRLEN;
|
||||
|
||||
/* Copy out the enc header to insure alignment */
|
||||
memcpy(&ench, pd, sizeof(ench));
|
||||
ench.af = g_ntohl(ench.af);
|
||||
|
||||
switch (ench.af) {
|
||||
af = pntohl(pd + offsetof(struct enchdr, af));
|
||||
switch (af) {
|
||||
|
||||
case BSD_ENC_INET:
|
||||
capture_ip(pd, offset, len, ld);
|
||||
capture_ip(pd, ENC_HDRLEN, len, ld);
|
||||
break;
|
||||
|
||||
#ifdef notyet
|
||||
case BSD_ENC_INET6:
|
||||
capture_ipv6(pd, offset, len, ld);
|
||||
capture_ipv6(pd, ENC_HDRLEN, len, ld);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
ld->other++;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* packet-enc.h
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
* 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_ENC_H__
|
||||
#define __PACKET_ENC_H__
|
||||
|
||||
void capture_enc(const guchar *, int, packet_counts *);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue