1998-11-12 06:01:27 +00:00
|
|
|
/* lanalyzer.c
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1998-11-12 06:01:27 +00:00
|
|
|
*
|
|
|
|
* Wiretap Library
|
2001-11-13 23:55:44 +00:00
|
|
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
|
2002-06-27 22:46:48 +00:00
|
|
|
*
|
1998-11-12 06:01:27 +00:00
|
|
|
* 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.
|
2002-06-27 22:46:48 +00:00
|
|
|
*
|
1998-11-12 06:01:27 +00:00
|
|
|
* 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.
|
2002-06-27 22:46:48 +00:00
|
|
|
*
|
1998-11-12 06:01:27 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
2002-03-04 00:25:35 +00:00
|
|
|
|
1999-07-13 02:53:26 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
1998-11-15 05:29:17 +00:00
|
|
|
#include <stdlib.h>
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
#include <errno.h>
|
2000-05-19 23:07:04 +00:00
|
|
|
#include "wtap-int.h"
|
2000-01-13 07:09:20 +00:00
|
|
|
#include "file_wrappers.h"
|
1999-03-01 18:57:07 +00:00
|
|
|
#include "buffer.h"
|
1998-11-12 06:01:27 +00:00
|
|
|
#include "lanalyzer.h"
|
|
|
|
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
/* The LANalyzer format is documented (at least in part) in Novell document
|
|
|
|
TID022037, which can be found at, among other places:
|
|
|
|
|
2009-10-26 18:41:54 +00:00
|
|
|
http://www.windowsecurity.com/whitepapers/Description_of_the_LANalysers_output_file.html
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* LANalyzer board types (which indicate the type of network on which
|
|
|
|
the capture was done). */
|
|
|
|
#define BOARD_325 226 /* LANalyzer 325 (Ethernet) */
|
|
|
|
#define BOARD_325TR 227 /* LANalyzer 325TR (Token-ring) */
|
|
|
|
|
2002-06-27 22:46:48 +00:00
|
|
|
|
2003-12-29 00:25:39 +00:00
|
|
|
static const guint8 LA_HeaderRegularFake[] = {
|
2002-06-27 22:46:48 +00:00
|
|
|
0x01,0x10,0x4c,0x00,0x01,0x05,0x54,0x72,0x61,0x63,0x65,0x20,0x44,0x69,0x73,0x70,
|
|
|
|
0x6c,0x61,0x79,0x20,0x54,0x72,0x61,0x63,0x65,0x20,0x46,0x69,0x6c,0x65,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
|
|
|
};
|
|
|
|
|
2003-12-29 00:25:39 +00:00
|
|
|
static const guint8 LA_RxChannelNameFake[] = {
|
|
|
|
0x06,0x10,0x80,0x00,0x43,0x68,0x61,0x6e ,0x6e,0x65,0x6c,0x31,0x00,0x43,0x68,0x61,
|
2002-06-27 22:46:48 +00:00
|
|
|
0x6e,0x6e,0x65,0x6c,0x32,0x00,0x43,0x68 ,0x61,0x6e,0x6e,0x65,0x6c,0x33,0x00,0x43,
|
|
|
|
0x68,0x61,0x6e,0x6e,0x65,0x6c,0x34,0x00 ,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x35,
|
|
|
|
0x00,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c ,0x36,0x00,0x43,0x68,0x61,0x6e,0x6e,0x65,
|
|
|
|
0x6c,0x37,0x00,0x43,0x68,0x61,0x6e,0x6e ,0x65,0x6c,0x38,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00
|
|
|
|
};
|
|
|
|
|
2003-12-29 00:25:39 +00:00
|
|
|
static const guint8 LA_TxChannelNameFake[] = {
|
2002-06-27 22:46:48 +00:00
|
|
|
0x0b,0x10,0x36,0x00 ,0x54,0x72,0x61,0x6e,0x73,0x31,0x00,0x00,
|
|
|
|
0x00,0x54,0x72,0x61,0x6e,0x73,0x32,0x00 ,0x00,0x00,0x54,0x72,0x61,0x6e,0x73,0x33,
|
|
|
|
0x00,0x00,0x00,0x54,0x72,0x61,0x6e,0x73 ,0x34,0x00,0x00,0x00,0x54,0x72,0x61,0x6e,
|
|
|
|
0x73,0x35,0x00,0x00,0x00,0x54,0x72,0x61 ,0x6e,0x73,0x36,0x00,0x00,0x00
|
|
|
|
};
|
|
|
|
|
2003-12-29 00:25:39 +00:00
|
|
|
static const guint8 LA_RxTemplateNameFake[] = {
|
2002-06-27 22:46:48 +00:00
|
|
|
0x35,0x10,
|
2003-12-29 00:25:39 +00:00
|
|
|
0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
2002-06-27 22:46:48 +00:00
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00
|
|
|
|
};
|
|
|
|
|
2003-12-29 00:25:39 +00:00
|
|
|
static const guint8 LA_TxTemplateNameFake[] = {
|
2002-06-27 22:46:48 +00:00
|
|
|
0x36,0x10,0x36,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00
|
|
|
|
};
|
|
|
|
|
2003-12-29 00:25:39 +00:00
|
|
|
static const guint8 LA_DisplayOptionsFake[] = {
|
2002-06-27 22:46:48 +00:00
|
|
|
0x0a,0x10,0x0a,0x01,
|
|
|
|
0x00,0x00,0x01,0x00,0x01,0x02,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00
|
|
|
|
};
|
|
|
|
|
2003-12-29 00:25:39 +00:00
|
|
|
static const guint8 LA_CyclicInformationFake[] = {
|
2002-06-27 22:46:48 +00:00
|
|
|
0x09,0x10,0x1a,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
|
|
|
};
|
|
|
|
|
2010-02-24 07:21:17 +00:00
|
|
|
typedef struct {
|
|
|
|
time_t start;
|
|
|
|
} lanalyzer_t;
|
|
|
|
|
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
|
|
|
static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
|
2006-11-05 22:46:44 +00:00
|
|
|
gint64 *data_offset);
|
|
|
|
static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
|
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
|
|
|
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
|
|
|
int *err, gchar **err_info);
|
2002-06-27 22:46:48 +00:00
|
|
|
static gboolean lanalyzer_dump_close(wtap_dumper *wdh, int *err);
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
|
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
|
|
|
int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
|
1998-11-12 06:01:27 +00:00
|
|
|
{
|
|
|
|
int bytes_read;
|
1999-08-20 04:49:18 +00:00
|
|
|
char LE_record_type[2];
|
|
|
|
char LE_record_length[2];
|
1998-11-12 06:01:27 +00:00
|
|
|
char summary[210];
|
1998-11-23 04:40:22 +00:00
|
|
|
guint16 board_type, mxslc;
|
1999-08-20 04:49:18 +00:00
|
|
|
guint16 record_type, record_length;
|
2004-01-07 04:50:21 +00:00
|
|
|
guint8 cr_day, cr_month;
|
|
|
|
guint16 cr_year;
|
1998-12-13 05:08:05 +00:00
|
|
|
struct tm tm;
|
2010-02-24 07:21:17 +00:00
|
|
|
lanalyzer_t *lanalyzer;
|
1998-11-12 06:01:27 +00:00
|
|
|
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
errno = WTAP_ERR_CANT_READ;
|
1999-09-22 01:26:50 +00:00
|
|
|
bytes_read = file_read(LE_record_type, 1, 2, wth->fh);
|
|
|
|
bytes_read += file_read(LE_record_length, 1, 2, wth->fh);
|
1998-11-12 06:01:27 +00:00
|
|
|
if (bytes_read != 4) {
|
1999-10-05 07:06:08 +00:00
|
|
|
*err = file_error(wth->fh);
|
|
|
|
if (*err != 0)
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
return -1;
|
|
|
|
return 0;
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset += 4;
|
1999-08-20 04:49:18 +00:00
|
|
|
record_type = pletohs(LE_record_type);
|
|
|
|
record_length = pletohs(LE_record_length); /* make sure to do this for while() loop */
|
1998-11-12 06:01:27 +00:00
|
|
|
|
2002-06-27 22:46:48 +00:00
|
|
|
if (record_type != RT_HeaderRegular && record_type != RT_HeaderCyclic) {
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
return 0;
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If we made it this far, then the file is a LANAlyzer file.
|
1999-08-20 04:49:18 +00:00
|
|
|
* Let's get some info from it. Note that we get wth->snapshot_length
|
|
|
|
* from a record later in the file. */
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
wth->file_type = WTAP_FILE_LANALYZER;
|
2010-02-24 07:21:17 +00:00
|
|
|
lanalyzer = (lanalyzer_t *)g_malloc(sizeof(lanalyzer_t));;
|
2010-02-26 07:59:54 +00:00
|
|
|
wth->priv = (void *)lanalyzer;
|
1998-11-12 06:01:27 +00:00
|
|
|
wth->subtype_read = lanalyzer_read;
|
2003-10-01 07:11:49 +00:00
|
|
|
wth->subtype_seek_read = lanalyzer_seek_read;
|
1999-08-20 04:49:18 +00:00
|
|
|
wth->snapshot_length = 0;
|
2005-08-25 21:29:54 +00:00
|
|
|
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
|
1998-11-12 06:01:27 +00:00
|
|
|
|
|
|
|
/* Read records until we find the start of packets */
|
|
|
|
while (1) {
|
2002-06-07 07:27:35 +00:00
|
|
|
if (file_seek(wth->fh, record_length, SEEK_CUR, err) == -1) {
|
2010-02-26 07:59:54 +00:00
|
|
|
g_free(wth->priv);
|
2002-03-04 00:25:35 +00:00
|
|
|
return -1;
|
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset += record_length;
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
errno = WTAP_ERR_CANT_READ;
|
1999-09-22 01:26:50 +00:00
|
|
|
bytes_read = file_read(LE_record_type, 1, 2, wth->fh);
|
|
|
|
bytes_read += file_read(LE_record_length, 1, 2, wth->fh);
|
1998-11-12 06:01:27 +00:00
|
|
|
if (bytes_read != 4) {
|
1999-10-05 07:06:08 +00:00
|
|
|
*err = file_error(wth->fh);
|
|
|
|
if (*err != 0) {
|
2010-02-26 07:59:54 +00:00
|
|
|
g_free(wth->priv);
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2010-02-26 07:59:54 +00:00
|
|
|
g_free(wth->priv);
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
return 0;
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset += 4;
|
1998-11-12 06:01:27 +00:00
|
|
|
|
1999-08-20 04:49:18 +00:00
|
|
|
record_type = pletohs(LE_record_type);
|
|
|
|
record_length = pletohs(LE_record_length);
|
1998-11-12 06:01:27 +00:00
|
|
|
|
1999-08-20 04:49:18 +00:00
|
|
|
/*g_message("Record 0x%04X Length %d", record_type, record_length);*/
|
|
|
|
switch (record_type) {
|
1998-11-12 06:01:27 +00:00
|
|
|
/* Trace Summary Record */
|
2002-06-27 22:46:48 +00:00
|
|
|
case RT_Summary:
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
errno = WTAP_ERR_CANT_READ;
|
1999-09-22 01:26:50 +00:00
|
|
|
bytes_read = file_read(summary, 1, sizeof summary,
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
wth->fh);
|
|
|
|
if (bytes_read != sizeof summary) {
|
1999-10-05 07:06:08 +00:00
|
|
|
*err = file_error(wth->fh);
|
|
|
|
if (*err != 0) {
|
2010-02-26 07:59:54 +00:00
|
|
|
g_free(wth->priv);
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2010-02-26 07:59:54 +00:00
|
|
|
g_free(wth->priv);
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset += sizeof summary;
|
1998-11-23 04:40:22 +00:00
|
|
|
|
|
|
|
/* Assume that the date of the creation of the trace file
|
|
|
|
* is the same date of the trace. Lanalyzer doesn't
|
|
|
|
* store the creation date/time of the trace, but only of
|
|
|
|
* the file. Unless you traced at 11:55 PM and saved at 00:05
|
|
|
|
* AM, the assumption that trace.date == file.date is true.
|
|
|
|
*/
|
|
|
|
cr_day = summary[0];
|
|
|
|
cr_month = summary[1];
|
2004-01-07 04:50:21 +00:00
|
|
|
cr_year = pletohs(&summary[2]);
|
1998-12-13 05:08:05 +00:00
|
|
|
/*g_message("Day %d Month %d Year %d (%04X)", cr_day, cr_month,
|
|
|
|
cr_year, cr_year);*/
|
1998-11-23 04:40:22 +00:00
|
|
|
|
1998-12-13 05:08:05 +00:00
|
|
|
/* Get capture start time. I learned how to do
|
|
|
|
* this from Guy's code in ngsniffer.c
|
|
|
|
*/
|
2004-01-07 04:50:21 +00:00
|
|
|
tm.tm_year = cr_year - 1900;
|
1998-12-13 05:08:05 +00:00
|
|
|
tm.tm_mon = cr_month - 1;
|
|
|
|
tm.tm_mday = cr_day;
|
|
|
|
tm.tm_hour = 0;
|
|
|
|
tm.tm_min = 0;
|
|
|
|
tm.tm_sec = 0;
|
|
|
|
tm.tm_isdst = -1;
|
2010-02-24 07:21:17 +00:00
|
|
|
lanalyzer->start = mktime(&tm);
|
1998-12-13 05:38:13 +00:00
|
|
|
/*g_message("Day %d Month %d Year %d", tm.tm_mday,
|
|
|
|
tm.tm_mon, tm.tm_year);*/
|
1998-11-23 04:40:22 +00:00
|
|
|
mxslc = pletohs(&summary[30]);
|
|
|
|
wth->snapshot_length = mxslc;
|
|
|
|
|
1999-08-20 04:49:18 +00:00
|
|
|
record_length = 0; /* to fake the next iteration of while() */
|
1998-11-12 06:01:27 +00:00
|
|
|
board_type = pletohs(&summary[188]);
|
|
|
|
switch (board_type) {
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
case BOARD_325:
|
1999-03-01 18:57:07 +00:00
|
|
|
wth->file_encap = WTAP_ENCAP_ETHERNET;
|
1998-11-12 06:01:27 +00:00
|
|
|
break;
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
case BOARD_325TR:
|
2000-09-21 04:41:37 +00:00
|
|
|
wth->file_encap = WTAP_ENCAP_TOKEN_RING;
|
1998-11-12 06:01:27 +00:00
|
|
|
break;
|
|
|
|
default:
|
2010-02-26 07:59:54 +00:00
|
|
|
g_free(wth->priv);
|
2004-07-08 07:32:39 +00:00
|
|
|
*err = WTAP_ERR_UNSUPPORTED_ENCAP;
|
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
|
|
|
*err_info = g_strdup_printf("lanalyzer: board type %u unknown",
|
|
|
|
board_type);
|
1999-08-22 02:29:40 +00:00
|
|
|
return -1;
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Trace Packet Data Record */
|
2002-06-27 22:46:48 +00:00
|
|
|
case RT_PacketData:
|
1999-08-20 04:49:18 +00:00
|
|
|
/* Go back header number ob ytes so that lanalyzer_read
|
|
|
|
* can read this header */
|
2002-06-07 07:27:35 +00:00
|
|
|
if (file_seek(wth->fh, -bytes_read, SEEK_CUR, err) == -1) {
|
2010-02-26 07:59:54 +00:00
|
|
|
g_free(wth->priv);
|
2002-03-04 00:25:35 +00:00
|
|
|
return -1;
|
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset -= bytes_read;
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
return 1;
|
1998-11-12 06:01:27 +00:00
|
|
|
|
1999-08-20 04:49:18 +00:00
|
|
|
default:
|
|
|
|
; /* no action */
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
2002-06-27 22:46:48 +00:00
|
|
|
}
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
|
|
|
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
#define DESCRIPTOR_LEN 32
|
|
|
|
|
1998-11-12 06:01:27 +00:00
|
|
|
/* Read the next packet */
|
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
|
|
|
static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
|
2006-11-05 22:46:44 +00:00
|
|
|
gint64 *data_offset)
|
1998-11-12 06:01:27 +00:00
|
|
|
{
|
1999-08-20 04:49:18 +00:00
|
|
|
int packet_size = 0;
|
|
|
|
int bytes_read;
|
|
|
|
char LE_record_type[2];
|
|
|
|
char LE_record_length[2];
|
|
|
|
guint16 record_type, record_length;
|
|
|
|
gchar descriptor[DESCRIPTOR_LEN];
|
|
|
|
guint16 time_low, time_med, time_high, true_size;
|
2005-08-28 22:52:05 +00:00
|
|
|
guint64 t;
|
|
|
|
time_t tsecs;
|
2010-02-24 07:21:17 +00:00
|
|
|
lanalyzer_t *lanalyzer;
|
1999-08-20 04:49:18 +00:00
|
|
|
|
|
|
|
/* read the record type and length. */
|
|
|
|
errno = WTAP_ERR_CANT_READ;
|
1999-09-22 01:26:50 +00:00
|
|
|
bytes_read = file_read(LE_record_type, 1, 2, wth->fh);
|
1999-08-20 04:49:18 +00:00
|
|
|
if (bytes_read != 2) {
|
1999-10-05 07:06:08 +00:00
|
|
|
*err = file_error(wth->fh);
|
2000-09-07 05:34:23 +00:00
|
|
|
if (*err == 0 && bytes_read != 0) {
|
1999-08-20 04:49:18 +00:00
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
}
|
2000-09-07 05:34:23 +00:00
|
|
|
return FALSE;
|
1999-08-20 04:49:18 +00:00
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset += 2;
|
1999-09-22 01:26:50 +00:00
|
|
|
bytes_read = file_read(LE_record_length, 1, 2, wth->fh);
|
1999-08-20 04:49:18 +00:00
|
|
|
if (bytes_read != 2) {
|
1999-10-05 07:06:08 +00:00
|
|
|
*err = file_error(wth->fh);
|
|
|
|
if (*err == 0)
|
1999-08-20 04:49:18 +00:00
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
2000-09-07 05:34:23 +00:00
|
|
|
return FALSE;
|
1999-08-20 04:49:18 +00:00
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset += 2;
|
1998-11-12 06:01:27 +00:00
|
|
|
|
1999-08-20 04:49:18 +00:00
|
|
|
record_type = pletohs(LE_record_type);
|
|
|
|
record_length = pletohs(LE_record_length);
|
1998-11-12 06:01:27 +00:00
|
|
|
|
1999-08-20 04:49:18 +00:00
|
|
|
/* Only Trace Packet Data Records should occur now that we're in
|
|
|
|
* the middle of reading packets. If any other record type exists
|
|
|
|
* after a Trace Packet Data Record, mark it as an error. */
|
2002-06-27 22:46:48 +00:00
|
|
|
if (record_type != RT_PacketData) {
|
1999-08-20 04:49:18 +00:00
|
|
|
*err = WTAP_ERR_BAD_RECORD;
|
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
|
|
|
*err_info = g_strdup_printf("lanalyzer: record type %u seen after trace summary record",
|
|
|
|
record_type);
|
2000-09-07 05:34:23 +00:00
|
|
|
return FALSE;
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
|
|
|
else {
|
1999-08-20 04:49:18 +00:00
|
|
|
packet_size = record_length - DESCRIPTOR_LEN;
|
|
|
|
}
|
1998-11-12 06:01:27 +00:00
|
|
|
|
|
|
|
/* Read the descriptor data */
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
errno = WTAP_ERR_CANT_READ;
|
1999-09-22 01:26:50 +00:00
|
|
|
bytes_read = file_read(descriptor, 1, DESCRIPTOR_LEN, wth->fh);
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
if (bytes_read != DESCRIPTOR_LEN) {
|
1999-10-05 07:06:08 +00:00
|
|
|
*err = file_error(wth->fh);
|
|
|
|
if (*err == 0)
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
2000-09-07 05:34:23 +00:00
|
|
|
return FALSE;
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset += DESCRIPTOR_LEN;
|
1998-11-12 06:01:27 +00:00
|
|
|
|
1998-11-23 04:40:22 +00:00
|
|
|
/* Read the packet data */
|
1999-03-01 18:57:07 +00:00
|
|
|
buffer_assure_space(wth->frame_buffer, packet_size);
|
2000-09-07 05:34:23 +00:00
|
|
|
*data_offset = wth->data_offset;
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
errno = WTAP_ERR_CANT_READ;
|
1999-09-22 01:26:50 +00:00
|
|
|
bytes_read = file_read(buffer_start_ptr(wth->frame_buffer), 1,
|
1998-11-12 06:01:27 +00:00
|
|
|
packet_size, wth->fh);
|
|
|
|
|
|
|
|
if (bytes_read != packet_size) {
|
1999-10-05 07:06:08 +00:00
|
|
|
*err = file_error(wth->fh);
|
|
|
|
if (*err == 0)
|
Have the per-capture-file-type open routines "wtap_open_offline()" calls
return 1 on success, -1 if they got an error, and 0 if the file isn't of
the type that file is checking for, and supply an error code if they
return -1; have "wtap_open_offline()" use that error code. Also, have
the per-capture-file-type open routines treat errors accessing the file
as errors, and return -1, rather than just returning 0 so that we try
another file type.
Have the per-capture-file-type read routines "wtap_loop()" calls return
-1 and supply an error code on error (and not, as they did in some
cases, call "g_error()" and abort), and have "wtap_loop()", if the read
routine returned an error, return FALSE (and pass an error-code-pointer
argument onto the read routines, so they fill it in), and return TRUE on
success.
Add some new error codes for them to return.
Now that "wtap_loop()" can return a success/failure indication and an
error code, in "read_cap_file()" put up a message box if we get an error
reading the file, and return the error code.
Handle the additional errors we can get when opening a capture file.
If the attempt to open a capture file succeeds, but the attempt to read
it fails, don't treat that as a complete failure - we may have managed
to read some of the capture file, and we should display what we managed
to read.
svn path=/trunk/; revision=516
1999-08-19 05:31:38 +00:00
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
2000-09-07 05:34:23 +00:00
|
|
|
return FALSE;
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
1999-08-28 01:19:45 +00:00
|
|
|
wth->data_offset += packet_size;
|
1998-11-12 06:01:27 +00:00
|
|
|
|
1998-11-23 04:40:22 +00:00
|
|
|
true_size = pletohs(&descriptor[4]);
|
2003-06-30 00:41:33 +00:00
|
|
|
packet_size = pletohs(&descriptor[6]);
|
1998-11-23 04:40:22 +00:00
|
|
|
|
2003-06-30 00:41:33 +00:00
|
|
|
/*
|
|
|
|
* OK, is the frame data size greater than than what's left of the
|
|
|
|
* record?
|
|
|
|
*/
|
|
|
|
if (packet_size > record_length - DESCRIPTOR_LEN) {
|
|
|
|
/*
|
|
|
|
* Yes - treat this as an error.
|
|
|
|
*/
|
|
|
|
*err = WTAP_ERR_BAD_RECORD;
|
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
|
|
|
*err_info = g_strdup("lanalyzer: Record length is less than packet size");
|
2003-06-30 00:41:33 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-08-28 22:52:05 +00:00
|
|
|
time_low = pletohs(&descriptor[8]);
|
|
|
|
time_med = pletohs(&descriptor[10]);
|
|
|
|
time_high = pletohs(&descriptor[12]);
|
|
|
|
t = (((guint64)time_low) << 0) + (((guint64)time_med) << 16) +
|
|
|
|
(((guint64)time_high) << 32);
|
|
|
|
tsecs = (time_t) (t/2000000);
|
2010-02-26 07:59:54 +00:00
|
|
|
lanalyzer = (lanalyzer_t *)wth->priv;
|
2010-02-24 07:21:17 +00:00
|
|
|
wth->phdr.ts.secs = tsecs + lanalyzer->start;
|
2005-08-28 22:52:05 +00:00
|
|
|
wth->phdr.ts.nsecs = ((guint32) (t - tsecs*2000000)) * 500;
|
1998-11-23 04:40:22 +00:00
|
|
|
|
2003-06-30 00:41:33 +00:00
|
|
|
if (true_size - 4 >= packet_size) {
|
|
|
|
/*
|
|
|
|
* It appears that the "true size" includes the FCS;
|
|
|
|
* make it reflect the non-FCS size (the "packet size"
|
|
|
|
* appears never to include the FCS, even if no slicing
|
|
|
|
* is done).
|
|
|
|
*/
|
|
|
|
true_size -= 4;
|
|
|
|
}
|
|
|
|
wth->phdr.len = true_size;
|
1998-11-12 06:01:27 +00:00
|
|
|
wth->phdr.caplen = packet_size;
|
|
|
|
|
2003-10-01 07:11:49 +00:00
|
|
|
switch (wth->file_encap) {
|
|
|
|
|
|
|
|
case WTAP_ENCAP_ETHERNET:
|
|
|
|
/* We assume there's no FCS in this frame. */
|
|
|
|
wth->pseudo_header.eth.fcs_len = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-11-05 22:46:44 +00:00
|
|
|
static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
|
Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.
Add messages for cases where those errors were returned without printing
an additional message.
Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.
Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument. (That handles a lot of the work of putting the info
string into the error message.)
Make some variables in "ascend-grammar.y" static.
Check the return value of "erf_read_header()" in "erf_seek_read()".
Get rid of an unused #define in "i4btrace.c".
svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
|
|
|
union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
|
|
|
|
int *err, gchar **err_info _U_)
|
2003-10-01 07:11:49 +00:00
|
|
|
{
|
|
|
|
int bytes_read;
|
|
|
|
|
|
|
|
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read the packet data.
|
|
|
|
*/
|
|
|
|
bytes_read = file_read(pd, sizeof(guint8), length, wth->random_fh);
|
|
|
|
if (bytes_read != length) {
|
|
|
|
*err = file_error(wth->random_fh);
|
|
|
|
if (*err == 0)
|
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (wth->file_encap) {
|
|
|
|
|
|
|
|
case WTAP_ENCAP_ETHERNET:
|
|
|
|
/* We assume there's no FCS in this frame. */
|
|
|
|
pseudo_header->eth.fcs_len = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-09-07 05:34:23 +00:00
|
|
|
return TRUE;
|
1998-11-12 06:01:27 +00:00
|
|
|
}
|
2000-03-22 07:06:59 +00:00
|
|
|
|
2002-06-27 22:46:48 +00:00
|
|
|
/*---------------------------------------------------
|
2010-06-06 22:19:30 +00:00
|
|
|
* Returns TRUE on success, FALSE on error
|
|
|
|
* Write "cnt" bytes of zero with error control
|
2002-06-27 22:46:48 +00:00
|
|
|
*---------------------------------------------------*/
|
2010-06-06 22:19:30 +00:00
|
|
|
static gboolean s0write(wtap_dumper *wdh, size_t cnt, int *err)
|
2002-06-27 22:46:48 +00:00
|
|
|
{
|
2010-06-06 22:19:30 +00:00
|
|
|
static const guint8 z64[64];
|
2002-06-27 22:46:48 +00:00
|
|
|
size_t snack;
|
|
|
|
|
|
|
|
while (cnt) {
|
2010-06-06 22:19:30 +00:00
|
|
|
snack = cnt > 64 ? 64 : cnt;
|
|
|
|
|
|
|
|
if (!wtap_dump_file_write(wdh, z64, snack, err))
|
|
|
|
return FALSE;
|
|
|
|
cnt -= snack;
|
|
|
|
}
|
|
|
|
return TRUE; /* ok */
|
2002-06-27 22:46:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------
|
2010-06-06 22:19:30 +00:00
|
|
|
* Returns TRUE on success, FALSE on error
|
|
|
|
* Write an 8-bit value with error control
|
2002-06-27 22:46:48 +00:00
|
|
|
*---------------------------------------------------*/
|
2010-06-06 22:19:30 +00:00
|
|
|
static gboolean s8write(wtap_dumper *wdh, const guint8 s8, int *err)
|
2002-06-27 22:46:48 +00:00
|
|
|
{
|
2010-06-06 22:19:30 +00:00
|
|
|
return wtap_dump_file_write(wdh, &s8, 1, err);
|
2002-06-27 22:46:48 +00:00
|
|
|
}
|
|
|
|
/*---------------------------------------------------
|
2010-06-06 22:19:30 +00:00
|
|
|
* Returns TRUE on success, FALSE on error
|
|
|
|
* Write a 16-bit value with error control
|
2002-06-27 22:46:48 +00:00
|
|
|
*---------------------------------------------------*/
|
2010-06-06 22:19:30 +00:00
|
|
|
static gboolean s16write(wtap_dumper *wdh, const guint16 s16, int *err)
|
2002-06-27 22:46:48 +00:00
|
|
|
{
|
2010-06-06 22:19:30 +00:00
|
|
|
return wtap_dump_file_write(wdh, &s16, 2, err);
|
2002-06-27 22:46:48 +00:00
|
|
|
}
|
|
|
|
/*---------------------------------------------------
|
2010-06-06 22:19:30 +00:00
|
|
|
* Returns TRUE on success, FALSE on error
|
|
|
|
* Write a 32-bit value with error control
|
2002-06-27 22:46:48 +00:00
|
|
|
*---------------------------------------------------*/
|
2010-06-06 22:19:30 +00:00
|
|
|
static gboolean s32write(wtap_dumper *wdh, const guint32 s32, int *err)
|
2002-06-27 22:46:48 +00:00
|
|
|
{
|
2010-06-06 22:19:30 +00:00
|
|
|
return wtap_dump_file_write(wdh, &s32, 4, err);
|
2002-06-27 22:46:48 +00:00
|
|
|
}
|
|
|
|
/*---------------------------------------------------
|
|
|
|
*
|
|
|
|
* calculates C.c = A.a - B.b
|
|
|
|
*---------------------------------------------------*/
|
|
|
|
static void my_timersub(const struct timeval *a,
|
|
|
|
const struct timeval *b,
|
|
|
|
struct timeval *c)
|
|
|
|
{
|
|
|
|
gint32 usec = a->tv_usec;
|
|
|
|
|
|
|
|
c->tv_sec = a->tv_sec - b->tv_sec;
|
|
|
|
if (b->tv_usec > usec) {
|
|
|
|
c->tv_sec--;
|
|
|
|
usec += 1000000;
|
|
|
|
}
|
|
|
|
c->tv_usec = usec - b->tv_usec;
|
|
|
|
}
|
|
|
|
/*---------------------------------------------------
|
|
|
|
* Write a record for a packet to a dump file.
|
|
|
|
* Returns TRUE on success, FALSE on failure.
|
|
|
|
*---------------------------------------------------*/
|
|
|
|
static gboolean lanalyzer_dump(wtap_dumper *wdh,
|
|
|
|
const struct wtap_pkthdr *phdr,
|
|
|
|
const union wtap_pseudo_header *pseudo_header _U_,
|
2002-07-29 06:09:59 +00:00
|
|
|
const guchar *pd, int *err)
|
2002-06-27 22:46:48 +00:00
|
|
|
{
|
|
|
|
double x;
|
|
|
|
int i;
|
|
|
|
int len;
|
2005-08-24 21:31:56 +00:00
|
|
|
struct timeval tv;
|
2002-06-27 22:46:48 +00:00
|
|
|
|
2010-02-26 07:59:54 +00:00
|
|
|
LA_TmpInfo *itmp = (LA_TmpInfo*)(wdh->priv);
|
2002-06-27 22:46:48 +00:00
|
|
|
struct timeval td;
|
|
|
|
int thisSize = phdr->caplen + LA_PacketRecordSize + LA_RecordHeaderSize;
|
|
|
|
|
|
|
|
if (wdh->bytes_dumped + thisSize > LA_ProFileLimit) {
|
|
|
|
/* printf(" LA_ProFileLimit reached\n"); */
|
|
|
|
*err = EFBIG;
|
|
|
|
return FALSE; /* and don't forget the header */
|
|
|
|
}
|
|
|
|
|
|
|
|
len = phdr->caplen + (phdr->caplen ? LA_PacketRecordSize : 0);
|
|
|
|
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(0x1005), err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(len), err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2010-06-06 22:19:30 +00:00
|
|
|
tv.tv_sec = (long int) phdr->ts.secs;
|
|
|
|
tv.tv_usec = phdr->ts.nsecs / 1000;
|
2002-06-27 22:46:48 +00:00
|
|
|
|
|
|
|
if (!itmp->init) {
|
|
|
|
/* collect some information for the
|
|
|
|
* finally written header
|
|
|
|
*/
|
2005-08-24 21:31:56 +00:00
|
|
|
/* XXX - this conversion could probably improved, if the start uses ns */
|
|
|
|
itmp->start = tv;
|
2002-06-27 22:46:48 +00:00
|
|
|
itmp->pkts = 0;
|
|
|
|
itmp->init = TRUE;
|
|
|
|
itmp->encap = wdh->encap;
|
|
|
|
itmp->lastlen = 0;
|
|
|
|
}
|
|
|
|
|
2005-08-24 21:31:56 +00:00
|
|
|
my_timersub(&(tv),&(itmp->start),&td);
|
2002-06-27 22:46:48 +00:00
|
|
|
|
|
|
|
x = (double) td.tv_usec;
|
|
|
|
x += (double) td.tv_sec * 1000000;
|
|
|
|
x *= 2;
|
|
|
|
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(0x0001), err)) /* pr.rx_channels */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(0x0008), err)) /* pr.rx_errors */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(phdr->len + 4), err)) /* pr.rx_frm_len */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(phdr->caplen), err)) /* pr.rx_frm_sln */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles((guint16) x), err)) /* pr.rx_time[i] */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
|
|
|
x /= 0xffff;
|
2010-06-06 22:19:30 +00:00
|
|
|
}
|
2002-06-27 22:46:48 +00:00
|
|
|
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s32write(wdh, htolel(++itmp->pkts), err)) /* pr.pktno */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(itmp->lastlen), err)) /* pr.prlen */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
|
|
|
itmp->lastlen = len;
|
|
|
|
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s0write(wdh, 12, err))
|
|
|
|
return FALSE;
|
2002-06-27 22:46:48 +00:00
|
|
|
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!wtap_dump_file_write(wdh, pd, phdr->caplen, err))
|
|
|
|
return FALSE;
|
2002-06-27 22:46:48 +00:00
|
|
|
|
|
|
|
wdh->bytes_dumped += thisSize;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------
|
|
|
|
* Returns 0 if we could write the specified encapsulation type,
|
|
|
|
* an error indication otherwise.
|
|
|
|
*---------------------------------------------------*/
|
|
|
|
int lanalyzer_dump_can_write_encap(int encap)
|
|
|
|
{
|
|
|
|
/* Per-packet encapsulations aren't supported. */
|
|
|
|
if (encap == WTAP_ENCAP_PER_PACKET)
|
|
|
|
return WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED;
|
|
|
|
|
|
|
|
if ( encap != WTAP_ENCAP_ETHERNET
|
|
|
|
&& encap != WTAP_ENCAP_TOKEN_RING )
|
|
|
|
return WTAP_ERR_UNSUPPORTED_ENCAP;
|
|
|
|
/*
|
|
|
|
* printf("lanalyzer_dump_can_write_encap(%d)\n",encap);
|
|
|
|
*/
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------
|
|
|
|
* Returns TRUE on success, FALSE on failure; sets "*err" to an
|
|
|
|
* error code on failure
|
|
|
|
*---------------------------------------------------*/
|
2002-07-16 07:15:09 +00:00
|
|
|
gboolean lanalyzer_dump_open(wtap_dumper *wdh, gboolean cant_seek, int *err)
|
2002-06-27 22:46:48 +00:00
|
|
|
{
|
|
|
|
int jump;
|
|
|
|
void *tmp;
|
|
|
|
|
2002-07-16 07:15:09 +00:00
|
|
|
/* This is a LANalyzer file. We can't fill in some fields in the
|
|
|
|
header until all the packets have been written, so we can't
|
|
|
|
write to a pipe. */
|
|
|
|
if (cant_seek) {
|
|
|
|
*err = WTAP_ERR_CANT_WRITE_TO_PIPE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-06-27 22:46:48 +00:00
|
|
|
|
|
|
|
tmp = g_malloc(sizeof(LA_TmpInfo));
|
|
|
|
if (!tmp) {
|
|
|
|
*err = errno;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
((LA_TmpInfo*)tmp)->init = FALSE;
|
2010-02-26 07:59:54 +00:00
|
|
|
wdh->priv = tmp;
|
|
|
|
wdh->subtype_write = lanalyzer_dump;
|
|
|
|
wdh->subtype_close = lanalyzer_dump_close;
|
2002-06-27 22:46:48 +00:00
|
|
|
|
|
|
|
/* Some of the fields in the file header aren't known yet so
|
|
|
|
just skip over it for now. It will be created after all
|
|
|
|
of the packets have been written. */
|
|
|
|
|
|
|
|
jump = sizeof (LA_HeaderRegularFake)
|
|
|
|
+ sizeof (LA_RxChannelNameFake)
|
|
|
|
+ sizeof (LA_TxChannelNameFake)
|
|
|
|
+ sizeof (LA_RxTemplateNameFake)
|
|
|
|
+ sizeof (LA_TxTemplateNameFake)
|
|
|
|
+ sizeof (LA_DisplayOptionsFake)
|
|
|
|
+ LA_SummaryRecordSize
|
|
|
|
+ LA_SubfileSummaryRecordSize
|
|
|
|
+ sizeof (LA_CyclicInformationFake)
|
|
|
|
+ LA_IndexRecordSize;
|
|
|
|
|
|
|
|
if (fseek(wdh->fh, jump, SEEK_SET) == -1) {
|
|
|
|
*err = errno;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wdh->bytes_dumped = jump;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------
|
|
|
|
*
|
|
|
|
*---------------------------------------------------*/
|
|
|
|
static gboolean lanalyzer_dump_header(wtap_dumper *wdh, int *err)
|
|
|
|
{
|
2010-02-26 07:59:54 +00:00
|
|
|
LA_TmpInfo *itmp = (LA_TmpInfo*)(wdh->priv);
|
2002-06-27 22:46:48 +00:00
|
|
|
guint16 board_type = itmp->encap == WTAP_ENCAP_TOKEN_RING
|
|
|
|
? BOARD_325TR /* LANalyzer Board Type */
|
|
|
|
: BOARD_325; /* LANalyzer Board Type */
|
2011-02-25 00:40:22 +00:00
|
|
|
time_t secs;
|
|
|
|
struct tm *fT;
|
|
|
|
|
|
|
|
/* The secs variable is needed to work around 32/64-bit time_t issues.
|
|
|
|
itmp->start is a timeval struct, which declares its tv_sec field
|
|
|
|
(itmp->start.tv_sec) as a long (typically 32 bits). time_t can be 32
|
|
|
|
or 64 bits, depending on the platform. Invoking as follows could
|
|
|
|
pass a pointer to a 32-bit long where a pointer to a 64-bit time_t
|
|
|
|
is expected: localtime((time_t*) &(itmp->start.tv_sec)) */
|
|
|
|
secs = itmp->start.tv_sec;
|
|
|
|
fT = localtime(&secs);
|
|
|
|
if (fT == NULL)
|
|
|
|
return FALSE;
|
2002-06-27 22:46:48 +00:00
|
|
|
|
|
|
|
fseek(wdh->fh, 0, SEEK_SET);
|
|
|
|
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!wtap_dump_file_write(wdh, &LA_HeaderRegularFake,
|
|
|
|
sizeof LA_HeaderRegularFake, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!wtap_dump_file_write(wdh, &LA_RxChannelNameFake,
|
|
|
|
sizeof LA_RxChannelNameFake, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!wtap_dump_file_write(wdh, &LA_TxChannelNameFake,
|
|
|
|
sizeof LA_TxChannelNameFake, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!wtap_dump_file_write(wdh, &LA_RxTemplateNameFake,
|
|
|
|
sizeof LA_RxTemplateNameFake, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!wtap_dump_file_write(wdh, &LA_TxTemplateNameFake,
|
|
|
|
sizeof LA_TxTemplateNameFake, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!wtap_dump_file_write(wdh, &LA_DisplayOptionsFake,
|
|
|
|
sizeof LA_DisplayOptionsFake, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
|
|
|
/*-----------------------------------------------------------------*/
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(RT_Summary), err)) /* rid */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(SummarySize), err)) /* rlen */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_mday, err)) /* s.datcre.day */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) (fT->tm_mon+1), err)) /* s.datcre.mon */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(fT->tm_year + 1900), err)) /* s.datcre.year */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_mday, err)) /* s.datclo.day */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) (fT->tm_mon+1), err)) /* s.datclo.mon */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(fT->tm_year + 1900), err)) /* s.datclo.year */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_sec, err)) /* s.timeopn.second */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_min, err)) /* s.timeopn.minute */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_hour, err)) /* s.timeopn.hour */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_mday, err)) /* s.timeopn.mday */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s0write(wdh, 2, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_sec, err)) /* s.timeclo.second */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_min, err)) /* s.timeclo.minute */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_hour, err)) /* s.timeclo.hour */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s8write(wdh, (guint8) fT->tm_mday, err)) /* s.timeclo.mday */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s0write(wdh, 2, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s0write(wdh, 6, err)) /* EAddr == 0 */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(1), err)) /* s.mxseqno */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(0), err)) /* s.slcoffo */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(1514), err)) /* s.mxslc */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s32write(wdh, htolel(itmp->pkts), err)) /* s.totpktt */
|
|
|
|
return FALSE;
|
|
|
|
/*
|
|
|
|
* statrg == 0; ? -1
|
|
|
|
* stptrg == 0; ? -1
|
|
|
|
* s.mxpkta[0]=0
|
|
|
|
*/
|
|
|
|
if (!s0write(wdh, 12, err))
|
|
|
|
return FALSE;
|
|
|
|
if (!s32write(wdh, htolel(itmp->pkts), err)) /* sr.s.mxpkta[1] */
|
|
|
|
return FALSE;
|
|
|
|
if (!s0write(wdh, 34*4, err)) /* s.mxpkta[2-33]=0 */
|
|
|
|
return FALSE;
|
|
|
|
if (!s16write(wdh, htoles(board_type), err))
|
|
|
|
return FALSE;
|
|
|
|
if (!s0write(wdh, 20, err)) /* board_version == 0 */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
|
|
|
/*-----------------------------------------------------------------*/
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(RT_SubfileSummary), err)) /* ssr.rid */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(LA_SubfileSummaryRecordSize-4), err)) /* ssr.rlen */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(1), err)) /* ssr.seqno */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s32write(wdh, htolel(itmp->pkts), err)) /* ssr.totpkts */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
|
|
|
/*-----------------------------------------------------------------*/
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!wtap_dump_file_write(wdh, &LA_CyclicInformationFake,
|
|
|
|
sizeof LA_CyclicInformationFake, err))
|
|
|
|
return FALSE;
|
2002-06-27 22:46:48 +00:00
|
|
|
/*-----------------------------------------------------------------*/
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(RT_Index), err)) /* rid */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(LA_IndexRecordSize -4), err)) /* rlen */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s16write(wdh, htoles(LA_IndexSize), err)) /* idxsp */
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
2010-06-06 22:19:30 +00:00
|
|
|
if (!s0write(wdh, LA_IndexRecordSize - 6, err))
|
2002-06-27 22:46:48 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------
|
|
|
|
* Finish writing to a dump file.
|
|
|
|
* Returns TRUE on success, FALSE on failure.
|
|
|
|
*---------------------------------------------------*/
|
|
|
|
static gboolean lanalyzer_dump_close(wtap_dumper *wdh, int *err)
|
|
|
|
{
|
2003-07-29 20:30:00 +00:00
|
|
|
lanalyzer_dump_header(wdh,err);
|
2002-06-27 22:46:48 +00:00
|
|
|
return *err ? FALSE : TRUE;
|
|
|
|
}
|