pcap-null.c revision 26175
117683Spst/*
226175Sfenner * Copyright (c) 1994, 1995, 1996
317683Spst *	The Regents of the University of California.  All rights reserved.
417683Spst *
517683Spst * Redistribution and use in source and binary forms, with or without
617683Spst * modification, are permitted provided that: (1) source code distributions
717683Spst * retain the above copyright notice and this paragraph in its entirety, (2)
817683Spst * distributions including binary code include the above copyright notice and
917683Spst * this paragraph in its entirety in the documentation or other materials
1017683Spst * provided with the distribution, and (3) all advertising materials mentioning
1117683Spst * features or use of this software display the following acknowledgement:
1217683Spst * ``This product includes software developed by the University of California,
1317683Spst * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
1417683Spst * the University nor the names of its contributors may be used to endorse
1517683Spst * or promote products derived from this software without specific prior
1617683Spst * written permission.
1717683Spst * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1817683Spst * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1917683Spst * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2017683Spst */
2117683Spst#ifndef lint
2226175Sfennerstatic const char rcsid[] =
2326175Sfenner    "@(#) $Header: pcap-null.c,v 1.7 96/12/10 23:15:01 leres Exp $ (LBL)";
2417683Spst#endif
2517683Spst
2617683Spst#include <sys/param.h>			/* optionally get BSD define */
2717683Spst
2817683Spst#include <string.h>
2917683Spst
3017683Spst#include "gnuc.h"
3117683Spst#ifdef HAVE_OS_PROTO_H
3217683Spst#include "os-proto.h"
3317683Spst#endif
3417683Spst
3517683Spst#include "pcap-int.h"
3617683Spst
3717683Spststatic char nosup[] = "live packet capture not supported on this system";
3817683Spst
3917683Spstint
4017683Spstpcap_stats(pcap_t *p, struct pcap_stat *ps)
4117683Spst{
4217683Spst
4317683Spst	(void)sprintf(p->errbuf, "pcap_stats: %s", nosup);
4417683Spst	return (-1);
4517683Spst}
4617683Spst
4717683Spstint
4817683Spstpcap_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
4917683Spst{
5017683Spst
5117683Spst	(void)sprintf(p->errbuf, "pcap_read: %s", nosup);
5217683Spst	return (-1);
5317683Spst}
5417683Spst
5517683Spstpcap_t *
5617683Spstpcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf)
5717683Spst{
5817683Spst
5917683Spst	(void)strcpy(ebuf, nosup);
6017683Spst	return (NULL);
6117683Spst}
6217683Spst
6317683Spstint
6417683Spstpcap_setfilter(pcap_t *p, struct bpf_program *fp)
6517683Spst{
6617683Spst
6717683Spst	if (p->sf.rfile == NULL) {
6817683Spst		(void)sprintf(p->errbuf, "pcap_setfilter: %s", nosup);
6917683Spst		return (-1);
7017683Spst	}
7117683Spst	p->fcode = *fp;
7217683Spst	return (0);
7317683Spst}
74