@@ Author:kano 2009/07/01 @@ --- Makefile.in.sk 2009-07-01 22:50:19.000000000 +0900 +++ Makefile.in 2009-07-01 21:52:09.000000000 +0900 @@ -276,6 +276,7 @@ aodv/aodv_rtable.o aodv/aodv_rqueue.o \ aomdv/aomdv_logs.o aomdv/aomdv.o \ aomdv/aomdv_rtable.o aomdv/aomdv_rqueue.o \ + olsr/OLSR.o olsr/OLSR_state.o olsr/OLSR_rtable.o olsr/OLSR_printer.o \ common/ns-process.o \ satellite/satgeometry.o satellite/sathandoff.o \ satellite/satlink.o satellite/satnode.o \ --- common/packet.h.sk 2009-07-01 21:52:44.000000000 +0900 +++ common/packet.h 2009-07-01 22:24:47.000000000 +0900 @@ -182,8 +182,11 @@ // AOMDV packet static const packet_t PT_AOMDV = 61; + // UM-OLSR packet +static const packet_t PT_OLSR = 62; + // insert new packet types here -static packet_t PT_NTYPE = 62; // This MUST be the LAST one +static packet_t PT_NTYPE = 63; // This MUST be the LAST one enum packetClass { @@ -383,6 +386,9 @@ // AOMDV patch name_[PT_AOMDV]= "AOMDV"; + // UM-OLSR + name_[PT_OLSR]= "UM-OLSR"; + name_[PT_NTYPE]= "undefined"; } static int addPacket(char *name); --- queue/priqueue.cc.sk 2009-07-01 21:56:57.000000000 +0900 +++ queue/priqueue.cc 2009-07-01 21:57:47.000000000 +0900 @@ -92,6 +92,8 @@ case PT_AODV: // AOMDV patch case PT_AOMDV: + // UM-OLSR patch + case PT_OLSR: recvHighPriority(p, h); break; --- tcl/lib/ns-agent.tcl.sk 2009-07-01 21:58:22.000000000 +0900 +++ tcl/lib/ns-agent.tcl 2009-07-01 21:59:30.000000000 +0900 @@ -197,3 +197,7 @@ Agent/AOMDV set dport_ 0 Agent/AOMDV set aomdv_prim_alt_path_len_diff_ 1 Agent/AOMDV set aomdv_max_paths_ 3 + +# UM-OLSR patch +Agent/OLSR set sport_ 0 +Agent/OLSR set dport_ 0 --- tcl/lib/ns-default.tcl.sk 2009-07-01 21:59:55.000000000 +0900 +++ tcl/lib/ns-default.tcl 2009-07-01 22:00:46.000000000 +0900 @@ -1451,6 +1451,14 @@ Delayer set debug_ false +# Defaults defined for UM-OLSR +Agent/OLSR set debug_ false +Agent/OLSR set use_mac_ false +Agent/OLSR set willingness_ 3 +Agent/OLSR set hello_ival_ 2 +Agent/OLSR set tc_ival_ 5 +Agent/OLSR set mid_ival_ 5 + Agent/TCP/Linux set rtxcur_init_ 3 Agent/TCP/Linux set maxrto_ 120 Agent/TCP/Linux set minrto_ 0.2 --- tcl/lib/ns-lib.tcl.sk 2009-07-01 22:01:29.000000000 +0900 +++ tcl/lib/ns-lib.tcl 2009-07-01 22:04:26.000000000 +0900 @@ -633,6 +633,9 @@ AOMDV { set ragent [$self create-aomdv-agent $node] } + OLSR { + set ragent [$self create-olsr-agent $node] + } TORA { Simulator set IMEPFlag_ ON set ragent [$self create-tora-agent $node] @@ -831,6 +834,14 @@ return $ragent } +Simulator instproc create-olsr-agent { node } { + # Create UM-OLSR routing agent + set ragent [new Agent/OLSR [$node node-addr]] + $self at 0.0 "$ragent start" + $node set ragent_ $ragent + return $ragent +} + Simulator instproc create-manual-rtg-agent { node } { # create a simple wireless agent --- tcl/lib/ns-packet.tcl.sk 2009-07-01 22:04:54.000000000 +0900 +++ tcl/lib/ns-packet.tcl 2009-07-01 22:05:56.000000000 +0900 @@ -169,6 +169,8 @@ TORA # routing protocol for ad-hoc networks # AOMDV patch AOMDV + # OLSR patch + OLSR # routing protocol for ad-hoc networks # Other: Encap # common/encap.cc IPinIP # IP encapsulation --- trace/cmu-trace.cc.sk 2009-07-01 22:06:26.000000000 +0900 +++ trace/cmu-trace.cc 2009-07-01 23:03:55.000000000 +0900 @@ -53,6 +53,8 @@ #include //AODV // AOMDV patch #include +// UM-OLSR patch +#include #include #include #include @@ -1062,6 +1064,81 @@ } void +CMUTrace::format_olsr(Packet *p, int offset) +{ + OLSR_pkt* op = PKT_OLSR(p); + + if (pt_->tagged()) { + sprintf(pt_->buffer() + offset, + "-olsr:n %d -olsr:s %d ", + op->count, + op->pkt_seq_num()); + + int len = strlen(pt_->buffer()); + for (int i = 0; i < op->count; i++) { + const char *s; + if (op->msg(i).msg_type() == OLSR_HELLO_MSG) + s = "-olsr:t HELLO -olsr:o %d -olsr:h %d -olsr:ms %d "; + else if (op->msg(i).msg_type() == OLSR_TC_MSG) + s = "-olsr:t TC -olsr:o %d -olsr:h %d -olsr:ms %d "; + else + s = "-olsr:t UNKNOWN -olsr:o %d -olsr:h %d -olsr:ms %d "; + sprintf(pt_->buffer() + len, s, + op->msg(i).orig_addr(), + op->msg(i).hop_count(), + op->msg(i).msg_seq_num()); + len = strlen(pt_->buffer()); + } + } + else if (newtrace_) { + sprintf(pt_->buffer() + offset, + "-P olsr -Pn %d -Ps %d ", + op->count, + op->pkt_seq_num()); + + int len = strlen(pt_->buffer()); + for (int i = 0; i < op->count; i++) { + const char *s; + if (op->msg(i).msg_type() == OLSR_HELLO_MSG) + s = "[-Pt HELLO -Po %d -Ph %d -Pms %d] "; + else if (op->msg(i).msg_type() == OLSR_TC_MSG) + s = "[-Pt TC -Po %d -Ph %d -Pms %d] "; + else + s = "[-Pt UNKNOWN -Po %d -Ph %d -Pms %d] "; + sprintf(pt_->buffer() + len, s, + op->msg(i).orig_addr(), + op->msg(i).hop_count(), + op->msg(i).msg_seq_num()); + len = strlen(pt_->buffer()); + } + } + else { + sprintf(pt_->buffer() + offset, + "[%d %d ", + op->count, + op->pkt_seq_num()); + + int len = strlen(pt_->buffer()); + for (int i = 0; i < op->count; i++) { + const char *s; + if (op->msg(i).msg_type() == OLSR_HELLO_MSG) + s = "[HELLO %d %d %d]"; + else if (op->msg(i).msg_type() == OLSR_TC_MSG) + s = "[TC %d %d %d]"; + else + s = "[UNKNOWN %d %d %d]"; + sprintf(pt_->buffer() + len, s, + op->msg(i).orig_addr(), + op->msg(i).hop_count(), + op->msg(i).msg_seq_num()); + len = strlen(pt_->buffer()); + } + + sprintf(pt_->buffer() + len, "]"); + } +} + +void CMUTrace::nam_format(Packet *p, int offset) { Node* srcnode = 0 ; @@ -1331,6 +1408,9 @@ case PT_AOMDV: format_aomdv(p, offset); break; + case PT_OLSR: + format_olsr(p, offset); + break; case PT_TORA: format_tora(p, offset); break; --- trace/cmu-trace.h.sk 2009-07-01 22:12:52.000000000 +0900 +++ trace/cmu-trace.h 2009-07-01 22:13:35.000000000 +0900 @@ -160,6 +160,7 @@ void format_imep(Packet *p, int offset); void format_aodv(Packet *p, int offset); void format_aomdv(Packet *p, int offset); + void format_olsr(Packet *p, int offset); // This holds all the tracers added at run-time static PacketTracer *pktTrc_;