176#include <yaf/autoinc.h>
177#include <yaf/decode.h>
180#if YAF_ENABLE_APPLABEL
181#define PCRE2_CODE_UNIT_WIDTH 8
186#define YAF_HOOK_INTERFACE_VERSION 7
218 yfTCPInfo_t *tcpinfo,
240 yfTCPInfo_t *tcpinfo,
261 void **yfHookCtxArray,
262 uint32_t max_payload,
265 gboolean applabelmode,
266 gboolean entropymode,
267 gboolean fingerprintmode,
268 gboolean fpExportMode,
269 gboolean udp_multipkt_payload,
270 uint16_t udp_uniflow_port);
296 void **yfHookCtxArray);
331 fbSession_t *session,
332 void **yfHookCtxArray);
345 fbSubTemplateMultiList_t *rec,
346 fbSubTemplateMultiListEntry_t *stml,
364 const char *hookName,
365 const char *hookOpts,
366 const char *hookConf,
367 void **yfHookCtxArray,
370#if YAF_ENABLE_APPLABEL
388 pcre2_code *expression,
452 yfTCPInfo_t *tcpinfo,
478 void *yfHookFlowContext,
484 yfTCPInfo_t *tcpinfo,
496 void *yfHookFlowContext,
509 void **yfHookFlowContext,
522 void *yfHookFlowContext,
538 void *yfHookFlowContext,
539 fbSubTemplateMultiList_t *rec,
540 fbSubTemplateMultiListEntry_t *stml,
562 fbSession_t *session,
574 const char *pluginOpt,
587 const char *pluginConf,
590#if YAF_ENABLE_APPLABEL
606 void *yfHookFlowContext,
610 pcre2_code *expression,
636 uint32_t max_payload,
639 gboolean applabelmode,
640 gboolean entropymode,
641 gboolean fingerprintmode,
642 gboolean fpExportMode,
643 gboolean udp_multipkt_payload,
644 uint16_t udp_uniflow_port,
656 void *yfHookFlowContext,
668 void *yfHookFlowContext,
struct yfFlowKey_st yfFlowKey_t
A YAF flow key.
struct yfFlowVal_st yfFlowVal_t
A YAF uniflow value.
struct yfFlow_st yfFlow_t
A YAF flow.
void ypFlowPacket(void *yfHookFlowContext, yfFlow_t *flow, yfFlowVal_t *val, const uint8_t *pkt, size_t caplen, uint32_t iplen, yfTCPInfo_t *tcpinfo, yfL2Info_t *l2info)
Callback invoked by yfHookFlowPacket() to allow the plugin to process each packet as it is read.
void yfHookFlowFree(yfFlow_t *flow)
Frees all memory associated with the flow state in all of the attached plugins.
gboolean ypHookPacket(yfFlowKey_t *key, const uint8_t *pkt, size_t caplen, uint32_t iplen, yfTCPInfo_t *tcpinfo, yfL2Info_t *l2info)
Callback invoked by yfHookPacket() to allow the plugin to prevent the packet from becoming a part of ...
void yfHookValidateFlowTab(void **yfHookCtxArray, uint32_t max_payload, gboolean uniflow, gboolean silkmode, gboolean applabelmode, gboolean entropymode, gboolean fingerprintmode, gboolean fpExportMode, gboolean udp_multipkt_payload, uint16_t udp_uniflow_port)
Validation function to make sure the plugin can and should operate based on the flowtable options.
void yfHookFlowPacket(yfFlow_t *flow, yfFlowVal_t *val, const uint8_t *pkt, size_t caplen, uint32_t iplen, yfTCPInfo_t *tcpinfo, yfL2Info_t *l2info)
Similar to yfHookPacket but also given yfFlowVal_t struct for processing per flow direction.
gboolean yfHookFlowWrite(fbSubTemplateMultiList_t *rec, fbSubTemplateMultiListEntry_t *stml, yfFlow_t *flow, GError **err)
called by yfWriteFlow to add the data from all registered plugins to the outgoing IPFIX record
const struct yfHookMetaData * ypGetMetaData(void)
Callback invoked by yfHookAddNewHook() to get the version, max export bytes, and whether the plugin r...
void ypFreeLists(void *yfHookFlowContext, yfFlow_t *flow)
Callback invoked by yfHookFreeLists() after the IPFIX record has been written to allow the plugin to ...
gboolean yfHookAddNewHook(const char *hookName, const char *hookOpts, const char *hookConf, void **yfHookCtxArray, GError **err)
Adds another hook (plugin) into yaf.
void ypFlowFree(void *yfHookFlowContext, yfFlow_t *flow)
Callback invoked by yfHookFlowFree() when a flow is destroyed to allow the plugin to free the flow-sp...
uint8_t ypGetTemplateCount(void *yfHookFlowContext, yfFlow_t *flow)
Callback invoked by yfHookGetTemplateCount() when sizing the STML to allow the plugin to reserve spac...
gboolean ypFlowWrite(void *yfHookFlowContext, fbSubTemplateMultiList_t *rec, fbSubTemplateMultiListEntry_t *stml, yfFlow_t *flow, GError **err)
Callback invoked by yfHookFlowWrite() when the data is copied into an IPFIX record immediately prior ...
fbInfoElement_t * yfHookGetInfoModel(void)
Returns the IPFIX info model aggregated for all plugins.
uint8_t yfHookGetTemplateCount(yfFlow_t *flow)
Returns the amount of templates to add to the SubtemplateMultiList from all plugins hooked.
gboolean yfHookPacket(yfFlowKey_t *key, const uint8_t *pkt, size_t caplen, uint32_t iplen, yfTCPInfo_t *tcpinfo, yfL2Info_t *l2info)
Function called to do processing on each packet as it comes in.
void yfHookFreeLists(yfFlow_t *flow)
Sends control back to the plugin to free any BasicLists, SubTemplateLists, or SubTemplateMultiLists t...
void yfHookFlowAlloc(yfFlow_t *flow, void **yfHookCtxArray)
Allow plugins to allocate flow state information for each flow captured by yaf at the time of flow cr...
gboolean yfHookFlowClose(yfFlow_t *flow)
Called upon flow close to do any necessary plugin processing upon flow close.
fbInfoElement_t * ypGetInfoModel(void)
Callback invoked by yfHookGetInfoModel() to allow the plugin to add elements to the InfoModel.
void ypSetPluginOpt(const char *pluginOpt, void *yfHookCtx)
Callback invoked by yfHookAddNewHook() to provide the plugin with command line options other than the...
void ypFlowAlloc(void **yfHookFlowContext, yfFlow_t *flow, void *yfHookCtx)
Callback invoked by yfHookFlowAlloc() when a new flow is opened to allow the plugin to create a per-f...
void ypSetPluginConf(const char *pluginConf, void **yfHookCtx)
Callback invoked by yfHookAddNewHook() to provide the plugin with the name of the configuration file ...
gboolean ypFlowClose(void *yfHookFlowContext, yfFlow_t *flow)
Callback invoked by yfHookFlowClose() when a flow is closed to allow the plugin to examine the comple...
gboolean ypValidateFlowTab(void *yfHookCtx, uint32_t max_payload, gboolean uniflow, gboolean silkmode, gboolean applabelmode, gboolean entropymode, gboolean fingerprintmode, gboolean fpExportMode, gboolean udp_multipkt_payload, uint16_t udp_uniflow_port, GError **err)
Callback invoked by yfFlowTabAlloc() to allow the plugin to confirm it can be used given the flow-tab...
gboolean ypGetTemplate(fbSession_t *session, void *yfHookCtx)
Callback invoked by yfHookGetTemplate() to allow the plugin to add its templates to the export sessio...
gboolean yfHookGetTemplate(fbSession_t *session, void **yfHookCtxArray)
Gets the IPFIX info model template for the export data from all the plugins and turns it into a singl...
Flow generation interface for YAF.