1 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
10 # Required NSC version
11 NSC_RELEASE_NAME = "nsc-0.5.0"
15 opt.add_option('--with-nsc',
16 help=('Use Network Simulation Cradle, given by the indicated path,'
17 ' to allow the use of real-world network stacks'),
18 default='', dest='with_nsc')
22 conf.env['ENABLE_NSC'] = False
24 # checks for flex and bison, which is needed to build NSCs globaliser
25 # TODO: how to move these checks into the allinone scripts?
26 #def check_nsc_buildutils():
29 # conf.check_tool('flex bison')
30 # conf.check(lib='fl', mandatory=True)
32 # Check for the location of NSC
33 if Options.options.with_nsc:
34 if os.path.isdir(Options.options.with_nsc):
35 conf.check_message("NSC location", '', True, ("%s (given)" % Options.options.with_nsc))
36 conf.env['WITH_NSC'] = os.path.abspath(Options.options.with_nsc)
38 nsc_dir = os.path.join('..', "nsc")
39 if os.path.isdir(nsc_dir):
40 conf.check_message("NSC location", '', True, ("%s (guessed)" % nsc_dir))
41 conf.env['WITH_NSC'] = os.path.abspath(nsc_dir)
43 if not conf.env['WITH_NSC']:
44 conf.check_message("NSC location", '', False)
45 conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
46 "NSC not found (see option --with-nsc)")
49 if sys.platform in ['linux2']:
54 if arch == 'x86_64' or arch == 'i686' or arch == 'i586' or arch == 'i486' or arch == 'i386':
55 conf.env['NSC_ENABLED'] = 'yes'
56 conf.env.append_value('CXXDEFINES', 'NETWORK_SIMULATION_CRADLE')
57 conf.check(mandatory=True, lib='dl', define_name='HAVE_DL', uselib='DL')
59 conf.check_message('NSC supported architecture', arch, ok)
60 conf.report_optional_feature("nsc", "Network Simulation Cradle", ok,
61 "architecture %r not supported" % arch)
63 # append the NSC kernel dirs to the module path so that these dirs
64 # will end up in the LD_LIBRARY_PATH, thus allowing the NSC NS-3
65 # module to find the necessary NSC shared libraries.
66 for nsc_module in ['linux-2.6.18', 'linux-2.6.26']:
67 conf.env.append_value('NS3_MODULE_PATH',
68 os.path.abspath(os.path.join(conf.env['WITH_NSC'], nsc_module)))
73 obj = bld.create_ns3_module('internet-stack', ['node'])
78 'ipv4-l4-protocol.cc',
83 'ipv4-l3-protocol.cc',
92 'ipv4-end-point-demux.cc',
93 'udp-socket-factory-impl.cc',
94 'tcp-socket-factory-impl.cc',
98 'ipv4-raw-socket-factory-impl.cc',
99 'ipv4-raw-socket-impl.cc',
101 'icmpv4-l4-protocol.cc',
102 'loopback-net-device.cc',
104 'ipv4-netfilter-hook.cc',
105 'netfilter-callback-chain.cc',
106 'netfilter-conntrack-tuple.cc',
107 'ip-conntrack-info.cc',
108 'ipv4-conntrack-l3-protocol.cc',
109 'tcp-conntrack-l4-protocol.cc',
110 'udp-conntrack-l4-protocol.cc',
111 'icmpv4-conntrack-l4-protocol.cc',
113 #'network-address-translation.cc',
116 headers = bld.new_task_gen('ns3header')
117 headers.module = 'internet-stack'
124 'ipv4-netfilter-hook.h',
125 'netfilter-callback-chain.h',
126 'netfilter-conntrack-l3-protocol.h',
127 'netfilter-conntrack-l4-protocol.h',
128 'netfilter-conntrack-tuple.h',
129 'netfilter-tuple-hash.h',
130 'ip-conntrack-info.h',
131 'ipv4-conntrack-l3-protocol.h',
132 'tcp-conntrack-l4-protocol.h',
133 'udp-conntrack-l4-protocol.h',
134 'icmpv4-conntrack-l4-protocol.h',
135 # 'network-address-translation.h',
137 'ipv4-l3-protocol.h',
141 if bld.env['NSC_ENABLED']:
142 obj.source.append ('nsc-tcp-socket-impl.cc')
143 obj.source.append ('nsc-tcp-l4-protocol.cc')
144 obj.source.append ('nsc-tcp-socket-factory-impl.cc')
145 obj.source.append ('nsc-sysctl.cc')