API: Handle a Flow Status Record

Stateful Flow Management

Platform
Napatech SmartNIC
Content Type
User Guide
Capture Software Version
Link™ Capture Software 12.6

Use this example to handle a Flow Status record.

Whenever a flow is unlearned or NT_FlowWrite is called, a flow status record can be generated and read by the NT_FlowStatusRead function. A flow status record can be seen as the state of an attempted learn/unlearn, triggered by user applications. The generation of such records depends on the ntservice.ini settings. This snippet reads and prints the possible statuses, but by default only a subset is enabled in ntservice.ini.

Note: Flow status records are read from the same flow stream that originally learned the flows.
Example:
NtFlowStatus_t flowStatus;

  // For each element in the flow stream queue, print the flow status record.
  while(NT_FlowStatusRead(flowStream, &flowStatus) == NT_SUCCESS) {
    std::cout << "Flow status for ID " << flowStatus.id;

    // The flags returned from NT_FlowStatusRead depend on ntservice.ini settings.
    switch(flowStatus.flags) {
      case NT_FLOW_STAT_LDS: std::cout << " NT_FLOW_STAT_LDS" << std::endl; break;
      case NT_FLOW_STAT_LFS: std::cout << " NT_FLOW_STAT_LFS" << std::endl; break;
      case NT_FLOW_STAT_LIS: std::cout << " NT_FLOW_STAT_LIS" << std::endl; break;
      case NT_FLOW_STAT_UDS: std::cout << " NT_FLOW_STAT_UDS" << std::endl; break;
      case NT_FLOW_STAT_UIS: std::cout << " NT_FLOW_STAT_UIS" << std::endl; break;
      default:               std::cout << " Unknown flag"     << std::endl; break;
    }
  }