|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
20 #include "ns3/boolean.h"
21 #include "ns3/uinteger.h"
22 #include "ns3/buffer.h"
23 #include "ns3/header.h"
37 .SetGroupName(
"Network")
39 .AddAttribute (
"CaptureSize",
40 "Maximum length of captured packets (cf. pcap snaplen)",
44 .AddAttribute (
"NanosecMode",
45 "Whether packet timestamps in the PCAP file are nanoseconds or microseconds(default).",
125 uint64_t s = current / 1000000000;
126 uint64_t ns = current % 1000000000;
132 uint64_t s = current / 1000000;
133 uint64_t us = current % 1000000;
145 uint64_t s = current / 1000000000;
146 uint64_t ns = current % 1000000000;
152 uint64_t s = current / 1000000;
153 uint64_t us = current % 1000000;
165 uint64_t s = current / 1000000000;
166 uint64_t ns = current % 1000000000;
172 uint64_t s = current / 1000000;
173 uint64_t us = current % 1000000;
187 uint8_t datbuf[65536];
189 m_file.
Read (datbuf,65536,tsSec,tsUsec,inclLen,origLen,readLen);
205 return Create<Packet> (datbuf,origLen);
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
AttributeValue implementation for Boolean.
uint32_t GetSnapLen(void)
Returns the max length of saved packets field of the pcap file as defined by the snaplen field in the...
PcapFile m_file
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint16_t GetVersionMajor(void)
Returns the major version of the pcap file as defined by the version_major field in the pcap global h...
uint32_t GetDataLinkType(void)
Returns the data link type field of the pcap file as defined by the network field in the pcap global ...
uint32_t m_snapLen
max length of saved packets
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< Packet > Read(Time &t)
Read the next packet from the file.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
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...
void Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const *const data, uint32_t totalLen)
Write next packet to file.
void Open(std::string const &filename, std::ios::openmode mode)
Create a new pcap file or open an existing pcap file.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void Clear(void)
Clear all state bits of the underlying iostream.
A base class which provides memory management and object aggregation.
uint32_t GetSigFigs(void)
Returns the accuracy of timestamps field of the pcap file as defined by the sigfigs field in the pcap...
static TypeId GetTypeId(void)
Get the type ID.
void Clear(void)
Clear all state bits of the underlying iostream.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
int32_t GetTimeZoneOffset(void)
Returns the time zone offset of the pcap file as defined by the thiszone field in the pcap global hea...
Simulation virtual time values and global simulation resolution.
uint32_t GetMagic(void)
Returns the magic number of the pcap file as defined by the magic_number field in the pcap global hea...
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
static const uint32_t SNAPLEN_DEFAULT
Default value for maximum octets to save per packet.
int32_t GetTimeZoneOffset(void)
Returns the time zone offset of the pcap file as defined by the thiszone field in the pcap global hea...
uint32_t GetSigFigs(void)
Returns the accuracy of timestamps field of the pcap file as defined by the sigfigs field in the pcap...
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 Close(void)
Close the underlying pcap 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...
uint16_t GetVersionMajor(void)
Returns the major version of the pcap file as defined by the version_major field in the pcap global h...
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
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.
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(Time t, Ptr< const Packet > p)
Write the next packet to file.
Hold an unsigned integer type.
void Open(std::string const &filename, std::ios::openmode mode)
Create a new pcap file or open an existing pcap file.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
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 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
Timestamps in nanosecond mode.
A class that wraps a PcapFile as an ns3::Object and provides a higher-layer ns-3 interface to the low...
void Close(void)
Close the underlying file.