00001
00060 #ifndef _FB_PRIVATE_H_
00061 #define _FB_PRIVATE_H_
00062 #include <fixbuf/public.h>
00063
00064 #if HAVE_SPREAD
00065 #include <sp.h>
00066 #include <pthread.h>
00067 #endif
00068
00069 #ident "$Id: private.h 16070 2010-07-26 17:33:25Z ecoff_svn $"
00070
00083 #define IPFIX_ENTERPRISE_BIT 0x8000
00084
00086 #define IPFIX_REVERSE_PEN 29305
00087
00090 #define FB_MSGLEN_MAX 65535
00091
00092 #ifdef HAVE_SPREAD
00093
00094 typedef struct sp_groupname_st
00095 {
00096 char name[MAX_GROUP_NAME];
00097 } sp_groupname_t;
00098
00099 #define FB_SPREAD_NUM_GROUPS 16
00100 #define FB_SPREAD_MTU 8192
00101
00102 typedef struct fbSpreadSpec_st {
00105 fbSession_t * session;
00108 char * daemon;
00110 sp_groupname_t *groups;
00112 int num_groups;
00114 mailbox mbox;
00116 char privgroup[MAX_GROUP_NAME + 2];
00118 pthread_mutex_t write_lock;
00120 pthread_t recv_thread;
00122 mailbox recv_mbox;
00124 char recv_privgroup[MAX_GROUP_NAME + 2];
00126 GError *recv_err;
00128 int recv_exit;
00130 int recv_max_groups;
00132 sp_groupname_t *recv_groups;
00134 int recv_max;
00136 char *recv_mess;
00137 } fbSpreadSpec_t;
00138
00139 #endif
00140
00146 struct fbTemplate_st {
00148 fbInfoModel_t *model;
00150 int ref_count;
00152 uint16_t ie_count;
00157 uint16_t scope_count;
00164 uint16_t ie_len;
00169 uint16_t tmpl_len;
00171 gboolean is_varlen;
00173 fbInfoElement_t **ie_ary;
00175 GHashTable *indices;
00177 uint16_t *off_cache;
00179 gboolean active;
00180 };
00181
00188 void fBufRewind(
00189 fBuf_t *fbuf);
00190
00202 gboolean fBufAppendTemplate(
00203 fBuf_t *fbuf,
00204 uint16_t tmpl_id,
00205 fbTemplate_t *tmpl,
00206 gboolean revoke,
00207 GError **err);
00208
00216 uint32_t fbInfoElementHash(
00217 fbInfoElement_t *ie);
00218
00227 gboolean fbInfoElementEqual(
00228 const fbInfoElement_t *a,
00229 const fbInfoElement_t *b);
00230
00238 void fbInfoElementDebug(
00239 gboolean tmpl,
00240 fbInfoElement_t *ie);
00241
00249 const fbInfoElement_t *fbInfoModelGetElement(
00250 fbInfoModel_t *model,
00251 fbInfoElement_t *ex_ie);
00252
00261 gboolean fbInfoElementCopyToTemplate(
00262 fbInfoModel_t *model,
00263 fbInfoElement_t *ex_ie,
00264 fbInfoElement_t *tmpl_ie);
00265
00276 gboolean fbInfoElementCopyToTemplateByName(
00277 fbInfoModel_t *model,
00278 const char *name,
00279 uint16_t len_override,
00280 fbInfoElement_t *tmpl_ie);
00281
00289 void fbTemplateRetain(
00290 fbTemplate_t *tmpl);
00291
00299 void fbTemplateRelease(
00300 fbTemplate_t *tmpl);
00301
00309 void fbTemplateFree(
00310 fbTemplate_t *tmpl);
00311
00320 void fbTemplateDebug(
00321 const char *label,
00322 uint16_t tid,
00323 fbTemplate_t *tmpl);
00324
00331 fbSession_t *fbSessionClone(
00332 fbSession_t *base);
00333
00341 uint32_t fbSessionGetSequence(
00342 fbSession_t *session);
00343
00351 void fbSessionSetSequence(
00352 fbSession_t *session,
00353 uint32_t sequence);
00354
00362 void fbSessionSetTemplateBuffer(
00363 fbSession_t *session,
00364 fBuf_t *fbuf);
00365
00373 fbInfoModel_t *fbSessionGetInfoModel(
00374 fbSession_t *session);
00375
00384 gboolean fbConnSpecLookupAI(
00385 fbConnSpec_t *spec,
00386 gboolean passive,
00387 GError **err);
00388
00397 gboolean fbConnSpecInitTLS(
00398 fbConnSpec_t *spec,
00399 gboolean passive,
00400 GError **err);
00401
00409 fbConnSpec_t *fbConnSpecCopy(
00410 fbConnSpec_t *spec);
00411
00419 void fbConnSpecFree(
00420 fbConnSpec_t *spec);
00421
00422 #if HAVE_SPREAD
00423
00430 fbSpreadSpec_t *fbConnSpreadCopy(
00431 fbSpreadParams_t *spec);
00432
00440 void fbConnSpreadFree(
00441 fbSpreadSpec_t *spec);
00442
00450 const char * fbConnSpreadError(
00451 int err );
00452
00453 #endif
00454
00462 uint16_t fbExporterGetMTU(
00463 fbExporter_t *exporter);
00464
00474 gboolean fbExportMessage(
00475 fbExporter_t *exporter,
00476 uint8_t *msgbase,
00477 size_t msglen,
00478 GError **err);
00479
00487 void fbExporterFree(
00488 fbExporter_t *exporter);
00489
00500 fbCollector_t *fbCollectorAllocSocket(
00501 fbListener_t *listener,
00502 void *ctx,
00503 int fd,
00504 struct sockaddr *peer,
00505 size_t peerlen);
00506
00518 fbCollector_t *fbCollectorAllocTLS(
00519 fbListener_t *listener,
00520 void *ctx,
00521 int fd,
00522 struct sockaddr *peer,
00523 size_t peerlen,
00524 GError **err);
00525
00535 gboolean fbCollectMessage(
00536 fbCollector_t *collector,
00537 uint8_t *msgbase,
00538 size_t *msglen,
00539 GError **err);
00540
00548 int fbCollectorGetFD(
00549 fbCollector_t *collector);
00550
00558 void fbCollectorFree(
00559 fbCollector_t *collector);
00560
00568 gboolean fbCollectorHasTranslator(
00569 fbCollector_t *collector);
00570
00571
00579 void fbListenerRemove(
00580 fbListener_t *listener,
00581 int fd);
00582
00590 fbConnSpec_t *fbListenerGetConnSpec(
00591 fbListener_t *listener);
00592
00593 #endif