30 #include "udp.h" |
30 #include "udp.h" |
31 #include "ipv4.h" |
31 #include "ipv4.h" |
32 #include "arp.h" |
32 #include "arp.h" |
33 #include "net-device.h" |
33 #include "net-device.h" |
34 #include "i-udp-impl.h" |
34 #include "i-udp-impl.h" |
|
35 #include "i-arp-private.h" |
35 |
36 |
36 namespace ns3 { |
37 namespace ns3 { |
37 |
38 |
38 |
39 |
39 InternetNode::InternetNode() |
40 InternetNode::InternetNode() |
40 { |
41 { |
41 Ipv4 *ipv4 = new Ipv4 (this); |
42 Ipv4 *ipv4 = new Ipv4 (this); |
42 Arp *arp = new Arp (this); |
43 Arp *arp = new Arp (this); |
43 Udp *udp = new Udp (this); |
44 Udp *udp = new Udp (this); |
44 |
45 |
45 |
|
46 // Instantiate the capabilities |
|
47 ApplicationList *applicationList = new ApplicationList(this); |
46 ApplicationList *applicationList = new ApplicationList(this); |
48 L3Demux *l3Demux = new L3Demux(this); |
47 L3Demux *l3Demux = new L3Demux(this); |
49 Ipv4L4Demux *ipv4L4Demux = new Ipv4L4Demux(this); |
48 Ipv4L4Demux *ipv4L4Demux = new Ipv4L4Demux(this); |
50 |
49 |
51 l3Demux->Insert (ipv4); |
50 l3Demux->Insert (ipv4); |
52 l3Demux->Insert (arp); |
51 l3Demux->Insert (arp); |
53 ipv4L4Demux->Insert (udp); |
52 ipv4L4Demux->Insert (udp); |
54 |
53 |
55 IUdpImpl *udpImpl = new IUdpImpl (udp); |
54 IUdpImpl *udpImpl = new IUdpImpl (udp); |
|
55 IArpPrivate *arpPrivate = new IArpPrivate (arp); |
56 |
56 |
|
57 NsUnknown::AddInterface (arpPrivate); |
57 NsUnknown::AddInterface (udpImpl); |
58 NsUnknown::AddInterface (udpImpl); |
58 NsUnknown::AddInterface (applicationList); |
59 NsUnknown::AddInterface (applicationList); |
59 NsUnknown::AddInterface (l3Demux); |
60 NsUnknown::AddInterface (l3Demux); |
60 NsUnknown::AddInterface (ipv4L4Demux); |
61 NsUnknown::AddInterface (ipv4L4Demux); |
61 |
62 |
109 L3Demux *l3Demux = QueryInterface<L3Demux> (L3Demux::iid); |
106 L3Demux *l3Demux = QueryInterface<L3Demux> (L3Demux::iid); |
110 Ipv4 *ipv4 = static_cast<Ipv4*> (l3Demux->PeekProtocol (Ipv4::PROT_NUMBER)); |
107 Ipv4 *ipv4 = static_cast<Ipv4*> (l3Demux->PeekProtocol (Ipv4::PROT_NUMBER)); |
111 l3Demux->Unref (); |
108 l3Demux->Unref (); |
112 ipv4->Ref (); |
109 ipv4->Ref (); |
113 return ipv4; |
110 return ipv4; |
114 } |
|
115 |
|
116 Arp * |
|
117 InternetNode::GetArp (void) const |
|
118 { |
|
119 L3Demux *l3Demux = QueryInterface<L3Demux> (L3Demux::iid); |
|
120 Arp *arp = static_cast<Arp*> (l3Demux->PeekProtocol (Arp::PROT_NUMBER)); |
|
121 l3Demux->Unref (); |
|
122 arp->Ref (); |
|
123 return arp; |
|
124 } |
111 } |
125 |
112 |
126 void |
113 void |
127 InternetNode::DoAddDevice (NetDevice *device) const |
114 InternetNode::DoAddDevice (NetDevice *device) const |
128 { |
115 { |