Make ipv4-interface.h, ipv4-l3-protocol.h, and ipv4-static-routing.h private. Closes #370.
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import os
import sys
import Options
import Logs
import Utils
import Task
# Required NSC version
NSC_RELEASE_NAME = "nsc-0.5.0"
def set_options(opt):
opt.add_option('--with-nsc',
help=('Use Network Simulation Cradle, given by the indicated path,'
' to allow the use of real-world network stacks'),
default='', dest='with_nsc')
def configure(conf):
conf.env['ENABLE_NSC'] = False
# checks for flex and bison, which is needed to build NSCs globaliser
# TODO: how to move these checks into the allinone scripts?
#def check_nsc_buildutils():
# import flex
# import bison
# conf.check_tool('flex bison')
# conf.check(lib='fl', mandatory=True)
# Check for the location of NSC
if Options.options.with_nsc:
if os.path.isdir(Options.options.with_nsc):
conf.check_message("NSC location", '', True, ("%s (given)" % Options.options.with_nsc))
conf.env['WITH_NSC'] = os.path.abspath(Options.options.with_nsc)
else:
nsc_dir = os.path.join('..', "nsc")
if os.path.isdir(nsc_dir):
conf.check_message("NSC location", '', True, ("%s (guessed)" % nsc_dir))
conf.env['WITH_NSC'] = os.path.abspath(nsc_dir)
del nsc_dir
if not conf.env['WITH_NSC']:
conf.check_message("NSC location", '', False)
conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
"NSC not found (see option --with-nsc)")
return
if sys.platform in ['linux2']:
arch = os.uname()[4]
else:
arch = None
ok = False
if arch == 'x86_64' or arch == 'i686' or arch == 'i586' or arch == 'i486' or arch == 'i386':
conf.env['NSC_ENABLED'] = 'yes'
conf.env.append_value('CXXDEFINES', 'NETWORK_SIMULATION_CRADLE')
conf.check(mandatory=True, lib='dl', define_name='HAVE_DL', uselib='DL')
ok = True
conf.check_message('NSC supported architecture', arch, ok)
conf.report_optional_feature("nsc", "Network Simulation Cradle", ok,
"architecture %r not supported" % arch)
# append the NSC kernel dirs to the module path so that these dirs
# will end up in the LD_LIBRARY_PATH, thus allowing the NSC NS-3
# module to find the necessary NSC shared libraries.
for nsc_module in ['linux-2.6.18', 'linux-2.6.26']:
conf.env.append_value('NS3_MODULE_PATH',
os.path.abspath(os.path.join(conf.env['WITH_NSC'], nsc_module)))
def build(bld):
obj = bld.create_ns3_module('internet-stack', ['node'])
obj.source = [
'internet-stack.cc',
'ipv4-l4-protocol.cc',
'udp-header.cc',
'tcp-header.cc',
'ipv4-checksum.cc',
'ipv4-interface.cc',
'ipv4-l3-protocol.cc',
'ipv4-static-routing.cc',
'ipv4-global-routing.cc',
'ipv4-end-point.cc',
'udp-l4-protocol.cc',
'tcp-l4-protocol.cc',
'arp-header.cc',
'arp-cache.cc',
'arp-ipv4-interface.cc',
'arp-l3-protocol.cc',
'ipv4-loopback-interface.cc',
'udp-socket-impl.cc',
'tcp-socket-impl.cc',
'ipv4-end-point-demux.cc',
'ipv4-impl.cc',
'udp-socket-factory-impl.cc',
'tcp-socket-factory-impl.cc',
'pending-data.cc',
'sequence-number.cc',
'rtt-estimator.cc',
'ipv4-raw-socket-factory-impl.cc',
'ipv4-raw-socket-impl.cc',
'icmpv4.cc',
'icmpv4-l4-protocol.cc',
]
headers = bld.new_task_gen('ns3header')
headers.module = 'internet-stack'
headers.source = [
'internet-stack.h',
'udp-header.h',
'tcp-header.h',
'sequence-number.h',
'ipv4-global-routing.h',
'icmpv4.h',
]
if bld.env['NSC_ENABLED']:
obj.source.append ('nsc-tcp-socket-impl.cc')
obj.source.append ('nsc-tcp-l4-protocol.cc')
obj.source.append ('nsc-tcp-socket-factory-impl.cc')
obj.source.append ('nsc-sysctl.cc')
obj.uselib = 'DL'