Add a new WTAP_ENCAP_CHDLC_WITH_PHDR type, to distinguish Cisco HDLC

captures with packet direction information from captures without it.
Use them appropriately.

svn path=/trunk/; revision=8780
This commit is contained in:
Guy Harris 2003-10-25 07:17:28 +00:00
parent aed6852d6b
commit b624dce63b
6 changed files with 22 additions and 17 deletions

View File

@ -1,7 +1,7 @@
/* packet-chdlc.c
* Routines for Cisco HDLC packet disassembly
*
* $Id: packet-chdlc.c,v 1.20 2003/08/26 05:52:43 guy Exp $
* $Id: packet-chdlc.c,v 1.21 2003/10/25 07:17:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -243,6 +243,7 @@ proto_reg_handoff_chdlc(void)
data_handle = find_dissector("data");
chdlc_handle = find_dissector("chdlc");
dissector_add("wtap_encap", WTAP_ENCAP_CHDLC, chdlc_handle);
dissector_add("wtap_encap", WTAP_ENCAP_CHDLC_WITH_PHDR, chdlc_handle);
}
#define SLARP_REQUEST 0

View File

@ -2,7 +2,7 @@
*
* Top-most dissector. Decides dissector based on Wiretap Encapsulation Type.
*
* $Id: packet-frame.c,v 1.40 2003/10/23 05:01:38 guy Exp $
* $Id: packet-frame.c,v 1.41 2003/10/25 07:17:26 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -84,7 +84,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (pinfo->fd->lnk_t) {
case WTAP_ENCAP_WFLEET_HDLC:
case WTAP_ENCAP_CHDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR:
case WTAP_ENCAP_PPP_WITH_PHDR:
case WTAP_ENCAP_SDLC:
pinfo->p2p_dir = pinfo->pseudo_header->p2p.sent ?

View File

@ -1,6 +1,6 @@
/* ngsniffer.c
*
* $Id: ngsniffer.c,v 1.111 2003/10/01 07:11:48 guy Exp $
* $Id: ngsniffer.c,v 1.112 2003/10/25 07:17:27 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@ -1667,7 +1667,7 @@ static int infer_pkt_encap(const guint8 *pd, int len)
/*
* Cisco HDLC.
*/
return WTAP_ENCAP_CHDLC;
return WTAP_ENCAP_CHDLC_WITH_PHDR;
}
}
@ -1701,7 +1701,7 @@ static int fix_pseudo_header(int encap, const guint8 *pd, int len,
switch (encap) {
case WTAP_ENCAP_WFLEET_HDLC:
case WTAP_ENCAP_CHDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR:
case WTAP_ENCAP_PPP_WITH_PHDR:
if (pseudo_header->x25.flags == 0)
pseudo_header->p2p.sent = TRUE;

View File

@ -2,7 +2,7 @@
* File read and write routines for Visual Networks cap files.
* Copyright (c) 2001, Tom Nisbet tnisbet@visualnetworks.com
*
* $Id: visual.c,v 1.13 2003/10/01 07:11:48 guy Exp $
* $Id: visual.c,v 1.14 2003/10/25 07:17:28 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@ -187,7 +187,7 @@ int visual_open(wtap *wth, int *err)
break;
case 22:
encap = WTAP_ENCAP_CHDLC;
encap = WTAP_ENCAP_CHDLC_WITH_PHDR;
break;
case 32:
@ -307,7 +307,7 @@ static gboolean visual_read(wtap *wth, int *err, long *data_offset)
/* Fill in the encapsulation. Visual files have a media type in the
file header and an encapsulation type in each packet header. Files
with a media type of HDLC can be either Cisco EtherType or PPP. */
if ((wth->file_encap == WTAP_ENCAP_CHDLC) && (vpkt_hdr.encap_hint == 14))
if ((wth->file_encap == WTAP_ENCAP_CHDLC_WITH_PHDR) && (vpkt_hdr.encap_hint == 14))
wth->phdr.pkt_encap = WTAP_ENCAP_PPP_WITH_PHDR;
else
wth->phdr.pkt_encap = wth->file_encap;
@ -383,7 +383,7 @@ static void visual_set_pseudo_header(int encap, struct visual_pkt_hdr *vpkt_hdr,
pseudo_header->eth.fcs_len = -1;
break;
case WTAP_ENCAP_CHDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR:
case WTAP_ENCAP_PPP_WITH_PHDR:
pseudo_header->p2p.sent = (packet_status & PS_SENT) ? TRUE : FALSE;
break;
@ -411,7 +411,7 @@ int visual_dump_can_write_encap(int encap)
case WTAP_ENCAP_ETHERNET:
case WTAP_ENCAP_TOKEN_RING:
case WTAP_ENCAP_LAPB:
case WTAP_ENCAP_CHDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR:
case WTAP_ENCAP_FRELAY_WITH_PHDR:
case WTAP_ENCAP_PPP:
case WTAP_ENCAP_PPP_WITH_PHDR:
@ -517,7 +517,7 @@ static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
case WTAP_ENCAP_PPP_WITH_PHDR:
vpkt_hdr.encap_hint = 14;
break;
case WTAP_ENCAP_CHDLC: /* HDLC Router */
case WTAP_ENCAP_CHDLC_WITH_PHDR: /* HDLC Router */
vpkt_hdr.encap_hint = 13;
break;
case WTAP_ENCAP_FRELAY_WITH_PHDR: /* Frame Relay Auto-detect */
@ -536,7 +536,7 @@ static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
packet_status = 0;
switch (wdh->encap)
{
case WTAP_ENCAP_CHDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR:
packet_status |= (pseudo_header->p2p.sent ? PS_SENT : 0x00);
break;
@ -668,7 +668,7 @@ static gboolean visual_dump_close(wtap_dumper *wdh, int *err)
case WTAP_ENCAP_PPP: /* PPP is differentiated from CHDLC in PktHdr */
case WTAP_ENCAP_PPP_WITH_PHDR:
case WTAP_ENCAP_CHDLC:
case WTAP_ENCAP_CHDLC_WITH_PHDR:
vfile_hdr.media_type = htoles(22);
break;

View File

@ -1,6 +1,6 @@
/* wtap.c
*
* $Id: wtap.c,v 1.83 2003/05/16 00:34:33 guy Exp $
* $Id: wtap.c,v 1.84 2003/10/25 07:17:28 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@ -175,6 +175,9 @@ static const struct encap_type_info {
/* WTAP_ENCAP_PFLOG */
{ "OpenBSD PF Firewall logs", "pflog" },
/* WTAP_ENCAP_CHDLC_WITH_PHDR */
{ "Cisco HDLC with Directional Info", "chdlc-with-direction" },
};
/* Name that should be somewhat descriptive. */

View File

@ -1,6 +1,6 @@
/* wtap.h
*
* $Id: wtap.h,v 1.141 2003/10/01 07:11:49 guy Exp $
* $Id: wtap.h,v 1.142 2003/10/25 07:17:28 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@ -128,9 +128,10 @@
#define WTAP_ENCAP_TZSP 36
#define WTAP_ENCAP_ENC 37
#define WTAP_ENCAP_PFLOG 38
#define WTAP_ENCAP_CHDLC_WITH_PHDR 39
/* last WTAP_ENCAP_ value + 1 */
#define WTAP_NUM_ENCAP_TYPES 39
#define WTAP_NUM_ENCAP_TYPES 40
/* File types that can be read by wiretap.
We support writing some many of these file types, too, so we