1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2007 INRIA |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License version 2 as |
|
7 * published by the Free Software Foundation; |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 * |
|
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
19 */ |
|
20 #include "ipv4-impl.h" |
|
21 #include "ipv4-l3-protocol.h" |
|
22 #include "ipv4-interface.h" |
|
23 #include "ns3/assert.h" |
|
24 #include "ns3/net-device.h" |
|
25 |
|
26 namespace ns3 { |
|
27 |
|
28 Ipv4Impl::Ipv4Impl () |
|
29 : m_ipv4 (0) |
|
30 {} |
|
31 Ipv4Impl::~Ipv4Impl () |
|
32 { |
|
33 NS_ASSERT (m_ipv4 == 0); |
|
34 } |
|
35 void |
|
36 Ipv4Impl::SetIpv4 (Ptr<Ipv4L3Protocol> ipv4) |
|
37 { |
|
38 m_ipv4 = ipv4; |
|
39 } |
|
40 void |
|
41 Ipv4Impl::DoDispose (void) |
|
42 { |
|
43 m_ipv4 = 0; |
|
44 } |
|
45 |
|
46 void |
|
47 Ipv4Impl::AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, |
|
48 int16_t priority) |
|
49 { |
|
50 m_ipv4->AddRoutingProtocol (routingProtocol, priority); |
|
51 } |
|
52 |
|
53 void |
|
54 Ipv4Impl::AddHostRouteTo (Ipv4Address dest, |
|
55 Ipv4Address nextHop, |
|
56 uint32_t interface) |
|
57 { |
|
58 m_ipv4->AddHostRouteTo (dest, nextHop, interface); |
|
59 } |
|
60 void |
|
61 Ipv4Impl::AddHostRouteTo (Ipv4Address dest, |
|
62 uint32_t interface) |
|
63 { |
|
64 m_ipv4->AddHostRouteTo (dest, interface); |
|
65 } |
|
66 void |
|
67 Ipv4Impl::AddNetworkRouteTo (Ipv4Address network, |
|
68 Ipv4Mask networkMask, |
|
69 Ipv4Address nextHop, |
|
70 uint32_t interface) |
|
71 { |
|
72 m_ipv4->AddNetworkRouteTo (network, networkMask, nextHop, interface); |
|
73 } |
|
74 void |
|
75 Ipv4Impl::AddNetworkRouteTo (Ipv4Address network, |
|
76 Ipv4Mask networkMask, |
|
77 uint32_t interface) |
|
78 { |
|
79 m_ipv4->AddNetworkRouteTo (network, networkMask, interface); |
|
80 } |
|
81 void |
|
82 Ipv4Impl::SetDefaultRoute (Ipv4Address nextHop, |
|
83 uint32_t interface) |
|
84 { |
|
85 m_ipv4->SetDefaultRoute (nextHop, interface); |
|
86 } |
|
87 uint32_t |
|
88 Ipv4Impl::GetNRoutes (void) |
|
89 { |
|
90 return m_ipv4->GetNRoutes (); |
|
91 } |
|
92 Ipv4Route |
|
93 Ipv4Impl::GetRoute (uint32_t i) |
|
94 { |
|
95 return *m_ipv4->GetRoute (i); |
|
96 } |
|
97 void |
|
98 Ipv4Impl::RemoveRoute (uint32_t i) |
|
99 { |
|
100 return m_ipv4->RemoveRoute (i); |
|
101 } |
|
102 |
|
103 void |
|
104 Ipv4Impl::AddMulticastRoute (Ipv4Address origin, |
|
105 Ipv4Address group, |
|
106 uint32_t inputInterface, |
|
107 std::vector<uint32_t> outputInterfaces) |
|
108 { |
|
109 m_ipv4->AddMulticastRoute (origin, group, inputInterface, outputInterfaces); |
|
110 } |
|
111 |
|
112 void |
|
113 Ipv4Impl::SetDefaultMulticastRoute (uint32_t outputInterface) |
|
114 { |
|
115 m_ipv4->SetDefaultMulticastRoute (outputInterface); |
|
116 } |
|
117 |
|
118 uint32_t |
|
119 Ipv4Impl::GetNMulticastRoutes (void) const |
|
120 { |
|
121 return m_ipv4->GetNMulticastRoutes (); |
|
122 } |
|
123 |
|
124 Ipv4MulticastRoute |
|
125 Ipv4Impl::GetMulticastRoute (uint32_t i) const |
|
126 { |
|
127 return *m_ipv4->GetMulticastRoute (i); |
|
128 } |
|
129 |
|
130 void |
|
131 Ipv4Impl::RemoveMulticastRoute (Ipv4Address origin, |
|
132 Ipv4Address group, |
|
133 uint32_t inputInterface) |
|
134 { |
|
135 m_ipv4->RemoveMulticastRoute (origin, group, inputInterface); |
|
136 } |
|
137 |
|
138 void |
|
139 Ipv4Impl::RemoveMulticastRoute (uint32_t i) |
|
140 { |
|
141 return m_ipv4->RemoveMulticastRoute (i); |
|
142 } |
|
143 |
|
144 uint32_t |
|
145 Ipv4Impl::AddInterface (Ptr<NetDevice> device) |
|
146 { |
|
147 return m_ipv4->AddInterface (device); |
|
148 } |
|
149 |
|
150 uint32_t |
|
151 Ipv4Impl::GetNInterfaces (void) |
|
152 { |
|
153 return m_ipv4->GetNInterfaces (); |
|
154 } |
|
155 |
|
156 uint32_t |
|
157 Ipv4Impl::FindInterfaceForAddr (Ipv4Address addr) const |
|
158 { |
|
159 return m_ipv4->FindInterfaceForAddr (addr); |
|
160 } |
|
161 |
|
162 uint32_t |
|
163 Ipv4Impl::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const |
|
164 { |
|
165 return m_ipv4->FindInterfaceForAddr (addr, mask); |
|
166 } |
|
167 |
|
168 int32_t |
|
169 Ipv4Impl::FindInterfaceForDevice (Ptr<NetDevice> device) const |
|
170 { |
|
171 return m_ipv4->FindInterfaceIndexForDevice (device); |
|
172 } |
|
173 |
|
174 Ptr<NetDevice> |
|
175 Ipv4Impl::GetNetDevice (uint32_t i) |
|
176 { |
|
177 return m_ipv4->GetInterface (i)-> GetDevice (); |
|
178 } |
|
179 |
|
180 void |
|
181 Ipv4Impl::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group) |
|
182 { |
|
183 m_ipv4->JoinMulticastGroup(origin, group); |
|
184 } |
|
185 |
|
186 void |
|
187 Ipv4Impl::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group) |
|
188 { |
|
189 m_ipv4->LeaveMulticastGroup(origin, group); |
|
190 } |
|
191 |
|
192 uint32_t |
|
193 Ipv4Impl::AddAddress (uint32_t i, Ipv4InterfaceAddress address) |
|
194 { |
|
195 return m_ipv4->AddAddress (i, address); |
|
196 } |
|
197 |
|
198 Ipv4InterfaceAddress |
|
199 Ipv4Impl::GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const |
|
200 { |
|
201 return m_ipv4->GetAddress (interfaceIndex, addressIndex); |
|
202 } |
|
203 |
|
204 uint32_t |
|
205 Ipv4Impl::GetNAddresses (uint32_t interface) const |
|
206 { |
|
207 return m_ipv4->GetNAddresses (interface); |
|
208 } |
|
209 |
|
210 void |
|
211 Ipv4Impl::SetMetric (uint32_t i, uint16_t metric) |
|
212 { |
|
213 m_ipv4->SetMetric (i, metric); |
|
214 } |
|
215 |
|
216 uint16_t |
|
217 Ipv4Impl::GetMetric (uint32_t i) const |
|
218 { |
|
219 return m_ipv4->GetMetric (i); |
|
220 } |
|
221 |
|
222 bool |
|
223 Ipv4Impl::GetInterfaceForDestination (Ipv4Address dest, uint32_t &interface) const |
|
224 { |
|
225 return m_ipv4->GetInterfaceForDestination (dest, interface); |
|
226 } |
|
227 |
|
228 Ipv4Address |
|
229 Ipv4Impl::GetSourceAddress (Ipv4Address destination) const |
|
230 { |
|
231 return m_ipv4->GetSourceAddress (destination); |
|
232 } |
|
233 |
|
234 uint16_t |
|
235 Ipv4Impl::GetMtu (uint32_t i) const |
|
236 { |
|
237 return m_ipv4->GetMtu (i); |
|
238 } |
|
239 bool |
|
240 Ipv4Impl::IsUp (uint32_t i) const |
|
241 { |
|
242 return m_ipv4->IsUp (i); |
|
243 } |
|
244 void |
|
245 Ipv4Impl::SetUp (uint32_t i) |
|
246 { |
|
247 m_ipv4->SetUp (i); |
|
248 } |
|
249 void |
|
250 Ipv4Impl::SetDown (uint32_t i) |
|
251 { |
|
252 m_ipv4->SetDown (i); |
|
253 } |
|
254 |
|
255 }//namespace ns3 |
|