55 bool Fail (
void)
const;
59 bool Eof (
void)
const;
81 void Open (std::string
const &filename, std::ios::openmode mode);
117 void Init (uint32_t dataLinkType,
120 bool swapMode =
false,
121 bool nanosecMode =
false);
132 void Write (uint32_t tsSec, uint32_t tsUsec, uint8_t
const *
const data, uint32_t totalLen);
286 static bool Diff (std::string
const & f1, std::string
const & f2,
287 uint32_t & sec, uint32_t & usec, uint32_t & packets,
319 uint8_t
Swap (uint8_t val);
325 uint16_t
Swap (uint16_t val);
331 uint32_t
Swap (uint32_t val);
A class representing a pcap file.
void Open(std::string const &filename, std::ios::openmode mode)
Create a new pcap file or open an existing pcap file.
uint16_t GetVersionMajor(void)
Returns the major version of the pcap file as defined by the version_major field in the pcap global h...
void Read(uint8_t *const data, uint32_t maxBytes, uint32_t &tsSec, uint32_t &tsUsec, uint32_t &inclLen, uint32_t &origLen, uint32_t &readLen)
Read next packet from file.
uint32_t GetSnapLen(void)
Returns the max length of saved packets field of the pcap file as defined by the snaplen field in the...
static bool Diff(std::string const &f1, std::string const &f2, uint32_t &sec, uint32_t &usec, uint32_t &packets, uint32_t snapLen=SNAPLEN_DEFAULT)
Compare two PCAP files packet-by-packet.
std::string m_filename
file name
void Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const *const data, uint32_t totalLen)
Write next packet to file.
PcapFileHeader m_fileHeader
file header
uint32_t WritePacketHeader(uint32_t tsSec, uint32_t tsUsec, uint32_t totalLen)
Write a Pcap packet header.
void Clear(void)
Clear all state bits of the underlying iostream.
void WriteFileHeader(void)
Write a Pcap file header.
uint32_t GetSigFigs(void)
Returns the accuracy of timestamps field of the pcap file as defined by the sigfigs field in the pcap...
void Init(uint32_t dataLinkType, uint32_t snapLen=SNAPLEN_DEFAULT, int32_t timeZoneCorrection=ZONE_DEFAULT, bool swapMode=false, bool nanosecMode=false)
Initialize the pcap file associated with this object.
uint32_t GetDataLinkType(void)
Returns the data link type field of the pcap file as defined by the network field in the pcap global ...
void ReadAndVerifyFileHeader(void)
Read and verify a Pcap file header.
bool IsNanoSecMode(void)
Get the nanosecond mode of the file.
static const int32_t ZONE_DEFAULT
Time zone offset for current location.
uint32_t GetMagic(void)
Returns the magic number of the pcap file as defined by the magic_number field in the pcap global hea...
bool m_nanosecMode
nanosecond timestamp mode
static const uint32_t SNAPLEN_DEFAULT
Default value for maximum octets to save per packet.
std::fstream m_file
file stream
void Close(void)
Close the underlying file.
uint16_t GetVersionMinor(void)
Returns the minor version of the pcap file as defined by the version_minor field in the pcap global h...
int32_t GetTimeZoneOffset(void)
Returns the time zone offset of the pcap file as defined by the thiszone field in the pcap global hea...
bool GetSwapMode(void)
Get the swap mode of the file.
uint8_t Swap(uint8_t val)
Swap a value byte order.
Every class exported by the ns3 library is enclosed in the ns3 namespace.