| 1 |
(NOTE: These instructions need to be revised for the |
| 2 |
Protolib version 2.x code. The included |
| 3 |
"ns229-Makefile.in" can be used but expects NRL |
| 4 |
MDP, NORM, and MGEN ns-2 extensions to also be |
| 5 |
used. The "patch-ns.sh" script is what I use |
| 6 |
to create some symbolic links and put the Makefile.in |
| 7 |
in place) |
| 8 |
|
| 9 |
|
| 10 |
To use PROTOLIB with ns, you will need to at least modify |
| 11 |
the ns "Makefile.in" to build the PROTOLIB code into ns. |
| 12 |
To do this, use the following steps: |
| 13 |
|
| 14 |
|
| 15 |
1) Make a link to the PROTOLIB source directory in the ns |
| 16 |
source directory. (I use "protolib" for the link name |
| 17 |
in the steps below). |
| 18 |
|
| 19 |
2) Provide paths to the PROTOLIB include files by setting |
| 20 |
|
| 21 |
PROTOLIB_INCLUDES = -Iprotolib/common -Iprotolib/ns |
| 22 |
|
| 23 |
and adding $(PROTOLIB_INCLUDES) to the "INCLUDES" macro |
| 24 |
already defined in the ns "Makefile.in" |
| 25 |
|
| 26 |
3) Define compile-time CFLAGS needed for the PROTOLIB code |
| 27 |
by setting |
| 28 |
|
| 29 |
PROTOLIB_FLAGS = -DUNIX -DNS2 -DPROTO_DEBUG -DHAVE_ASSERT |
| 30 |
|
| 31 |
and adding $(PROTOLIB_FLAGS) to the "CFLAGS" macro |
| 32 |
already defined in the ns "Makefile.in" |
| 33 |
|
| 34 |
4) Add the list of PROTOLIB object files to get compiled |
| 35 |
and linked during the ns build. For UDP and TCP support, set |
| 36 |
|
| 37 |
OBJ_PROTOLIB_CPP = \ |
| 38 |
$(PROTOLIB)/common/protoTimer.o \ |
| 39 |
$(PROTOLIB)/ns/nsProtoSimAgent.o \ |
| 40 |
$(PROTOLIB)/common/protoSimAgent.o \ |
| 41 |
$(PROTOLIB)/common/protoDebug.o \ |
| 42 |
$(PROTOLIB)/common/protoAddress.o \ |
| 43 |
$(PROTOLIB)/common/protoSimSocket.o \ |
| 44 |
$(PROTOLIB)/ns/nsRouteMgr.o \ |
| 45 |
$(PROTOLIB)/common/protoRouteMgr.o \ |
| 46 |
$(PROTOLIB)/common/protoRouteTable.o \ |
| 47 |
$(PROTOLIB)/common/protoTree.o \ |
| 48 |
$(PROTOLIB)/common/protoExample.o \ |
| 49 |
$(PROTOLIB)/common/protoBitmask.o\ |
| 50 |
$(PROTOLIB)/ns/tcp/TCPData.o \ |
| 51 |
$(PROTOLIB)/ns/tcp/TCPDataFIFO.o \ |
| 52 |
$(PROTOLIB)/ns/tcp/TCPSocketApp.o \ |
| 53 |
$(PROTOLIB)/ns/tcp/TCPEvent.o \ |
| 54 |
$(PROTOLIB)/ns/tcp/TCPSocketAgent.o \ |
| 55 |
$(PROTOLIB)/ns/tcp/TCPServerSocketAgent.o \ |
| 56 |
$(PROTOLIB)/ns/tcp/TCPSocketFactory.o \ |
| 57 |
$(PROTOLIB)/ns/tcp/TCPSocketExample.o \ |
| 58 |
$(PROTOLIB)/ns/nsTCPProtoSocketAgent.o |
| 59 |
|
| 60 |
and then add $(OBJ_PROTOLIB_CPP) to the list in the |
| 61 |
"OBJ" macro already defined in the ns "Makefile.in" |
| 62 |
|
| 63 |
Note: "nsProtoAgent.cpp" contains a starter ns agent |
| 64 |
which uses the PROTOLIB ProtocolTimer and UdpSocket |
| 65 |
classes. |
| 66 |
|
| 67 |
5) Add the the rule for .cpp files to ns-2 "Makefile.in": |
| 68 |
|
| 69 |
.cpp.o: @rm -f $@ $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $*.cpp |
| 70 |
|
| 71 |
and add to the ns-2 Makefile.in "SRC" macro definition: |
| 72 |
|
| 73 |
$(OBJ_CPP:.o=.cpp) |
| 74 |
|
| 75 |
|
| 76 |
6) Run "./configure" in the ns source directory to create |
| 77 |
a new Makefile and then type "make ns" to rebuild ns. |
| 78 |
|
| 79 |
|
| 80 |
Brian Adamson <mailto://[email protected]> |
| 81 |
31 October 2005 |