libpcap  1.10.1
About: libpcap is a packet filter library used by tools like tcpdump.
  Fossies Dox: libpcap-1.10.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

capturetest.c File Reference
#include "varattrs.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <limits.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <pcap.h>
#include "pcap/funcattrs.h"
Include dependency graph for capturetest.c:

Go to the source code of this file.

Macros

#define B_OPTION   "b"
 
#define R_OPTION   "r"
 
#define S_OPTION   "s"
 
#define COMMAND_OPTIONS   B_OPTION "i:mn" R_OPTION S_OPTION "t:"
 
#define USAGE_OPTIONS   "-" B_OPTION "mn" R_OPTION S_OPTION
 

Functions

static void countme (u_char *, const struct pcap_pkthdr *, const u_char *)
 
static void usage (void)
 
static void error (const char *,...)
 
static void warning (const char *,...)
 
static char * copy_argv (char **)
 
static void sigint_handler (int signum)
 
int main (int argc, char **argv)
 
static char * copy_argv (register char **argv)
 

Variables

static const char copyright []
 
static char * program_name
 
static pcap_tpd
 
static int breaksigint = 0
 

Macro Definition Documentation

◆ B_OPTION

#define B_OPTION   "b"

Definition at line 88 of file capturetest.c.

◆ COMMAND_OPTIONS

#define COMMAND_OPTIONS   B_OPTION "i:mn" R_OPTION S_OPTION "t:"

Definition at line 93 of file capturetest.c.

◆ R_OPTION

#define R_OPTION   "r"

Definition at line 89 of file capturetest.c.

◆ S_OPTION

#define S_OPTION   "s"

Definition at line 90 of file capturetest.c.

◆ USAGE_OPTIONS

#define USAGE_OPTIONS   "-" B_OPTION "mn" R_OPTION S_OPTION

Definition at line 94 of file capturetest.c.

Function Documentation

◆ copy_argv() [1/2]

static char* copy_argv ( char **  )
static

Referenced by main().

◆ copy_argv() [2/2]

static char* copy_argv ( register char **  argv)
static

Definition at line 352 of file capturetest.c.

References error().

◆ countme()

static void countme ( u_char *  user,
const struct pcap_pkthdr h,
const u_char *  sp 
)
static

Definition at line 297 of file capturetest.c.

Referenced by main().

◆ error()

static void error ( const char *  fmt,
  ... 
)
static

Definition at line 314 of file capturetest.c.

References program_name.

Referenced by copy_argv(), and main().

◆ main()

◆ sigint_handler()

static void sigint_handler ( int  signum)
static

Definition at line 70 of file capturetest.c.

References breaksigint, pcap_breakloop(), and pd.

Referenced by main().

◆ usage()

static void usage ( void  )
static

Definition at line 305 of file capturetest.c.

References program_name, and USAGE_OPTIONS.

Referenced by main().

◆ warning()

static void warning ( const char *  fmt,
  ... 
)
static

Definition at line 333 of file capturetest.c.

References program_name.

Referenced by main(), and pcap_nametoport().

Variable Documentation

◆ breaksigint

int breaksigint = 0
static

Definition at line 65 of file capturetest.c.

Referenced by main(), and sigint_handler().

◆ copyright

const char copyright[]
static
Initial value:
=
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
The Regents of the University of California. All rights reserved.\n"

Definition at line 25 of file capturetest.c.

◆ pd

◆ program_name

char* program_name
static

Definition at line 54 of file capturetest.c.

Referenced by error(), main(), usage(), and warning().