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)  

sf-pcap.c File Reference
#include <pcap-types.h>
#include <errno.h>
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "pcap-int.h"
#include "pcap-common.h"
#include "sf-pcap.h"
Include dependency graph for sf-pcap.c:

Go to the source code of this file.

Data Structures

struct  pcap_sf
 

Macros

#define TCPDUMP_MAGIC   0xa1b2c3d4
 
#define KUZNETZOV_TCPDUMP_MAGIC   0xa1b2cd34
 
#define FMESQUITA_TCPDUMP_MAGIC   0xa1b234cd
 
#define NAVTEL_TCPDUMP_MAGIC   0xa12b3c4d
 
#define NSEC_TCPDUMP_MAGIC   0xa1b23c4d
 
#define LT_LINKTYPE(x)   ((x) & 0x03FFFFFF)
 
#define LT_LINKTYPE_EXT(x)   ((x) & 0xFC000000)
 

Enumerations

enum  swapped_type_t { NOT_SWAPPED , SWAPPED , MAYBE_SWAPPED }
 
enum  tstamp_scale_type_t {
  PASS_THROUGH , SCALE_UP , SCALE_DOWN , PASS_THROUGH ,
  SCALE_UP_DEC , SCALE_DOWN_DEC , SCALE_UP_BIN , SCALE_DOWN_BIN
}
 

Functions

static int pcap_next_packet (pcap_t *p, struct pcap_pkthdr *hdr, u_char **datap)
 
pcap_tpcap_check_header (const uint8_t *magic, FILE *fp, u_int precision, char *errbuf, int *err)
 
static int grow_buffer (pcap_t *p, u_int bufsize)
 
static int sf_write_header (pcap_t *p, FILE *fp, int linktype, int snaplen)
 
void pcap_dump (u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
 
static pcap_dumper_tpcap_setup_dump (pcap_t *p, int linktype, FILE *f, const char *fname)
 
pcap_dumper_tpcap_dump_open (pcap_t *p, const char *fname)
 
pcap_dumper_tpcap_dump_fopen (pcap_t *p, FILE *f)
 
pcap_dumper_tpcap_dump_open_append (pcap_t *p, const char *fname)
 
FILE * pcap_dump_file (pcap_dumper_t *p)
 
long pcap_dump_ftell (pcap_dumper_t *p)
 
int64_t pcap_dump_ftell64 (pcap_dumper_t *p)
 
int pcap_dump_flush (pcap_dumper_t *p)
 
void pcap_dump_close (pcap_dumper_t *p)
 

Macro Definition Documentation

◆ FMESQUITA_TCPDUMP_MAGIC

#define FMESQUITA_TCPDUMP_MAGIC   0xa1b234cd

Definition at line 85 of file sf-pcap.c.

◆ KUZNETZOV_TCPDUMP_MAGIC

#define KUZNETZOV_TCPDUMP_MAGIC   0xa1b2cd34

Definition at line 79 of file sf-pcap.c.

◆ LT_LINKTYPE

#define LT_LINKTYPE (   x)    ((x) & 0x03FFFFFF)

Definition at line 108 of file sf-pcap.c.

◆ LT_LINKTYPE_EXT

#define LT_LINKTYPE_EXT (   x)    ((x) & 0xFC000000)

Definition at line 109 of file sf-pcap.c.

◆ NAVTEL_TCPDUMP_MAGIC

#define NAVTEL_TCPDUMP_MAGIC   0xa12b3c4d

Definition at line 91 of file sf-pcap.c.

◆ NSEC_TCPDUMP_MAGIC

#define NSEC_TCPDUMP_MAGIC   0xa1b23c4d

Definition at line 97 of file sf-pcap.c.

◆ TCPDUMP_MAGIC

#define TCPDUMP_MAGIC   0xa1b2c3d4

Definition at line 74 of file sf-pcap.c.

Enumeration Type Documentation

◆ swapped_type_t

Enumerator
NOT_SWAPPED 
SWAPPED 
MAYBE_SWAPPED 

Definition at line 130 of file sf-pcap.c.

◆ tstamp_scale_type_t

Enumerator
PASS_THROUGH 
SCALE_UP 
SCALE_DOWN 
PASS_THROUGH 
SCALE_UP_DEC 
SCALE_DOWN_DEC 
SCALE_UP_BIN 
SCALE_DOWN_BIN 

Definition at line 136 of file sf-pcap.c.

Function Documentation

◆ grow_buffer()

static int grow_buffer ( pcap_t p,
u_int  bufsize 
)
static

Definition at line 421 of file sf-pcap.c.

References pcap::buffer, pcap::bufsize, pcap::errbuf, PCAP_ERRBUF_SIZE, and snprintf().

Referenced by pcap_next_packet().

◆ pcap_check_header()

◆ pcap_dump()

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

◆ pcap_dump_close()

void pcap_dump_close ( pcap_dumper_t p)

Definition at line 1155 of file sf-pcap.c.

References error().

◆ pcap_dump_file()

FILE* pcap_dump_file ( pcap_dumper_t p)

Definition at line 1094 of file sf-pcap.c.

◆ pcap_dump_flush()

int pcap_dump_flush ( pcap_dumper_t p)

Definition at line 1145 of file sf-pcap.c.

◆ pcap_dump_fopen()

pcap_dumper_t* pcap_dump_fopen ( pcap_t p,
FILE *  f 
)

◆ pcap_dump_ftell()

long pcap_dump_ftell ( pcap_dumper_t p)

Definition at line 1100 of file sf-pcap.c.

◆ pcap_dump_ftell64()

int64_t pcap_dump_ftell64 ( pcap_dumper_t p)

Definition at line 1138 of file sf-pcap.c.

◆ pcap_dump_open()

pcap_dumper_t* pcap_dump_open ( pcap_t p,
const char *  fname 
)

◆ pcap_dump_open_append()

◆ pcap_next_packet()

◆ pcap_setup_dump()

static pcap_dumper_t* pcap_setup_dump ( pcap_t p,
int  linktype,
FILE *  f,
const char *  fname 
)
static

◆ sf_write_header()