anonymous_namespace{flow_learn_span_example.cpp}

Reference Documentation

Platform
Intel® PAC
Napatech SmartNIC
Content Type
Reference Information
Capture Software Version
Link™ Capture Software 12.10
Napatech Software Suite: anonymous_namespace{flow_learn_span_example.cpp} Namespace Reference
anonymous_namespace{flow_learn_span_example.cpp} Namespace Reference

Functions

void handle_error_status (int status, const char *message)
 
void ntpl_multicall (const std::vector< std::string > &ntpls)
 
uint64_t flow_hash (const NtFlow_t *flow)
 
void rx_task (std::atomic< int > *ready, std::atomic< bool > *end_task, uint32_t stream_id, std::function< void(const NtNetBuf_t &)> handle)
 
void flow_program_task (std::atomic< int > *ready, std::atomic< bool > *end_task)
 
void handle_stream_unhandled (const NtNetBuf_t &)
 
void handle_stream_miss (const NtNetBuf_t &net_buffer)
 
void handle_stream_blacklist_hit (const NtNetBuf_t &)
 
void handle_stream_whitelist_hit (const NtNetBuf_t &)
 

Variables

uint64_t counter_unhandled = 0
 
uint64_t counter_miss = 0
 
uint64_t counter_blacklist_hit = 0
 
uint64_t counter_whitelist_hit = 0
 
NtFlowStream_t flow_stream
 
std::unordered_multimap< uint64_t, std::unique_ptr< NtFlow_t > > flow_map
 
std::atomic< uint64_t > flow_learn_queue_read_index {0}
 
std::atomic< uint64_t > flow_learn_queue_write_index {0}
 
std::array< NtFlow_t *, 0x100000 > flow_learn_queue
 
constexpr uint64_t flow_learn_queue_index_mask = 0xfffff
 

Function Documentation

void anonymous_namespace{flow_learn_span_example.cpp}::handle_error_status ( int  status,
const char *  message 
)
void anonymous_namespace{flow_learn_span_example.cpp}::ntpl_multicall ( const std::vector< std::string > &  ntpls)

Opens a config stream and programs the input NTPL. When the NTPL has been programmed, the config stream is closed again.

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 123 of file flow_learn_span_example.cpp.

Referenced by main().

uint64_t anonymous_namespace{flow_learn_span_example.cpp}::flow_hash ( const NtFlow_t flow)

Quick and dirty hashing function for some fields in NtFlow_t. The hash uniqueness in this function is not great, but since std::unordered_multimap is used to store the flows, the application is able to handle duplicate hashes.

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 146 of file flow_learn_span_example.cpp.

Referenced by handle_stream_miss().

void anonymous_namespace{flow_learn_span_example.cpp}::rx_task ( std::atomic< int > *  ready,
std::atomic< bool > *  end_task,
uint32_t  stream_id,
std::function< void(const NtNetBuf_t &)>  handle 
)

Opens a RX stream and received packets until an end-task signal is received.

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 167 of file flow_learn_span_example.cpp.

Referenced by main().

void anonymous_namespace{flow_learn_span_example.cpp}::flow_program_task ( std::atomic< int > *  ready,
std::atomic< bool > *  end_task 
)

Separate task to program flows

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 223 of file flow_learn_span_example.cpp.

Referenced by main().

void anonymous_namespace{flow_learn_span_example.cpp}::handle_stream_unhandled ( const NtNetBuf_t )

Handle used for the unhandled packets RX thread.

In this example, unhandled packets are only counted.

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 251 of file flow_learn_span_example.cpp.

Referenced by main().

void anonymous_namespace{flow_learn_span_example.cpp}::handle_stream_miss ( const NtNetBuf_t net_buffer)

Handle used for the missed packets RX thread.

Whenever a missed packet is received, the function calculates the flow learn data, and checks if it is a new flow, or a previously known flow. If the flow is new, then the flow is programmed.

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 263 of file flow_learn_span_example.cpp.

Referenced by main().

void anonymous_namespace{flow_learn_span_example.cpp}::handle_stream_blacklist_hit ( const NtNetBuf_t )

Handle used for the blacklist packets RX thread.

In this example, packets that hit a programmed flow are only counted.

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 343 of file flow_learn_span_example.cpp.

Referenced by main().

void anonymous_namespace{flow_learn_span_example.cpp}::handle_stream_whitelist_hit ( const NtNetBuf_t )

Handle used for the whitelist packets RX thread.

In this example, packets that hit a programmed flow are only counted.

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 353 of file flow_learn_span_example.cpp.

Referenced by main().

Variable Documentation

uint64_t anonymous_namespace{flow_learn_span_example.cpp}::counter_unhandled = 0
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 203 of file flow_learn_span_example.cpp.

Referenced by main().

uint64_t anonymous_namespace{flow_learn_span_example.cpp}::counter_miss = 0
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 204 of file flow_learn_span_example.cpp.

Referenced by main().

uint64_t anonymous_namespace{flow_learn_span_example.cpp}::counter_blacklist_hit = 0
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 205 of file flow_learn_span_example.cpp.

Referenced by main().

uint64_t anonymous_namespace{flow_learn_span_example.cpp}::counter_whitelist_hit = 0
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 206 of file flow_learn_span_example.cpp.

Referenced by main().

NtFlowStream_t anonymous_namespace{flow_learn_span_example.cpp}::flow_stream
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 208 of file flow_learn_span_example.cpp.

Referenced by main().

std::unordered_multimap<uint64_t, std::unique_ptr<NtFlow_t> > anonymous_namespace{flow_learn_span_example.cpp}::flow_map
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 209 of file flow_learn_span_example.cpp.

Referenced by main().

std::atomic<uint64_t> anonymous_namespace{flow_learn_span_example.cpp}::flow_learn_queue_read_index {0}
std::atomic<uint64_t> anonymous_namespace{flow_learn_span_example.cpp}::flow_learn_queue_write_index {0}
std::array<NtFlow_t*, 0x100000> anonymous_namespace{flow_learn_span_example.cpp}::flow_learn_queue
constexpr uint64_t anonymous_namespace{flow_learn_span_example.cpp}::flow_learn_queue_index_mask = 0xfffff