19 #ifndef PCAP_FILE_WRAPPER_H
20 #define PCAP_FILE_WRAPPER_H
26 #include "ns3/packet.h"
27 #include "ns3/object.h"
28 #include "ns3/nstime.h"
55 bool Fail (
void)
const;
59 bool Eof (
void)
const;
78 void Open (std::string
const &filename, std::ios::openmode mode);
108 void Init (uint32_t dataLinkType,
143 void Write (
Time t, uint8_t
const *buffer, uint32_t length);
A base class which provides memory management and object aggregation.
A class representing a pcap file.
static const int32_t ZONE_DEFAULT
Time zone offset for current location.
A class that wraps a PcapFile as an ns3::Object and provides a higher-layer ns-3 interface to the low...
Ptr< Packet > Read(Time &t)
Read the next packet from the file.
void Write(Time t, Ptr< const Packet > p)
Write the next packet to file.
PcapFile m_file
Pcap file.
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 Clear(void)
Clear all state bits of the underlying iostream.
void Open(std::string const &filename, std::ios::openmode mode)
Create a new pcap file or open an existing pcap 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...
void Close(void)
Close the underlying pcap file.
uint32_t m_snapLen
max length of saved packets
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=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=PcapFile::ZONE_DEFAULT)
Initialize the pcap file associated with this wrapper.
static TypeId GetTypeId(void)
Get the type ID.
uint16_t GetVersionMajor(void)
Returns the major version of the pcap file as defined by the version_major field in the pcap global h...
uint16_t GetVersionMinor(void)
Returns the minor version of the pcap file as defined by the version_minor field in the pcap global h...
uint32_t GetMagic(void)
Returns the magic number of the pcap file as defined by the magic_number field in the pcap global hea...
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 m_nanosecMode
Timestamps in nanosecond mode.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.