[問題] NS2的wireless廣播

看板Network_Sim作者 (Carael Macchiato)時間14年前 (2010/02/21 16:49), 編輯推噓1(105)
留言6則, 2人參與, 最新討論串1/1
小弟是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
這應該是給Routing Agent用的
02/24 03:44, 1F

02/24 03:46, , 2F
其實也不一定,反正上層的Agent只要new一個這樣的
02/24 03:46, 2F

02/24 03:46, , 3F
往下送自然就會Broadcast出去
02/24 03:46, 3F

02/24 03:46, , 4F
Packet
02/24 03:46, 4F

02/24 14:02, , 5F
謝謝樓上,有一點想法了 先試看看 :)
02/24 14:02, 5F

08/29 22:47, , 6F
自己回..發現在2.34裡有內建的module 當初眼殘沒看到...
08/29 22:47, 6F
文章代碼(AID): #1BWFEPBe (Network_Sim)
文章代碼(AID): #1BWFEPBe (Network_Sim)