From 4ec9c54b4b00287efa764746602f94f52ac4af2a Mon Sep 17 00:00:00 2001 From: Gilbert Ramirez Date: Thu, 11 Nov 1999 05:36:16 +0000 Subject: Add LAPD support. svn path=/trunk/; revision=1004 --- wiretap/toshiba.c | 16 ++++++++-------- wiretap/wtap.h | 17 ++++++++++++----- 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'wiretap') diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c index 8b977f429c..cb4e045433 100644 --- a/wiretap/toshiba.c +++ b/wiretap/toshiba.c @@ -1,6 +1,6 @@ /* toshiba.c * - * $Id: toshiba.c,v 1.1 1999/10/31 17:46:08 gram Exp $ + * $Id: toshiba.c,v 1.2 1999/11/11 05:36:15 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -257,7 +257,7 @@ parse_toshiba_rec_hdr(wtap *wth, FILE *fh, int *err) char line[TOSHIBA_LINE_LENGTH]; int num_items_scanned; int pkt_len, pktnum, hr, min, sec, csec; - char channel[10]; + char channel[10], direction[10]; /* Our file pointer should be on the line containing the * summary information for a packet. Read in that line and @@ -271,10 +271,10 @@ parse_toshiba_rec_hdr(wtap *wth, FILE *fh, int *err) return -1; } - num_items_scanned = sscanf(line, "[No.%d] %d:%d:%d.%d %s:", - &pktnum, &hr, &min, &sec, &csec, channel); + num_items_scanned = sscanf(line, "[No.%d] %d:%d:%d.%d %s %s", + &pktnum, &hr, &min, &sec, &csec, channel, direction); - if (num_items_scanned != 6) { + if (num_items_scanned != 7) { *err = WTAP_ERR_BAD_RECORD; return -1; } @@ -306,9 +306,9 @@ parse_toshiba_rec_hdr(wtap *wth, FILE *fh, int *err) break; case 'D': - /*wth->phdr.pkt_encap = WTAP_ENCAP_LAPD;*/ - /*wth->phdr.pkt_encap = WTAP_ENCAP_ISDN;*/ - wth->phdr.pkt_encap = WTAP_ENCAP_UNKNOWN; + wth->phdr.pkt_encap = WTAP_ENCAP_LAPD; + wth->phdr.pseudo_header.lapd.from_network_to_user = + (direction[0] == 'R' ? TRUE : FALSE ); break; default: diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 269be246c0..21eba2253a 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1,6 +1,6 @@ /* wtap.h * - * $Id: wtap.h,v 1.48 1999/11/06 10:31:46 guy Exp $ + * $Id: wtap.h,v 1.49 1999/11/11 05:36:16 gram Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -91,9 +91,10 @@ #define WTAP_ENCAP_ATM_SNIFFER 12 #define WTAP_ENCAP_NULL 13 #define WTAP_ENCAP_ASCEND 14 +#define WTAP_ENCAP_LAPD 15 /* last WTAP_ENCAP_ value + 1 */ -#define WTAP_NUM_ENCAP_TYPES 15 +#define WTAP_NUM_ENCAP_TYPES 16 /* File types that can be read by wiretap. We may eventually support writing some or all of these file types, @@ -224,6 +225,11 @@ struct ascend_phdr { guint32 task; /* Task number */ }; +/* Packet "pseudo-header" information for LAPD capture files. */ +struct lapd_phdr { + gboolean from_network_to_user; +}; + /* * Bits in AppTrafType. * @@ -277,9 +283,10 @@ struct ascend_phdr { #define AHLT_VCMX_BPDU 0xe /* VCMX: BPDU */ union pseudo_header { - struct x25_phdr x25; - struct ngsniffer_atm_phdr ngsniffer_atm; - struct ascend_phdr ascend; + struct x25_phdr x25; + struct ngsniffer_atm_phdr ngsniffer_atm; + struct ascend_phdr ascend; + struct lapd_phdr lapd; }; struct wtap_pkthdr { -- cgit v1.2.3