nsc: move nsc glue code from nsc-tcp-l4-protocol to node/nsc-glue.cc.
known problems:
- sim_interface.h is duplicated
- nsc-glue.cc adds hooks in node.cc, "hijacks" incoming packets
- nsc-glue exports NSCs INetStack (instead of wrapping it completely)
- nsc-tcp-l4-protocol and nsc-tcp-socket-impl make calls into nsc-glue
- nsc-tcp-socket-impl should really be "nsc-socket-core" (or something
like that)
needs fixing on nsc side:
- no support for multiple interfaces yet (also not yet supported
on nsc side)
- nsc initialisation still tied to IP (Adding an Interface and assigning the
IP address is a single step; it should be separate)
maybe there is more.
There is a NSC_NEXT define in nsc-glue.h, its main purpose is to flag
the places where the NSC API needs to be adapted to support multiple
interfaces in nsc.
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)))
72 obj = bld.create_ns3_module('internet-stack', ['node'])
77 'ipv4-l4-protocol.cc',
81 'ipv4-l3-protocol.cc',
90 'ipv4-end-point-demux.cc',
91 'udp-socket-factory-impl.cc',
92 'tcp-socket-factory-impl.cc',
96 'ipv4-raw-socket-factory-impl.cc',
97 'ipv4-raw-socket-impl.cc',
99 'icmpv4-l4-protocol.cc',
100 'loopback-net-device.cc',
103 headers = bld.new_task_gen('ns3header')
104 headers.module = 'internet-stack'
111 'ipv4-l3-protocol.h',
114 if bld.env['NSC_ENABLED']:
115 obj.source.append ('nsc-tcp-socket-impl.cc')
116 obj.source.append ('nsc-tcp-l4-protocol.cc')
117 obj.source.append ('nsc-tcp-socket-factory-impl.cc')