/*
* Copyright (C) 1993-2001 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id: ipft_sn.c,v 1.7 2003/02/16 02:32:36 darrenr Exp $
*/
/*
* Written to comply with the recent RFC 1761 from Sun.
*/
#include "ipf.h"
#include "snoop.h"
#include "ipt.h"
#if !defined(lint)
#endif
struct llc {
};
/*
* While many of these maybe the same, some do have different header formats
* which make this useful.
*/
{ 0, 0, 0 }, /* SDL_8023 */
{ 0, 0, 0 }, /* SDL_8024 */
{ 0, 0, 0 }, /* SDL_8025 */
{ 0, 0, 0 }, /* SDL_8026 */
{ 14, 12, 2 }, /* SDL_ETHER */
{ 0, 0, 0 }, /* SDL_HDLC */
{ 0, 0, 0 }, /* SDL_CHSYNC */
{ 0, 0, 0 }, /* SDL_IBMCC */
{ 0, 0, 0 }, /* SDL_FDDI */
{ 0, 0, 0 }, /* SDL_OTHER */
};
static int snoop_open __P((char *));
static int snoop_close __P((void));
static int snoop_readip __P((char *, int, char **, int *));
char *fname;
{
int fd;
int s_v;
if (sfd != -1)
return sfd;
fd = 0;
return -1;
return -2;
if (s_v != SNOOP_VERSION ||
return -2;
}
return fd;
}
static int snoop_close()
{
}
/*
* read in the header (and validate) which should be the first record
* in a snoop file.
*/
{
return -2;
return -2;
if (!n || n < 0)
return -3;
return plen;
}
#ifdef notyet
/*
* read an entire snoop packet record. only the data part is copied into
* the available buffer, with the number of bytes copied returned.
*/
char *buf;
int cnt;
{
int i, n;
if ((i = snoop_read_rec(&rec)) <= 0)
return i;
if (!bufp)
else
return -2;
return n;
}
#endif
/*
* return only an IP packet read into buf
*/
{
struct llc *l;
int i, n;
do {
if ((i = snoop_read_rec(&rec)) <= 0)
return i;
if (!bufp)
else
s = bufp;
return -2;
i -= l->lc_to;
s += l->lc_to;
/*
* XXX - bogus assumption here on the part of the time field
* that it won't be greater than 4 bytes and the 1st two will
* have the values 8 and 0 for IP. Should be a table of
* these too somewhere. Really only works for SDL_ETHER.
*/
i -= l->lc_tl;
s += l->lc_tl;
return n;
}