From owner-freebsd-questions Mon Aug 13 19:33:47 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mta05-svc.ntlworld.com (mta05-svc.ntlworld.com [62.253.162.45]) by hub.freebsd.org (Postfix) with ESMTP id 51F5A37B412 for ; Mon, 13 Aug 2001 19:33:43 -0700 (PDT) (envelope-from greid@FreeBSD.org) Received: from sobek.lan ([62.252.8.47]) by mta05-svc.ntlworld.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20010814023340.NCJU20588.mta05-svc.ntlworld.com@sobek.lan>; Tue, 14 Aug 2001 03:33:40 +0100 Received: (from greid@localhost) by sobek.lan (8.11.5/8.11.5) id f7E1nxY64258; Tue, 14 Aug 2001 02:49:59 +0100 (BST) (envelope-from greid@FreeBSD.org) X-Authentication-Warning: sobek.lan: greid set sender to greid@FreeBSD.org using -f Date: Tue, 14 Aug 2001 02:49:59 +0100 From: George Reid To: Wing Tim Cc: freebsd-questions@FreeBSD.org Subject: Re: Programming on Berkeley Packet Filter (bpf) Message-ID: <20010814024959.A64143@FreeBSD.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from twchim1@hotmail.com on Mon, Aug 13, 2001 at 11:46:10PM +0800 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Aug 13, 2001 at 11:46:10PM +0800, Wing Tim wrote: > Hi all, > From the man page of BPF(4), I found there're lots of useful functions > such as BIOCGBLEN, BIOCSBLEN, BIOCGDLT, ... , BIOCGSTATS. I tried to write a > should program to use these functions as follows: Those aren't functions, those are command codes that you can pass to ioctl(2) for an opened bpf device. > main () > { > printf(BIOCGBLEN); > ... > } ...is nonsense. > By the way, how can I specify which interface I want to snoop data on? > Could anyone kindly give me a help? Thanks! I think you need to read a basic UNIX programming guide before you start playing around with BPF. However, in answer to your question, the network device is specified with the BIOCSETIF ioctl. -- +-------------------+---------------------+ | George Reid | FreeBSD Committer | | +44 7740 197460 | greid@FreeBSD.org | +-------------------+---------------------+ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message