|
|
| 23 |
#include "ns3/packet.h" |
23 |
#include "ns3/packet.h" |
| 24 |
#include "ns3/node.h" |
24 |
#include "ns3/node.h" |
| 25 |
#include "ns3/boolean.h" |
25 |
#include "ns3/boolean.h" |
|
|
26 |
#include "ns3/object-vector.h" |
| 26 |
#include "ns3/ipv4-route.h" |
27 |
#include "ns3/ipv4-route.h" |
| 27 |
|
28 |
|
| 28 |
#include "udp-l4-protocol.h" |
29 |
#include "udp-l4-protocol.h" |
|
|
| 48 |
static TypeId tid = TypeId ("ns3::UdpL4Protocol") |
49 |
static TypeId tid = TypeId ("ns3::UdpL4Protocol") |
| 49 |
.SetParent<Ipv4L4Protocol> () |
50 |
.SetParent<Ipv4L4Protocol> () |
| 50 |
.AddConstructor<UdpL4Protocol> () |
51 |
.AddConstructor<UdpL4Protocol> () |
|
|
52 |
.AddAttribute ("SocketList", "The list of sockets associated to this protocol.", |
| 53 |
ObjectVectorValue (), |
| 54 |
MakeObjectVectorAccessor (&UdpL4Protocol::m_sockets), |
| 55 |
MakeObjectVectorChecker<UdpSocketImpl> ()) |
| 51 |
; |
56 |
; |
| 52 |
return tid; |
57 |
return tid; |
| 53 |
} |
58 |
} |
|
|
| 107 |
UdpL4Protocol::DoDispose (void) |
112 |
UdpL4Protocol::DoDispose (void) |
| 108 |
{ |
113 |
{ |
| 109 |
NS_LOG_FUNCTION_NOARGS (); |
114 |
NS_LOG_FUNCTION_NOARGS (); |
|
|
115 |
for (std::vector<Ptr<UdpSocketImpl> >::iterator i = m_sockets.begin (); i != m_sockets.end (); i++) |
| 116 |
{ |
| 117 |
*i = 0; |
| 118 |
} |
| 119 |
m_sockets.clear (); |
| 120 |
|
| 110 |
if (m_endPoints != 0) |
121 |
if (m_endPoints != 0) |
| 111 |
{ |
122 |
{ |
| 112 |
delete m_endPoints; |
123 |
delete m_endPoints; |
|
|
| 123 |
Ptr<UdpSocketImpl> socket = CreateObject<UdpSocketImpl> (); |
134 |
Ptr<UdpSocketImpl> socket = CreateObject<UdpSocketImpl> (); |
| 124 |
socket->SetNode (m_node); |
135 |
socket->SetNode (m_node); |
| 125 |
socket->SetUdp (this); |
136 |
socket->SetUdp (this); |
|
|
137 |
m_sockets.push_back (socket); |
| 126 |
return socket; |
138 |
return socket; |
| 127 |
} |
139 |
} |
| 128 |
|
140 |
|