#include <introspected-doxygen.h>
Public Member Functions | |
void | Clear (void) |
void | Close (void) |
bool | Eof (void) const |
bool | Fail (void) const |
uint32_t | GetDataLinkType (void) |
uint32_t | GetMagic (void) |
uint32_t | GetSigFigs (void) |
uint32_t | GetSnapLen (void) |
int32_t | GetTimeZoneOffset (void) |
uint16_t | GetVersionMajor (void) |
uint16_t | GetVersionMinor (void) |
void | Init (uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=PcapFile::ZONE_DEFAULT) |
void | Open (std::string const &filename, std::ios::openmode mode) |
void | Write (Time t, Ptr< const Packet > p) |
Write the next packet to file. More... | |
void | Write (Time t, Header &header, Ptr< const Packet > p) |
Write the provided header along with the packet to the pcap file. More... | |
void | Write (Time t, uint8_t const *buffer, uint32_t length) |
Write the provided data buffer to the pcap file. More... | |
Public Member Functions inherited from ns3::Object | |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Private Attributes | |
PcapFile | m_file |
uint32_t | m_snapLen |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoDispose (void) |
virtual void | DoInitialize (void) |
virtual void | NotifyNewAggregate (void) |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
Doxygen introspection did not find any typical Config paths.
No TraceSources are defined for this type.
Definition at line 39 of file pcap-file-wrapper.h.
void ns3::PcapFileWrapper::Clear | ( | void | ) |
Clear all state bits of the underlying iostream.
Definition at line 72 of file pcap-file-wrapper.cc.
References ns3::PcapFile::Clear(), and NS_LOG_FUNCTION.
void ns3::PcapFileWrapper::Close | ( | void | ) |
Close the underlying pcap file.
Definition at line 79 of file pcap-file-wrapper.cc.
References ns3::PcapFile::Close(), and NS_LOG_FUNCTION.
bool ns3::PcapFileWrapper::Eof | ( | void | ) | const |
Definition at line 66 of file pcap-file-wrapper.cc.
References ns3::PcapFile::Eof(), and NS_LOG_FUNCTION.
bool ns3::PcapFileWrapper::Fail | ( | void | ) | const |
Definition at line 60 of file pcap-file-wrapper.cc.
References ns3::PcapFile::Fail(), and NS_LOG_FUNCTION.
void ns3::PcapFileWrapper::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. This file must have been previously opened with write permissions.
dataLinkType | A data link type as defined in the pcap library. If you want to make resulting pcap files visible in existing tools, the data link type must match existing definitions, such as PCAP_ETHERNET, PCAP_PPP, PCAP_80211, etc. If you are storing different kinds of packet data, such as naked TCP headers, you are at liberty to locally define your own data link types. According to the pcap-linktype man page, "well-known" pcap linktypes range from 0 to 177. If you use a large random number for your type, chances are small for a collision. |
snapLen | An optional maximum size for packets written to the file. Defaults to 65535. If packets exceed this length they are truncated. |
tzCorrection | An integer describing the offset of your local time zone from UTC/GMT. For example, Pacific Standard Time in the US is GMT-8, so one would enter -8 for that correction. Defaults to 0 (UTC). |
Definition at line 93 of file pcap-file-wrapper.cc.
References ns3::PcapFile::Init(), and NS_LOG_FUNCTION.
void ns3::PcapFileWrapper::Open | ( | std::string const & | filename, |
std::ios::openmode | mode | ||
) |
Create a new pcap file or open an existing pcap file. Semantics are similar to the stdc++ io stream classes.
Since a pcap file is always a binary file, the file type is automatically selected as a binary file (fstream::binary is automatically ored with the mode field).
filename | String containing the name of the file. |
mode | String containing the access mode for the file. |
Definition at line 86 of file pcap-file-wrapper.cc.
References NS_LOG_FUNCTION, and ns3::PcapFile::Open().
Write the next packet to file.
Definition at line 112 of file pcap-file-wrapper.cc.
References ns3::Time::GetMicroSeconds(), NS_LOG_FUNCTION, and ns3::PcapFile::Write().
Write the provided header along with the packet to the pcap file.
It is the case that adding a header to a packet prior to writing it to a file must trigger a deep copy in the Packet. By providing the header separately, we can avoid that copy.
t | Packet timestamp as ns3::Time. |
header | The Header to prepend to the packet. |
p | Packet to write to the pcap file. |
Definition at line 123 of file pcap-file-wrapper.cc.
References ns3::Time::GetMicroSeconds(), NS_LOG_FUNCTION, and ns3::PcapFile::Write().
void ns3::PcapFileWrapper::Write | ( | Time | t, |
uint8_t const * | buffer, | ||
uint32_t | length | ||
) |
Write the provided data buffer to the pcap file.
Definition at line 134 of file pcap-file-wrapper.cc.
References ns3::Time::GetMicroSeconds(), NS_LOG_FUNCTION, and ns3::PcapFile::Write().