equal
deleted
inserted
replaced
28 #include "ns3/address.h" |
28 #include "ns3/address.h" |
29 #include "ns3/application.h" |
29 #include "ns3/application.h" |
30 #include "ns3/event-id.h" |
30 #include "ns3/event-id.h" |
31 #include "ns3/ptr.h" |
31 #include "ns3/ptr.h" |
32 #include "ns3/data-rate.h" |
32 #include "ns3/data-rate.h" |
33 #include "ns3/random-variable.h" |
|
34 #include "ns3/traced-callback.h" |
33 #include "ns3/traced-callback.h" |
35 |
34 |
36 namespace ns3 { |
35 namespace ns3 { |
37 |
36 |
38 class Address; |
37 class Address; |
39 class RandomVariable; |
38 class RandomVariableStream; |
40 class Socket; |
39 class Socket; |
41 |
40 |
42 /** |
41 /** |
43 * \ingroup applications |
42 * \ingroup applications |
44 * \defgroup onoff OnOffApplication |
43 * \defgroup onoff OnOffApplication |
105 /** |
104 /** |
106 * \return pointer to associated socket |
105 * \return pointer to associated socket |
107 */ |
106 */ |
108 Ptr<Socket> GetSocket (void) const; |
107 Ptr<Socket> GetSocket (void) const; |
109 |
108 |
|
109 /** |
|
110 * Assign a fixed random variable stream number to the random variables |
|
111 * used by this model. Return the number of streams (possibly zero) that |
|
112 * have been assigned. |
|
113 * |
|
114 * \param stream first stream index to use |
|
115 * \return the number of stream indices assigned by this model |
|
116 */ |
|
117 int64_t AssignStreams (int64_t stream); |
|
118 |
110 protected: |
119 protected: |
111 virtual void DoDispose (void); |
120 virtual void DoDispose (void); |
112 private: |
121 private: |
113 // inherited from Application base class. |
122 // inherited from Application base class. |
114 virtual void StartApplication (void); // Called at time specified by Start |
123 virtual void StartApplication (void); // Called at time specified by Start |
131 void SendPacket (); |
140 void SendPacket (); |
132 |
141 |
133 Ptr<Socket> m_socket; // Associated socket |
142 Ptr<Socket> m_socket; // Associated socket |
134 Address m_peer; // Peer address |
143 Address m_peer; // Peer address |
135 bool m_connected; // True if connected |
144 bool m_connected; // True if connected |
136 RandomVariable m_onTime; // rng for On Time |
145 Ptr<RandomVariableStream> m_onTime; // rng for On Time |
137 RandomVariable m_offTime; // rng for Off Time |
146 Ptr<RandomVariableStream> m_offTime; // rng for Off Time |
138 DataRate m_cbrRate; // Rate that data is generated |
147 DataRate m_cbrRate; // Rate that data is generated |
139 uint32_t m_pktSize; // Size of packets |
148 uint32_t m_pktSize; // Size of packets |
140 uint32_t m_residualBits; // Number of generated, but not sent, bits |
149 uint32_t m_residualBits; // Number of generated, but not sent, bits |
141 Time m_lastStartTime; // Time last packet sent |
150 Time m_lastStartTime; // Time last packet sent |
142 uint32_t m_maxBytes; // Limit total number of bytes sent |
151 uint32_t m_maxBytes; // Limit total number of bytes sent |