42 #ifndef _FB_PRIVATE_H_ 43 #define _FB_PRIVATE_H_ 64 #define IPFIX_ENTERPRISE_BIT 0x8000 68 #define FB_MSGLEN_MAX 65535 77 char name[MAX_GROUP_NAME];
81 #define FB_SPREAD_NUM_GROUPS 16 84 #define FB_SPREAD_MTU 8192 103 int num_groups_to_send;
107 char privgroup[MAX_GROUP_NAME + 2];
115 char recv_privgroup[MAX_GROUP_NAME + 2];
148 struct sockaddr_in ip4;
149 struct sockaddr_in6 ip6;
166 #ifdef DEFINE_TEMPLATE_METADATA_SPEC 172 {
"templateId", 2, 0 },
404 uint16_t len_override,
786 struct sockaddr *peer,
804 struct sockaddr *peer,
gboolean fbCollectMessage(fbCollector_t *collector, uint8_t *msgbase, size_t *msglen, GError **err)
fbCollectMessage
void fbTemplateRelease(fbTemplate_t *tmpl)
fbTemplateRelease
fbSession_t * fbListenerSetPeerSession(fbListener_t *listener, fbSession_t *session)
Set the session on the fbuf and listener.
const char * fbConnSpreadError(int err)
fbConnSpreadError
size_t peerlen
size of peer
Definition: private.h:152
void fbCollectorInterruptSocket(fbCollector_t *collector)
Interrupt the socket for a given collector to stop it from reading more data.
uint16_t ie_count
Count of information elements in template.
Definition: private.h:203
gboolean fbInfoElementCopyToTemplateByName(fbInfoModel_t *model, const char *name, uint16_t len_override, fbInfoElement_t *tmpl_ie)
fbInfoElementCopyToTemplateByName
#define FB_IESPEC_NULL
Convenience macro defining a null information element specification initializer to terminate a consta...
Definition: public.h:1603
struct fbTemplateOptRec_st fbTemplateOptRec_t
Template metadata options record structure.
time_t last_seen
last seen time
Definition: private.h:158
int fbSessionIntTmplTableFlagIsSet(fbSession_t *session)
fbSessionIntTmplTableFlagIsSet
const fbInfoElement_t * fbInfoModelGetElement(fbInfoModel_t *model, fbInfoElement_t *ex_ie)
fbInfoModelGetElement
fbVarfield_t template_name
List of PEN, IE num pairs.
Definition: private.h:185
An IPFIX template or options template structure.
Definition: private.h:197
struct fbCollector_st fbCollector_t
IPFIX Collecting Process endpoint.
Definition: public.h:1750
struct fbExporter_st fbExporter_t
IPFIX Exporting Process endpoint.
Definition: public.h:1741
int fbCollectorGetFD(fbCollector_t *collector)
fbCollectorGetFD
struct fbSession_st fbSession_t
An IPFIX Transport Session state container.
Definition: public.h:1640
fbCollector_t * fbCollectorAllocSocket(fbListener_t *listener, void *ctx, int fd, struct sockaddr *peer, size_t peerlen)
fbCollectorAllocSocket
uint16_t * off_cache
Field offset cache.
Definition: private.h:234
struct fbListener_st fbListener_t
IPFIX Collecting Process session listener.
Definition: public.h:1758
int ref_count
Reference count.
Definition: private.h:201
void fBufSetExportGroups(fBuf_t *fbuf, char **groups, int num_groups, GError **err)
fBufSetExportGroups
int fbSessionExtTmplTableFlagIsSet(fbSession_t *session)
fbSessionExtTmplTableFlagIsSet
uint32_t fbInfoElementHash(fbInfoElement_t *ie)
fbInfoElementHash
struct fbUDPConnSpec_st * next
link to next one in list
Definition: private.h:154
void fbSessionSetGroupParams(fbSession_t *session, sp_groupname_t *groups, int num_groups)
fbSessionSetGroupParams
gboolean fbListenerCallAppInit(fbListener_t *listener, fbUDPConnSpec_t *spec, GError **err)
call appinit from UDP
gboolean active
TRUE if this template has been activated (is no longer mutable)
Definition: private.h:236
pthread_mutex_t write_lock
Spread write lock.
Definition: private.h:109
gboolean fBufAppendTemplate(fBuf_t *fbuf, uint16_t tmpl_id, fbTemplate_t *tmpl, gboolean revoked, GError **err)
fBufAppendTemplate
uint16_t fBufGetExportTemplate(fBuf_t *fbuf)
fBufGetExportTemplate
void fbCollectorRemoveListenerLastBuf(fBuf_t *fbuf, fbCollector_t *collector)
fbCollectorRemoveListenerLastBuf
gboolean fbConnSpecInitTLS(fbConnSpec_t *spec, gboolean passive, GError **err)
fbConnSpecInitTLS
Connection specifier.
Definition: public.h:1676
void(* fbTemplateCtxFree_fn)(void *tmpl_ctx, void *app_ctx)
A callback function that is called when a template is freed.
Definition: public.h:1806
fbInfoElement_t ** ie_ary
Ordered array of pointers to information elements in this template.
Definition: private.h:230
unsigned int fbSessionGetGroupOffset(fbSession_t *session, char *group)
fbSessionGetGroupOffset
Fixbuf IPFIX protocol library public interface.
void fbTemplateRetain(fbTemplate_t *tmpl)
fbTemplateRetain
gboolean fbCollectorTestGroupMembership(fbCollector_t *collector, int group_offset)
fbCollectorTestGroupMembership
uint16_t ie_internal_len
Total length required to store this template in memory.
Definition: private.h:221
void fbListenerRemove(fbListener_t *listener, int fd)
fbListenerRemove
gboolean is_varlen
Set to TRUE if this template contains any variable length IEs.
Definition: private.h:228
Spread connection parameters.
Definition: public.h:1722
gboolean fbConnSpecLookupAI(fbConnSpec_t *spec, gboolean passive, GError **err)
fbConnSpecLookupAI
gboolean fbExportMessage(fbExporter_t *exporter, uint8_t *msgbase, size_t msglen, GError **err)
fbExportMessage
uint16_t ie_len
Total length of information elements in records described by this template.
Definition: private.h:215
fbSession_t * session
pointer to the session, this MUST be set to a valid session before the spec is passed to fbExporterAl...
Definition: private.h:92
#define FB_IE_VARLEN
Information element length constant for variable-length IE.
Definition: public.h:1334
void * tmpl_ctx
Template context.
Definition: private.h:248
int recv_max_groups
max size of group name array
Definition: private.h:121
mailbox mbox
the mailbox for the connection
Definition: private.h:105
An UDP Connection specifier.
Definition: private.h:140
void fbTemplateDebug(const char *label, uint16_t tid, fbTemplate_t *tmpl)
fbTemplateDebug
struct fbUDPConnSpec_st * prev
doubly linked to timeout faster
Definition: private.h:156
void fbCollectorFree(fbCollector_t *collector)
fbCollectorFree
int num_groups
number of groups in groups
Definition: private.h:100
A variable-length field value.
Definition: public.h:1076
A single IPFIX Information Element definition.
Definition: public.h:1496
fbSession_t * fbSessionClone(fbSession_t *base)
fbSessionClone
char * daemon
pointer to the daemon host address, in Spread format.
Definition: private.h:95
void * fbSessionNewTemplateCallbackAppCtx(fbSession_t *session)
Return the callback function's application context for a given session.
uint32_t obdomain
with peer address this is the key
Definition: private.h:160
struct fbInfoModel_st fbInfoModel_t
An IPFIX information model.
Definition: public.h:1093
GError * recv_err
GError for thread errors, set by receiver, read by main.
Definition: private.h:117
gboolean fbCollectorHasTranslator(fbCollector_t *collector)
fbCollectorHasTranslator
void fbSessionSetGroup(fbSession_t *session, char *group)
fbSessionSetGroup
void fbListenerAppFree(fbListener_t *listener, void *ctx)
fbListenerAppFree
void fbSessionClearIntTmplTableFlag(fbSession_t *session)
fbSessionClearIntTmplTableFlag
void fbConnSpecFree(fbConnSpec_t *spec)
fbConnSpecFree
void * ctx
application context.
Definition: private.h:144
void fBufRewind(fBuf_t *fbuf)
fBufRewind
void fbConnSpreadFree(fbSpreadSpec_t *spec)
fbConnSpreadFree
fbInfoModel_t * model
Information model (for looking up information elements by spec)
Definition: private.h:199
void fbListenerRemoveLastBuf(fBuf_t *fbuf, fbListener_t *listener)
fbListenerRemoveLastBuf
GHashTable * indices
Map of information element to index in ie_ary.
Definition: private.h:232
mailbox recv_mbox
the receiver's mailbox
Definition: private.h:113
void fbSessionSetTemplateBuffer(fbSession_t *session, fBuf_t *fbuf)
fbSessionSetTemplateBuffer
sp_groupname_t * recv_groups
groups array for SP_receive
Definition: private.h:125
gboolean reject
reject flag
Definition: private.h:162
void fbExporterFree(fbExporter_t *exporter)
fbExporterFree
Template metadata options record structure.
Definition: private.h:181
gboolean fbCollectMessageBuffer(uint8_t *hdr, size_t b_len, size_t *m_len, GError **err)
fbCollectMessageBuffer
gboolean fbInfoElementEqual(const fbInfoElement_t *a, const fbInfoElement_t *b)
fbInfoElementEqual
gboolean fbExporterCheckGroups(fbExporter_t *exporter, char **groups, int num_groups)
fbExporterCheckGroups
void fbCollectorSetFD(fbCollector_t *collector, int fd)
fbCollectorSetFD
int recv_exit
flag to tell the thread to exit
Definition: private.h:119
gboolean fbInfoElementCopyToTemplate(fbInfoModel_t *model, fbInfoElement_t *ex_ie, fbInfoElement_t *tmpl_ie)
fbInfoElementCopyToTemplate
char * recv_mess
message buffer for receive
Definition: private.h:129
sp_groupname_t * groups_to_send
groups to send to
Definition: private.h:102
uint16_t tmpl_len
Total length of the template record or options template record defining this template.
Definition: private.h:226
uint32_t fbSessionGetSequence(fbSession_t *session)
fbSessionGetSequence
fbTemplateCtxFree_fn ctx_free
Callback to free the ctx pointer when template is freed.
Definition: private.h:252
uint16_t fbExporterGetMTU(fbExporter_t *exporter)
fbExporterGetMTU
fbNewTemplateCallback_fn fbSessionNewTemplateCallback(fbSession_t *session)
Returns the callback function for a given session.
sp_groupname_t * groups
pointer to array of group names, must have at least one, and must be null term array ...
Definition: private.h:98
fbConnSpec_t * fbConnSpecCopy(fbConnSpec_t *spec)
fbConnSpecCopy
fbSession_t * session
pointer to the session for this peer address
Definition: private.h:142
void fbSessionClearExtTmplTableFlag(fbSession_t *session)
fbSessionClearExtTmplTableFlag
fbVarfield_t template_description
Template description (optional)
Definition: private.h:187
void fbInfoElementDebug(gboolean tmpl, fbInfoElement_t *ie)
fbInfoElementDebug
struct sp_groupname_st sp_groupname_t
sp_groupname_t
uint16_t template_id
Template ID.
Definition: private.h:189
void * app_ctx
The application's Context pointer for the ctx_free function.
Definition: private.h:256
fbCollector_t * fbCollectorAllocTLS(fbListener_t *listener, void *ctx, int fd, struct sockaddr *peer, size_t peerlen, GError **err)
fbCollectorAllocTLS
void fbSessionSetCollector(fbSession_t *session, fbCollector_t *collector)
fbSessionSetCollector
int recv_num_groups
actual size of group name array
Definition: private.h:123
struct fBuf_st fBuf_t
An IPFIX message buffer.
Definition: public.h:1068
pthread_t recv_thread
the receiver thread
Definition: private.h:111
void(* fbNewTemplateCallback_fn)(fbSession_t *session, uint16_t tid, fbTemplate_t *tmpl, void *app_ctx, void **tmpl_ctx, fbTemplateCtxFree_fn *tmpl_ctx_free_fn)
A callback function that will be called when the session receives a new external template.
Definition: public.h:1833
void fbTemplateFree(fbTemplate_t *tmpl)
fbTemplateFree
fbSpreadSpec_t
Definition: private.h:89
A single IPFIX Information Element specification.
Definition: public.h:1610
void fbExporterSetGroupsToSend(fbExporter_t *exporter, char **groups, int num_groups)
fbExporterSetGroupToSend
const fbInfoElement_t * fbInfoModelAddAlienElement(fbInfoModel_t *model, fbInfoElement_t *ex_ie)
fbInfoModelAddAlienElement
uint16_t fBufGetInternalTemplate(fBuf_t *fbuf)
fBufGetInternalTemplate
fbSpreadSpec_t * fbConnSpreadCopy(fbSpreadParams_t *spec)
fbConnSpreadCopy
gboolean default_length
TRUE if any field was created using an fbInfoElementSpec_t with a defaulted length.
Definition: private.h:241
void fbSessionSetPrivateGroup(fbSession_t *session, char *group, char *privgroup)
fbSessionSetPrivateGroup
int recv_max
length of message buffer
Definition: private.h:127
fbConnSpec_t * fbListenerGetConnSpec(fbListener_t *listener)
fbListenerGetConnSpec
struct fbSpreadSpec_st fbSpreadSpec_t
fbSpreadSpec_t
void fBufSetSession(fBuf_t *fbuf, fbSession_t *session)
fBufSetSession
uint16_t scope_count
Count of scope information elements in template.
Definition: private.h:208
sp_groupname_t
Definition: private.h:75
struct fbUDPConnSpec_st fbUDPConnSpec_t
An UDP Connection specifier.
void fbSessionSetSequence(fbSession_t *session, uint32_t sequence)
fbSessionSetSequence
void fBufRemoveTemplateTcplan(fBuf_t *fbuf, fbTemplate_t *tmpl)
fBufRemoveTemplateTcplan
unsigned int fbSessionGetGroup(fbSession_t *session)
fbSessionGetGroup