#include <pcap-writer.h>
Public Member Functions | |
void | Open (std::string const &name) |
void | WriteEthernetHeader (void) |
void | WriteIpHeader (void) |
void | WriteWifiHeader (void) |
void | WriteWifiRadiotapHeader (void) |
void | WriteWifiPrismHeader (void) |
void | WritePppHeader (void) |
void | WritePacket (Ptr< const Packet > packet) |
void | WriteWifiMonitorPacket (Ptr< const Packet > packet, uint16_t channelFreqMhz, uint32_t rate, bool isShortPreamble, bool isTx, double signalDbm, double noiseDbm) |
Log Packets to a file in pcap format which can be read by pcap readers.
void ns3::PcapWriter::Open | ( | std::string const & | name | ) |
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. |
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.
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.
packet | packet to write to output file |
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.
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.
void ns3::PcapWriter::WriteWifiMonitorPacket | ( | Ptr< const Packet > | packet, | |
uint16_t | channelFreqMhz, | |||
uint32_t | rate, | |||
bool | isShortPreamble, | |||
bool | isTx, | |||
double | signalDbm, | |||
double | noiseDbm | |||
) |
Write a Packet, possibly adding wifi PHY layer information to it
packet | the packet being received | |
channelFreqMhz | the frequency in MHz at which the packet is received. Note that in real devices this is normally the frequency to which the receiver is tuned, and this can be different than the frequency at which the packet was originally transmitted. This is because it is possible to have the receiver tuned on a given channel and still to be able to receive packets on a nearby channel. | |
rate | the PHY data rate in units of 500kbps (i.e., the same units used both for the radiotap and for the prism header) | |
isShortPreamble | true if short preamble is used, false otherwise | |
isTx | true if packet is being transmitted, false when packet is being received | |
signalDbm | signal power in dBm | |
noiseDbm | noise power in dBm |
void ns3::PcapWriter::WriteWifiPrismHeader | ( | void | ) |
Write a pcap header in the output file which specifies that the content of the file will be 802.11 Packets preceded by a prism header providing PHY layer info. This method should be invoked before ns3::PcapWriter::WritePacket and after ns3::PcapWriter::Open.
void ns3::PcapWriter::WriteWifiRadiotapHeader | ( | void | ) |
Write a pcap header in the output file which specifies that the content of the file will be 802.11 Packets preceded by a radiotap header providing PHY layer info. This method should be invoked before ns3::PcapWriter::WritePacket and after ns3::PcapWriter::Open.