/* csids.c
*
- * $Id: csids.c,v 1.15 2002/08/28 20:30:44 jmayer Exp $
+ * $Id$
*
* Copyright (c) 2000 by Mike Hall <mlh@io.com>
* Copyright (c) 2000 by Cisco Systems
*
* For a time there was an error in iplogging and the ip length, flags, and id
* were byteswapped. We will check for this and handle it before handing to
- * ethereal.
+ * wireshark.
*/
-static gboolean csids_read(wtap *wth, int *err, long *data_offset);
-static gboolean csids_seek_read(wtap *wth, long seek_off,
- union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, int *err);
+static gboolean csids_read(wtap *wth, int *err, gchar **err_info,
+ gint64 *data_offset);
+static gboolean csids_seek_read(wtap *wth, gint64 seek_off,
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
+ int *err, gchar **err_info);
static void csids_close(wtap *wth);
struct csids_header {
};
/* XXX - return -1 on I/O error and actually do something with 'err'. */
-int csids_open(wtap *wth, int *err)
+int csids_open(wtap *wth, int *err, gchar **err_info _U_)
{
/* There is no file header. There is only a header for each packet
* so we read a packet header and compare the caplen with iplen. They
wth->subtype_read = csids_read;
wth->subtype_seek_read = csids_seek_read;
wth->subtype_close = csids_close;
+ wth->tsprecision = WTAP_FILE_TSPREC_SEC;
return 1;
}
-/* Find the next packet and parse it; called from wtap_loop(). */
-static gboolean csids_read(wtap *wth, int *err, long *data_offset)
+/* Find the next packet and parse it; called from wtap_read(). */
+static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_,
+ gint64 *data_offset)
{
guint8 *buf;
int bytesRead = 0;
wth->phdr.len = hdr.caplen;
wth->phdr.caplen = hdr.caplen;
- wth->phdr.ts.tv_sec = hdr.seconds;
- wth->phdr.ts.tv_usec = 0;
- wth->phdr.pkt_encap = WTAP_ENCAP_RAW_IP;
+ wth->phdr.ts.secs = hdr.seconds;
+ wth->phdr.ts.nsecs = 0;
if( wth->capture.csids->byteswapped == TRUE ) {
guint16* swap = (guint16*)buf;
/* Used to read packets in random-access fashion */
static gboolean
csids_seek_read (wtap *wth,
- long seek_off,
+ gint64 seek_off,
union wtap_pseudo_header *pseudo_header _U_,
guint8 *pd,
int len,
- int *err)
+ int *err,
+ gchar **err_info)
{
int bytesRead;
struct csids_header hdr;
if( len != hdr.caplen ) {
*err = WTAP_ERR_BAD_RECORD;
+ *err_info = g_strdup_printf("csids: record length %u doesn't match requested length %d",
+ hdr.caplen, len);
return FALSE;
}