sort.h File Reference
NAF Core Library Flow Sorting API. More...
#include <naf/autoinc.h>
#include <naf/nafcore.h>
Go to the source code of this file.
Data Structures | |
| struct | _NAFSorter |
| A sort context for sorting NAFlows. More... | |
Defines | |
| #define | NAF_SORT_FIELDCOUNT 18 |
| Count of fields subject to sorting. | |
Typedefs | |
| typedef gboolean(* | NAFSortFlushFn )(void *ctx, NAFlow *flow, GError **err) |
| A sorter flush function. | |
| typedef _NAFSorter | NAFSorter |
| A sort context for sorting NAFlows. | |
Functions | |
| void | naf_sort_init (NAFSorter *sorter) |
| Initialize a new sorter. | |
| void | naf_sort_reinit (NAFSorter *sorter) |
| Reinitialize a sorter for sorting a new bin after a naf_sort_flush() call. | |
| void | naf_sort_begin (NAFSorter *sorter) |
| Begin sorting flows with an initalized or reinitialized NAFSorter. | |
| void | naf_sort_flow (NAFSorter *sorter, NAFlow *flow) |
| Add a flow to a sorter. | |
| void | naf_sort_flow_kv (NAFSorter *sorter, NAFlowKey *key, NAFlowVal *val) |
| Add a flow to a sorter. | |
| gboolean | naf_sort_flush (NAFSorter *sorter, NAFSortFlushFn ffn, void *fctx, GError **err) |
| Flush a sorter. | |
| void | naf_sort_print (NAFSorter *sorter, GString *str) |
| Print a parseable sort descriptor for a given sorter. | |
| gboolean | naf_sort_parse (GScanner *scanner, NAFSorter *sorter) |
| Parse a sort descriptor. | |
Detailed Description
NAF Core Library Flow Sorting API.Used by nafalize and nafilter. Defines an API for sorting collections of flows. The flow sorting API also provides a facility for parsing sort expressions from user input.
Define Documentation
|
|
Count of fields subject to sorting. When new fields are added to the NAFlow structure and the sort facility, update this count. |
Typedef Documentation
|
|
A sorter flush function. Called by naf_sort_flush to write a NAFlow to a private context. Used by nafalize and nafilter to write sorted NAFlow tree to output. |
Function Documentation
|
|
Begin sorting flows with an initalized or reinitialized NAFSorter.
|
|
||||||||||||
|
Add a flow to a sorter. Inserts the flow into the sort tree. It is assumed this flow is in the same bin as the other flows in the sorter. The caller is responsible for the storage of the given NAFlow instance.
|
|
||||||||||||||||
|
Add a flow to a sorter. Copies the flow into the sort tree. It is assumed this flow is in the same bin as the other flows in the sorter. It is safe to reuse or free the key and val parameters after this call.
|
|
||||||||||||||||||||
|
Flush a sorter. Calls the supplied sort flush function once per sorted flow, in sort order. Call this after adding all the flows in a given bin to the sorter.
|
|
|
Initialize a new sorter. Call this once to zero the fields of an allocated sorter structure; use naf_sort_reinit() after flush to zero an active sorter, instead.
|
|
||||||||||||
|
Parse a sort descriptor.
|
|
||||||||||||
|
Print a parseable sort descriptor for a given sorter.
|
|
|
Reinitialize a sorter for sorting a new bin after a naf_sort_flush() call. Clears out the sorter tree and flow chunk, but leaves the descriptor prepared by naf_sort_parse() intact.
|


