2008年2月24日 星期日

為NIST新增traffic type

昨天晚上嘗試將長庚根據Std. IEEE 802.16e所開發的五種traffic type,加入NIST所release支援mobility的ns-2.29中,其加入步驟如下:
Step 1.
將長庚所開發的traffic type檔案複製到ns-2.29/tools內.

Step 2.
修改ns-allinone-2.29/ns-2.29/common/packet.h
在enum packet_t {} 裡加
PT_UGS,
PT_rtPS,
PT_ertPS,
PT_nrtPS,
PT_BE,
在p_info() {} 裡加
name_[PT_UGS]="UGS";
name_[PT_rtPS]="rtPS";
name_[PT_ertPS]="ertPS";
name_[PT_nrtPS]="nrtPS";
name_[PT_BE]="BE";

Step 3.
修改ns-allinone-2.29/ns-2.29/Makefile.in, 由於我是將各個traffic type放在ns-2.29/tools下,所以在Makefile.in的OBJ_CC加入:
tools/UGS_traffic.o \
tools/rtPS_traffic.o \
tools/ertPS_traffic.o \
tools/nrtPS_traffic.o \
tools/BE_traffic.o \

Step 4.
在ns-2.29下重新再下一次指令"make clean; ./configure; make"即可.

End~

2008年2月23日 星期六

重新安裝gcc

在上篇文章中提到對於NIST 其所release能支援mobility的ns-2.29,在編譯時所會遭遇的問題以及解決方法,但是整體來說大部分的問題是因為gcc版本的關係,所以這篇文章將描述如何安裝自己想要的gcc版本.
#gcc -v (可得到目前所用的gcc版本)
然後可以去ftp://ftp.ntu.edu.tw/pub/gnu/gnu/ (GCC在台灣的mirror)下載所想要的gcc版本.
下載完後,分別載console執行下列指令:
# tar -zxvf gcc-x.x.x.tar.gz
# mkdir gcc-build
# cd gcc-build
# ../gcc-x.x.x/configure --prefix=/usr/local/gcc-x.x.x --enable-threads=posix --host=i386-redhat-linux --with-system-zlib --enable-languages=c,c++,java
# make
# make install
# which gcc (查看原來的gcc所在的路徑)
# cd /usr/bin
# ln -s /usr/local/gcc-x.x.x/bin/gcc gccxx (gccxx是自己取的名子)
# ln -s /usr/local/gcc-x.x.x/bin/g++ g++xx
# ln -s /usr/local/gcc-x.x.x/bin/gcj gcjxx
(利用連結的方式,就可以分別使用gccxx, g++xx, gcjxx對C, C++, JAVA程式進行編譯,除此之外由於是利用連結的方式去取得gcc-x.x.x的gcc, g++, gcj, 所以還是可以使用本來舊版的gcc, g++等命令)
最後在.bashrc中的LD_LIBRARY_PATH加入/usr/local/gcc-x.x.x/lib

End~

2008年2月22日 星期五

編譯NS2-NIST_mobility時遇到的問題與解決方法

今天在安裝NIST所release支援mobility的ns-2.29版本http://www.antd.nist.gov/seamlessandsecure/download.html,在編譯時遇到以下幾個問題:

問題1:
./sctp/sctp.h:705: error: extra qualification 'SctpAgent::' on member 'DumpSendBuffer'
make: *** [trace/trace.o] Error 1
解決方法:
將sctp.h裡面第705行DumpSendBuffer function前面的'SctpAgent::'去掉.

問題2:
./mobile/god.h:88: error:extra qualification ‘vector::’ on member ‘operator=’
./mobile/god.h:93: error:extra qualification ‘vector::’ on member ‘operator+=’
./mobile/god.h:98: error:extra qualification ‘vector::’ on member ‘operator==’
./mobile/god.h:101: error:extra qualification ‘vector::’ on member ‘operator!=’
解決方法:
分別將mobile/god.h內相對應的‘vector::’刪去.

問題3:
./mac/mac-802_11.h:620: error: extra qualification 'Mac802_11::' on member 'calFreq'
make: *** [mac/mac-802_11.o] Error 1
解決方法:
將mac/mac-802_11.h內相對應的'Mac802_11::'刪去.

