Debian Codegraph @

protolib/src/sim/ns/ns235/README.TXT

raw
1 (NOTE: The included "ns235-Makefile.in" can be used
2 but expects NRL PROTOLIB, NORM, OLSR, and MGEN ns-2
3 extensions to be used.)
4
5 QUICK INSTALL
6 (using the supplied ns235-Makefile.in)
7
8 1) Download source code of the following NRL programs PROTOLIB,
9 NORM, OLSR, and MGEN.
10
11 a) Using svn:
12 1. make current directory /ns-allinone-2.35/ns-2.35/
13 2. type "svn checkout --username <username> https://pf.itd.nrl.navy.mil/svnroot/protolib/trunk protolib"
14 3. type "svn checkout --username <username> https://pf.itd.nrl.navy.mil/svnroot/norm/trunk norm"
15 3. type "svn checkout --username <username> https://pf.itd.nrl.navy.mil/svnroot/nrlolsr/trunk nrlolsr"
16 3. type "svn checkout --username <username> https://pf.itd.nrl.navy.mil/svnroot/mgen/trunk mgen"
17 b) Using cvs: (depreciated older code)
18 1. make current directory /ns-allinone-2.35/ns-2.35/
19 2. type "cvs -d :pserver:[email protected]:/cvsroot/protolib co protolib"
20 3. type "cvs -d :pserver:[email protected]:/cvsroot/norm co norm"
21 4. type "cvs -d :pserver:[email protected]:/cvsroot/olsr co nrlolsr"
22 5. type "cvs -d :pserver:[email protected]:/cvsroot/mgen co mgen"
23 c) Using tarballs:
24 1. make current directory /ns-allinone-2.35/ns-2.35/
25 2. download norm, nrlolsr, mgen (nightly build tar file use is encouraged)
26 3. type "tar -xvzf <tarfilenamehere>.tgz
27 d) Using symbolic links (Note: only works if you have already downloaded the nrl code)
28 1. make current directory /ns-allinone-2.35/ns-2.35/
29 2. type "ln -s <target-protolib-source-dir> protolib
30 3. type "ln -s <target-norm-source-dir> norm
31 4. type "ln -s <target-nrolsr-source-dir> nrlolsr
32 5. type "ln -s <target-mgen-source-dir> mgen
33 (Note: using this method will create ns specific .o files in the source trees which can
34 cause issues if building these programs for other envirnments)
35
36 2) Copy the files within this directory to the appropriate places in the ns 2.35 code tree
37 a) make current directory /ns-allinone-2.35/ns-2.35/
38 (Note: you may want to make backups of the files being written over before performing the following commands)
39 b) type "cp protolib/src/sim/ns/ns234/cmu-trace.h trace/"
40 c) type "cp protolib/src/sim/ns/ns234/cmu-trace.cc trace/"
41 d) type "cp protolib/src/sim/ns/ns234/packet.h common/"
42 e) type "cp protolib/src/sim/ns/ns234/packet.cc common/"
43 f) type "cp protolib/src/sim/ns/ns234/priqueue.cc queue/"
44 g) type "cp protolib/src/sim/ns/ns234/ns-lib.tcl tcl/lib/"
45
46 3) Using the supplied makefile build your protolib enabled ns2.35 build
47 a) Make current directory /ns-allinone-2.35/ns-2.35/
48 (Note: you may want to make backups of the files being written over before performing the following commands)
49 b) type "cp protolib/src/sim/ns/ns234/ns234-Makefile.in Makefile.in"
50 c) type "./configure"
51 d) type "make clean"
52 e) type "make ns"
53
54 =========================
55 LONG INSTALL INSTRUCTIONS
56 (provided mainly as hints for those building on top of a
57 modified ns code tree in which the quick install did not work)
58
59 To use PROTOLIB with ns, you will need to at least modify
60 the ns "Makefile.in" to build the PROTOLIB code into ns.
61 To do this, use the following steps:
62
63
64 1) Make a link to the PROTOLIB source directory in the ns
65 source directory. (I use "protolib" for the link name
66 in the steps below).
67
68 2) Provide paths to the PROTOLIB include files by setting
69
70 PROTOLIB_INCLUDES = -Iprotolib/common -Iprotolib/ns
71
72 and adding $(PROTOLIB_INCLUDES) to the "INCLUDES" macro
73 already defined in the ns "Makefile.in"
74
75 3) Define compile-time CFLAGS needed for the PROTOLIB code
76 by setting
77
78 PROTOLIB_FLAGS = -DUNIX -DNS2 -DPROTO_DEBUG -DHAVE_ASSERT
79
80 and adding $(PROTOLIB_FLAGS) to the "CFLAGS" macro
81 already defined in the ns "Makefile.in"
82
83 4) Add the list of PROTOLIB object files to get compiled
84 and linked during the ns build. For UDP and TCP support, set
85
86 OBJ_PROTOLIB_CPP = \
87 protolib/ns/nsProtoSimAgent.o protolib/ns/nsRouteMgr.o \
88 protolib/ns/nsProtoSimAgent.o protolib/common/protoSimAgent.o \
89 protolib/common/protoSimSocket.o protolib/common/protoAddress.o \
90 protolib/common/protoTimer.o protolib/common/protoExample.o \
91 protolib/common/protoDebug.o protolib/common/protoTree.o \
92 protolib/ns/nsRouteMgr.o protolib/common/protoRouteTable.o \
93 protolib/common/protoBitmask.o protolib/ns/nsProtolibMK.o \
94 protolib/common/protoTime.o
95
96 and then add $(OBJ_PROTOLIB_CPP) to the list in the
97 "OBJ" macro already defined in the ns "Makefile.in"
98
99 Note: "nsProtoAgent.cpp" contains a starter ns agent
100 which uses the PROTOLIB ProtocolTimer and UdpSocket
101 classes.
102
103 5) Add the the rule for .cpp files to ns-2 "Makefile.in":
104
105 .cpp.o: @rm -f $@ $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $*.cpp
106
107 and add to the ns-2 Makefile.in "SRC" macro definition:
108
109 $(OBJ_CPP:.o=.cpp)
110
111 6) Change your ns-2.35/common/packet.h file to include info on ProtolibMK:
112
113 a) add:
114
115 "#define HDR_PROTOLIBMK(p) (hdr_protolibmk::access(p))"
116 near the top of the file with the other similar #defines.
117
118 b) Before the end of the statics for packet_t, change the
119 current PT_NTYPE line to
120
121 "static const packet_t PT_PROTOLIBMK=73;"
122
123 and change the last entry to
124
125 "PT_NTYPE = 74; // This MUST be the LAST one"
126
127 c) add "name_[PT_PROTOLIBMK]= "ProtolibMK";" in the p_info() section
128
129 7) Change your ns-2.35/trace/cmu-trace.h file adding ProtolibMK hooks
130 add "void format_protolibmk(Packet *p, int offset);" at the bottom with
131 the other "format_xxx" functions.
132
133 8) Change your ns-2.35/trace/cmu-trace.cc file adding ProtolibManetKernel hooks:
134
135 a) add "#include <nsProtoManetKernel.h>" at the end of the #includes
136
137 b) add empty function:
138 "void CMUTrace::format_protolibmk(Packet *p, int offset) {return;}"
139
140 c) add to the switch(ch->ptype()) (default one) statement:
141
142 "case PT_PROTOLIBMK:
143 format_protolibmk(p, offset);
144 break;"
145
146 9) Change your ns-2.35/tcl/lib/ns-lib.tcl file:
147
148 a) add to the "switch -exact $routingAgent" statement:
149
150 "ProtolibMK {
151 set ragent [$self create-protolibmk-agent $node]
152 }"
153
154 b) add along with other Simulator create functions:
155
156 "Simulator instproc create-protolibmk-agent {node} {
157 # create a dummie wireless agent
158 # it will foward packets up to protolib manet
159 # and just act as a wedge into ns
160 # used by protolib wireless manets
161 set ragent [new Agent/ProtolibMK [$node node-addr]]
162 $node set ragent_ $ragent
163 return $ragent
164 }"
165
166 10) Last edit! Change ns-2.35/queue/priqueue.cc file, add
167
168 "case PT_PROTOLIBMK:"
169
170 to the switch statment in the if(Prefer_Routing_Protocols) conditional (at top)
171
172
173 6) Run "./configure" in the ns source directory to create
174 a new Makefile and then type "make ns" to rebuild ns.
175
176
177 Brian Adamson <mailto://[email protected]>
178 Justin Dean <mailto://[email protected]>
179 1/14/2014