42 #ifndef _FB_PRIVATE_H_
43 #define _FB_PRIVATE_H_
64 #define IPFIX_ENTERPRISE_BIT 0x8000
68 #define FB_MSGLEN_MAX 65535
72 typedef struct sp_groupname_st
74 char name[MAX_GROUP_NAME];
77 #define FB_SPREAD_NUM_GROUPS 16
78 #define FB_SPREAD_MTU 8192
80 typedef struct fbSpreadSpec_st {
88 sp_groupname_t *groups;
92 sp_groupname_t *groups_to_send;
93 int num_groups_to_send;
97 char privgroup[MAX_GROUP_NAME + 2];
99 pthread_mutex_t write_lock;
101 pthread_t recv_thread;
105 char recv_privgroup[MAX_GROUP_NAME + 2];
115 sp_groupname_t *recv_groups;
138 struct sockaddr_in ip4;
139 struct sockaddr_in6 ip6;
156 #ifdef DEFINE_TEMPLATE_METADATA_SPEC
162 {
"templateId", 2, 0 },
283 void fBufSetExportGroups(
394 uint16_t len_override,
528 void fbSessionSetGroupParams(
530 sp_groupname_t *groups,
538 void fbSessionSetPrivateGroup(
547 void fbSessionSetGroup(
555 unsigned int fbSessionGetGroupOffset(
563 unsigned int fbSessionGetGroup(
567 void fbSessionClearIntTmplTableFlag(
570 void fbSessionClearExtTmplTableFlag(
573 int fbSessionIntTmplTableFlagIsSet(
576 int fbSessionExtTmplTableFlagIsSet(
632 fbSpreadSpec_t *fbConnSpreadCopy(
633 fbSpreadParams_t *spec);
642 void fbConnSpreadFree(
643 fbSpreadSpec_t *spec);
653 const char * fbConnSpreadError(
666 void fbExporterSetGroupsToSend(
681 gboolean fbExporterCheckGroups(
749 struct sockaddr *peer,
767 struct sockaddr *peer,
855 gboolean fbCollectorTestGroupMembership(
gboolean reject
reject flag
Definition: private.h:152
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.
fbVarfield_t template_description
Template description (optional)
Definition: private.h:177
void fbCollectorInterruptSocket(fbCollector_t *collector)
Interrupt the socket for a given collector to stop it from reading more data.
gboolean fbInfoElementCopyToTemplateByName(fbInfoModel_t *model, const char *name, uint16_t len_override, fbInfoElement_t *tmpl_ie)
fbInfoElementCopyToTemplateByName
struct fbTemplateOptRec_st fbTemplateOptRec_t
Template metadata options record structure.
A variable-length field value.
Definition: public.c:1059
void * ctx
application context.
Definition: private.h:134
struct fBuf_st fBuf_t
An IPFIX message buffer.
Definition: public.c:1051
struct fbUDPConnSpec_st * prev
doubly linked to timeout faster
Definition: private.h:146
struct fbCollector_st fbCollector_t
IPFIX Collecting Process endpoint.
Definition: public.c:1737
const fbInfoElement_t * fbInfoModelGetElement(fbInfoModel_t *model, fbInfoElement_t *ex_ie)
fbInfoModelGetElement
struct fbInfoModel_st fbInfoModel_t
An IPFIX information model.
Definition: public.c:1077
size_t peerlen
size of peer
Definition: private.h:142
int fbCollectorGetFD(fbCollector_t *collector)
fbCollectorGetFD
fbCollector_t * fbCollectorAllocSocket(fbListener_t *listener, void *ctx, int fd, struct sockaddr *peer, size_t peerlen)
fbCollectorAllocSocket
struct fbExporter_st fbExporter_t
IPFIX Exporting Process endpoint.
Definition: public.c:1727
struct fbListener_st fbListener_t
IPFIX Collecting Process session listener.
Definition: public.c:1746
uint32_t fbInfoElementHash(fbInfoElement_t *ie)
fbInfoElementHash
gboolean active
TRUE if this template has been activated (is no longer mutable)
Definition: private.h:226
gboolean fbListenerCallAppInit(fbListener_t *listener, fbUDPConnSpec_t *spec, GError **err)
call appinit from UDP
time_t last_seen
last seen time
Definition: private.h:148
uint16_t template_id
Template ID.
Definition: private.h:179
uint16_t ie_count
Count of information elements in template.
Definition: private.h:193
fbInfoModel_t * model
Information model (for looking up information elements by spec)
Definition: private.h:189
gboolean fBufAppendTemplate(fBuf_t *fbuf, uint16_t tmpl_id, fbTemplate_t *tmpl, gboolean revoked, GError **err)
fBufAppendTemplate
An UDP Connection specifier.
Definition: private.h:130
uint16_t fBufGetExportTemplate(fBuf_t *fbuf)
fBufGetExportTemplate
void fbCollectorRemoveListenerLastBuf(fBuf_t *fbuf, fbCollector_t *collector)
fbCollectorRemoveListenerLastBuf
gboolean default_length
TRUE if any field was created using an fbInfoElementSpec_t with a defaulted length.
Definition: private.h:231
Template metadata options record structure.
Definition: private.h:171
gboolean fbConnSpecInitTLS(fbConnSpec_t *spec, gboolean passive, GError **err)
fbConnSpecInitTLS
uint16_t ie_internal_len
Total length required to store this template in a data structure.
Definition: private.h:211
struct fbUDPConnSpec_st * next
link to next one in list
Definition: private.h:144
Fixbuf IPFIX protocol library public interface.
void fbTemplateRetain(fbTemplate_t *tmpl)
fbTemplateRetain
void fbListenerRemove(fbListener_t *listener, int fd)
fbListenerRemove
gboolean fbConnSpecLookupAI(fbConnSpec_t *spec, gboolean passive, GError **err)
fbConnSpecLookupAI
gboolean fbExportMessage(fbExporter_t *exporter, uint8_t *msgbase, size_t msglen, GError **err)
fbExportMessage
int ref_count
Reference count.
Definition: private.h:191
uint32_t obdomain
with peer address this is the key
Definition: private.h:150
void fbTemplateDebug(const char *label, uint16_t tid, fbTemplate_t *tmpl)
fbTemplateDebug
void(* fbTemplateCtxFree_fn)(void *tmpl_ctx, void *app_ctx)
A callback function that is called when a template is freed.
Definition: public.c:1801
void fbCollectorFree(fbCollector_t *collector)
fbCollectorFree
fbSession_t * fbSessionClone(fbSession_t *base)
fbSessionClone
void * fbSessionNewTemplateCallbackAppCtx(fbSession_t *session)
Return the callback function's application context for a given session.
uint16_t tmpl_len
Total length of the template record or options template record defining this template.
Definition: private.h:216
gboolean fbCollectorHasTranslator(fbCollector_t *collector)
fbCollectorHasTranslator
void fbListenerAppFree(fbListener_t *listener, void *ctx)
fbListenerAppFree
uint16_t ie_len
Total length of information elements in records described by this template.
Definition: private.h:205
void fbConnSpecFree(fbConnSpec_t *spec)
fbConnSpecFree
uint16_t * off_cache
Field offset cache.
Definition: private.h:224
void fBufRewind(fBuf_t *fbuf)
fBufRewind
void * app_ctx
The application's Context pointer for the ctx_free function.
Definition: private.h:246
#define FB_IESPEC_NULL
Convenience macro defining a null information element specification initializer to terminate a consta...
Definition: public.c:1591
void fbListenerRemoveLastBuf(fBuf_t *fbuf, fbListener_t *listener)
fbListenerRemoveLastBuf
GHashTable * indices
Map of information element to index in ie_ary.
Definition: private.h:222
void fbSessionSetTemplateBuffer(fbSession_t *session, fBuf_t *fbuf)
fbSessionSetTemplateBuffer
gboolean is_varlen
Set to TRUE if this template contains any variable length IEs.
Definition: private.h:218
void fbExporterFree(fbExporter_t *exporter)
fbExporterFree
gboolean fbCollectMessageBuffer(uint8_t *hdr, size_t b_len, size_t *m_len, GError **err)
fbCollectMessageBuffer
fbVarfield_t template_name
List of PEN, IE num pairs.
Definition: private.h:175
gboolean fbInfoElementEqual(const fbInfoElement_t *a, const fbInfoElement_t *b)
fbInfoElementEqual
#define FB_IE_VARLEN
Information element length constant for variable-length IE.
Definition: public.c:1322
void fbCollectorSetFD(fbCollector_t *collector, int fd)
fbCollectorSetFD
gboolean fbInfoElementCopyToTemplate(fbInfoModel_t *model, fbInfoElement_t *ex_ie, fbInfoElement_t *tmpl_ie)
fbInfoElementCopyToTemplate
void * tmpl_ctx
Template context.
Definition: private.h:238
uint32_t fbSessionGetSequence(fbSession_t *session)
fbSessionGetSequence
uint16_t fbExporterGetMTU(fbExporter_t *exporter)
fbExporterGetMTU
fbNewTemplateCallback_fn fbSessionNewTemplateCallback(fbSession_t *session)
Returns the callback function for a given session.
An IPFIX template or options template structure.
Definition: private.h:187
struct fbSession_st fbSession_t
An IPFIX Transport Session state container.
Definition: public.c:1629
fbConnSpec_t * fbConnSpecCopy(fbConnSpec_t *spec)
fbConnSpecCopy
void(* fbNewTemplateCallback_fn)(fbSession_t *session, uint16_t tid, fbTemplate_t *tmpl, void *app_ctx, void **tmpl_ctx, fbTemplateCtxFree_fn *fn)
A callback function that will be called when the session receives a new external template.
Definition: public.c:1828
void fbInfoElementDebug(gboolean tmpl, fbInfoElement_t *ie)
fbInfoElementDebug
union fbUDPConnSpec_st::@0 peer
key to this conn spec
fbInfoElement_t ** ie_ary
Ordered array of pointers to information elements in this template.
Definition: private.h:220
fbCollector_t * fbCollectorAllocTLS(fbListener_t *listener, void *ctx, int fd, struct sockaddr *peer, size_t peerlen, GError **err)
fbCollectorAllocTLS
Connection specifier.
Definition: public.c:1665
void fbSessionSetCollector(fbSession_t *session, fbCollector_t *collector)
fbSessionSetCollector
void fbTemplateFree(fbTemplate_t *tmpl)
fbTemplateFree
const fbInfoElement_t * fbInfoModelAddAlienElement(fbInfoModel_t *model, fbInfoElement_t *ex_ie)
fbInfoModelAddAlienElement
uint16_t fBufGetInternalTemplate(fBuf_t *fbuf)
fBufGetInternalTemplate
A single IPFIX Information Element definition.
Definition: public.c:1483
uint16_t scope_count
Count of scope information elements in template.
Definition: private.h:198
fbConnSpec_t * fbListenerGetConnSpec(fbListener_t *listener)
fbListenerGetConnSpec
void fBufSetSession(fBuf_t *fbuf, fbSession_t *session)
fBufSetSession
A single IPFIX Information Element specification.
Definition: public.c:1598
fbTemplateCtxFree_fn ctx_free
Callback to free the ctx pointer when template is freed.
Definition: private.h:242
struct fbUDPConnSpec_st fbUDPConnSpec_t
An UDP Connection specifier.
void fbSessionSetSequence(fbSession_t *session, uint32_t sequence)
fbSessionSetSequence
fbSession_t * session
pointer to the session for this peer address
Definition: private.h:132
void fBufRemoveTemplateTcplan(fBuf_t *fbuf, fbTemplate_t *tmpl)
fBufRemoveTemplateTcplan