2010年1月21日星期四
慎用 "./configure"
如果你添加过新的协议,在makefile中做了修改,当你运行./configure后,重新make ns就会报错:
“This should work unless it involves constant data structures referencing symbols
from auto-imported DLLs.trace/cmu-trace.o:cmu-trace.cc:(.text$_ZN12hdr_smcr_pkt
6accessEPK6Packet[hdr_smcr_pkt::access(Packet const*)]+0x7): undefined reference
to `hdr_smcr_pkt::offset_'
trace/cmu-trace.o:cmu-trace.cc:(.text$_ZN9hdr_wcett6accessEPK6Packet[hdr_wcett::
access(Packet const*)]+0x7): undefined reference to `hdr_wcett::offset_'
Info: resolving __timezone by linking to __imp___timezone (auto-import)
collect2: ld returned 1 exit status
make: *** [ns] Error 1”
因为smcr和wcett是后来添加的路由协议,都在makefile中添加了相关语句;当运行./configure后相关语句被删除,新协议未被编译,从而找不到 “xx::offset”
因此,如果需要使用./configure,记得运行后新修改makefile;通常,重新编译时,不运行./configure应该也可以正确重新编译ns
2010年1月13日星期三
Range of nodes that affected on WirelessChannel
radius=distCST+/*safety*/5=555.0
xmin = mn->X() - radius;
xmax = mn->X() + radius;
ymin = mn->Y() - radius;
ymax = mn->Y() + radius;
2009年12月18日星期五
make again after modifying ns-lib.tcl
2009年3月24日星期二
OTcl类-结构、定义、继承
Class--创建一个类(object class)
instproc--定义类的成员函数
instvar--定义类的成员变量,首先检查变量在此类和父类中已声明(declare),是则引用(reference),否则声明
-superclass--类继承,父类
$self——相当于C++中的this指针
new--创建一个类对象(object instance)
示例:
# add a member function call "great"
Class mom
mom instproc greet {} {
$self instvar age_
puts "$age_ year old mom say:
How are you doing?"
}
# Create a child class of "mom" called "kid"
#and overide the member function "greet"
Class kid -superclass mom
kid instproc greet {} {
$self instvar age_
puts "$age_ year old kid say:
What's up, dude?"
}
#Create a mom and a kid object, set each age
set a [new mom]
$a set age_ 45
set b [new kid]
$b set age_ 15
#Calling member function "greet" of each object
$a greet
$b greet
#end
(参考ns by example ex-otcl.tcl)
GOD--General Operations Director
(from ns Tutorial)
The General Operations Director (GOD) object is used to store global information about the state of the environment, network, or nodes that an omniscent observer would have, but that should not be made known to any participant in the simulation.
Currently, the god object is used only to store an array of the shortest number of hops required to reach from one node to an other. The god object does not calculate this on the fly during simulation runs, since it can be quite time consuming. The information is loaded into the god object from the movement pattern file where lines of the form
$ns_ at 899.642 "$god_ set-dist 23 46 2" |
2009年3月18日星期三
NS-2 Trace Formats
NS-2 Trace Formats
This document lists various trace formats used by the NS-2 Network Simulator. The information is based on NS2 version 2.1b9a. The best effort has been made to document correctly all of the trace formats, but be warned that this list is not complete, and may contain errors. If you find any errors or omissions, please edit this page to fix the problems.
The various traces begin with a single character or abbreviation that indicates the type of trace, followed by a fixed or variable trace format. The tables listing the trace formats differ between fixed and variable trace formats:
- For fixed trace formats, the table lists the event the triggers the trace under the Event heading and the characters that start the trace under the Abbreviation heading. The format is listed across the last two columns, and the the type and value for each element of the format are listed beneath under the Type and Value headings. Some events have multiple trace formats.
- For variable trace formats, the table lists the event the triggers the trace under the Event heading and the characters that start the trace under the Abbreviation heading. The last three columns list the possible flags, types, and values for the event under the Flag, Type, and Value headings.
Normal trace formats
This information comes from "The ns Manual" "Trace and Monitoring Support: Trace File Format" chapter. This trace is used normal wired operations. The trace starts with one of four possible characters.
The tables that list the additional wireless trace information do not have an Abbreviation column, since the information is appended to the end of the regular wireless trace format.
| Event | Abbreviation | Type | Value |
|---|---|---|---|
| Normal Event | r: Receive d: Drop e: Error +: Enqueue -: Dequeue | %g %d %d %s %d %s %d %d.%d %d.%d %d %d | |
| double | Time | ||
| int | Source Node | ||
| int | Destination Node | ||
| string | Packet Name | ||
| int | Packet Size | ||
| string | Flags | ||
| int | Flow ID | ||
| int | Source Address | ||
| int | Source Port | ||
| int | Destination Address | ||
| int | Destination Port | ||
| int | Sequence Number | ||
| int | Unique Packet ID | ||
The flags are read as follow (the "value" is displayed instead of `-` if flag is set). Each row is one of the "slots", from left to right. From from ns/trace/trace.cc.
| Value | Meaning |
|---|---|
| C | ECN-echo |
| P | pri_ (supposedly unused) |
| - | |
| A | Congestion Action |
| E | Congestion Experienced (CE) |
| F | Fast Start |
| N | ECN-capable |
| SCTP-only |
Depending on the packet type, the trace may log additional information:
| Event | Type | Value |
|---|---|---|
| TCP Trace | %d 0x%x %d %d | |
| int | Ack Number | |
| hexadecimal | Flags | |
| int | Header Length | |
| int | Socket Address Length | |
| Satellite Trace | %.2f %.2f %.2f %.2f | |
| double | Source Latitude | |
| double | Source Longitude | |
| double | Destination Latitude | |
| double | Destination Longitude | |
Wireless Trace Formats
This section covers the various wireless trace format:
- Old Wireless Trace Formats
- New Wireless Trace Formats
- AODV Trace Formats
- DSDV Trace Formats
- DSR Trace Formats
- TORA Trace Formats
- Mobile node movement and energy trace formats
Old Wireless Trace Formats
This information comes from "The ns Manual" "Mobile Networking in ns: Trace Support" chapter, and the "trace/cmu-trace.cc" file. Wireless traces begin with one of four characters followed by one of two different trace formats, depending on whether the trace logs the X and Y coordinates of the mobile node.
| Event | Abbreviation | Type | Value |
|---|---|---|---|
| Wireless Event | s: Send r: Receive d: Drop f: Forward | %.9f %d (%6.2f %6.2f) %3s %4s %d %s %d [%x %x %x %x] | |
| %.9f _%d_ %3s %4s %d %s %d [%x %x %x %x] | |||
| double | Time | ||
| int | Node ID | ||
| double | X Coordinate (If Logging Position) | ||
| double | Y Coordinate (If Logging Position) | ||
| string | Trace Name | ||
| string | Reason | ||
| int | Event Identifier | ||
| string | Packet Type | ||
| int | Packet Size | ||
| hexadecimal | Time To Send Data | ||
| hexadecimal | Destination MAC Address | ||
| hexadecimal | Source MAC Address | ||
| hexadecimal | Type (ARP, IP) | ||
Some older versions of NS2 (such as 2.1b5) have five hexidecimal values between the square braces. The first hexidecimal value is the MAC frame control information, and the remaining hexidecimal values are the same as listed above.
Depending on the packet type, the trace may log additional information:
| Event | Type | Value |
|---|---|---|
| ARP Trace | ------- [%s %d/%d %d/%d] | |
| string | Request or Reply | |
| int | Source MAC Address | |
| int | Source Address | |
| int | Destination MAC Address | |
| int | Destination Address | |
| IP Trace | ------- [%d:%d %d:%d %d %d] | |
| int | Source IP Address | |
| int | Source Port | |
| int | Destination IP Address | |
| int | Destination Port Address | |
| int | TTL | |
| int | Next hop node (or 0 if not valid) | |
| DSR Trace | %d [%d %d] [%d %d %d %d->%d] [%d %d %d %d- | |
无线网络仿真Trace 旧格式
r 160.093884945_6_RTR---5 tcp 1492[a2 4 6 800]-------[65536:0 16777984:0 31 16777984][1 0]2 0ldN xs,x-LM0
7PQaF3NE0Here we see a TCP data packet being received by a node with id of 6.UID of this pkt is 5 with a cmn hdr size of 1492.The mac details shows an IP pkt(ETHERTYPE_IP is defined as 0x0800,ETHERTYPE_ARP is 0x0806),mac-id of this receiving node is 4.That of the sending node is 6 and expected time to send this data pkt over the wireless channel is a2(hex2dec conversion:160+2 sec).Additionally,IP traces information about IP src and destination addresses.The src translates(using a 3 level hier-address of 8/8/8)to a address string of 0.1.0 with port of 0.The dest address is 1.0.3 with port address of 0.The TTL value is 31 and the destination was a hop away from the src.Additionally TCP format prints information about tcp seqno of 1,ackno of 0.See other formats described in~ns//cmu-trace.cc for DSR,UDP/MESSAGE,TCP/ACK and CBR packet types.西子博客%PV:JlG+m}_R
西子博客%a,TLgu*tOther trace formats are also used by the routing agents(TORA and DSR)to log certain special routing events like"originating"(adding a SR header to a packet)or"ran off the end of a source route"indicating some sort of routing problem with the source西子博客.~&G$z1~Cw"lroute etc.These special event traces begin with"S"for DSR and"T"for Tora and may be found in~ns/tora/tora.cc for TORA and~ns/dsr/dsrgent.cc for DSR routing agent.
(from: http://blog.hz0752.com/?uid-15519-action-viewspace-itemid-163973)
2008年11月17日星期一
NS学习笔记(1)
- NS分裂对象模型:NS的构件由相互关联的两个类实现
2)Otcl类:提供C++对象面向用户的借口
- NS模拟分两个从层次:
2)基于C++和Otcl编程层次——扩展、添加所需网络元素
- NS初学建议
2)牢记节点结构(一个节点由分类器、复用器、代理、链路等组成)
3)学会查手册但不依赖于手册
4)用户应该对主要的网络构件的功能都有所了解
5)常看源代码
6)ns Tutorial 和 ns by examples 比较适合初学者(笔者自加)