merge with HEAD

This commit is contained in:
Mathieu Lacage
2007-12-11 10:25:34 +01:00
7 changed files with 163 additions and 374 deletions

View File

@@ -1,44 +0,0 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import Object
def build(bld):
env = bld.env_of_name('default')
if env['NS3_ENABLED_MODULES']:
modules = env['NS3_ENABLED_MODULES']
changed = True
while changed:
changed = False
for module in modules:
module_obj = Object.name_to_obj(module)
if module_obj is None:
raise ValueError("module %s not found" % module)
for dep in module_obj.add_objects:
if not dep.startswith('ns3-'):
continue
if dep not in modules:
modules.append(dep)
changed = True
## remove objects that depend on modules not listed
for obj in list(Object.g_allobjs):
if hasattr(obj, 'ns3_module_dependencies'):
for dep in obj.ns3_module_dependencies:
if dep not in modules:
Object.g_allobjs.remove(obj)
break
if obj.name in env['NS3_MODULES'] and obj.name not in modules:
Object.g_allobjs.remove(obj)
## Create a single ns3 library containing all modules
lib = bld.create_obj('cpp', 'shlib')
lib.name = 'ns3'
lib.target = 'ns3'
if env['NS3_ENABLED_MODULES']:
lib.add_objects = list(modules)
else:
lib.add_objects = list(env['NS3_MODULES'])

View File

@@ -366,7 +366,7 @@ GlobalRouteManagerImpl::SelectRouterNodes ()
NS_LOG_LOGIC ("Adding GlobalRouter interface to node " <<
node->GetId ());
Ptr<GlobalRouter> globalRouter = Create<GlobalRouter> (node);
Ptr<GlobalRouter> globalRouter = Create<GlobalRouter> ();
node->AddInterface (globalRouter);
}
}

View File

