forked from Gabrielcarvfer/NS3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwscript
462 lines (441 loc) · 17.2 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import os
import sys
from waflib import Options, Logs, Utils, Task
# Required NSC version
NSC_RELEASE_NAME = "nsc-0.5.3"
def 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')
opt.add_option('--disable-nsc',
help=('Disable Network Simulation Cradle support'),
dest='disable_nsc', default=False, action="store_true")
def configure(conf):
conf.env['ENABLE_NSC'] = False
if Options.options.disable_nsc:
conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
"disabled by user request")
return
# 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
lib_to_check = 'liblinux2.6.26.so'
if Options.options.with_nsc:
if os.path.isdir(Options.options.with_nsc):
conf.msg("Checking for NSC location", ("%s (given)" % Options.options.with_nsc))
conf.env['WITH_NSC'] = os.path.abspath(Options.options.with_nsc)
else:
# bake.py uses ../../build, while ns-3-dev uses ../nsc,
# and ns-3 release uses ../NSC_RELEASE_NAME
nsc_bake_build_dir = os.path.join('..', '..', 'build')
nsc_bake_lib_dir = os.path.join(nsc_bake_build_dir, 'lib')
nsc_dir = os.path.join('..', "nsc")
nsc_release_dir = os.path.join('..', NSC_RELEASE_NAME)
if os.path.exists(os.path.join(nsc_bake_lib_dir, lib_to_check)):
conf.msg("Checking for NSC location",("%s (guessed)" % nsc_bake_build_dir))
conf.env['WITH_NSC'] = os.path.abspath(nsc_bake_build_dir)
elif os.path.isdir(nsc_dir):
conf.msg("Checking for NSC location",("%s (guessed)" % nsc_dir))
conf.env['WITH_NSC'] = os.path.abspath(nsc_dir)
elif os.path.isdir(nsc_release_dir):
conf.msg("Checking for NSC location", ("%s (guessed)" % nsc_release_dir))
conf.env['WITH_NSC'] = os.path.abspath(nsc_release_dir)
del nsc_bake_build_dir
del nsc_bake_lib_dir
del nsc_dir
del nsc_release_dir
if not conf.env['WITH_NSC']:
conf.msg("Checking for NSC location", False)
conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
"NSC not found (see option --with-nsc)")
return
if Utils.unversioned_sys_platform() in ['linux', 'freebsd']:
arch = os.uname()[4]
else:
arch = None
ok = False
if arch in ('amd64', 'x86_64', 'i686', 'i586', 'i486', 'i386'):
conf.env['NSC_ENABLED'] = True
conf.env.append_value('CXXDEFINES', 'NETWORK_SIMULATION_CRADLE')
conf.check_nonfatal(mandatory=True, lib='dl', define_name='HAVE_DL', uselib_store='DL')
ok = True
conf.msg('Checking for NSC supported architecture ' + (arch or ''), ok)
if not ok:
conf.env['NSC_ENABLED'] = False
conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
"architecture %r not supported" % arch)
return
found = False
for path in ['.', 'lib', 'lib64', 'linux-2.6.26']:
if os.path.exists(os.path.join(conf.env['WITH_NSC'], path, lib_to_check)):
# append the NSC kernel dir to the module path so that this dir
# will end up in the LD_LIBRARY_PATH, thus allowing the NSC NS-3
# module to find the necessary NSC shared libraries.
found = True
conf.env.append_value('NS3_MODULE_PATH',
os.path.abspath(os.path.join(conf.env['WITH_NSC'], path)))
if not found:
conf.env['NSC_ENABLED'] = False
conf.report_optional_feature("nsc", "Network Simulation Cradle", False,
"NSC library %s is missing: NSC has not been built?" % lib_to_check)
else:
conf.report_optional_feature("nsc", "Network Simulation Cradle", True, "")
def build(bld):
# bridge dependency is due to global routing
obj = bld.create_ns3_module('internet', ['bridge', 'traffic-control', 'network', 'core'])
obj.source = [
'model/ip-l4-protocol.cc',
'model/udp-header.cc',
'model/tcp-header.cc',
'model/ipv4-interface.cc',
'model/ipv4-l3-protocol.cc',
'model/ipv4-end-point.cc',
'model/udp-l4-protocol.cc',
'model/tcp-l4-protocol.cc',
'model/arp-header.cc',
'model/arp-cache.cc',
'model/arp-l3-protocol.cc',
'model/arp-queue-disc-item.cc',
'model/udp-socket-impl.cc',
'model/ipv4-end-point-demux.cc',
'model/udp-socket-factory-impl.cc',
'model/tcp-socket-factory-impl.cc',
'model/pending-data.cc',
'model/rtt-estimator.cc',
'model/ipv4-raw-socket-factory-impl.cc',
'model/ipv4-raw-socket-impl.cc',
'model/icmpv4.cc',
'model/icmpv4-l4-protocol.cc',
'model/loopback-net-device.cc',
'model/ndisc-cache.cc',
'model/ipv6-interface.cc',
'model/icmpv6-header.cc',
'model/ipv6-l3-protocol.cc',
'model/ipv6-end-point.cc',
'model/ipv6-end-point-demux.cc',
'model/ipv6-raw-socket-factory-impl.cc',
'model/ipv6-raw-socket-impl.cc',
'model/ipv6-autoconfigured-prefix.cc',
'model/ipv6-extension.cc',
'model/ipv6-extension-header.cc',
'model/ipv6-extension-demux.cc',
'model/ipv6-option.cc',
'model/ipv6-option-header.cc',
'model/ipv6-option-demux.cc',
'model/icmpv6-l4-protocol.cc',
'model/tcp-socket-base.cc',
'model/tcp-socket-state.cc',
'model/tcp-highspeed.cc',
'model/tcp-hybla.cc',
'model/tcp-vegas.cc',
'model/tcp-congestion-ops.cc',
'model/tcp-linux-reno.cc',
'model/tcp-westwood.cc',
'model/tcp-scalable.cc',
'model/tcp-veno.cc',
'model/tcp-bic.cc',
'model/tcp-cubic.cc',
'model/tcp-yeah.cc',
'model/tcp-ledbat.cc',
'model/tcp-illinois.cc',
'model/tcp-htcp.cc',
'model/tcp-lp.cc',
'model/tcp-dctcp.cc',
'model/tcp-bbr.cc',
'model/tcp-rx-buffer.cc',
'model/tcp-tx-buffer.cc',
'model/tcp-tx-item.cc',
'model/tcp-rate-ops.cc',
'model/tcp-option.cc',
'model/tcp-option-rfc793.cc',
'model/tcp-option-winscale.cc',
'model/tcp-option-ts.cc',
'model/tcp-option-sack-permitted.cc',
'model/tcp-option-sack.cc',
'model/ipv4-packet-info-tag.cc',
'model/ipv6-packet-info-tag.cc',
'model/ipv4-interface-address.cc',
'model/ipv4-address-generator.cc',
'model/ipv4-header.cc',
'model/ipv4-queue-disc-item.cc',
'model/ipv4-packet-filter.cc',
'model/ipv4-route.cc',
'model/ipv4-routing-protocol.cc',
'model/udp-socket.cc',
'model/udp-socket-factory.cc',
'model/tcp-socket.cc',
'model/tcp-socket-factory.cc',
'model/tcp-recovery-ops.cc',
'model/tcp-prr-recovery.cc',
'model/ipv4.cc',
'model/ipv4-raw-socket-factory.cc',
'model/ipv6-header.cc',
'model/ipv6-queue-disc-item.cc',
'model/ipv6-packet-filter.cc',
'model/ipv6-interface-address.cc',
'model/ipv6-route.cc',
'model/ipv6.cc',
'model/ipv6-raw-socket-factory.cc',
'model/ipv6-routing-protocol.cc',
'model/ipv4-list-routing.cc',
'model/ipv6-list-routing.cc',
'helper/ipv4-list-routing-helper.cc',
'helper/ipv6-list-routing-helper.cc',
'model/ipv4-static-routing.cc',
'model/ipv4-routing-table-entry.cc',
'model/ipv6-static-routing.cc',
'model/ipv6-routing-table-entry.cc',
'helper/ipv4-static-routing-helper.cc',
'helper/ipv6-static-routing-helper.cc',
'model/global-router-interface.cc',
'model/global-route-manager.cc',
'model/global-route-manager-impl.cc',
'model/candidate-queue.cc',
'model/ipv4-global-routing.cc',
'helper/ipv4-global-routing-helper.cc',
'helper/internet-stack-helper.cc',
'helper/internet-trace-helper.cc',
'helper/ipv4-address-helper.cc',
'helper/ipv4-interface-container.cc',
'helper/ipv4-routing-helper.cc',
'helper/ipv6-address-helper.cc',
'helper/ipv6-interface-container.cc',
'helper/ipv6-routing-helper.cc',
'model/ipv6-address-generator.cc',
'model/ipv4-packet-probe.cc',
'model/ipv6-packet-probe.cc',
'model/ipv6-pmtu-cache.cc',
'model/ripng.cc',
'model/ripng-header.cc',
'helper/ripng-helper.cc',
'model/rip.cc',
'model/rip-header.cc',
'helper/rip-helper.cc',
]
internet_test = bld.create_ns3_module_test_library('internet')
internet_test.source = [
'test/global-route-manager-impl-test-suite.cc',
'test/ipv4-address-generator-test-suite.cc',
'test/ipv4-address-helper-test-suite.cc',
'test/ipv4-list-routing-test-suite.cc',
'test/ipv4-packet-info-tag-test-suite.cc',
'test/ipv4-raw-test.cc',
'test/ipv4-header-test.cc',
'test/ipv4-fragmentation-test.cc',
'test/ipv4-forwarding-test.cc',
'test/ipv4-test.cc',
'test/ipv4-static-routing-test-suite.cc',
'test/ipv4-global-routing-test-suite.cc',
'test/ipv6-extension-header-test-suite.cc',
'test/ipv6-list-routing-test-suite.cc',
'test/ipv6-packet-info-tag-test-suite.cc',
'test/ipv6-test.cc',
'test/ipv6-raw-test.cc',
'test/ipv6-address-duplication-test.cc',
'test/tcp-test.cc',
'test/tcp-timestamp-test.cc',
'test/tcp-sack-permitted-test.cc',
'test/tcp-wscaling-test.cc',
'test/tcp-option-test.cc',
'test/tcp-header-test.cc',
'test/tcp-ecn-test.cc',
'test/tcp-general-test.cc',
'test/tcp-error-model.cc',
'test/tcp-slow-start-test.cc',
'test/tcp-cong-avoid-test.cc',
'test/tcp-fast-retr-test.cc',
'test/tcp-rto-test.cc',
'test/tcp-highspeed-test.cc',
'test/tcp-hybla-test.cc',
'test/tcp-vegas-test.cc',
'test/tcp-scalable-test.cc',
'test/tcp-veno-test.cc',
'test/tcp-bic-test.cc',
'test/tcp-yeah-test.cc',
'test/tcp-illinois-test.cc',
'test/tcp-htcp-test.cc',
'test/tcp-lp-test.cc',
'test/tcp-ledbat-test.cc',
'test/tcp-zero-window-test.cc',
'test/tcp-pkts-acked-test.cc',
'test/tcp-rtt-estimation.cc',
'test/tcp-bytes-in-flight-test.cc',
'test/tcp-advertised-window-test.cc',
'test/tcp-classic-recovery-test.cc',
'test/tcp-prr-recovery-test.cc',
'test/tcp-loss-test.cc',
'test/tcp-linux-reno-test.cc',
'test/udp-test.cc',
'test/ipv6-address-generator-test-suite.cc',
'test/ipv6-dual-stack-test-suite.cc',
'test/ipv6-fragmentation-test.cc',
'test/ipv6-forwarding-test.cc',
'test/ipv6-ripng-test.cc',
'test/ipv6-address-helper-test-suite.cc',
'test/rtt-test.cc',
'test/tcp-tx-buffer-test.cc',
'test/tcp-rx-buffer-test.cc',
'test/tcp-endpoint-bug2211.cc',
'test/tcp-datasentcb-test.cc',
'test/tcp-rate-ops-test.cc',
'test/ipv4-rip-test.cc',
'test/tcp-close-test.cc',
'test/icmp-test.cc',
'test/ipv4-deduplication-test.cc',
'test/tcp-dctcp-test.cc',
'test/tcp-syn-connection-failed-test.cc',
'test/tcp-pacing-test.cc',
'test/tcp-bbr-test.cc',
]
# Tests encapsulating example programs should be listed here
if (bld.env['ENABLE_EXAMPLES']):
internet_test.source.extend([
# 'test/internet-examples-test-suite.cc',
])
privateheaders = bld(features='ns3privateheader')
privateheaders.module = 'internet'
privateheaders.source = [
'model/win32-internet-private.h'
]
headers = bld(features='ns3header')
headers.module = 'internet'
headers.source = [
'model/udp-header.h',
'model/tcp-header.h',
'model/tcp-option.h',
'model/tcp-option-winscale.h',
'model/tcp-option-ts.h',
'model/tcp-option-sack-permitted.h',
'model/tcp-option-sack.h',
'model/tcp-option-rfc793.h',
'model/icmpv4.h',
'model/icmpv6-header.h',
# used by routing
'model/ipv4-interface.h',
'model/ipv4-l3-protocol.h',
'model/ipv4-end-point.h',
'model/ipv4-end-point-demux.h',
'model/ipv6-l3-protocol.h',
'model/ipv6-extension.h',
'model/ipv6-extension-demux.h',
'model/ipv6-extension-header.h',
'model/ipv6-option.h',
'model/ipv6-option-header.h',
'model/ipv6-end-point.h',
'model/ipv6-end-point-demux.h',
'model/arp-l3-protocol.h',
'model/udp-l4-protocol.h',
'model/tcp-l4-protocol.h',
'model/icmpv4-l4-protocol.h',
'model/ip-l4-protocol.h',
'model/arp-header.h',
'model/arp-cache.h',
'model/arp-queue-disc-item.h',
'model/icmpv6-l4-protocol.h',
'model/ipv6-interface.h',
'model/ndisc-cache.h',
'model/loopback-net-device.h',
'model/ipv4-packet-info-tag.h',
'model/ipv6-packet-info-tag.h',
'model/ipv4-interface-address.h',
'model/ipv4-address-generator.h',
'model/ipv4-header.h',
'model/ipv4-queue-disc-item.h',
'model/ipv4-packet-filter.h',
'model/ipv4-route.h',
'model/ipv4-routing-protocol.h',
'model/udp-socket.h',
'model/udp-socket-factory.h',
'model/tcp-socket.h',
'model/tcp-socket-factory.h',
'model/ipv4.h',
'model/ipv4-raw-socket-factory.h',
'model/ipv4-raw-socket-impl.h',
'model/ipv6-header.h',
'model/ipv6-queue-disc-item.h',
'model/ipv6-packet-filter.h',
'model/ipv6-interface-address.h',
'model/ipv6-route.h',
'model/ipv6.h',
'model/ipv6-raw-socket-factory.h',
'model/ipv6-routing-protocol.h',
'model/ipv4-list-routing.h',
'model/ipv6-list-routing.h',
'helper/ipv4-list-routing-helper.h',
'helper/ipv6-list-routing-helper.h',
'model/ipv4-static-routing.h',
'model/ipv4-routing-table-entry.h',
'model/ipv6-static-routing.h',
'model/ipv6-routing-table-entry.h',
'helper/ipv4-static-routing-helper.h',
'helper/ipv6-static-routing-helper.h',
'model/global-router-interface.h',
'model/global-route-manager.h',
'model/global-route-manager-impl.h',
'model/candidate-queue.h',
'model/ipv4-global-routing.h',
'helper/ipv4-global-routing-helper.h',
'helper/internet-stack-helper.h',
'helper/internet-trace-helper.h',
'helper/ipv4-address-helper.h',
'helper/ipv4-interface-container.h',
'helper/ipv4-routing-helper.h',
'helper/ipv6-address-helper.h',
'helper/ipv6-interface-container.h',
'helper/ipv6-routing-helper.h',
'model/ipv6-address-generator.h',
'model/tcp-highspeed.h',
'model/tcp-hybla.h',
'model/tcp-vegas.h',
'model/tcp-congestion-ops.h',
'model/tcp-linux-reno.h',
'model/tcp-westwood.h',
'model/tcp-scalable.h',
'model/tcp-veno.h',
'model/tcp-bic.h',
'model/tcp-cubic.h',
'model/tcp-yeah.h',
'model/tcp-illinois.h',
'model/tcp-htcp.h',
'model/tcp-lp.h',
'model/tcp-dctcp.h',
'model/windowed-filter.h',
'model/tcp-bbr.h',
'model/tcp-ledbat.h',
'model/tcp-socket-base.h',
'model/tcp-socket-state.h',
'model/tcp-tx-buffer.h',
'model/tcp-tx-item.h',
'model/tcp-rate-ops.h',
'model/tcp-rx-buffer.h',
'model/tcp-recovery-ops.h',
'model/tcp-prr-recovery.h',
'model/rtt-estimator.h',
'model/ipv4-packet-probe.h',
'model/ipv6-packet-probe.h',
'model/ipv6-pmtu-cache.h',
'model/ripng.h',
'model/ripng-header.h',
'helper/ripng-helper.h',
'model/rip.h',
'model/rip-header.h',
'helper/rip-helper.h',
]
if bld.env['NSC_ENABLED']:
obj.source.append ('model/nsc-tcp-socket-impl.cc')
obj.source.append ('model/nsc-tcp-l4-protocol.cc')
obj.source.append ('model/nsc-tcp-socket-factory-impl.cc')
obj.source.append ('model/nsc-sysctl.cc')
headers.source.append('model/nsc-tcp-l4-protocol.h')
obj.use.append('DL')
internet_test.use.append('DL')
if (bld.env['ENABLE_EXAMPLES']):
bld.recurse('examples')
bld.ns3_python_bindings()