ns3::PcapWriter Class Reference
[Common]

Pcap output for Packet logger. More...

#include <pcap-writer.h>

Inheritance diagram for ns3::PcapWriter:
Inheritance graph
[legend]
Collaboration diagram for ns3::PcapWriter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PcapWriter ()
 ~PcapWriter ()
void Open (std::string const &name)
void WriteEthernetHeader (void)
void WriteIpHeader (void)
void WriteWifiHeader (void)
void WritePppHeader (void)
void WritePacket (Ptr< const Packet > packet)

Private Member Functions

void WriteData (uint8_t const *buffer, uint32_t size)
void Write32 (uint32_t data)
void Write16 (uint16_t data)
void WriteHeader (uint32_t network)

Private Attributes

std::ofstream * m_writer

Detailed Description

Pcap output for Packet logger.

Log Packets to a file in pcap format which can be read by pcap readers.

Definition at line 39 of file pcap-writer.h.


Constructor & Destructor Documentation

ns3::PcapWriter::PcapWriter (  ) 

Definition at line 46 of file pcap-writer.cc.

References m_writer, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

ns3::PcapWriter::~PcapWriter (  ) 

Definition at line 53 of file pcap-writer.cc.

References m_writer, NS_LOG_FUNCTION, and NS_LOG_LOGIC.


Member Function Documentation

void ns3::PcapWriter::Open ( std::string const &  name  ) 
Parameters:
name the name of the file to store packet log into. This method creates the file if it does not exist. If it exists, the file is emptied.

Definition at line 79 of file pcap-writer.cc.

References m_writer, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

void ns3::PcapWriter::Write16 ( uint16_t  data  )  [private]

Definition at line 172 of file pcap-writer.cc.

References WriteData().

Referenced by WriteHeader().

void ns3::PcapWriter::Write32 ( uint32_t  data  )  [private]

Definition at line 161 of file pcap-writer.cc.

References WriteData().

Referenced by WriteHeader(), and WritePacket().

void ns3::PcapWriter::WriteData ( uint8_t const *  buffer,
uint32_t  size 
) [private]

Definition at line 155 of file pcap-writer.cc.

References m_writer.

Referenced by Write16(), Write32(), and WritePacket().

void ns3::PcapWriter::WriteEthernetHeader ( void   ) 

Write a pcap header in the output file which specifies that the content of the file will be Packets with Ethernet/LLC/SNAP encapsulation. This method should be invoked before ns3::PcapWriter::writePacket and after ns3::PcapWriter::open.

Definition at line 98 of file pcap-writer.cc.

References NS_LOG_FUNCTION_NOARGS, ns3::PCAP_ETHERNET, and WriteHeader().

void ns3::PcapWriter::WriteHeader ( uint32_t  network  )  [private]
void ns3::PcapWriter::WriteIpHeader ( void   ) 

Write a pcap header in the output file which specifies that the content of the file will be IPv4 Packets. This method should be invoked before ns3::PcapWriter::WritePacket and after ns3::PcapWriter::Open.

Definition at line 105 of file pcap-writer.cc.

References NS_LOG_FUNCTION_NOARGS, ns3::PCAP_RAW_IP, and WriteHeader().

void ns3::PcapWriter::WritePacket ( Ptr< const Packet packet  ) 
Parameters:
packet packet to write to output file

Definition at line 139 of file pcap-writer.cc.

References ns3::TimeUnit< 1 >::GetMicroSeconds(), m_writer, ns3::Now(), Write32(), and WriteData().

void ns3::PcapWriter::WritePppHeader ( void   ) 

Write a pcap header in the output file which specifies that the content of the file will be ppp Packets. This method should be invoked before ns3::PcapWriter::WritePacket and after ns3::PcapWriter::Open.

Definition at line 119 of file pcap-writer.cc.

References NS_LOG_FUNCTION_NOARGS, ns3::PCAP_PPP, and WriteHeader().

void ns3::PcapWriter::WriteWifiHeader ( void   ) 

Write a pcap header in the output file which specifies that the content of the file will be 802.11 Packets. This method should be invoked before ns3::PcapWriter::WritePacket and after ns3::PcapWriter::Open.

Definition at line 112 of file pcap-writer.cc.

References NS_LOG_FUNCTION_NOARGS, ns3::PCAP_80211, and WriteHeader().


Member Data Documentation

std::ofstream* ns3::PcapWriter::m_writer [private]

Definition at line 95 of file pcap-writer.h.

Referenced by Open(), PcapWriter(), WriteData(), WritePacket(), and ~PcapWriter().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:10:00 2009 for NS-3 by  doxygen 1.6.3