From owner-freebsd-questions Sun Jun 20 8:20:25 1999 Delivered-To: freebsd-questions@freebsd.org Received: from cygnus.rush.net (cygnus.rush.net [209.45.245.133]) by hub.freebsd.org (Postfix) with ESMTP id 5282614DF1 for ; Sun, 20 Jun 1999 08:20:20 -0700 (PDT) (envelope-from bright@rush.net) Received: from localhost (bright@localhost) by cygnus.rush.net (8.9.3/8.9.3) with SMTP id LAA19016; Sun, 20 Jun 1999 11:20:03 -0400 (EDT) Date: Sun, 20 Jun 1999 10:20:00 -0500 (EST) From: Alfred Perlstein To: Alexander Podoplelov Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Looking for some net sniffer C sources In-Reply-To: <376CFEFB.9C487896@sth.frontec.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 20 Jun 1999, Alexander Podoplelov wrote: > Hello. > > I have a task which implies to read raw data from the network interface. > I would be more than happy to have a "necessary and sufficient" piece of > C code for proper opening of the network interface (bpf, ioctl?), > reading packets from there (I guess read() is enough :), and having > structure of the packet (detecting that it belongs to IP ones; which > *.h files are to be included). A working example for monitoring IP packets > is wanted mostly. > > Also, if you know good sources to read about that (books, url), please, > share that info with me. Any help is Ok. > > Thank you in advance, Alexander. look no further than "TCPdump" it's in the source tree, it should guide the way for you. you can get the source tree by executing this command: pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/CVSup/cvsupit.tgz and downloading the 300 or so megs, or you can grab the FreeBSD cdroms from Walnut Creek. www.cdrom.com good luck, -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message