[問題] NS2的wireless廣播
小弟是ns2新手 恰巧最近開始接觸VANET相關的研究
想在ns2上先練習實作簡單的廣播功能 以期未來可以做區域廣播的動作
卻發現ns2在wireless部份似乎沒有提供廣播的功能
於是參考過網路上一些資料後發現這個解法
http://mailman.isi.edu/pipermail/ns-users/2000-June/009635.html
但在文章修改過ll.cc過後的部份卻不太能理解
下面這一段是應該另外新增一個Agent或者是加在哪邊呢?
又或者是否有已開發完畢的模組有提供廣播功能?
先謝謝各位大哥了 @@
// Create a new packet
Packet* pkt = allocpkt();
// Access the common header for the new packet:
hdr_cmn* cmnhdr = (hdr_cmn*)pkt->access(off_cmn_);
// Access the IP header for the new packet:
hdr_ip* iphdr = (hdr_ip*)pkt->access(off_ip_);
// set all the necessary things for the common header
cmnhdr->next_hop_ = IP_BROADCAST; // broadcast
// now the ip header stuff
iphdr->saddr() = myAddress;
iphdr->sport() = myPort;
iphdr->daddr() = IP_BROADCAST;
iphdr->dport() = desiredDestinationPort;
// I do this just to be sure that it isn't forwarded
// beyond the neighbors
iphdr->ttl() = 1;
// this is taken from dsragent::sendOutBCastPkt
Scheduler::instance().schedule(ll, pkt, 0.0);
// return TCL_OK, so the calling function knows that the
// command has been processed
return (TCL_OK);
--
《Sometimes Love Just Ain't Enough》 Yan-zi
"But there's a danger in loving somebody too much.
And its sad when you know it's your heart you can't trust.
There's a reason why people don't stay where they are.
Baby sometimes love just ain't enough."
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.216.89
※ 編輯: CxMacchi 來自: 140.116.216.89 (02/21 16:49)
※ 編輯: CxMacchi 來自: 140.116.216.89 (02/21 16:50)
推
02/24 03:44, , 1F
02/24 03:44, 1F
→
02/24 03:46, , 2F
02/24 03:46, 2F
→
02/24 03:46, , 3F
02/24 03:46, 3F
→
02/24 03:46, , 4F
02/24 03:46, 4F
→
02/24 14:02, , 5F
02/24 14:02, 5F
→
08/29 22:47, , 6F
08/29 22:47, 6F
Network_Sim 近期熱門文章
PTT數位生活區 即時熱門文章