From 87205b018fec98ad93b73cfc63df64d922d20c08 Mon Sep 17 00:00:00 2001 From: Olivier Abad Date: Mon, 13 Nov 2000 23:00:55 +0000 Subject: Improve the detection of the encapsulation used in a radcom file. svn path=/trunk/; revision=2639 --- wiretap/radcom.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'wiretap/radcom.c') diff --git a/wiretap/radcom.c b/wiretap/radcom.c index 23cb8fdfa9..f0cde052fa 100644 --- a/wiretap/radcom.c +++ b/wiretap/radcom.c @@ -1,6 +1,6 @@ /* radcom.c * - * $Id: radcom.c,v 1.26 2000/09/07 05:34:18 gram Exp $ + * $Id: radcom.c,v 1.27 2000/11/13 23:00:55 oabad Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -81,7 +81,7 @@ int radcom_open(wtap *wth, int *err) guint32 sec; struct tm tm; char byte; - char encap_magic[7] = {0x54, 0x43, 0x50, 0x00, 0x42, 0x43, 0x09}; + char encap_magic[4] = {0x00, 0x42, 0x43, 0x09}; char search_encap[7]; /* Read in the string that should be at the start of a RADCOM file */ @@ -121,8 +121,6 @@ int radcom_open(wtap *wth, int *err) } wth->data_offset += 1; } - file_seek(wth->fh, 1, SEEK_CUR); - wth->data_offset += 1; /* Get capture start time */ errno = WTAP_ERR_CANT_READ; @@ -154,20 +152,20 @@ int radcom_open(wtap *wth, int *err) wth->data_offset += sizeof(struct frame_date); errno = WTAP_ERR_CANT_READ; - bytes_read = file_read(search_encap, 1, 7, wth->fh); - if (bytes_read != 7) { + bytes_read = file_read(search_encap, 1, 4, wth->fh); + if (bytes_read != 4) { goto read_error; } - wth->data_offset += 7; - while (memcmp(encap_magic, search_encap, 7)) { - file_seek(wth->fh, -6, SEEK_CUR); - wth->data_offset -= 6; + wth->data_offset += 4; + while (memcmp(encap_magic, search_encap, 4)) { + file_seek(wth->fh, -3, SEEK_CUR); + wth->data_offset -= 3; errno = WTAP_ERR_CANT_READ; - bytes_read = file_read(search_encap, 1, 7, wth->fh); - if (bytes_read != 7) { + bytes_read = file_read(search_encap, 1, 4, wth->fh); + if (bytes_read != 4) { goto read_error; } - wth->data_offset += 7; + wth->data_offset += 4; } file_seek(wth->fh, 12, SEEK_CUR); wth->data_offset += 12; -- cgit v1.2.3