Skip to main content

34 posts tagged with "OMNET++"

View All Tags

· One min read

void TCPGenericCliAppBase::setStatusString(const char *s) { if (ev.isGUI()) displayString().setTagArg("t", 0, s); }

void TCPGenericCliAppBase::socketEstablished(int, void ) { // redefine* to perform or schedule first sending ev << "connected\n"; setStatusString("connected"); }

· One min read

I found this paper through IEEE Xplore, and intrest in the topic "Eval freeBSD protocol stack in OMNeT++".

Integration of the FreeBSD TCP/IP-Stack into the Discrete Event Simulator OMNet++ Bless, R.; Doll, M.; Simulation Conference, 2004. Proceedings of the 2004 Winter Volume 2, December 5-8, 2004 Page(s):487 - 492

--

  • In asimulation environment one wants to run several hosts in parallel, So every required global and static FreeBSD variable must be made local to each host. -> a structure to store all the kernel variables for one host. -> Consequently,in the FreeBSD source every occurrence of the variables must be replaced by a reference into the corresponding structure.

ex: xyz is replaced to D->xyz

where D points to the current host structure that contains all the global and static kernel variables for this particular host.

  • Encapsulate the complete TCP/IP into one OMNeT++ simple module.

Others are out of my knowledge...... In consequence, I think porting protocol stacks from different architecture is still not an easy way....

· One min read

Define_Module (PingApp); 模組名稱是 PingApp

PingApp::initialize()

  1. 讀入 omnetpp.ini 中設定的參數.
  2. 在 TKenv 中監視
  • sendSeqNo
  • expectedReplySeqNo
  • dropCount
  • outOfOrderArrivalCount 這幾個結果 PingApp::handleMessage (cMessage *msg)

if (msg->isSelfMessage ()) 若訊息來自本身節點

destAddr = IPAddressResolver ().resolve (par ("destAddr")); 解析目的位址設定

來自其他節點則啟動回覆機制

processPingResponse(check_and_cast<pingpayload>(msg));

void PingApp::sendPing()

PingPayload msg = new PingPayload (name); 新增封包,接著下面照著宣告的格式填入對應的值 msg->setLength (8packetSize); //? 封包裡沒宣告

sendToICMP (msg, destAddr, srcAddr, hopLimit); 把訊息送到 ICMP 裡

PingApp::scheduleNextPing(cMessage *timer)

simtime_t nextPing = simTime () + intervalp->doubleValue (); 模擬時間加上間隔時間

void PingApp::sendToICMP(cMessage *msg, const IPvXAddress& destAddr, const IPvXAddress& srcAddr, int hopLimit) 判斷送出 v4/v6 icmp 格式封包

void PingApp::processPingResponse (PingPayload *msg) 收到 ICMP 封包,判斷</pingpayload> v4/v6 並<pingpayload>處理 </pingpayload>

· One min read

針對我所要用的編譯器 還有 執行檔 定義一些所需要的 set path

在命令提示字元底下一定要找得到以下幾個可執行的程式: nmake cl vcvars32.bat

我的電腦按右鍵 -> 內容 -> 進階 -> 環境變數 -> 系統變數 -> 編輯 path, 加入 C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin;

切換到目錄,執行 vcvars32.bat 以設定 vc71 環境. 若 path 變數未設好,則會出現找不到這檔案的訊息. 接著執行 m.bat 編譯即可.

若發生問題,可以試著鍵入 makemake 重新產生 makefiles. 再打入 nmake -f makefile.vc depend 確認相依性. 之後再執行 m.bat 重新編譯一次即可

參考網址 http://java.csie.nctu.edu.tw/~deryann/paper/HowToSTL.htm