close

 

Other configuration file ===========================
編輯 NCTUns-x.0/src/nctuns/.config file 將用不到的network設成n, 這樣compile就可以變快
編輯/usr/locel/nctuns/etc/ps.cfg檔, 可改變GUI上node預設的protocol stack.

Run simulation ==================================
在run之前必須把iptables關掉 避免跑不出流量.
Method 1 (close iptables temporarily):
service iptables stop (暫時關閉iptables, 重新開機後或執行過iptables就又會啟動)
Method 2 (close iptables permanently):
chkconfig --list iptables (show出 level3 and 5 有沒有關)
chkconfig --level 35 off (關閉 level 3 and 5)

ADV route =====================================
- pkt_handled的值每broadcast一次會減半, 每forward一次會加一
- RtTable, ctrlTable滿了的話size會加倍, 初始大小10
- BUF_THRESHOLD預設值是2
routingResult
NOROUTE: No such entry in rt_table of the Dst_IP
INFINITEENTRY: Dst_IP不等於seqSignHost
REACHABLE: Dst_IP等於seqSignHost

Application =================================
stcp [-p port] [-l writesize] dstIP
stcp [-lip srcIP] dstIP
rtcp [-p port] [-l readsize] [-w throughput.log]

rtg -t/-u [-p port] [-w throughput.log] [-o delay.log]

Kernel =====================================
把src/kernel-patch/linux.xxxx.tar.bz2解壓縮 (用tar xjf xxx.tar.bz2)

1. 如果沒改nctuns kernel name:
make bzImage && make install

2. 如果用不一樣的nctuns kernel name:
(例如用"make menuconfig"到"General setup --> (-nctuns-2008xxxx) Local version - append to kernel release"改名字)
就得 make bzImage && make modules && make modules_install && make install

make modules會先把module編好, make modules_install會在/lib/modules/ 底下產生新的module資料夾

參考 http://zoe.nuper.com/linux/linux_ch8.php

Module =====================================
Constructor (會比init先執行)
- vBind("Name1", &para1): 將tcl內, Name所代表的值存入變數para裡面, 在init()裡面值就會改變
- REG_VAR("Name2", &para2): 將此module的變數para2註冊到SE, 可供其他module取出使用.
取出方法: (type *)get_regvar(module_node_id, module_node_port, "Name2");
e.g., int* getpara = (int *)get_regvar(get_nid(), get_port(), "beamwidth");

init()
- 可在此做module所需變數的初始化

- packet add info (可將額外資訊加入到packet裡面, 帶到其他module去)
e.g., struct wphyInfo *wphyinfo = (struct wphyInfo *)malloc(sizeof(struct wphyInfo));
p->pkt_addinfo("WPHY", (char *)wphyinfo, sizeof(struct wphyInfo));

- packet get info
e.g., struct wphyInfo *wphyinfo;
wphyinfo = (struct wphyInfo *)p->pkt_getinfo("WPHY");

- pkt_setHandler在routing module中會用到, 主要是讓MAC層當封包送不出去時, 可以cross layer的呼叫routing module的function, 讓routing module可做相對應的事, ex. adv_hdler

sendtarget_, recvtarget_本身就是MBinder用來做module之間的連結.
sendtarget_->get_curqlen() > 0 表示在mbinder queue裡面目前有東西還沒往下送, 所以module自己要先queue住此pkt或直接drop掉
sendtarget_->set_upcall(upcall) 是用來當mbinder的pkt往下送後, 會呼叫upcall所指定的function. 一般是用來從上層的module queue裡面抓一個pkt下來放在mbinder裡.避免上層出現pkt out of order的情形. (因為若沒立刻塞一個pkt到MBqueue裡面, 則有pkt進上層時因為get_curqlen()<=0, 就直接往MB送, 不會被module queue住, 可參考ADVD.cc的sendToQueue())

Remove Kernel ================================
0. remove the nctuns directory under /usr/local directory

1. rpm -q kernel-nctuns
You can get the kernel name [Name]

2. rpm -e [Kernel Name]

Set Manually Control ====================================================
1. set manually control, then make again and copy to the directory you want to execution
vim NCTUns-x.0/src/nctuns/nctuns_api.h
#define IPC 0

2-1. set the .sim working directory (valid on current terminal)
EX 1: type command:
export NCTUNS_WORKDIR=/root/Desktop/GUI_test/150Cars_400Roads/150Cars_400Roads.sim

EX 2: use shell script
vim /usr/local/nctuns/etc/nctuns.bash
(then add the following line into nctuns.bashrc)
export NCTUNS_WORKDIR=/root/Desktop/GUI_test/150Cars_400Roads/150Cars_400Roads.sim
(then execute the following command)

source /usr/local/nctuns/etc/nctuns.bash

2-2. set global environment (valid on all terminals)
e.g,
vim /root/.bashrc
(then add the following line into .bashrc)
export NCTUNS_WORKDIR=/root/Desktop/GUI_test/150Cars_400Roads/150Cars_400Roads.sim
(then reboot or logout)


4. If you add (modify) new class under src/nctuns/module/phy, you need to copy the libawp.so to /usr/local/nctuns/lib/

5. execution:
在NCTUns-x.o/src/nctuns目錄下執行./nctuns /xxx/xxx.sim/xxx.tcl

 

arrow
arrow
    全站熱搜

    vincentHsu 發表在 痞客邦 留言(1) 人氣()