View | Details | Raw Unified | Return to bug 2002
Collapse All | Expand All

(-)a/ns3/_placeholder_ (-1 lines)
Line 1    Link Here 
1
This is a placeholder file used only to keep the ns3 directory present (needed for the WAF build system).
(-)a/src/internet/model/tcp-option-rfc793.h (-1 / +1 lines)
 Lines 20-26    Link Here 
20
#ifndef TCPOPTIONRFC793_H
20
#ifndef TCPOPTIONRFC793_H
21
#define TCPOPTIONRFC793_H
21
#define TCPOPTIONRFC793_H
22
22
23
#include "tcp-option.h"
23
#include "ns3/tcp-option.h"
24
24
25
namespace ns3 {
25
namespace ns3 {
26
26
(-)a/src/internet/model/tcp-option-ts.h (-1 / +1 lines)
 Lines 21-27    Link Here 
21
#ifndef TCP_OPTION_TS_H
21
#ifndef TCP_OPTION_TS_H
22
#define TCP_OPTION_TS_H
22
#define TCP_OPTION_TS_H
23
23
24
#include "tcp-option.h"
24
#include "ns3/tcp-option.h"
25
#include "ns3/timer.h"
25
#include "ns3/timer.h"
26
26
27
namespace ns3 {
27
namespace ns3 {
(-)a/src/internet/model/tcp-option-winscale.h (-1 / +1 lines)
 Lines 22-28    Link Here 
22
#ifndef TCP_OPTION_WINSCALE_H
22
#ifndef TCP_OPTION_WINSCALE_H
23
#define TCP_OPTION_WINSCALE_H
23
#define TCP_OPTION_WINSCALE_H
24
24
25
#include "tcp-option.h"
25
#include "ns3/tcp-option.h"
26
26
27
namespace ns3 {
27
namespace ns3 {
28
28
(-)a/src/internet/test/tcp-header-test.cc (-2 / +1 lines)
 Lines 23-30    Link Here 
23
#include "ns3/core-module.h"
23
#include "ns3/core-module.h"
24
#include "ns3/tcp-header.h"
24
#include "ns3/tcp-header.h"
25
#include "ns3/buffer.h"
25
#include "ns3/buffer.h"
26
26
#include "ns3/private/tcp-option-rfc793.h"
27
#include "../src/internet/model/tcp-option-rfc793.h"
28
27
29
namespace ns3 {
28
namespace ns3 {
30
29
(-)a/src/internet/test/tcp-option-test.cc (-2 / +2 lines)
 Lines 20-27    Link Here 
20
#include "ns3/test.h"
20
#include "ns3/test.h"
21
#include "ns3/core-module.h"
21
#include "ns3/core-module.h"
22
#include "ns3/tcp-option.h"
22
#include "ns3/tcp-option.h"
23
#include "../src/internet/model/tcp-option-winscale.h"
23
#include "ns3/private/tcp-option-winscale.h"
24
#include "../src/internet/model/tcp-option-ts.h"
24
#include "ns3/private/tcp-option-ts.h"
25
25
26
#include <string.h>
26
#include <string.h>
27
27
(-)a/src/internet/test/tcp-timestamp-test.cc (-1 / +1 lines)
 Lines 45-51    Link Here 
45
#include "ns3/udp-l4-protocol.h"
45
#include "ns3/udp-l4-protocol.h"
46
#include "ns3/tcp-l4-protocol.h"
46
#include "ns3/tcp-l4-protocol.h"
47
47
48
#include "../src/internet/model/tcp-option-ts.h"
48
#include "ns3/private/tcp-option-ts.h"
49
49
50
namespace ns3 {
50
namespace ns3 {
51
51
(-)a/src/internet/wscript (+7 lines)
 Lines 244-249    Link Here 
244
        'test/rtt-test.cc',
244
        'test/rtt-test.cc',
245
        'test/codel-queue-test-suite.cc',
245
        'test/codel-queue-test-suite.cc',
246
        ]
246
        ]
247
    privateheaders = bld(features='ns3privateheader')
248
    privateheaders.module = 'internet'
249
    privateheaders.source = [
250
        'model/tcp-option-winscale.h',
251
        'model/tcp-option-ts.h',
252
        'model/tcp-option-rfc793.h',
253
        ]
247
    headers = bld(features='ns3header')
254
    headers = bld(features='ns3header')
248
    headers.module = 'internet'
255
    headers.module = 'internet'
249
    headers.source = [
256
    headers.source = [
(-)a/src/wscript (-2 / +94 lines)
 Lines 442-448    Link Here 
442
def apply_ns3header(self):
442
def apply_ns3header(self):
443
    if self.module is None:
443
    if self.module is None:
444
        raise WafError("'module' missing on ns3headers object %s" % self)
444
        raise WafError("'module' missing on ns3headers object %s" % self)
445
    ns3_dir_node = self.bld.path.find_dir("ns3")
445
    ns3_dir_node = self.bld.path.find_or_declare("ns3")
446
    for filename in set(self.to_list(self.source)):
446
    for filename in set(self.to_list(self.source)):
447
        src_node = self.path.find_resource(filename)
447
        src_node = self.path.find_resource(filename)
448
        if src_node is None:
448
        if src_node is None:
 Lines 530-535    Link Here 
530
            return 0
530
            return 0
531
531
532
532
533
@TaskGen.feature('ns3privateheader')
534
@TaskGen.after_method('process_rule')
535
def apply_ns3privateheader(self):
536
    if self.module is None:
537
        raise WafError("'module' missing on ns3headers object %s" % self)
538
    ns3_dir_node = self.bld.path.find_or_declare("ns3/private")
539
    for filename in set(self.to_list(self.source)):
540
        src_node = self.path.find_resource(filename)
541
        if src_node is None:
542
            raise WafError("source ns3 header file %s not found" % (filename,))
543
        dst_node = ns3_dir_node.find_or_declare(src_node.name)
544
        assert dst_node is not None
545
        task = self.create_task('ns3privateheader')
546
        task.mode = getattr(self, 'mode', 'install')
547
        if task.mode == 'install':
548
            task.set_inputs([src_node])
549
            task.set_outputs([dst_node])
550
        else:
551
            task.header_to_remove = dst_node
552
    self.headers = set(self.to_list(self.source))
553
    self.source = '' # tell WAF not to process these files further
554
555
class ns3privateheader_task(Task.Task):
556
    before = 'cxx gen_ns3_module_header'
557
    after = 'ns3_header'
558
    color = 'BLUE'
559
560
    def __str__(self):
561
        "string to display to the user"
562
        env = self.env
563
        src_str = ' '.join([a.nice_path(env) for a in self.inputs])
564
        tgt_str = ' '.join([a.nice_path(env) for a in self.outputs])
565
        if self.outputs: sep = ' -> '
566
        else: sep = ''
567
        if self.mode == 'remove':
568
            return 'rm-ns3-header %s\n' % (self.header_to_remove.abspath(),)
569
        return 'install-ns3-header: %s%s%s\n' % (src_str, sep, tgt_str)
570
571
    def __repr__(self):
572
        return str(self)
573
574
    def uid(self):
575
        try:
576
            return self.uid_
577
        except AttributeError:
578
            m = Utils.md5()
579
            up = m.update
580
            up(self.__class__.__name__.encode())
581
            for x in self.inputs + self.outputs:
582
                up(x.abspath().encode())
583
            up(self.mode)
584
            if self.mode == 'remove':
585
                up(self.header_to_remove.abspath().encode())
586
            self.uid_ = m.digest()
587
            return self.uid_
588
589
    def runnable_status(self):
590
        if self.mode == 'remove':
591
            if os.path.exists(self.header_to_remove.abspath()):
592
                return Task.RUN_ME
593
            else:
594
                return Task.SKIP_ME
595
        else:
596
            return super(ns3privateheader_task, self).runnable_status()
597
598
    def run(self):
599
        if self.mode == 'install':
600
            assert len(self.inputs) == len(self.outputs)
601
            inputs = [node.abspath() for node in self.inputs]
602
            outputs = [node.abspath() for node in self.outputs]
603
            for src, dst in zip(inputs, outputs):
604
                try:
605
                    os.chmod(dst, 0600)
606
                except OSError:
607
                    pass
608
                shutil.copy2(src, dst)
609
                ## make the headers in builddir read-only, to prevent
610
                ## accidental modification
611
                os.chmod(dst, 0400)
612
            return 0
613
        else:
614
            assert len(self.inputs) == 0
615
            assert len(self.outputs) == 0
616
            out_file_name = self.header_to_remove.abspath()
617
            try:
618
                os.unlink(out_file_name)
619
            except OSError, ex:
620
                if ex.errno != 2:
621
                    raise
622
            return 0
623
624
533
class gen_ns3_module_header_task(Task.Task):
625
class gen_ns3_module_header_task(Task.Task):
534
    before = 'cxx'
626
    before = 'cxx'
535
    after = 'ns3header'
627
    after = 'ns3header'
 Lines 616-622    Link Here 
616
@TaskGen.after_method('process_rule')
708
@TaskGen.after_method('process_rule')
617
def apply_ns3moduleheader(self):
709
def apply_ns3moduleheader(self):
618
    ## get all of the ns3 headers
710
    ## get all of the ns3 headers
619
    ns3_dir_node = self.bld.path.find_dir("ns3")
711
    ns3_dir_node = self.bld.path.find_or_declare("ns3")
620
    all_headers_inputs = []
712
    all_headers_inputs = []
621
    found_the_module = False
713
    found_the_module = False
622
    for ns3headers in self.bld.all_task_gen:
714
    for ns3headers in self.bld.all_task_gen:
(-)a/wscript (-1 / +6 lines)
 Lines 807-812    Link Here 
807
                if ("ns3-%s" % obj.module) not in modules:
807
                if ("ns3-%s" % obj.module) not in modules:
808
                    obj.mode = 'remove' # tell it to remove headers instead of installing 
808
                    obj.mode = 'remove' # tell it to remove headers instead of installing 
809
809
810
            # disable the ns3privateheader_taskgen
811
            if 'ns3privateheader' in getattr(obj, "features", []):
812
                if ("ns3-%s" % obj.module) not in modules:
813
                    obj.mode = 'remove' # tell it to remove headers instead of installing 
814
810
            # disable pcfile taskgens for disabled modules
815
            # disable pcfile taskgens for disabled modules
811
            if 'ns3pcfile' in getattr(obj, "features", []):
816
            if 'ns3pcfile' in getattr(obj, "features", []):
812
                if obj.module not in bld.env.NS3_ENABLED_MODULES:
817
                if obj.module not in bld.env.NS3_ENABLED_MODULES:
 Lines 855-861    Link Here 
855
            program_obj = wutils.find_program(program_name, bld.env)
860
            program_obj = wutils.find_program(program_name, bld.env)
856
            program_obj.use.append('ns3-visualizer')
861
            program_obj.use.append('ns3-visualizer')
857
        for gen in bld.all_task_gen:
862
        for gen in bld.all_task_gen:
858
            if type(gen).__name__ in ['ns3header_taskgen', 'ns3moduleheader_taskgen']:
863
            if type(gen).__name__ in ['ns3header_taskgen', 'ns3privateheader_taskgen', 'ns3moduleheader_taskgen']:
859
                gen.post()
864
                gen.post()
860
        bld.env['PRINT_BUILT_MODULES_AT_END'] = False 
865
        bld.env['PRINT_BUILT_MODULES_AT_END'] = False 
861
866

Return to bug 2002