@@ -396,6 +396,92 @@ ipx_ctx_subscribe(ipx_ctx_t *ctx, const ipx_msg_mask_t *mask_new, ipx_msg_mask_t
396396IPX_API const fds_iemgr_t *
397397ipx_ctx_iemgr_get (ipx_ctx_t * ctx );
398398
399+ /**
400+ * \brief Register an extension of Data Records (Intermediate and Output plugins ONLY!)
401+ *
402+ * Reserve space for metadata that will be part of each Data Record. The purpose of extension
403+ * it is to add non-flow information which can be useful during record processing. For example,
404+ * one plugin can add some labels and one or more plugins further in the pipeline can use them
405+ * later.
406+ *
407+ * Structure or data type of the extension is up to the producer. Nevertheless, the producer and
408+ * all consumers must use the same. The producer is also RESPONSIBLE for filling content of the
409+ * extension to EACH Data Record in the IPFIX Message!
410+ *
411+ * One plugin instance can register multiple extensions.
412+ * \warning
413+ * This function can be called only during ipx_plugin_init() of Intermediate and Output plugins.
414+ * \note
415+ * Only single plugin instance at time can produce extension with the given combination
416+ * of the \p type and the \p name.
417+ * \param[in] ctx Plugin context
418+ * \param[in] type Identification of the extension type (e.g. "profiles-v1")
419+ * \param[in] name Identification of the extension name (e.g. "main_profiles")
420+ * \param[in] size Size of memory required for the extension (in bytes)
421+ * \param[out] rext Internal description of the extension
422+ *
423+ * \return #IPX_OK on success
424+ * \return #IPX_ERR_ARG if the \p type or \p name are not valid (i.e. empty or NULL)
425+ * \return #IPX_ERR_DENIED if the plugin doesn't have permission to register extension
426+ * \return #IPX_ERR_NOMEM if the maximum number of extensions has been reached
427+ */
428+ IPX_API int
429+ ipx_ctx_rext_producer (ipx_ctx_t * ctx , const char * type , const char * name , size_t size ,
430+ ipx_ctx_rext * * rext );
431+
432+ /**
433+ * @brief Add dependency on an extension of Data Records (Intermediate and Output plugins ONLY!)
434+ *
435+ * Register dependency on an extension. This will make sure that the required extension is
436+ * available for EACH Data Record during ipx_plugin_process() and that there is a particular
437+ * producer earlier in the processing pipeline.
438+ *
439+ * One plugin instance can register multiple dependencies.
440+ *
441+ * \warning
442+ * This function can be called only during ipx_plugin_init() of Intermediate and Output plugins.
443+ * \note
444+ * If the function has succeeded, it doesn't mean that there is particular extension producer.
445+ * Since dependencies are resolved later during configuration of the collector, startup
446+ * process will be interrupted if all requirements are not met.
447+ * \note
448+ * The plugin instance CANNOT add dependency on an extension which it is producing.
449+ *
450+ * \param[in] ctx Plugin context
451+ * \param[in] type Identification of the extension type (e.g. "profiles-v1")
452+ * \param[in] name Identification of the extension name (e.g. "main_profiles")
453+ * \param[out] rext Internal description of the extension
454+ *
455+ * \return #IPX_OK on success (see notes)
456+ * \return #IPX_ERR_ARG if the \p type or \p name are not valid (i.e. empty or NULL)
457+ * \return #IPX_ERR_DENIED if the plugin doesn't have permission to register dependency
458+ * \return #IPX_ERR_NOMEM if the maximum number of extensions has been reached
459+ */
460+ IPX_API int
461+ ipx_ctx_rext_consumer (ipx_ctx_t * ctx , const char * type , const char * name , ipx_ctx_rext_t * * rext );
462+
463+ /**
464+ * \brief Get size of an extension
465+ *
466+ * Information about the extension are not available during ipx_plugin_init().
467+ * \param[in] rext Internal description of the extension
468+ * \param[out] size Size of the extension
469+ * \return #IPX_OK on success
470+ * \return #IPX_ERR_DENIED if the information is not available
471+ */
472+ IPX_API int
473+ ipx_ctx_rext_size (ipx_ctx_rext * rext , size_t * size );
474+
475+ /**
476+ * \brief Get data of an extension
477+ *
478+ * \param[in] rext Internal description of the extension
479+ * \param[in] ipx_drec Data Record with extensions
480+ * \return Pointer to the extension
481+ */
482+ IPX_API void *
483+ ipx_ctx_rext_get (ipx_ctx_rext * rext , struct ipx_ipfix_record * ipx_drec );
484+
399485/**
400486 * @}
401487 * @}
0 commit comments