当前位置: 首页>>代码示例>>C++>>正文


C++ Packet::GetPacketTags方法代码示例

本文整理汇总了C++中Packet::GetPacketTags方法的典型用法代码示例。如果您正苦于以下问题:C++ Packet::GetPacketTags方法的具体用法?C++ Packet::GetPacketTags怎么用?C++ Packet::GetPacketTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Packet的用法示例。


在下文中一共展示了Packet::GetPacketTags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if


//.........这里部分代码省略.........
		    {
			  //std::cout << "\t\t !! consecutive fragment --> we expect another fragment" << std::endl;
			  expectedNextByte = packet->GetRLCHeader ()->GetEndByte () + 1;
		    }
	    }
	}


  //DELETE REASSEBLED PACKETS!
#ifdef RLC_DEBUG
  std::cout << "\t\t !! DELETE REASSEBLED PACKETS" << std::endl;
#endif

  for (std::list<int>::iterator iter = packetIdToDelete.begin (); iter != packetIdToDelete.end (); iter++)
    {
	  std::vector <AmdRecord*> *newAmdList = new std::vector <AmdRecord*>;
	  int id = (*iter);
	  for (std::vector <AmdRecord*>::iterator  itt = m_receivedAMDs->begin (); itt != m_receivedAMDs->end (); itt++)
		{
		  AmdRecord *amdRecord = (*itt);
		  double delay = amdRecord->m_packet->GetTimeStamp () + GetRadioBearerInstance ()->GetQoSParameters ()->GetMaxDelay ();
  		  if (amdRecord->m_packet->GetID () == id)
			{
				delete amdRecord;
			}
  		  else
  		    {
  			  newAmdList->push_back (amdRecord);
  		    }
		}
   	  m_receivedAMDs->clear();
   	  delete m_receivedAMDs;
   	  m_receivedAMDs = newAmdList;
    }


  //DELETE PACKETS or AMDs WHOSE DEADLINE is EXPIRED !
#ifdef RLC_DEBUG
  std::cout << "\t\t !! DELETE PACKETS or AMDs WHOSE DEADLINE is EXPIRED !" << std::endl;
#endif

  int currentpacketId = -1;
  std::vector <AmdRecord*> *newAmdList = new std::vector <AmdRecord*>;
  for (std::vector <AmdRecord*>::iterator  itt = m_receivedAMDs->begin (); itt != m_receivedAMDs->end (); itt++)
	{
	  AmdRecord *amdRecord = (*itt);
	  double delay = amdRecord->m_packet->GetTimeStamp () + GetRadioBearerInstance ()->GetQoSParameters ()->GetMaxDelay ();
	  if ((delay + 0.01) < Simulator::Init()->Now())
		{
		  //trace for statistical purposes
		  Packet *pp = amdRecord->m_packet;
		  if (pp->GetID () !=  currentpacketId)
		    {
			  currentpacketId = amdRecord->m_packet->GetID ();

			  if (_RLC_TRACING_)
			    {
				  std::cout << "DROP_RX_AM_RLC";
				  if (pp->GetPacketTags()->GetApplicationType() == PacketTAGs::APPLICATION_TYPE_VOIP)
					  std::cout << " VOIP";
				  else if (pp->GetPacketTags()->GetApplicationType() == PacketTAGs::APPLICATION_TYPE_TRACE_BASED)
					  std::cout << " VIDEO";
				  else if (pp->GetPacketTags()->GetApplicationType() == PacketTAGs::APPLICATION_TYPE_CBR)
					  std::cout << " CBR";
				  else if (pp->GetPacketTags()->GetApplicationType() == PacketTAGs::APPLICATION_TYPE_INFINITE_BUFFER)
					  std::cout << " INF_BUF";
				  else
					  std::cout << " UNKNOW";

				  std::cout << " ID "<< pp->GetID()
						  << " B " << GetRlcEntityIndex ();

				  if (pp->GetPacketTags() != NULL
						  && pp->GetPacketTags()->GetApplicationType() ==
								  PacketTAGs::APPLICATION_TYPE_TRACE_BASED)
					{
					   std::cout << " FRAME " <<  pp->GetPacketTags()->GetFrameNuber()
								<< " START " << pp->GetPacketTags()->GetStartByte()
								<< " END " << pp->GetPacketTags()->GetEndByte();
					}
				  std::cout  <<  std::endl;
			    }
		    }
			delete amdRecord;
		}
	  else
		{
		  newAmdList->push_back (amdRecord);
		}
	}
  m_receivedAMDs->clear();
  delete m_receivedAMDs;
  m_receivedAMDs = newAmdList;



#ifdef RLC_DEBUG
  PrintReceivedAMDs ();
#endif
}
开发者ID:AbubakarAuwal,项目名称:lte-sim,代码行数:101,代码来源:am-rlc-entity.cpp

示例2: if

void
UmRlcEntity::ReceptionProcedure (Packet* p)
{
#ifdef RLC_DEBUG
  std::cout << "UM RLC rx procedure for node " << GetRadioBearerInstance ()->GetDestination ()->GetIDNetworkNode ()<< std::endl;
  std::cout << "RECEIVE PACKET id " << p->GetID() << " frag n " << p->GetRLCHeader ()->GetFragmentNumber ()<< std::endl;
#endif

  if (_RLC_TRACING_)
    {
      std::cout << "RX UM_RLC SIZE " << p->GetSize () <<
		  " B " << GetRlcEntityIndex () <<
		  " PDU_SN " << p->GetRLCHeader ()->GetRlcPduSequenceNumber() << std::endl;
    }

  if (m_incomingPacket.size() > 0 && p->GetID () != m_incomingPacket.at (0)->GetID ())
    {
#ifdef RLC_DEBUG
		  std::cout << "received a new packet, delete enqueued fragments"<< std::endl;
#endif

      Packet *pp = m_incomingPacket.at (0);

      if (_RLC_TRACING_)
        {
		  std::cout << "DROP_RX_UM_RLC";
		  if (pp->GetPacketTags()->GetApplicationType() == PacketTAGs::APPLICATION_TYPE_VOIP)
			  std::cout << " VOIP";
		  else if (pp->GetPacketTags()->GetApplicationType() == PacketTAGs::APPLICATION_TYPE_TRACE_BASED)
			  std::cout << " VIDEO";
		  else if (pp->GetPacketTags()->GetApplicationType() == PacketTAGs::APPLICATION_TYPE_CBR)
			  std::cout << " CBR";
		  else if (pp->GetPacketTags()->GetApplicationType() == PacketTAGs::APPLICATION_TYPE_INFINITE_BUFFER)
			  std::cout << " INF_BUF";
		  else
			  std::cout << " UNKNOW";

		  std::cout << " ID "<< pp->GetID()
				  << " B " << GetRlcEntityIndex ();

		  if (pp->GetPacketTags() != NULL
				  && pp->GetPacketTags()->GetApplicationType() ==
						  PacketTAGs::APPLICATION_TYPE_TRACE_BASED)
			{
			   std::cout << " FRAME " <<  pp->GetPacketTags()->GetFrameNuber()
						<< " START " << pp->GetPacketTags()->GetStartByte()
						<< " END " << pp->GetPacketTags()->GetEndByte();
			}
		  std::cout  <<  std::endl;
        }

	  ClearIncomingPackets ();
    }

  //The received packet is not a fragment
  if (!p->GetRLCHeader ()->IsAFragment ())
    {
#ifdef RLC_DEBUG
      std::cout << "\t received a packet " << std::endl;
#endif


      RadioBearerSink *bearer = (RadioBearerSink*) GetRadioBearerInstance ();
	  bearer->Receive (p);
    }

  //The received packet is a fragment
  if (p->GetRLCHeader ()->IsAFragment () && !p->GetRLCHeader ()->IsTheLatestFragment())
    {

#ifdef RLC_DEBUG
      std::cout << "\t received a fragment " << std::endl;
#endif
      m_incomingPacket.push_back (p);
    }

  //The received packet is the latest fragment
  if (p->GetRLCHeader ()->IsAFragment () && p->GetRLCHeader ()->IsTheLatestFragment())
    {

#ifdef RLC_DEBUG
       std::cout << "\t received the latest fragment " << std::endl;
#endif
	  m_incomingPacket.push_back (p);

	  //check if all fragment have been received
	  int numberOfPackets = p->GetRLCHeader ()->GetFragmentNumber () + 1;

	  if (m_incomingPacket.size () == numberOfPackets)
	    {
		  RadioBearerSink *bearer = (RadioBearerSink*) GetRadioBearerInstance ();
		  bearer->Receive (p->Copy ());

		  ClearIncomingPackets ();
	    }
	  else
	    {

#ifdef RLC_DEBUG
		  std::cout << "list of fragment incomplete -> delete all!"<< std::endl;
//.........这里部分代码省略.........
开发者ID:Linyes,项目名称:lte_sim,代码行数:101,代码来源:um-rlc-entity.cpp

示例3: Packet

Packet*
RadioBearer::CreatePacket (int bytes)
{
  Packet *p = new Packet ();

  p->SetID(Simulator::Init()->GetUID ());
  p->SetTimeStamp(Simulator::Init()->Now ());

  UDPHeader *udp = new UDPHeader (GetClassifierParameters ()->GetSourcePort(),
		                          GetClassifierParameters ()->GetDestinationPort ());
  p->AddUDPHeader(udp);

  IPHeader *ip = new IPHeader (GetClassifierParameters ()->GetSourceID (),
                               GetClassifierParameters ()->GetDestinationID());
  p->AddIPHeader(ip);

  PDCPHeader *pdcp = new PDCPHeader ();
  p->AddPDCPHeader (pdcp);

  RLCHeader *rlc = new RLCHeader ();
  p->AddRLCHeader(rlc);

  PacketTAGs *tags = new PacketTAGs ();
  tags->SetApplicationType(PacketTAGs::APPLICATION_TYPE_INFINITE_BUFFER);
  p->SetPacketTags(tags);

  if (_APP_TRACING_)
    {
	  /*
	   * Trace format:
	   *
	   * TX   APPLICATION_TYPE   BEARER_ID  SIZE   SRC_ID   DST_ID   TIME
	   */
	  UserEquipment* ue = (UserEquipment*) GetApplication ()->GetDestination ();
	   std::cout << "TX";
	   switch (p->GetPacketTags ()->GetApplicationType ())
	     {
	       case Application::APPLICATION_TYPE_VOIP:
	         {
	     	  std::cout << " VOIP";
	     	  break;
	         }
	       case Application::APPLICATION_TYPE_TRACE_BASED:
	         {
	           std::cout << " VIDEO";
	     	  break;
	         }
	       case Application::APPLICATION_TYPE_CBR:
	         {
	     	  std::cout << " CBR";
	     	  break;
	         }
	       case Application::APPLICATION_TYPE_INFINITE_BUFFER:
	         {
	     	  std::cout << " INF_BUF";
	     	  break;
	         }
	       default:
	         {
	     	  std::cout << " UNDEFINED";
	     	  break;
	         }
	     }

	   if (bytes > 1490) bytes = 1490;
	   else bytes = bytes - 13;

       std::cout << " ID " << p->GetID ()
	 		    << " B " << GetRlcEntity ()->GetRlcEntityIndex ()
	 			<< " SIZE " << bytes
	 			<< " SRC " << GetSource ()->GetIDNetworkNode ()
	 			<< " DST " << GetDestination ()->GetIDNetworkNode ()
	 			<< " T " << Simulator::Init()->Now()
	 			<< " " << ue->IsIndoor () << std::endl;
    }

  return p;
}
开发者ID:AbubakarAuwal,项目名称:lte-sim,代码行数:78,代码来源:radio-bearer.cpp


注:本文中的Packet::GetPacketTags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。