c_cpp OMNeT ++中的数据包检测

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp OMNeT ++中的数据包检测相关的知识,希望对你有一定的参考价值。

    auto aTempPacket = pkt->dup();
    if (dynamic_cast<RlcPacket *>(aTempPacket) != nullptr) {
      auto aRlcPacket = omnetpp::check_and_cast<RlcPacket *>(aTempPacket);
      if (aRlcPacket->hasEncapsulatedPacket()) {
        auto aPdcpPacket = aRlcPacket->decapsulate();
        delete aRlcPacket;
        auto aTempPacket_2 = aPdcpPacket->decapsulate();
        delete aPdcpPacket;
        if (dynamic_cast<RrcPacket *>(aTempPacket_2) != nullptr) {
          auto aRrcPacket = omnetpp::check_and_cast<RrcPacket *>(aTempPacket_2);
          EV_TRACE << "PHY: Received RRC packet \"" << aRrcPacket->getName() << "\"." << std::endl;
          delete aRrcPacket;
        } else if (dynamic_cast<CoapPacket *>(aTempPacket_2) != nullptr) {
          auto aCoapPacket = omnetpp::check_and_cast<RrcPacket *>(aTempPacket_2);
          auto anAppPacket = aCoapPacket->decapsulate();
          delete aCoapPacket;
          EV_TRACE << "PHY: Received CoAP packet \"" << anAppPacket->getName() << "\"." << std::endl;
          delete anAppPacket;
        } else {
          EV_TRACE << "PHY: Unknown packet" << std::endl;
        }
      } else {
        EV_TRACE << "PHY: Received RLC packet \"" << aRlcPacket->getName() << "\"." << std::endl;
        delete aRlcPacket;
      }
    } else {
      EV_TRACE << "PHY: Unknown packet" << std::endl;
      delete aTempPacket;
    }

以上是关于c_cpp OMNeT ++中的数据包检测的主要内容,如果未能解决你的问题,请参考以下文章

使用GnuRadio解码蓝牙信号和数据包

NGFW中数据包转发流程

二层转发

二层转发原理

DPI与DFI技术分析

心脏滴血与利用