addPacket_example.c
Go to the documentation of this file.
27 NtNetBuf_t hNetBuf; // Net buffer container. Packet data is returned in this when calling NT_NetRxGet().
33 // Initialize the NTAPI library and thereby check if NTAPI_VERSION can be used together with this library
51 if ((status = NT_NTPL(hCfgStream, ntplStr, &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
62 // Get a stream handle with the hostBuffer mapped to it. NT_NET_INTERFACE_PACKET receive data packet-by-packet
63 if ((status = NT_NetRxOpen(&hNetRx, "TestStream", NT_NET_INTERFACE_PACKET, 1, -1)) != NT_SUCCESS) {
71 if ((status = NT_NetTxOpen(&hNetTx, "TxStreamPort", (1<<TX_PORT), NT_NETTX_NUMA_ADAPTER_HB, 0)) != NT_SUCCESS) {
91 // We got a packet. Check if the timestamp is newer than when the NTPL assign command was applied
93 break; // Break out, we have received a packet that is received after the NTPL assign command was applied
111 //The fixed parts of the fragment structure for a TX-packet must be completed before the “forward loop”:
126 printf("%6s %016llX - %04d - %02X:%02X:%02X:%02X:%02X:%02X %02X:%02X:%02X:%02X:%02X:%02X %04x\n",
129 NT_NET_GET_PKT_DESCRIPTOR_TYPE(hNetBuf)==NT_PACKET_DESCRIPTOR_TYPE_NT_EXTENDED?"NT_EXT":"Unknown"),
137 addPacketFragmentList[2].data = (uint8_t*) (addPacketFragmentList[0].data + addPacketFragmentList[0].size);
190 if ((status = NT_NTPL(hCfgStream, ntplStr, &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {