src/contrib/pyviz.h
changeset 3595 6eccb090137c
parent 3530 57af5f5bb3fa
child 3702 d3c1312e5a61
     1.1 --- a/src/contrib/pyviz.h	Fri Aug 08 12:25:08 2008 +0100
     1.2 +++ b/src/contrib/pyviz.h	Wed Sep 03 14:26:49 2008 +0100
     1.3 @@ -24,6 +24,11 @@
     1.4  #define NS3_PYVIZ_H
     1.5  
     1.6  #include "ns3/nstime.h"
     1.7 +#include "ns3/node.h"
     1.8 +#include "ns3/channel.h"
     1.9 +#include "ns3/packet.h"
    1.10 +#include "ns3/mac48-address.h"
    1.11 +#include <map>
    1.12  
    1.13  namespace ns3 {
    1.14  
    1.15 @@ -35,7 +40,46 @@
    1.16    
    1.17    // Run simulation until a given (simulated, absolute) time is reached
    1.18    void SimulatorRunUntil (Time time);
    1.19 -  
    1.20 +
    1.21 +  struct TransmissionSample
    1.22 +  {
    1.23 +    Ptr<Node> transmitter;
    1.24 +    Ptr<Node> receiver; // NULL if broadcast
    1.25 +    Ptr<Channel> channel;
    1.26 +    uint32_t bytes;
    1.27 +  };
    1.28 +
    1.29 +  typedef std::vector<TransmissionSample> TransmissionSampleList;
    1.30 +
    1.31 +  TransmissionSampleList GetTransmissionSamples () const;
    1.32 +
    1.33 +private:
    1.34 +
    1.35 +  struct TxRecord
    1.36 +  {
    1.37 +    Ptr<Node> srcNode;
    1.38 +  };
    1.39 +  std::map<uint32_t, TxRecord> m_txRecords;
    1.40 +
    1.41 +  struct TransmissionSampleKey
    1.42 +  {
    1.43 +    bool operator < (TransmissionSampleKey const &other) const;
    1.44 +    Ptr<Node> transmitter;
    1.45 +    Ptr<Node> receiver; // NULL if broadcast
    1.46 +    Ptr<Channel> channel;
    1.47 +  };
    1.48 +
    1.49 +  struct TransmissionSampleValue
    1.50 +  {
    1.51 +    TransmissionSampleValue () : bytes (0) {}
    1.52 +    uint32_t bytes;
    1.53 +  };
    1.54 +
    1.55 +  std::map<TransmissionSampleKey, TransmissionSampleValue> m_transmissionSamples;
    1.56 +
    1.57 +  void TraceNetDevTx (std::string context, Ptr<const Packet> packet, Mac48Address address);
    1.58 +  void TraceNetDevRx (std::string context, Ptr<const Packet> packet, Mac48Address address);
    1.59 +
    1.60  };
    1.61  
    1.62