會有以上三種類似的問題是因為gcc版本的關係!!

問題4:
dsr/dsragent.cc: In member function ‘void DSRAgent::handleFlowForwarding(SRPacket&, int)’:
dsr/dsragent.cc:828: error: ‘XmitFlowFailureCallback’ was not declared in this scope
dsr/dsragent.cc: In member function ‘void DSRAgent::sendOutPacketWithRoute(SRPacket&, bool, Time)’:
dsr/dsragent.cc:1385: error: ‘XmitFailureCallback’ was not declared in this scope
dsr/dsragent.cc:1386: error: ‘XmitFlowFailureCallback’ was not declared in this scope
dsr/dsragent.cc:1403: error: ‘XmitFailureCallback’ was not declared in this scope
make: *** [dsr/dsragent.o] Error 1
解決方法:
voidXmitFailureCallback(Packet *pkt, void *data){ DSRAgent *agent = (DSRAgent *)data; // cast of trust agent->xmitFailed(pkt);}
voidXmitFlowFailureCallback(Packet *pkt, void *data){ DSRAgent *agent = (DSRAgent *)data; agent->xmitFlowFailed(pkt);}
這兩個function移到218行左右,或是在218行加上
void XmitFlowFailureCallback(Packet *pkt, void *data);
void XmitFailureCallback(Packet *pkt, void *data);

問題5:
diffusion/diffusion.cc: In member function 'void DiffusionAgent::MACprepare(Packet*, nsaddr_t, int, bool)':
diffusion/diffusion.cc:429: error: 'XmitFailedCallback' was not declared in this scope
make: *** [diffusion/diffusion.o] Error 1
解決方法:
參考問題4.

問題6:
diffusion/omni_mcast.cc: In member function 'void OmniMcastAgent::MACprepare(Packet*, nsaddr_t, unsigned int, bool)':
diffusion/omni_mcast.cc:388: error: 'OmniMcastXmitFailedCallback'was not de clared in this scope
make: *** [diffusion/omni_mcast.o] Error 1
解決方法:
參考問題4.

問題7:
tcp/tcp-sack-rh.cc:68: error: extra qualification 'SackRHTcpAgent::' on member 'newack'
make: *** [tcp/tcp-sack-rh.o] Error 1
解決方法:
將tcp/tcp-sack-rh.cc內相對應位置的SackRHTcpAgent::刪去.

問題8:
pgm/pgm-agent.cc:307: error: extra qualification 'PgmAgent::'on member 'trace_event'
make: *** [pgm/pgm-agent.o] Error 1
解決方法:
將pgm/pgm-agent.cc內相對應位置的PgmAgent::刪去.

問題9:
pgm/pgm-sender.cc:189: error: extra qualification 'PgmSender::' on member 'trace_event'
make: *** [pgm/pgm-sender.o] Error 1
解決方法:
將pgm/pgm-sender.cc內相對應位置的PgmSender::刪去.

問題10:
pgm/pgm-receiver.cc:186: error: extra qualification 'PgmReceiver::' on member 'trace_event'
make: *** [pgm/pgm-receiver.o] Error 1
解決方法:
將pgm/pgm-receiver.cc內相對應位置的PgmReceiver::刪去.

問題11:
bluetooth/lmp-link.h:296: error: extra qualification 'LMPLink::' on member 'LMPLink'
bluetooth/bt-node.h:100: error: extra qualification 'BTNode::' on member 'setup'
make: *** [bluetooth/baseband.o] Error 1
解決方法:
將bluetooth/lmp-link.h與bluetooth/bt-node.h內相對應位置的LMPLink::和BTNode::刪去.

開張大吉~^^

大家好~這個網誌是我放有關於軟體方面的東東~包括linux, C++, C#, JAVA等等,一些平常會用到的指令或是程式編輯概念,我都會放到我自己的網誌上~~一方面讓我自己有時忘記某個指令或是程式設計的概念時~可以較快速的找到我想要的東西,另一方面可以跟大家分享分享心得^^,請大家多多指教嚕!!