streamidstatistics_example.c
Go to the documentation of this file.
47 * This source file show the procedure needed to get stream-id statistics that can be correlated with what the application receive.
125 * - @ref NT_NetRxGet() and @ref NT_NetRxRelease() - Receive and release packets. Packets received
126 * with a @ref NT_NET_GET_PKT_TIMESTAMP() older than the time stamp returned in the "in-activation"
128 * - When 10 packets has been received the stream-id is inactivated via @ref NT_ConfigWrite() and
129 * the application will continue @ref NT_NetRxGet() and @ref NT_NetRxRelease() until @ref NT_STATUS_TIMEOUT
165 NtNetBuf_t hNetBuf; // Net buffer container. Packet data is returned in this when calling NT_NetRxGet().
169 // Initialize the NTAPI library and thereby check if NTAPI_VERSION can be used together with this library
193 if ((status = NT_NTPL(hCfgStream, "Setup[State=Inactive]=StreamId==1", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
218 // Get a stream handle with the hostBuffer mapped to it. NT_NET_INTERFACE_PACKET specify that we will receive data packet-by-packet
219 if ((status = NT_NetRxOpen(&hNetRx, "TestStream", NT_NET_INTERFACE_PACKET, 1, -1)) != NT_SUCCESS) {
227 if ((status = NT_NTPL(hCfgStream, "Assign[streamid=1;color=7] = All", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
242 if ((status = NT_NTPL(hCfgStream, "Setup[State=Active]=StreamId==1", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
266 // We got a packet. Check if the timestamp is newer than when the NTPL assign command was applied
285 if ((status = NT_NTPL(hCfgStream, "Setup[State=Inactive]=StreamId==1", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
307 // We got a packet. Check if the timestamp is newer than when the NTPL assign command was applied
329 if ((status = NT_NTPL(hCfgStream, tmpBuffer, &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
372 printf("Stream-id received: %" PRIu64 " packets, %" PRIu64" bytes. \n", stat.u.query_v4.data.stream.streamid[1].forward.pkts, stat.u.query_v4.data.stream.streamid[1].forward.octets);