tcpflow  1.6.1
About: tcpflow is a TCP/IP packet demultiplexer that captures data transmitted as part of TCP connections (flows), and stores the data in a way that is convenient for protocol analysis and debugging.
  Fossies Dox: tcpflow-1.6.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

pcap_writer Class Reference

#include <pcap_writer.h>

Classes

class  write_error
 

Public Member Functions

 pcap_writer ()
 
virtual ~pcap_writer ()
 
void writepkt (const struct pcap_pkthdr *h, const u_char *p)
 
void refresh_sink (const std::string &fname, const int pcap_dlt)
 
void update_sink (FILE *sink)
 
FILE * yield_sink ()
 

Static Public Member Functions

static pcap_writeropen_new (const std::string &ofname)
 
static pcap_writeropen_copy (const std::string &ofname, const std::string &ifname)
 

Private Types

enum  { PCAP_RECORD_HEADER_SIZE = 16 , PCAP_MAX_PKT_LEN = 65535 , PCAP_HEADER_SIZE = 4+2+2+4+4+4+4 }
 

Private Member Functions

pcap_writeroperator= (const pcap_writer &that)
 
 pcap_writer (const pcap_writer &t)
 
void write_bytes (const uint8_t *const val, size_t num_bytes)
 
void write2 (const uint16_t val)
 
void write4 (const uint32_t val)
 
void open (const std::string &fname)
 
void write_header (const int pcap_dlt)
 
void copy_header (const std::string &ifname)
 

Private Attributes

FILE * fcap
 

Detailed Description

Definition at line 9 of file pcap_writer.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
PCAP_RECORD_HEADER_SIZE 
PCAP_MAX_PKT_LEN 
PCAP_HEADER_SIZE 

Definition at line 19 of file pcap_writer.h.

Constructor & Destructor Documentation

◆ pcap_writer() [1/2]

pcap_writer::pcap_writer ( const pcap_writer t)
private

◆ pcap_writer() [2/2]

pcap_writer::pcap_writer ( )
inline

Definition at line 64 of file pcap_writer.h.

Referenced by open_copy(), and open_new().

◆ ~pcap_writer()

virtual pcap_writer::~pcap_writer ( )
inlinevirtual

Definition at line 78 of file pcap_writer.h.

References fcap.

Member Function Documentation

◆ copy_header()

void pcap_writer::copy_header ( const std::string &  ifname)
inlineprivate

Definition at line 49 of file pcap_writer.h.

References fcap, and PCAP_HEADER_SIZE.

Referenced by open_copy().

◆ open()

void pcap_writer::open ( const std::string &  fname)
inlineprivate

Definition at line 36 of file pcap_writer.h.

References fcap.

Referenced by open_copy(), open_new(), and refresh_sink().

◆ open_copy()

static pcap_writer* pcap_writer::open_copy ( const std::string &  ofname,
const std::string &  ifname 
)
inlinestatic

Definition at line 72 of file pcap_writer.h.

References copy_header(), open(), and pcap_writer().

Referenced by tcpdemux::save_unk_packets().

◆ open_new()

static pcap_writer* pcap_writer::open_new ( const std::string &  ofname)
inlinestatic

Definition at line 66 of file pcap_writer.h.

References DLT_EN10MB, open(), pcap_writer(), and write_header().

◆ operator=()

pcap_writer& pcap_writer::operator= ( const pcap_writer that)
private

◆ refresh_sink()

void pcap_writer::refresh_sink ( const std::string &  fname,
const int  pcap_dlt 
)
inline

Definition at line 90 of file pcap_writer.h.

References open(), and write_header().

Referenced by tcpdemux::dissect_tcp().

◆ update_sink()

void pcap_writer::update_sink ( FILE *  sink)
inline

Definition at line 94 of file pcap_writer.h.

References fcap.

Referenced by tcpdemux::dissect_tcp().

◆ write2()

void pcap_writer::write2 ( const uint16_t  val)
inlineprivate

Definition at line 28 of file pcap_writer.h.

References fcap.

Referenced by write_header().

◆ write4()

void pcap_writer::write4 ( const uint32_t  val)
inlineprivate

Definition at line 32 of file pcap_writer.h.

References fcap.

Referenced by write_header(), and writepkt().

◆ write_bytes()

void pcap_writer::write_bytes ( const uint8_t *const  val,
size_t  num_bytes 
)
inlineprivate

Definition at line 24 of file pcap_writer.h.

References fcap.

◆ write_header()

void pcap_writer::write_header ( const int  pcap_dlt)
inlineprivate

Definition at line 40 of file pcap_writer.h.

References PCAP_MAX_PKT_LEN, write2(), and write4().

Referenced by open_new(), and refresh_sink().

◆ writepkt()

void pcap_writer::writepkt ( const struct pcap_pkthdr h,
const u_char *  p 
)
inline

◆ yield_sink()

FILE* pcap_writer::yield_sink ( )
inline

Definition at line 97 of file pcap_writer.h.

References fcap.

Referenced by tcpdemux::dissect_tcp().

Member Data Documentation

◆ fcap

FILE* pcap_writer::fcap
private

The documentation for this class was generated from the following file: