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


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

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


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

示例1: if

void
AmRlcEntity::InsertAMDIntoReceptionList (AmdRecord* amd)
{
#ifdef RLC_DEBUG
  std::cout  << "InsertAMDIntoReceptionList" << std::endl;
  PrintReceivedAMDs ();
#endif

  int amds = m_receivedAMDs->size ();

  if (amds == 0)
    {
	  //std::cout << "no AMD into the list" << std::endl;
	  m_receivedAMDs->insert (m_receivedAMDs->begin (), amd);
	  return;
    }

  for (int i = 0; i < amds; i++)
	{
	  Packet* packet = m_receivedAMDs->at (i)->m_packet;

	  if (amd->m_packet->GetRLCHeader ()->GetRlcPduSequenceNumber () < packet->GetRLCHeader ()->GetRlcPduSequenceNumber ())
	    {
		  //std::cout << "insert the AMD" << std::endl;
		  m_receivedAMDs->insert (m_receivedAMDs->begin () + i, amd);
		  return;
	    }
	  else if (amd->m_packet->GetRLCHeader ()->GetRlcPduSequenceNumber () > packet->GetRLCHeader ()->GetRlcPduSequenceNumber ()
			  && i == amds - 1)
	    {
		  //std::cout << "insert the AMD at the end of the queue" << std::endl;
		  m_receivedAMDs->insert (m_receivedAMDs->end (), amd);
          return;
	    }
	  else if (amd->m_packet->GetRLCHeader ()->GetRlcPduSequenceNumber () == packet->GetRLCHeader ()->GetRlcPduSequenceNumber ())
	    {
		  if (amd->m_packet->GetRLCHeader ()->GetEndByte () < packet->GetRLCHeader ()->GetStartByte ())
		    {
			  //std::cout << "insert before an AMD with the same SN" << std::endl;
			  m_receivedAMDs->insert (m_receivedAMDs->begin () + i, amd);
			  return;
		    }
		  else if (i == amds - 1)
		    {
			  //std::cout << "insert the AMD at the end of the queue" << std::endl;
			  m_receivedAMDs->insert (m_receivedAMDs->end (), amd);
	          return;
		    }
	    }
	  else
	    {}
	}

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

示例2:

void
AmRlcEntity::PrintReceivedAMDs (void)
{
  std::cout << "\t PrintReceivedAMDs" << std::endl;
  std::vector <AmdRecord*>::iterator it;
  for (it = m_receivedAMDs->begin (); it != m_receivedAMDs->end (); it++)
	{
	  Packet* packet = (*it)->m_packet;
	  std::cout << "\t\t *** pkt " << packet->GetID() << " frag " << packet->GetRLCHeader ()->GetFragmentNumber () <<
			  " sn " << packet->GetRLCHeader ()->GetRlcPduSequenceNumber () <<
			  " startB " << packet->GetRLCHeader ()->GetStartByte () <<
			  " endB " << packet->GetRLCHeader ()->GetEndByte () << std::endl;

	}
}
开发者ID:AbubakarAuwal,项目名称:lte-sim,代码行数:15,代码来源:am-rlc-entity.cpp

示例3: if

PacketBurst*
UmRlcEntity::TransmissionProcedure (int availableBytes)
{
#ifdef RLC_DEBUG
  std::cout << "UM RLC tx procedure for node " << GetRadioBearerInstance ()->GetSource ()->GetIDNetworkNode ()<< std::endl;
#endif

  PacketBurst* pb = new PacketBurst ();

  RadioBearer *bearer = (RadioBearer*) GetRadioBearerInstance ();
  MacQueue *queue = bearer->GetMacQueue ();

  if (bearer->GetApplication ()->GetApplicationType () == Application::APPLICATION_TYPE_INFINITE_BUFFER)
    {
	  //CREATE PACKET FOR THE INFINITE BUFFER SOURCE
	  while (true)
	    {
	      Packet *packet = bearer->CreatePacket (availableBytes);

	      //Set the id of the receiver RLC entity
	      packet->GetRLCHeader ()->SetRlcEntityIndex (GetRlcEntityIndex ());

	      packet->GetRLCHeader ()->SetRlcPduSequenceNumber (GetRlcPduSequenceNumber ());
	      int newSequenceNumber = GetRlcPduSequenceNumber () + 1;
	      SetRlcPduSequenceNumber (newSequenceNumber);

	      //Add MAC header
	      MACHeader *mac = new MACHeader (GetRadioBearerInstance ()->GetSource ()->GetIDNetworkNode (),
	    		                          GetRadioBearerInstance ()->GetDestination ()->GetIDNetworkNode ());
	      packet->AddMACHeader(mac);
          packet->AddHeaderSize (3); //CRC

	      if (availableBytes > 1503)
	        {
	    	  packet->SetSize (1503);
	    	  packet->GetPacketTags ()->SetApplicationSize (1490);
	    	  //Set the id of the receiver RLC entity
		      packet->GetRLCHeader ()->SetRlcEntityIndex (GetRlcEntityIndex ());
		      packet->GetRLCHeader ()->SetRlcPduSequenceNumber (GetRlcPduSequenceNumber ());
		      int newSequenceNumber = GetRlcPduSequenceNumber () + 1;
		      SetRlcPduSequenceNumber (newSequenceNumber);

	    	  availableBytes -= 1503;
	          pb->AddPacket (packet);

	          if (_RLC_TRACING_)
	            {
	              std::cout << "TX UM_RLC SIZE" << packet->GetSize () <<
	        		  " B " << GetRlcEntityIndex () <<
	        		  " PDU_SN " << packet->GetRLCHeader ()->GetRlcPduSequenceNumber() << std::endl;
	            }
	        }
	      else if (availableBytes > 13)
	        {
	    	  packet->SetSize (availableBytes);
	    	  packet->GetPacketTags ()->SetApplicationSize (availableBytes - 13);
	    	  //Set the id of the receiver RLC entity
		      packet->GetRLCHeader ()->SetRlcEntityIndex (GetRlcEntityIndex ());
		      packet->GetRLCHeader ()->SetRlcPduSequenceNumber (GetRlcPduSequenceNumber ());
		      int newSequenceNumber = GetRlcPduSequenceNumber () + 1;
		      SetRlcPduSequenceNumber (newSequenceNumber);

	    	  availableBytes = 0;
	    	  pb->AddPacket (packet);

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

	    	  break;
	        }
	      else
	        {
	    	  availableBytes = 0;
	    	  break;
	        }
	    }
    }
  else
    {
      while (availableBytes > 0 && !queue->IsEmpty ())
        {
	      Packet* packet = queue->GetPacketToTramsit (availableBytes);

	      if (packet != NULL)
	        {
	    	  //Set the id of the receiver RLC entity
		      packet->GetRLCHeader ()->SetRlcEntityIndex (GetRlcEntityIndex ());
		      packet->GetRLCHeader ()->SetRlcPduSequenceNumber (GetRlcPduSequenceNumber ());
		      int newSequenceNumber = GetRlcPduSequenceNumber () + 1;
		      SetRlcPduSequenceNumber (newSequenceNumber);

	          if (_RLC_TRACING_)
	            {
	              std::cout << "TX UM_RLC SIZE" << packet->GetSize () <<
	        		  " B " << GetRlcEntityIndex () <<
	        		  " PDU_SN " << packet->GetRLCHeader ()->GetRlcPduSequenceNumber() << std::endl;
//.........这里部分代码省略.........
开发者ID:Linyes,项目名称:lte_sim,代码行数:101,代码来源:um-rlc-entity.cpp


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