API: Open a Flow Stream

Stateful Flow Management

product_line_custom
Napatech SmartNIC
category
User Guide

Use this example to open a flow stream. You need to open a flow stream before you can process packets.

The flow manager learns its known flows from user applications, but before such an application can teach the SmartNIC anything, a stream to the SmartNIC must be established. Each flow stream is SmartNIC-specific, so if multiple SmartNICs have a flow manager, then multiple flow streams are required. This snippet shows how a flow stream is configured and then opened.

Example:
uint8_t         adapterNo = 0;
  NtFlowAttr_t    flowAttr;
  NtFlowStream_t  flowStream;

  // Initialize flow stream attributes and set adapter number attribute.
  NT_FlowOpenAttrInit(&flowAttr);
  NT_FlowOpenAttrSetAdapterNo(&flowAttr, adapterNo);

  // Opens a flow programming stream and returns a stream handle (flowStream).
  status = NT_FlowOpen_Attr(&flowStream, "open_flow_stream_example", &flowAttr);
  if(status != NT_SUCCESS) { /* Handle error */ }