diff options
author | Paul Atkins <patkins@graphiant.com> | 2021-09-21 20:49:12 +0100 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2021-11-22 09:30:09 +0000 |
commit | 9ec6449e298ed10695c4afbba951ac46daa52e43 (patch) | |
tree | ef9589f9e172ea905587812e440c3dfc9d1fc5a0 /src/vnet/ipfix-export/flow_report.h | |
parent | a3767bda9817eab15dd0eca0955d5ad194ec8840 (diff) |
ipfix-export: refactor fields in flow_report_main
Pull out the fields in flow_report_main_t that are specific to a single
exporter and move them into a new structure that represents an exporter.
Add a pool of exporters to flow_report_main_t and do a pool_get() to get
the entry at index 0, so that the existing users of the code need only
change the path at which they access the old fields and have no need to
make further code changes. In functions that were accessing the fields
that now make up the ipfix_exporter create a local var that points to the
first (always valid) exporter and use this as the base for the fields
rather than finding them from flow_report_main.
This is in preparation for supporting multiple flow_exporters.
Note that at the moment the code supports multiple 'streams' for a given
exporter, where each stream has its own source port, domain id and template
space. But all streams within an exporter have the same destination address,
so this is not the same as multiple exporters.
Type: refactor
Signed-off-by: Paul Atkins <patkins@graphiant.com>
Change-Id: I49f5c7fb9e901773351d31dc8a59178c37e99301
Diffstat (limited to 'src/vnet/ipfix-export/flow_report.h')
-rw-r--r-- | src/vnet/ipfix-export/flow_report.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/vnet/ipfix-export/flow_report.h b/src/vnet/ipfix-export/flow_report.h index 30df8a93c82..d1f308011b8 100644 --- a/src/vnet/ipfix-export/flow_report.h +++ b/src/vnet/ipfix-export/flow_report.h @@ -107,7 +107,16 @@ typedef struct flow_report vnet_flow_data_callback_t *flow_data_callback; } flow_report_t; -typedef struct flow_report_main +/* + * The maximum number of ipfix exporters we can have at once + */ +#define IPFIX_EXPORTERS_MAX 5 + +/* + * We support multiple exporters. Each one has its own configured + * destination, and its own set of reports and streams. + */ +typedef struct ipfix_exporter { flow_report_t *reports; flow_report_stream_t *streams; @@ -126,6 +135,16 @@ typedef struct flow_report_main /* UDP checksum calculation enable flag */ u8 udp_checksum; +} ipfix_exporter_t; + +typedef struct flow_report_main +{ + /* + * A pool of the exporters. Entry 0 is always there for backwards + * compatability reasons. Entries 1 and above have to be created by + * the users. + */ + ipfix_exporter_t *exporters; /* time scale transform. Joy. */ u32 unix_time_0; |