#include <fixbuf/public.h>
Go to the source code of this file.
Typedefs | |
typedef struct fbElementPositions_st | fbElementPositions_t |
typedef struct fbTemplateInfoRecord_st | fbTemplateInfoRecord_t |
typedef struct fbUDPConnSpec_st | fbUDPConnSpec_t |
Macros | |
#define | FB_MSGLEN_MAX 65535 |
#define | FB_SSL_ERR_BUFSIZ 512 |
#define | IPFIX_ENTERPRISE_BIT 0x8000 |
Data Structures | |
struct | fbElementPositions_st |
struct | fbTemplate_st |
struct | fbTemplateInfoRecord_st |
struct | fbUDPConnSpec_st |
union | fbUDPConnSpec_st.peer |
fixbuf IPFIX protocol library private interface.
These calls and structures are intended for the use of libfixbuf modules, and as such are not documented or guaranteed to remain stable in any way. Applications using these calls and structures may have to be modified to track changes to this interface across minor version releases of fixbuf.
typedef struct fbUDPConnSpec_st fbUDPConnSpec_t |
An UDP Connection specifier.
These are managed by the collector. The collector creates one fbUDPConnSpec_t per "UDP session." A UDP session is defined by a unique IP and observation domain."
typedef struct fbTemplateInfoRecord_st fbTemplateInfoRecord_t |
TemplateInfo options record structure.
This is the form the fbTemplateInfo_t has on the wire.
typedef struct fbElementPositions_st fbElementPositions_t |
fbElementPositions_t supports a variable-sized array that is used to store the index positions of a particular element in Template.
#define IPFIX_ENTERPRISE_BIT 0x8000 |
define the bit in ID's that marks the Enterprise ID's
#define FB_MSGLEN_MAX 65535 |
definition of the max-size of an fbuf_t buffer, or the default/only size
#define FB_SSL_ERR_BUFSIZ 512 |
size of the buffer for OpenSSL error messages
void fBufRewind | ( | fBuf_t * | fbuf | ) |
fBufRewind
fbuf |
gboolean fBufAppendTemplate | ( | fBuf_t * | fbuf, |
uint16_t | tmpl_id, | ||
const fbTemplate_t * | tmpl, | ||
gboolean | revoked, | ||
GError ** | err | ||
) |
fBufAppendTemplate
fbuf | |
tmpl_id | |
tmpl | |
revoked | |
err |
void fBufRemoveTemplateTcplan | ( | fBuf_t * | fbuf, |
const fbTemplate_t * | tmpl | ||
) |
fBufRemoveTemplateTcplan
void fBufSetSession | ( | fBuf_t * | fbuf, |
fbSession_t * | session | ||
) |
fBufSetSession
uint16_t fBufGetExportTemplate | ( | const fBuf_t * | fbuf | ) |
fBufGetExportTemplate
uint16_t fBufGetInternalTemplate | ( | const fBuf_t * | fbuf | ) |
fBufGetInternalTemplate
uint32_t fbInfoElementHash | ( | const fbInfoElement_t * | ie | ) |
fbInfoElementHash
ie |
gboolean fbInfoElementEqual | ( | const fbInfoElement_t * | a, |
const fbInfoElement_t * | b | ||
) |
fbInfoElementEqual
a | |
b |
void fbInfoElementDebug | ( | gboolean | tmpl, |
const fbInfoElement_t * | ie | ||
) |
fbInfoElementDebug
tmpl | |
ie |
const fbInfoElement_t * fbInfoModelGetElement | ( | const fbInfoModel_t * | model, |
const fbInfoElement_t * | ex_ie | ||
) |
fbInfoModelGetElement
model | |
ex_ie |
gboolean fbInfoElementCopyToTemplate | ( | fbInfoModel_t * | model, |
const fbInfoElement_t * | ex_ie, | ||
fbTemplateField_t * | tmpl_ie, | ||
GError ** | err | ||
) |
fbInfoElementCopyToTemplate
Finds ex_ie
in the info model (using its element id and PEN) and updates tmpl_ie
to point at it using the length specified in ex_ie
. If ex_ie
is not in the information model, adds it as an alien element.
Returns TRUE unless the length in ex_ie
is invalid for the element's type.
This is only to be used when reading templates from a stream.
model | |
ex_ie | |
tmpl_ie | |
err |
gboolean fbInfoElementCopyToTemplateByName | ( | const fbInfoModel_t * | model, |
const fbInfoElementSpec_t * | spec, | ||
fbTemplateField_t * | tmpl_ie, | ||
GError ** | err | ||
) |
fbInfoElementCopyToTemplateByName
Finds the element named spec->name
in the info model and updates tmpl_ie
to point at it using the length spec->len_override
.
Returns FALSE if the info model does not contain an element named spec->name
. Also returns FALSE if spec->len_override
is invalid for the element's type.
model | |
spec | |
tmpl_ie | |
err |
gboolean fbInfoElementCopyToTemplateByIdent | ( | const fbInfoModel_t * | model, |
const fbInfoElementSpecId_t * | spec, | ||
fbTemplateField_t * | tmpl_ie, | ||
GError ** | err | ||
) |
fbInfoElementCopyToTemplateByIdent
Finds the element have the specified spec->enterprise_id
and spec->element_id
in the info model and updates tmpl_ie
to point at it using the length spec->len_override
.
Returns FALSE if the info model does not contain an element with the specified ID pair. Also returns FALSE if spec->len_override
is invalid for the element's type.
model | |
spec | |
tmpl_ie | |
err |
const fbInfoElement_t * fbInfoModelAddAlienElement | ( | fbInfoModel_t * | model, |
const fbInfoElement_t * | ex_ie | ||
) |
fbInfoModelAddAlienElement
model | |
ex_ie |
fbTemplate_t * fbInfoElementAllocTypeTemplate2 | ( | fbInfoModel_t * | model, |
gboolean | internal, | ||
GError ** | err | ||
) |
fbInfoElementAllocTypeTemplate2
model | |
internal | |
err |
gboolean fbInfoModelIsTemplateElementType | ( | const fbTemplate_t * | tmpl | ) |
fbInfoModelIsTemplateElementType
tmpl |
void fbTemplateRetain | ( | fbTemplate_t * | tmpl | ) |
fbTemplateRetain
tmpl |
void fbTemplateRelease | ( | fbTemplate_t * | tmpl | ) |
fbTemplateRelease
tmpl |
void fbTemplateDebug | ( | const char * | label, |
uint16_t | tid, | ||
const fbTemplate_t * | tmpl | ||
) |
fbTemplateDebug
label | |
tid | |
tmpl |
fbTemplateInfo_t * fbTemplateInfoCreateFromRecord | ( | const fbTemplateInfoRecord_t * | mdRec, |
unsigned int | mdRecVersion, | ||
GError ** | err | ||
) |
fbTemplateInfoCreateFromRecord
Allocates and initializes a TemplateInfo from data read from a collector.
mdRec | |
mdRecVersion | |
err |
void fbTemplateInfoFillRecord | ( | const fbTemplateInfo_t * | mdInfo, |
fbTemplateInfoRecord_t * | mdRec, | ||
const fbTemplate_t * | stlTemplate, | ||
uint16_t | stlTid | ||
) |
fbTemplateInfoFillRecord
mdInfo | |
mdRec | |
stlTemplate | |
stlTid |
void fbTemplateInfoSetTemplateId | ( | fbTemplateInfo_t * | mdInfo, |
uint16_t | tid | ||
) |
fbTemplateInfoSetTemplateId
mdInfo | |
tid |
void fbTemplateInfoRecordInit | ( | fbTemplateInfoRecord_t * | mdRec | ) |
fbTemplateInfoRecordInit
Initalizes a fbTemplateInfoRecord_t
mdRec |
void fbTemplateInfoRecordClear | ( | fbTemplateInfoRecord_t * | mdRec | ) |
Clears any list data used by a fbTemplateInfoRecord_t.
mdRec |
gboolean fbTemplateAllocTemplateInfoTemplates | ( | fbInfoModel_t * | model, |
fbTemplate_t ** | tmplinfo_v3_tmpl, | ||
fbTemplate_t ** | bl_ie_metadata_tmpl, | ||
GError ** | err | ||
) |
Allocates new Templates to describe records that hold TemplateInfo.
model | The info model |
tmplinfo_v3_tmpl | If non-NULL, its referent is set to the internal template that matches metadata records created by fixbuf v3.0.0 |
bl_ie_metadata_tmpl | If non-NULL, its referent is set to the template that matches basicList-contents records used the subTemplateList on the metadata record created by fixbuf v3.0.0 |
err |
fbNewTemplateCallback_fn fbSessionGetNewTemplateCallback | ( | const fbSession_t * | session | ) |
Returns the callback function for a given session.
session |
void * fbSessionGetNewTemplateCallbackAppCtx | ( | const fbSession_t * | session | ) |
Returns the callback function's application context for a given session.
session |
fbSession_t * fbSessionClone | ( | const fbSession_t * | base | ) |
fbSessionClone
base |
uint32_t fbSessionGetSequence | ( | const fbSession_t * | session | ) |
fbSessionGetSequence
session |
void fbSessionSetSequence | ( | fbSession_t * | session, |
uint32_t | sequence | ||
) |
fbSessionSetSequence
session | |
sequence |
void fbSessionSetTemplateBuffer | ( | fbSession_t * | session, |
fBuf_t * | fbuf | ||
) |
fbSessionSetTemplateBuffer
session | |
fbuf |
gboolean fbSessionGetTemplatePair | ( | const fbSession_t * | session, |
uint16_t | ext_tid, | ||
uint16_t * | int_tid, | ||
fbTemplate_t ** | ext_tmpl, | ||
fbTemplate_t ** | int_tmpl, | ||
GError ** | err | ||
) |
Checks for a template pair and finds the associated external and internal templates.
Acts like fbSessionLookupTemplatePair() when ext_tmpl
and int_tmpl
are NULL. Otherwise:
Sets the referent of ext_tmpl
to the external template associated with ext_tid
. If no external template exists, sets the referents of all output parameters to zero or NULL and returns FALSE.
If no template pairs are defined or they are disabled (fbSessionSetTemplatePairsDisabled()), sets the referents of int_tmpl
and int_tid
to the external values and returns TRUE.
If there is no matching internal ID paired with ext_tid
or it was explicitly disabled, sets the referents of int_tid
and int_tmpl
to 0 and NULL and returns TRUE.
If there is a template pair, checks for an interal template having the paired ID. If found, sets the referent of int_tmpl
to the value, sets the referent of int_tid
to the paired ID, and returns TRUE.
If no internal template having the paired ID exists and the paired ID equals ext_tid
, sets the referents of int_tmpl
and int_tid
to the external values and returns TRUE.
Otherwise, sets an error and returns FALSE.
session | |
ext_tid | |
int_tid | |
ext_tmpl | |
int_tmpl | |
err |
void fbSessionSetTemplatePairsDisabled | ( | fbSession_t * | session, |
gboolean | disabled | ||
) |
Sets the flag on a Session that says whether the template-pairs lookup table should be ignored.
If disabled
is TRUE, the template-pairs table is ignored and fbSessionLookupTemplatePair() always returns the template ID it is given. If disabled
is FALSE, the template-pairs table is used.
session | |
disabled |
void fbSessionSetCollector | ( | fbSession_t * | session, |
fbCollector_t * | collector | ||
) |
fbSessionSetCollector
session | |
collector |
void fbSessionClearIntTmplTableFlag | ( | fbSession_t * | session | ) |
fbSessionClearIntTmplTableFlag
session |
void fbSessionClearExtTmplTableFlag | ( | fbSession_t * | session | ) |
fbSessionClearExtTmplTableFlag
session |
int fbSessionIntTmplTableFlagIsSet | ( | fbSession_t * | session | ) |
fbSessionIntTmplTableFlagIsSet
session |
int fbSessionExtTmplTableFlagIsSet | ( | fbSession_t * | session | ) |
fbSessionExtTmplTableFlagIsSet
session |
void fbSessionSaveTemplateInfo | ( | fbSession_t * | session, |
fbTemplateInfo_t * | mdInfo | ||
) |
fbSessionSaveTemplateInfo
session | |
mdInfo |
gboolean fbSessionAddInternalRfc5610Template | ( | fbSession_t * | session, |
GError ** | err | ||
) |
fbSessionAddInternalRfc5610Template
Adds an internal template for reading RFC5610 records (Info Element Type definitions) unless it already exists. Use fbSessionGetInternalRfc5610Template() to get this template.
session | |
err |
fbTemplate_t * fbSessionGetInternalRfc5610Template | ( | fbSession_t * | session, |
uint16_t * | tid, | ||
GError ** | err | ||
) |
fbSessionGetInternalRfc5610Template
Gets the internal template for reading RFC5610 records (InfoElement Type defintions) set by fbSessionAddInternalRfc5610Template(). If tid
is not NULL, it referent is set to the Template ID.
session | |
tid | |
err |
gboolean fbSessionAddInternalTemplateInfoTemplate | ( | fbSession_t * | session, |
GError ** | err | ||
) |
fbSessionAddInternalTemplateInfoTemplate
Adds an internal template for reading TemplateInfo records unless it already exists. Use fbSessionGetInternalTemplateInfoTemplate() to get this Template.
Does not allocate an internal template for the STL that the fbTemplateInfo_t contains since it is not needed: When decoding the TemplateInfo, any existing template-pairs are ignored and the external template is used as the internal template.
session | |
err |
fbTemplate_t * fbSessionGetInternalTemplateInfoTemplate | ( | fbSession_t * | session, |
uint16_t * | tid, | ||
GError ** | err | ||
) |
fbSessionGetInternalTemplateInfoTemplate
Gets the internal template for reading TemplateInfo records. If tid
is not NULL, its referent is to the Template ID. This Template is created by fbSessionAddInternalTemplateInfoTemplate().
session | |
tid | |
err |
gboolean fbConnSpecLookupAI | ( | fbConnSpec_t * | spec, |
gboolean | passive, | ||
GError ** | err | ||
) |
fbConnSpecLookupAI
spec | |
passive | |
err |
gboolean fbConnSpecInitTLS | ( | fbConnSpec_t * | spec, |
gboolean | passive, | ||
GError ** | err | ||
) |
fbConnSpecInitTLS
spec | |
passive | |
err |
fbConnSpec_t * fbConnSpecCopy | ( | const fbConnSpec_t * | spec | ) |
fbConnSpecCopy
spec |
void fbConnSpecFree | ( | fbConnSpec_t * | spec | ) |
fbConnSpecFree
spec |
uint16_t fbExporterGetMTU | ( | const fbExporter_t * | exporter | ) |
fbExporterGetMTU
exporter |
gboolean fbExportMessage | ( | fbExporter_t * | exporter, |
uint8_t * | msgbase, | ||
size_t | msglen, | ||
GError ** | err | ||
) |
fbExportMessage
exporter | |
msgbase | |
msglen | |
err |
void fbExporterFree | ( | fbExporter_t * | exporter | ) |
fbExporterFree
exporter |
void fbCollectorRemoveListenerLastBuf | ( | fBuf_t * | fbuf, |
fbCollector_t * | collector | ||
) |
fbCollectorRemoveListenerLastBuf
fbuf | |
collector |
fbCollector_t * fbCollectorAllocSocket | ( | fbListener_t * | listener, |
void * | ctx, | ||
int | fd, | ||
struct sockaddr * | peer, | ||
size_t | peerlen, | ||
GError ** | err | ||
) |
fbCollectorAllocSocket
listener | |
ctx | |
fd | |
peer | |
peerlen | |
err |
fbCollector_t * fbCollectorAllocTLS | ( | fbListener_t * | listener, |
void * | ctx, | ||
int | fd, | ||
struct sockaddr * | peer, | ||
size_t | peerlen, | ||
GError ** | err | ||
) |
fbCollectorAllocTLS
listener | |
ctx | |
fd | |
peer | |
peerlen | |
err |
gboolean fbCollectMessage | ( | fbCollector_t * | collector, |
uint8_t * | msgbase, | ||
size_t * | msglen, | ||
GError ** | err | ||
) |
fbCollectMessage
collector | |
msgbase | |
msglen | |
err |
int fbCollectorGetFD | ( | const fbCollector_t * | collector | ) |
fbCollectorGetFD
collector |
void fbCollectorSetFD | ( | fbCollector_t * | collector, |
int | fd | ||
) |
fbCollectorSetFD
void fbCollectorFree | ( | fbCollector_t * | collector | ) |
fbCollectorFree
collector |
gboolean fbCollectorHasTranslator | ( | fbCollector_t * | collector | ) |
fbCollectorHasTranslator
collector |
gboolean fbCollectMessageBuffer | ( | uint8_t * | hdr, |
size_t | b_len, | ||
size_t * | m_len, | ||
GError ** | err | ||
) |
fbCollectMessageBuffer
used for applications that manage their own connection, file reading, etc.
hdr | |
b_len | |
m_len | |
err |
void fbListenerAppFree | ( | fbListener_t * | listener, |
void * | ctx | ||
) |
fbListenerAppFree
listener | |
ctx |
void fbListenerRemoveLastBuf | ( | fBuf_t * | fbuf, |
fbListener_t * | listener | ||
) |
fbListenerRemoveLastBuf
fbuf | |
listener |
void fbListenerRemove | ( | fbListener_t * | listener, |
int | fd | ||
) |
fbListenerRemove
listener | |
fd |
fbConnSpec_t * fbListenerGetConnSpec | ( | const fbListener_t * | listener | ) |
fbListenerGetConnSpec
listener |
void fbCollectorInterruptSocket | ( | fbCollector_t * | collector | ) |
Interrupt the socket for a given collector to stop it from reading more data.
collector | pointer to the collector to stop reading from |
gboolean fbListenerCallAppInit | ( | fbListener_t * | listener, |
fbUDPConnSpec_t * | spec, | ||
GError ** | err | ||
) |
call appinit from UDP
fbSession_t * fbListenerSetPeerSession | ( | fbListener_t * | listener, |
fbSession_t * | session | ||
) |
Set the session on the fbuf and listener.
struct fbElementPositions_st |
struct fbTemplate_st |
An IPFIX template or options template structure.
Part of the private interface. Applications should use the fbTemplate calls defined in public.h to manipulate templates instead of accessing this structure directly.
Data Fields | ||
---|---|---|
fbInfoModel_t * | model | Information model (for looking up information elements by spec) |
fbTemplateField_t ** | ie_ary | Ordered array of pointers to information elements in this template. |
GHashTable * | indices | Map of information element to index in ie_ary. |
uint16_t * | off_cache |
Field offset cache. For internal use by the transcoder. |
int | ref_count | Reference count. |
uint16_t | ie_count | Count of information elements in template. |
uint16_t | scope_count |
Count of scope information elements in template. If scope_count is greater than 0, this template is an options template. |
uint16_t | ie_len |
Total length of information elements in records described by this template. If the is_varlen flag is set, this represents the minimum length of the information elements in the record (i.e. with each variable length IE's length set to 0). |
uint16_t | ie_internal_len |
Total length required to store this template in memory. Uses sizeof(fbVarfield_t), sizeof(fbBasicList_t), etc instead of 0 as done with ie_len. |
uint16_t | tmpl_len |
Total length of the template record or options template record defining this template. Used during template input and output. |
gboolean | is_varlen | TRUE if this template contains any variable length IEs. |
gboolean | contains_list | TRUE if this template contains any structured data (lists). |
gboolean | active | TRUE if this template has been activated (is no longer mutable). |
gboolean | default_length | TRUE if any field was created using an fbInfoElementSpec_t with a defaulted length. |
void * | tmpl_ctx |
Template context. Created and owned by the application when the listener calls the fbNewTemplateCallback_fn. |
fbTemplateCtxFree_fn | ctx_free | Callback to free the ctx pointer when template is freed. |
void * | app_ctx | The application's Context pointer for the ctx_free function. |
fbElementPositions_t | bl | Index positions of the FB_BASIC_LIST elements. |
fbElementPositions_t | stl | Index positions of the FB_SUB_TMPL_LIST elements. |
fbElementPositions_t | stml | Index positions of the FB_SUB_TMPL_MULTI_LIST elements. |
struct fbTemplateInfoRecord_st |
TemplateInfo options record structure.
This is the form the fbTemplateInfo_t has on the wire.
Data Fields | ||
---|---|---|
uint16_t | tid | Template ID. |
uint16_t | appLabel | |
uint16_t | parentTid | |
uint8_t | padding[2] | |
fbVarfield_t | name | Template name. |
fbVarfield_t | description | Template description (optional) |
fbSubTemplateList_t | blInfoList | List of PEN, IE num pairs. |
struct fbUDPConnSpec_st |
An UDP Connection specifier.
These are managed by the collector. The collector creates one fbUDPConnSpec_t per "UDP session." A UDP session is defined by a unique IP and observation domain."
Data Fields | ||
---|---|---|
fbSession_t * | session | pointer to the session for this peer address |
void * | ctx |
application context. Created and owned by the app |
union fbUDPConnSpec_st.peer | peer | key to this conn spec |
size_t | peerlen | size of peer |
struct fbUDPConnSpec_st * | next | link to next one in list |
struct fbUDPConnSpec_st * | prev | doubly linked to timeout faster |
time_t | last_seen | last seen time |
uint32_t | obdomain | with peer address this is the key |
gboolean | reject | reject flag |