ndnsim下转发策略的研究以及架构
来源:互联网 发布:淘宝开店认证不通过 编辑:程序博客网 时间:2024/05/21 13:56
// node self mobilityPtr<MobilityModel> mobility = this->m_node->GetObject<MobilityModel>();Vector v_NodePosition = mobility->GetPosition();Vector v_NodeVelocity = mobility->GetVelocity();Vector _n;_n.x=v_NodePosition.x+v_NodeVelocity.x;_n.y=v_NodePosition.y+v_NodeVelocity.y;// last hop mobilityPtr<Packet> p_copy = p->Copy();FwGeoTag geotag;p_copy->RemovePacketTag(geotag);uint32_t n_LastHopNodeId = geotag.GetNodeId();Vector v_LastHopPosition = geotag.GetPosition();Vector v_LastHopVelocity = geotag.GetVelocity();Vector _d2;_d2.x=v_LastHopPosition.x+v_LastHopVelocity.x;_d2.x=v_LastHopPosition.y+v_LastHopVelocity.y;Ptr<Packet> packet = p->Copy();try{// get last hop's node iduint32_t n_From = -1;string str_From;stringstream ss2;ss2 << from;ss2 >> str_From;char szValue[] = "00";szValue[0] = str_From.at(str_From.length() - 2);szValue[1] = str_From.at(str_From.length() - 1);uint32_t nValude = 0;sscanf(szValue, "%x", &nValude);n_From = nValude - 1;uint32_t type = Convert::getPacketType(p);// ============== Interest ================if (type == ::ndn::tlv::Interest){bool b_Sent = false; // a flag indicating if this interest has been sent out successfully (has data)shared_ptr<const Interest> i = Convert::FromPacket<Interest>(packet);//NS_LOG_FUNCTION(Simulator::Now().GetSeconds() << this->m_node->GetId() << "Interest" << i->getName()<< n_From);NS_LOG_DEBUG(setprecision(8) << setw(9) << Simulator::Now().GetSeconds() << "\tInterest arrive at " << this->m_node->GetId() << "\t from " <<n_From << "\t name: " << i->getName());// BEACON Int: not forwardstring str_Name;stringstream s;s << i->getName().get(0);s >> str_Name;if (str_Name.compare("BEACON") == 0){// 1. check neighbor list, delete duplicated and outdatedNeighborQueue::iterator item = m_NeighborList.begin();while (item != m_NeighborList.end()){if (item->m_NodeId == n_LastHopNodeId || (Simulator::Now().GetSeconds() - item->m_Time.GetSeconds()) > 1){NeighborQueue::iterator tmp = item;tmp++;m_NeighborList.erase(item);item = tmp;}elseitem++;}// 2. add new entry to the listint degree=get_popularitity();//每秒更新beacon包,所以也是每秒更新受欢迎度,这里不能被注释,因为下面的语句需要插入degree,如果想注释,把degree随便赋值即可m_NeighborList.push_front(Neighbor_Item(Simulator::Now(), n_LastHopNodeId, v_LastHopPosition, v_LastHopVelocity,degree));// 3. look at Interest Retx List, schedule available retxItemQueue::iterator item_retx = m_RetxQueue_Interest.begin();int P=0;
终于在ndnsim下,完成了转发策略的研究。不是基于L3层,而是在L2层和L3层之间,处理包的发送和选择。并且完成了BEACON包所携带的位置,距离,速度互相交流。通过设置不同的转发时间,避免了洪泛广播,减少了网络拥塞,并且可以在容延网络下,重新转发兴趣包。研三,可以顺利结束了。
注:如果有同学想找我讨论转发策略等内容,请联系QQ:798309267
0 0
- ndnsim下转发策略的研究以及架构
- Ubuntu12.04下ndnSIM安装
- ndnSIM中可视化的解决办法
- ndnSIM的介绍与使用(一)
- ndnSIM的介绍与使用(二)
- ndnSIM中概率缓存的简单实现
- ndnSIM中LCD的简单实现
- 浅谈大数据背景下的NUMA架构研究
- RAC模式下的备份策略以及RMAN备份脚本
- 量化策略研究的网站
- iOS架构的研究
- redis架构以及源码研究+caseStudy
- Android下DLNA和UPnP的研究以及问题
- Android下DLNA和UPnP的研究以及问题
- Android下DLNA和UPnP的研究以及问题
- Android下DLNA和UPnP的研究以及问题
- Android下DLNA和UPnP的研究以及问题
- 软件架构设计的策略
- 堆积木
- SQL统计函数及分组操作
- mysql二进制日志
- 马的移动
- hdu 1533 Going Home 【最小权的二分图匹配】
- ndnsim下转发策略的研究以及架构
- Docker学习之路
- 跳跃游戏
- 递推递归练习--O(螺旋方阵)
- 递推递归练习P
- 蓝桥杯-基础试题-试笔-01字串
- 手把手git教程(05)--远程仓库推送和克隆
- Android使用谷歌封装好的api增删查改
- java类型自动装箱拆箱和字符串与基本类型的装换