@@ -434,8 +434,8 @@ std::ostream& operator<< (std::ostream& os, GlobalRoutingLSA& lsa)
const InterfaceId GlobalRouter::iid =
MakeInterfaceId ("GlobalRouter", Object::iid);
GlobalRouter::GlobalRouter (Ptr<Node> node)
: m_node(node), m_LSAs()
GlobalRouter::GlobalRouter ()
: m_LSAs()
{
NS_LOG_FUNCTION;
SetInterfaceId (GlobalRouter::iid);
@@ -452,7 +452,6 @@ void
GlobalRouter::DoDispose ()
{
NS_LOG_FUNCTION;
m_node = 0;
Object::DoDispose ();
}
@@ -491,8 +490,9 @@ GlobalRouter::GetRouterId (void) const
GlobalRouter::DiscoverLSAs (void)
{
NS_LOG_FUNCTION;
NS_LOG_LOGIC("For node " << m_node->GetId () );
NS_ASSERT_MSG(m_node,
Ptr<Node> node = QueryInterface<Node> (Node::iid);
NS_LOG_LOGIC("For node " << node->GetId () );
NS_ASSERT_MSG(node,
"GlobalRouter::DiscoverLSAs (): <Node> interface not set");
ClearLSAs ();
@@ -506,7 +506,7 @@ GlobalRouter::DiscoverLSAs (void)
// Ipv4 interface. This is where the information regarding the attached
// interfaces lives.
//
Ptr<Ipv4> ipv4Local = m_node->QueryInterface<Ipv4> (Ipv4::iid);
Ptr<Ipv4> ipv4Local = node->QueryInterface<Ipv4> (Ipv4::iid);
NS_ASSERT_MSG(ipv4Local,
"GlobalRouter::DiscoverLSAs (): QI for <Ipv4> interface failed");
//
@@ -523,11 +523,11 @@ GlobalRouter::DiscoverLSAs (void)
// as the number of devices may include those for stub networks (e.g.,
// ethernets, etc.).
//
uint32_t numDevices = m_node->GetNDevices();
uint32_t numDevices = node->GetNDevices();
NS_LOG_LOGIC ("numDevices = " << numDevices);
for (uint32_t i = 0; i < numDevices; ++i)
{
Ptr<NetDevice> ndLocal = m_node->GetDevice(i);
Ptr<NetDevice> ndLocal = node->GetDevice(i);
if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () )
{
@@ -543,7 +543,7 @@ GlobalRouter::DiscoverLSAs (void)
// is a function to do this used down in the guts of the stack, but it's not
// exported so we had to whip up an equivalent.
//
uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal);
uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
NS_LOG_LOGIC ("Working with local address " << addrLocal);
@@ -580,11 +580,11 @@ GlobalRouter::DiscoverLSAs (void)
plr->SetLinkType (GlobalRoutingLinkRecord::TransitNetwork);
// Link ID is IP interface address of designated router
Ipv4Address desigRtr =
FindDesignatedRouterForLink (m_node, ndLocal);
FindDesignatedRouterForLink (node, ndLocal);
if (desigRtr == addrLocal)
{
listOfDRInterfaces.push_back (ndLocal);
NS_LOG_LOGIC (m_node->GetId () << " is a DR");
NS_LOG_LOGIC (node->GetId () << " is a DR");
}
plr->SetLinkId (desigRtr);
// Link Data is router's own IP address
@@ -604,7 +604,7 @@ GlobalRouter::DiscoverLSAs (void)
// is a function to do this used down in the guts of the stack, but it's not
// exported so we had to whip up an equivalent.
//
uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal);
uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
//
// Now that we have the Ipv4 interface index, we can get the address and mask
// we need.
@@ -691,7 +691,7 @@ GlobalRouter::DiscoverLSAs (void)
{
// Build one NetworkLSA for each interface that is a DR
Ptr<NetDevice> ndLocal = *i;
uint32_t ifIndexLocal = FindIfIndexForDevice(m_node, ndLocal);
uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
@@ -729,7 +729,7 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr<Node> node,
Ptr<NetDevice> ndLocal) const
{
uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
Ptr<Ipv4> ipv4Local = m_node->QueryInterface<Ipv4> (Ipv4::iid);
Ptr<Ipv4> ipv4Local = QueryInterface<Ipv4> (Ipv4::iid);
NS_ASSERT (ipv4Local);
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);

View File

@@ -563,12 +563,9 @@ public:
static const InterfaceId iid;
/**
* @brief Create a Global Router class and aggregate its interface onto the
* Node provided.
*
* @param node The existing Node onto which this router will be aggregated.
* @brief Create a Global Router class
*/
GlobalRouter (Ptr<Node> node);
GlobalRouter ();
/**
* @brief Get the Router ID associated with this Global Router.
@@ -646,8 +643,6 @@ private:
Ipv4Address FindDesignatedRouterForLink (Ptr<Node> node,
Ptr<NetDevice> ndLocal) const;
Ptr<Node> m_node;
typedef std::list<GlobalRoutingLSA*> ListOfLSAs_t;
ListOfLSAs_t m_LSAs;

View File

@@ -48,17 +48,13 @@ def configure(conf):
conf.sub_config('simulator')
blddir = os.path.abspath(os.path.join(conf.m_blddir, conf.env.variant()))
conf.env['NS3_MODULE_PATH'] = [os.path.join(blddir, 'lib')]
conf.env['NS3_MODULE_PATH'] = [blddir]
if Params.g_options.enable_rpath:
conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (os.path.join(blddir),))
## Used to link the 'run-tests' program with all of ns-3 code
conf.env['NS3_MODULES'] = ['ns3-' + module.split('/')[-1] for module in all_modules]
if Params.g_options.enable_modules:
conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in
Params.g_options.enable_modules.split(',')]
def create_ns3_module(bld, name, dependencies=()):
module = bld.create_obj('cpp', 'objects')

396
waf vendored

File diff suppressed because one or more lines are too long

52
wscript
View File

@@ -144,6 +144,10 @@ def configure(conf):
conf.sub_config('src')
conf.sub_config('utils')
if Params.g_options.enable_modules:
conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in
Params.g_options.enable_modules.split(',')]
def create_ns3_program(bld, name, dependencies=('simulator',)):
program = bld.create_obj('cpp', 'program')
@@ -179,10 +183,56 @@ def build(bld):
raise SystemExit(0)
# process subfolders from here
bld.add_subdirs('lib') # first subdirs are processed last by WAF
bld.add_subdirs('src')
bld.add_subdirs('samples utils examples tutorial')
## if --enabled-modules option was given, we disable building the
## modules that were not enabled, and programs that depend on
## disabled modules.
env = bld.env()
if Params.g_options.enable_modules:
Params.warning("the option --enable-modules is being applied to this build only;"
" to make it permanent it needs to be given to waf configure.")
env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in
Params.g_options.enable_modules.split(',')]
if env['NS3_ENABLED_MODULES']:
modules = env['NS3_ENABLED_MODULES']
changed = True
while changed:
changed = False
for module in modules:
module_obj = Object.name_to_obj(module)
if module_obj is None:
raise ValueError("module %s not found" % module)
for dep in module_obj.add_objects:
if not dep.startswith('ns3-'):
continue
if dep not in modules:
modules.append(dep)
changed = True
## remove objects that depend on modules not listed
for obj in list(Object.g_allobjs):
if hasattr(obj, 'ns3_module_dependencies'):
for dep in obj.ns3_module_dependencies:
if dep not in modules:
Object.g_allobjs.remove(obj)
break
if obj.name in env['NS3_MODULES'] and obj.name not in modules:
Object.g_allobjs.remove(obj)
## Create a single ns3 library containing all enabled modules
lib = bld.create_obj('cpp', 'shlib')
lib.name = 'ns3'
lib.target = 'ns3'
if env['NS3_ENABLED_MODULES']:
lib.add_objects = list(modules)
else:
lib.add_objects = list(env['NS3_MODULES'])
def shutdown():