src/helper/internet-stack-helper.h
changeset 2845 2398826af6b4
parent 2834 1aab57845b07
child 2887 9a637e6daee0
equal deleted inserted replaced
2844:6e2d19edddae 2845:2398826af6b4
    19  */
    19  */
    20 #ifndef INTERNET_STACK_HELPER_H
    20 #ifndef INTERNET_STACK_HELPER_H
    21 #define INTERNET_STACK_HELPER_H
    21 #define INTERNET_STACK_HELPER_H
    22 
    22 
    23 #include "node-container.h"
    23 #include "node-container.h"
       
    24 #include "net-device-container.h"
       
    25 #include "ns3/pcap-writer.h"
       
    26 #include "ns3/packet.h"
    24 
    27 
    25 namespace ns3 {
    28 namespace ns3 {
    26 
    29 
    27 /**
    30 /**
    28  * \brief aggregate ip/tcp/udp functionality to existing Nodes.
    31  * \brief aggregate ip/tcp/udp functionality to existing Nodes.
    35    *
    38    *
    36    * For each node in the input container, aggregate implementations
    39    * For each node in the input container, aggregate implementations
    37    * of the ns3::Ipv4, ns3::Udp, and, ns3::Tcp classes.
    40    * of the ns3::Ipv4, ns3::Udp, and, ns3::Tcp classes.
    38    */
    41    */
    39   void Build (NodeContainer c);
    42   void Build (NodeContainer c);
       
    43 
       
    44   /**
       
    45    * \param filename filename prefix to use for pcap files.
       
    46    *
       
    47    * Enable pcap output on each protocol instance which is of the
       
    48    * ns3::Ipv4L3Protocol type.  Both Tx and Rx events will be logged.
       
    49    */
       
    50   static void EnablePcap (std::string filename);
       
    51 
       
    52 private:
       
    53   static void LogRxIp (std::string context, Ptr<const Packet> packet, uint32_t deviceId);
       
    54   static void LogTxIp (std::string context, Ptr<const Packet> packet, uint32_t deviceId);
       
    55   static Ptr<PcapWriter> GetStream (uint32_t nodeId, uint32_t interfaceId);
       
    56   struct Trace {
       
    57     uint32_t nodeId;
       
    58     uint32_t interfaceId;
       
    59     Ptr<PcapWriter> writer;
       
    60   };
       
    61   static std::string m_pcapBaseFilename;
       
    62   static uint32_t GetNodeIndex (std::string context);
       
    63   static std::vector<Trace> m_traces;
    40 };
    64 };
    41 
    65 
    42 } // namespace ns3
    66 } // namespace ns3
    43 
    67 
    44 #endif /* INTERNET_STACK_HELPER_H */
    68 #endif /* INTERNET_STACK_HELPER_H */