/* eyesdn.c
*
- * $Id: eyesdn.c,v 1.8 2004/04/02 07:40:37 guy Exp $
+ * $Id$
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
* Each Frame starts with the 0xff Flag byte
* - Bytes 0-2: timestamp (long usec in network byte order)
* - Bytes 3-7: timestamp (40bits sec since 1970 in network byte order)
- * - Byte 8: channel (0 for D channel, 1-30 for B1-B30)
+ * - Byte 8: channel (0 for D channel, 1-30 for B1-B30,
+ * 128 ATM cells, 129 ATM layer indications)
* - Byte 9: Sender (0 NT, 1 TE)
* - Byte 10-11: frame size in bytes
* - Byte 12-n: Frame Payload
#define EYESDN_MAX_PACKET_LEN 16384
static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset);
-static gboolean eyesdn_seek_read(wtap *wth, long seek_off,
+ gint64 *data_offset);
+static gboolean eyesdn_seek_read(wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
int *err, gchar **err_info);
static gboolean parse_eyesdn_packet_data(FILE_T fh, int pkt_len, guint8* buf,
/* Seeks to the beginning of the next packet, and returns the
byte offset. Returns -1 on failure, and sets "*err" to the error. */
-static long eyesdn_seek_next_packet(wtap *wth, int *err)
+static gint64 eyesdn_seek_next_packet(wtap *wth, int *err)
{
int byte;
- long cur_off;
+ gint64 cur_off;
while ((byte = file_getc(wth->fh)) != EOF) {
if (byte == 0xff) {
wth->snapshot_length = 0; /* not known */
wth->subtype_read = eyesdn_read;
wth->subtype_seek_read = eyesdn_seek_read;
+ wth->tsprecision = WTAP_FILE_TSPREC_USEC;
return 1;
}
-/* Find the next packet and parse it; called from wtap_loop() and wtap_read(). */
+/* Find the next packet and parse it; called from wtap_read(). */
static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
- long *data_offset)
+ gint64 *data_offset)
{
- long offset;
+ gint64 offset;
guint8 *buf;
int pkt_len;
/* Used to read packets in random-access fashion */
static gboolean
-eyesdn_seek_read (wtap *wth, long seek_off,
+eyesdn_seek_read (wtap *wth, gint64 seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
int *err, gchar **err_info)
{
guint8 hdr[EYESDN_HDR_LENGTH];
unsigned long secs, usecs;
int pkt_len;
- unsigned int channel, direction;
+ guint8 channel, direction;
/* Our file pointer should be at the summary information header
* for a packet. Read in that header and extract the useful
pkt_len = (pkt_len << 8) | ((unsigned long) hdr[11]);
/* sanity checks */
- if(channel>30) {
+ if((channel>30)&&(channel<128)) {
*err = WTAP_ERR_BAD_RECORD;
*err_info = g_strdup_printf("eyesdn: bad channel number %u",
channel);
}
if (wth) {
- wth->phdr.ts.tv_sec = secs;
- wth->phdr.ts.tv_usec = usecs;
+ wth->phdr.ts.secs = secs;
+ wth->phdr.ts.nsecs = usecs * 1000;
wth->phdr.caplen = pkt_len;
wth->phdr.len = pkt_len;
}