55 bool Fail (
void)
const;
59 bool Eof (
void)
const;
81 void Open (std::string
const &filename, std::ios::openmode mode);
119 void Init (uint32_t dataLinkType,
122 bool swapMode =
false,
123 bool nanosecMode =
false);
134 void Write (uint32_t tsSec, uint32_t tsUsec, uint8_t
const *
const data, uint32_t totalLen);
288 static bool Diff (std::string
const & f1, std::string
const & f2,
289 uint32_t & sec, uint32_t & usec, uint32_t & packets,
321 uint8_t
Swap (uint8_t val);
327 uint16_t
Swap (uint16_t val);
333 uint32_t
Swap (uint32_t val);
bool m_nanosecMode
nanosecond timestamp mode
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.
uint8_t Swap(uint8_t val)
Swap a value byte order.
void WriteFileHeader(void)
Write a Pcap file header.
uint16_t GetVersionMinor(void)
Returns the minor version of the pcap file as defined by the version_minor field in the pcap global h...
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.
bool GetSwapMode(void)
Get the swap mode of the file.
A class representing a pcap file.
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.
static const int32_t ZONE_DEFAULT
Time zone offset for current location.
PcapFileHeader m_fileHeader
file header
uint32_t GetMagic(void)
Returns the magic number of the pcap file as defined by the magic_number field in the pcap global hea...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Clear(void)
Clear all state bits of the underlying iostream.
static const uint32_t SNAPLEN_DEFAULT
Default value for maximum octets to save per packet.
void ReadAndVerifyFileHeader(void)
Read and verify a Pcap file header.
uint32_t WritePacketHeader(uint32_t tsSec, uint32_t tsUsec, uint32_t totalLen)
Write a Pcap packet 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 Close(void)
Close the underlying 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 Open(std::string const &filename, std::ios::openmode mode)
Create a new pcap file or open an existing pcap file.
std::fstream m_file
file stream
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 Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const *const data, uint32_t totalLen)
Write next packet to file.
bool IsNanoSecMode(void)
Get the nanosecond mode of the 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...
int32_t GetTimeZoneOffset(void)
Returns the time zone offset of the pcap file as defined by the thiszone field in the pcap global hea...
std::string m_filename
file name