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.8
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 
)

Handle errors by printing an error and exit the application.

Examples:
flow/flow_learn_span/flow_learn_span_example.cpp, net/checksum/checksum_example.cpp, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Definition at line 108 of file flow_learn_span_example.cpp.

Referenced by flow_program_task(), main(), ntpl_multicall(), and rx_task().

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 122 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 145 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 166 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 222 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 250 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 262 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 342 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 352 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 202 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 203 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 204 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 205 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 207 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 208 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}
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 210 of file flow_learn_span_example.cpp.

Referenced by flow_program_task().

std::atomic<uint64_t> anonymous_namespace{flow_learn_span_example.cpp}::flow_learn_queue_write_index {0}
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 211 of file flow_learn_span_example.cpp.

Referenced by flow_program_task(), and handle_stream_miss().

std::array<NtFlow_t*, 0x100000> anonymous_namespace{flow_learn_span_example.cpp}::flow_learn_queue
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 212 of file flow_learn_span_example.cpp.

constexpr uint64_t anonymous_namespace{flow_learn_span_example.cpp}::flow_learn_queue_index_mask = 0xfffff
Examples:
flow/flow_learn_span/flow_learn_span_example.cpp.

Definition at line 213 of file flow_learn_span_example.cpp.