0
// let's get the TCP layer
pcpp::TcpLayer* tcpLayer = parsedPacket.getLayerOfType<pcpp::TcpLayer>();
if (tcpLayer == NULL) {
    cout << "NO TCP LAYER" << endl;
}
else {
    // change source port
    tcpLayer->getTcpHeader()->portSrc = pcpp::hostToNet16(12345);
    // add URG flag
    tcpLayer->getTcpHeader()->urgFlag = 1;
}

this is the code to get TCP layer from the parsed packet. i want to know how to get the sctp layer from the packet.

i want to get the code of it.

  • Unfortunately SCTP is not yet supported in PcapPlusPlus, so the only way to parse it is by writing some custom code: you can get the IP layer from the packet: `auto ipLayer = parsedPacket.getLayerOfType()` and then parse its payload by using `ipLayer->getLayerPayload()`. If you're interested, you're more than welcome to write a new SCTP layer and contribute to PcapPlusPlus – seladb Apr 12 '23 at 05:57

0 Answers0