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)  

savefile.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 "sf-pcap.h"
#include "sf-pcapng.h"
#include "pcap-common.h"
#include "charconv.h"
Include dependency graph for savefile.c:

Go to the source code of this file.

Macros

#define N_FILE_TYPES   (sizeof check_headers / sizeof check_headers[0])
 

Functions

static int sf_getnonblock (pcap_t *p)
 
static int sf_setnonblock (pcap_t *p, int nonblock)
 
static int sf_stats (pcap_t *p, struct pcap_stat *ps)
 
static int sf_inject (pcap_t *p, const void *buf, int size)
 
static int sf_setdirection (pcap_t *p, pcap_direction_t d)
 
void sf_cleanup (pcap_t *p)
 
pcap_tpcap_open_offline_with_tstamp_precision (const char *fname, u_int precision, char *errbuf)
 
pcap_tpcap_open_offline (const char *fname, char *errbuf)
 
bpf_u_int32 pcap_adjust_snapshot (bpf_u_int32 linktype, bpf_u_int32 snaplen)
 
pcap_tpcap_fopen_offline_with_tstamp_precision (FILE *fp, u_int precision, char *errbuf)
 
pcap_tpcap_fopen_offline (FILE *fp, char *errbuf)
 
int pcap_offline_read (pcap_t *p, int cnt, pcap_handler callback, u_char *user)
 

Variables

static pcap_t *(* check_headers [])(const uint8_t *, FILE *, u_int, char *, int *)
 

Macro Definition Documentation

◆ N_FILE_TYPES

#define N_FILE_TYPES   (sizeof check_headers / sizeof check_headers[0])

Definition at line 466 of file savefile.c.

Function Documentation

◆ pcap_adjust_snapshot()

bpf_u_int32 pcap_adjust_snapshot ( bpf_u_int32  linktype,
bpf_u_int32  snaplen 
)

Definition at line 444 of file savefile.c.

References max_snaplen_for_dlt().

Referenced by pcap_check_header(), pcap_ng_check_header(), and pcap_ng_next_packet().

◆ pcap_fopen_offline()

pcap_t* pcap_fopen_offline ( FILE *  fp,
char *  errbuf 
)

◆ pcap_fopen_offline_with_tstamp_precision()

◆ pcap_offline_read()

int pcap_offline_read ( pcap_t p,
int  cnt,
pcap_handler  callback,
u_char *  user 
)

◆ pcap_open_offline()

pcap_t* pcap_open_offline ( const char *  fname,
char *  errbuf 
)

◆ pcap_open_offline_with_tstamp_precision()

pcap_t* pcap_open_offline_with_tstamp_precision ( const char *  fname,
u_int  precision,
char *  errbuf 
)

◆ sf_cleanup()

void sf_cleanup ( pcap_t p)

Definition at line 241 of file savefile.c.

References pcap::buffer, pcap::fcode, pcap_freecode(), and pcap::rfile.

Referenced by pcap_check_header(), and pcap_ng_cleanup().

◆ sf_getnonblock()

static int sf_getnonblock ( pcap_t p)
static

Definition at line 89 of file savefile.c.

Referenced by pcap_fopen_offline_with_tstamp_precision().

◆ sf_inject()

static int sf_inject ( pcap_t p,
const void *  buf,
int  size 
)
static

Definition at line 221 of file savefile.c.

References pcap::errbuf, PCAP_ERRBUF_SIZE, and pcap_strlcpy().

Referenced by pcap_fopen_offline_with_tstamp_precision().

◆ sf_setdirection()

static int sf_setdirection ( pcap_t p,
pcap_direction_t  d 
)
static

Definition at line 233 of file savefile.c.

References pcap::errbuf, and snprintf().

Referenced by pcap_fopen_offline_with_tstamp_precision().

◆ sf_setnonblock()

static int sf_setnonblock ( pcap_t p,
int  nonblock 
)
static

Definition at line 99 of file savefile.c.

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

Referenced by pcap_fopen_offline_with_tstamp_precision().

◆ sf_stats()

static int sf_stats ( pcap_t p,
struct pcap_stat ps 
)
static

Definition at line 115 of file savefile.c.

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

Referenced by pcap_fopen_offline_with_tstamp_precision().

Variable Documentation

◆ check_headers

pcap_t*(* check_headers[])(const uint8_t *, FILE *, u_int, char *, int *) ( const uint8_t *  ,
FILE *  ,
u_int  ,
char *  ,
int *   
)
static
Initial value:
= {
}
pcap_t * pcap_check_header(const uint8_t *magic, FILE *fp, u_int precision, char *errbuf, int *err)
Definition: sf-pcap.c:153
pcap_t * pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision, char *errbuf, int *err)
Definition: sf-pcapng.c:769

Definition at line 461 of file savefile.c.

Referenced by pcap_fopen_offline_with_tstamp_precision().