Data Structures | |
| struct | context |
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_miss (const NtNetBuf_t &net_buffer) |
| void | handle_stream_blacklist_hit (const NtNetBuf_t &) |
| void | handle_stream_whitelist_hit (const NtNetBuf_t &) |
Variables | |
| struct context | context_miss |
| struct context | context_blacklist |
| struct context | context_whitelist |
| 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 110 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.
Definition at line 124 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.
Definition at line 147 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.
Definition at line 168 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
Definition at line 227 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.
Definition at line 257 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.
Definition at line 345 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.
Definition at line 355 of file flow_learn_span_example.cpp.
Referenced by main().
Variable Documentation
| struct context anonymous_namespace{flow_learn_span_example.cpp}::context_miss |
Definition at line 208 of file flow_learn_span_example.cpp.
Referenced by handle_stream_miss(), and main().
| struct context anonymous_namespace{flow_learn_span_example.cpp}::context_blacklist |
Definition at line 209 of file flow_learn_span_example.cpp.
Referenced by handle_stream_blacklist_hit(), and main().
| struct context anonymous_namespace{flow_learn_span_example.cpp}::context_whitelist |
Definition at line 210 of file flow_learn_span_example.cpp.
Referenced by handle_stream_whitelist_hit(), and main().
| NtFlowStream_t anonymous_namespace{flow_learn_span_example.cpp}::flow_stream |
Definition at line 212 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 |
Definition at line 213 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} |
Definition at line 215 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} |
Definition at line 216 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 |
Definition at line 217 of file flow_learn_span_example.cpp.
| constexpr uint64_t anonymous_namespace{flow_learn_span_example.cpp}::flow_learn_queue_index_mask = 0xfffff |
Definition at line 218 of file flow_learn_span_example.cpp.