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