OK, thanks.
My node topology is like this:
n0 ========= n3
|
|
|
|
n1 ========= n2(switch)
// \\
// \\
n4 n5
When I use the first peace of code (using Ipv4StaticRoutingHelper),
there is no errors - but this 0.0.0.0 gateway.
So, I tried to prepare the following function (I hope than gateway
will be correct):
226 void printRoutingTable (Ptr<Node> node) {
227 //Ipv4GlobalRoutingHelper helper;
228 Ptr<Ipv4> stack = node -> GetObject<Ipv4>();
229 Ptr<GlobalRouter> router = node->GetObject<GlobalRouter> ();
230 Ptr<Ipv4GlobalRouting> globalrouting = router-
>GetRoutingProtocol ();
231 uint32_t numroutes = globalrouting->GetNRoutes();
232 Ipv4RoutingTableEntry entry;
233 std::cout << "Routing table for device: " <<
Names::FindName(node) <<"\n";
234 std::cout << "Destination\tMask\t\tGateway\t\tIface\n";
235
236 for (uint32_t i =0 ; i<numroutes;i++) {
237 entry =globalrouting->GetRoute(i);
238 std::cout << entry.GetDestNetwork() << "\t"
239 << entry.GetDestNetworkMask() <<
"\t"
240 << entry.GetGateway() << "\t\t"
241 << entry.GetInterface() << "\t"
242 <</*globalrouting->GetMetric(i)*/<<"\n";
243 }
244 return;
245
246 }
Unfortunately, there are errors:
../scratch/rys10Glob.cc: In function ‘void
printRoutingTable(ns3::Ptr<ns3::Node>)’:
../scratch/rys10Glob.cc:231: error: invalid use of incomplete type
‘struct ns3::Ipv4GlobalRouting’
debug/ns3/global-router-interface.h:40: error: forward declaration of
‘struct ns3::Ipv4GlobalRouting’
../scratch/rys10Glob.cc:237: error: invalid use of incomplete type
‘struct ns3::Ipv4GlobalRouting’
debug/ns3/global-router-interface.h:40: error: forward declaration of
‘struct ns3::Ipv4GlobalRouting’
../scratch/rys10Glob.cc:242: error: expected primary-expression before
‘<<’ token
debug/ns3/ptr.h: In destructor ‘ns3::Ptr<T>::~Ptr() [with T =
ns3::Ipv4GlobalRouting]’:
../scratch/rys10Glob.cc:230: instantiated from here
debug/ns3/ptr.h:441: error: invalid use of incomplete type ‘struct
ns3::Ipv4GlobalRouting’
debug/ns3/global-router-interface.h:40: error: forward declaration of
‘struct ns3::Ipv4GlobalRouting’
debug/ns3/ptr.h: In member function ‘void ns3::Ptr<T>::Acquire() const
[with T = ns3::Ipv4GlobalRouting]’:
debug/ns3/ptr.h:426: instantiated from ‘ns3::Ptr<T>::Ptr(const
ns3::Ptr<T>&) [with T = ns3::Ipv4GlobalRouting]’
../scratch/rys10Glob.cc:230: instantiated from here
debug/ns3/ptr.h:396: error: invalid use of incomplete type ‘struct
ns3::Ipv4GlobalRouting’
debug/ns3/global-router-interface.h:40: error: forward declaration of
‘struct ns3::Ipv4GlobalRouting’
Waf: Leaving directory `/home/slawek/repos2/ns-allinone-3.8/ns-3.8/
build'
Build failed: -> task failed (err #1):
{task: cxx rys10Glob.cc -> rys10Glob_1.o}
Thanks in advance for your help.
On 12 Sie, 17:12, Быков Евгений <
bikov...@gmail.com> wrote:
> Probably it will be a good idea to show log of errors and node topology.
> 0.0.0.0 gateway may not be as bad as it seems
>
> 2010/8/12 Slawek <
slawmac...@gmail.com>
> >
ns-3-users+...@googlegroups.com<
ns-3-users%2Bunsu...@googlegroups.com>
> > .