public.h
Go to the documentation of this file.
1 /*
2  ** public.h
3  ** fixbuf IPFIX Implementation Public Interface
4  **
5  ** ------------------------------------------------------------------------
6  ** Copyright (C) 2006-2013 Carnegie Mellon University. All Rights Reserved.
7  ** ------------------------------------------------------------------------
8  ** Authors: Brian Trammell, Dan Ruef
9  ** ------------------------------------------------------------------------
10  ** Use of the libfixbuf system and related source code is subject to the terms
11  ** of the following licenses:
12  **
13  ** GNU Lesser GPL (LGPL) Rights pursuant to Version 2.1, February 1999
14  ** Government Purpose License Rights (GPLR) pursuant to DFARS 252.227.7013
15  **
16  ** NO WARRANTY
17  **
18  ** ANY INFORMATION, MATERIALS, SERVICES, INTELLECTUAL PROPERTY OR OTHER
19  ** PROPERTY OR RIGHTS GRANTED OR PROVIDED BY CARNEGIE MELLON UNIVERSITY
20  ** PURSUANT TO THIS LICENSE (HEREINAFTER THE "DELIVERABLES") ARE ON AN
21  ** "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
22  ** KIND, EITHER EXPRESS OR IMPLIED AS TO ANY MATTER INCLUDING, BUT NOT
23  ** LIMITED TO, WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE,
24  ** MERCHANTABILITY, INFORMATIONAL CONTENT, NONINFRINGEMENT, OR ERROR-FREE
25  ** OPERATION. CARNEGIE MELLON UNIVERSITY SHALL NOT BE LIABLE FOR INDIRECT,
26  ** SPECIAL OR CONSEQUENTIAL DAMAGES, SUCH AS LOSS OF PROFITS OR INABILITY
27  ** TO USE SAID INTELLECTUAL PROPERTY, UNDER THIS LICENSE, REGARDLESS OF
28  ** WHETHER SUCH PARTY WAS AWARE OF THE POSSIBILITY OF SUCH DAMAGES.
29  ** LICENSEE AGREES THAT IT WILL NOT MAKE ANY WARRANTY ON BEHALF OF
30  ** CARNEGIE MELLON UNIVERSITY, EXPRESS OR IMPLIED, TO ANY PERSON
31  ** CONCERNING THE APPLICATION OF OR THE RESULTS TO BE OBTAINED WITH THE
32  ** DELIVERABLES UNDER THIS LICENSE.
33  **
34  ** Licensee hereby agrees to defend, indemnify, and hold harmless Carnegie
35  ** Mellon University, its trustees, officers, employees, and agents from
36  ** all claims or demands made against them (and any related losses,
37  ** expenses, or attorney's fees) arising out of, or relating to Licensee's
38  ** and/or its sub licensees' negligent use or willful misuse of or
39  ** negligent conduct or willful misconduct regarding the Software,
40  ** facilities, or other rights or assistance granted by Carnegie Mellon
41  ** University under this License, including, but not limited to, any
42  ** claims of product liability, personal injury, death, damage to
43  ** property, or violation of any laws or regulations.
44  **
45  ** Carnegie Mellon University Software Engineering Institute authored
46  ** documents are sponsored by the U.S. Department of Defense under
47  ** Contract FA8721-05-C-0003. Carnegie Mellon University retains
48  ** copyrights in all material produced under this contract. The U.S.
49  ** Government retains a non-exclusive, royalty-free license to publish or
50  ** reproduce these documents, or allow others to do so, for U.S.
51  ** Government purposes only pursuant to the copyright license under the
52  ** contract clause at 252.227.7013.
53  **
54  ** ------------------------------------------------------------------------
55  */
56 
659 #ifndef _FB_PUBLIC_H_
660 #define _FB_PUBLIC_H_
661 #include <fixbuf/autoinc.h>
662 
663 #ifdef __cplusplus
664 extern "C" {
665 #endif
666 
667 #ident "$Id$"
668 
669 /*
670  * Error Handling Definitions
671  */
672 
674 #define FB_ERROR_DOMAIN g_quark_from_string("fixbufError")
675 
676 #define FB_ERROR_TMPL 1
677 
681 #define FB_ERROR_EOM 2
682 
687 #define FB_ERROR_EOF 3
688 
692 #define FB_ERROR_IPFIX 4
693 
698 #define FB_ERROR_BUFSZ 5
699 
700 #define FB_ERROR_IMPL 6
701 
702 #define FB_ERROR_IO 7
703 
707 #define FB_ERROR_NLREAD 8
708 
713 #define FB_ERROR_NLWRITE 9
714 
717 #define FB_ERROR_NOELEMENT 10
718 
721 #define FB_ERROR_CONN 11
722 
726 #define FB_ERROR_NETFLOWV9 12
727 
730 #define FB_ERROR_TRANSMISC 13
731 
732 /*
733  * Public Datatypes and Constants
734  */
735 
736 struct fBuf_st;
742 typedef struct fBuf_st fBuf_t;
743 
750 typedef struct fbVarfield_st {
752  size_t len;
759  uint8_t *buf;
760 } fbVarfield_t;
761 
762 
763 struct fbInfoModel_st;
768 typedef struct fbInfoModel_st fbInfoModel_t;
769 
775 #define FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, _min_, _max_, _type_, _desc_)\
776  { {(const struct fbInfoElement_st*)_name_}, 0, _ent_, _num_, _len_, _flags_, _min_, _max_, _type_, _desc_ }
777 
783 #define FB_IE_INIT(_name_, _ent_, _num_, _len_, _flags_) \
784  FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, 0, 0, 0, (char*)NULL)
785 
786 
792 #define FB_IE_NULL FB_IE_INIT(NULL, 0, 0, 0, 0)
793 
799 #define FB_IE_SEMANTIC(flags) ((flags & 0x0000ff00) >> 8)
800 
806 #define FB_IE_UNITS(flags) ((flags & 0xFFFF0000) >> 16)
807 
812 #define FB_IE_F_NONE 0x00000000
813 
818 #define FB_IE_F_ENDIAN 0x00000001
819 
829 #define FB_IE_F_REVERSIBLE 0x00000040
830 
838 #define FB_IE_F_ALIEN 0x00000080
839 
844 #define FB_IE_QUANTITY 0x00000100
845 
851 #define FB_IE_TOTALCOUNTER 0x00000200
852 
857 #define FB_IE_DELTACOUNTER 0x00000300
858 
863 #define FB_IE_IDENTIFIER 0x00000400
864 
869 #define FB_IE_FLAGS 0x00000500
870 
876 #define FB_IE_LIST 0x00000600
877 
883 #define FB_IE_DEFAULT 0x00000000
884 
895 #define FB_UNITS_BITS 0x00010000
896 
901 #define FB_UNITS_OCTETS 0x00020000
902 
907 #define FB_UNITS_PACKETS 0x00030000
908 
913 #define FB_UNITS_FLOWS 0x00040000
914 
919 #define FB_UNITS_SECONDS 0x00050000
920 
925 #define FB_UNITS_MILLISECONDS 0x00060000
926 
931 #define FB_UNITS_MICROSECONDS 0x00070000
932 
937 #define FB_UNITS_NANOSECONDS 0x00080000
938 
943 #define FB_UNITS_WORDS 0x00090000
944 
949 #define FB_UNITS_MESSAGES 0x000A0000
950 
955 #define FB_UNITS_HOPS 0x000B0000
956 
961 #define FB_UNITS_ENTRIES 0x000C0000
962 
963 
967 #define FB_IE_VARLEN 65535
968 
973 #define FB_IE_BASIC_LIST 291
974 
978 #define FB_IE_SUBTEMPLATE_LIST 292
979 
983 #define FB_IE_SUBTEMPLATE_MULTILIST 293
984 
992 #define FB_IE_PEN_REVERSE 29305
993 
1002 #define FB_IE_VENDOR_BIT_REVERSE 0x4000
1003 
1009 #define FB_CISCO_GENERIC 9999
1010 
1017 #define FB_CISCO_ASA_EVENT_ID 9998
1018 
1027 #define FB_CISCO_ASA_EVENT_XTRA 9997
1028 
1033 #define FB_IE_REVERSE_STR "reverse"
1034 
1036 #define FB_IE_REVERSE_STRLEN 7
1037 
1044  FB_OCTET_ARRAY,
1045  FB_UINT_8,
1046  FB_UINT_16,
1047  FB_UINT_32,
1048  FB_UINT_64,
1049  FB_INT_8,
1050  FB_INT_16,
1051  FB_INT_32,
1052  FB_INT_64,
1053  FB_FLOAT_32,
1054  FB_FLOAT_64,
1055  FB_BOOL,
1056  FB_MAC_ADDR,
1057  FB_STRING,
1058  FB_DT_SEC,
1059  FB_DT_MILSEC,
1060  FB_DT_MICROSEC,
1061  FB_DT_NANOSEC,
1062  FB_IP4_ADDR,
1063  FB_IP6_ADDR,
1064  FB_BASIC_LIST,
1065  FB_SUB_TMPL_LIST,
1066  FB_SUB_TMPL_MULTI_LIST
1068 
1077 typedef struct fbInfoElement_st {
1079  union {
1085  const struct fbInfoElement_st *canon;
1090  const char *name;
1091  } ref;
1092 
1098  uint32_t midx;
1100  uint32_t ent;
1105  uint16_t num;
1107  uint16_t len;
1110  uint32_t flags;
1112  uint64_t min;
1114  uint64_t max;
1116  uint8_t type;
1118  const char *description;
1119 } fbInfoElement_t;
1120 
1127 typedef struct fbInfoElementOptRec_st {
1129  uint64_t ie_range_begin;
1131  uint64_t ie_range_end;
1133  uint32_t ie_pen;
1135  uint16_t ie_units;
1137  uint16_t ie_id;
1139  uint8_t ie_type;
1141  uint8_t ie_semantic;
1143  uint8_t padding[6];
1149 
1154 #define FB_TID_AUTO 0
1155 
1159 #define FB_TID_TS 2
1160 
1164 #define FB_TID_OTS 3
1165 
1169 #define FB_TID_MIN_DATA 256
1170 
1171 struct fbTemplate_st;
1178 
1184 #define FB_IESPEC_NULL { NULL, 0, 0 }
1185 
1191 typedef struct fbInfoElementSpec_st {
1193  char *name;
1198  uint16_t len_override;
1205  uint32_t flags;
1207 
1208 struct fbSession_st;
1215 typedef struct fbSession_st fbSession_t;
1216 
1218 typedef enum fbTransport_en {
1245 } fbTransport_t;
1246 
1251 typedef struct fbConnSpec_st {
1255  char *host;
1257  char *svc;
1270  void *vai;
1275  void *vssl_ctx;
1276 } fbConnSpec_t;
1277 
1281 #define FB_CONNSPEC_INIT { FB_SCTP, NULL, NULL, \
1282  NULL, NULL, NULL, NULL, \
1283  NULL, NULL }
1284 
1285 #if HAVE_SPREAD
1286 
1291 #define FB_SPREADPARAMS_INIT { 0, 0, 0 }
1292 
1293 typedef struct fbSpreadParams_st {
1296  fbSession_t * session;
1299  char * daemon;
1302  char ** groups;
1303 } fbSpreadParams_t;
1304 
1305 #endif /* HAVE_SPREAD */
1306 
1307 struct fbExporter_st;
1313 typedef struct fbExporter_st fbExporter_t;
1314 
1315 struct fbCollector_st;
1323 typedef struct fbCollector_st fbCollector_t;
1324 
1325 struct fbListener_st;
1332 typedef struct fbListener_st fbListener_t;
1333 
1338 
1343 {
1350 };
1351 
1356 
1363 {
1370 };
1371 
1375 typedef struct fbListenerGroup_st
1376 {
1382 
1395 typedef gboolean (*fbAcceptCallback_fn) (
1396  fBuf_t *buf,
1397  fbListener_t *listener,
1398  struct sockaddr *sAddr,
1399  GError **err);
1400 
1417 typedef void (*fbNewTemplateCallback_fn) (
1418  fbSession_t *session,
1419  uint16_t tid,
1420  fbTemplate_t *tmpl);
1421 
1429 typedef void (*fbTemplateCtxFree_fn)(
1430  void *ctx);
1431 
1432 
1454 typedef void (*fbTemplateCtxCallback_fn) (
1455  fbSession_t *session,
1456  uint16_t tid,
1457  fbTemplate_t *tmpl,
1458  void **ctx,
1459  fbTemplateCtxFree_fn *fn);
1460 
1461 
1465 #define UNDEFINED 0xFF
1466 
1469 #define NONE_OF 0x00
1470 
1473 #define EXACTLY_ONE_OF 0x01
1474 
1477 #define ONE_OR_MORE_OF 0x02
1478 
1481 #define ALL_OF 0x03
1482 
1485 #define ORDERED 0x04
1486 
1493 gboolean fbListValidSemantic(
1494  uint8_t semantic);
1495 
1496 /****** BASICLIST FUNCTIONS AND STRUCTS *******/
1502 typedef struct fbBasicList_st {
1506  uint8_t *dataPtr;
1508  uint16_t numElements;
1510  uint16_t dataLength;
1512  uint8_t semantic;
1513 } fbBasicList_t;
1514 
1515 
1522  void);
1523 
1536 void* fbBasicListInit(
1537  fbBasicList_t *basicListPtr,
1538  uint8_t semantic,
1539  const fbInfoElement_t *infoElement,
1540  uint16_t numElements);
1541 
1557  fbBasicList_t *basicListPtr,
1558  uint8_t semantic,
1559  const fbInfoElement_t *infoElement,
1560  uint16_t numElements,
1561  uint16_t dataLength,
1562  uint8_t *dataPtr);
1563 
1577  fbBasicList_t *basicListPtr);
1578 
1579 
1587 uint8_t fbBasicListGetSemantic(
1588  fbBasicList_t *basicListPtr);
1589 
1599  fbBasicList_t *basicListPtr,
1600  uint8_t semantic);
1601 
1602 
1611  fbBasicList_t *basicListPtr);
1612 
1618 void* fbBasicListGetDataPtr(
1619  fbBasicList_t *basicListPtr);
1620 
1630  fbBasicList_t *basicListPtr,
1631  uint16_t bl_index);
1632 
1641 void* fbBasicListGetNextPtr(
1642  fbBasicList_t *basicListPtr,
1643  void *currentPtr);
1644 
1654 void* fbBasicListRealloc(
1655  fbBasicList_t *basicList,
1656  uint16_t newNumElements);
1657 
1666  fbBasicList_t *basicList,
1667  uint16_t numNewElements);
1668 
1674 void fbBasicListClear(
1675  fbBasicList_t *basicListPtr);
1676 
1684  fbBasicList_t *basicList);
1685 
1691 void fbBasicListFree(
1692  fbBasicList_t *basicListPtr);
1693 
1694 /******* END OF BASICLIST ********/
1695 
1696 
1697 
1698 /******* SUBTEMPLATELIST FUNCTIONS ****/
1699 
1707 typedef struct fbSubTemplateList_st {
1710  union {
1711  size_t length;
1712  uint64_t extra;
1713  } dataLength;
1717  uint8_t *dataPtr;
1719  uint16_t tmplID;
1721  uint16_t numElements;
1723  uint8_t semantic;
1725 
1733  void);
1734 
1747 void* fbSubTemplateListInit(
1748  fbSubTemplateList_t *sTL,
1749  uint8_t semantic,
1750  uint16_t tmplID,
1751  const fbTemplate_t *tmpl,
1752  uint16_t numElements);
1753 
1769  fbSubTemplateList_t *subTemplateList,
1770  uint8_t semantic,
1771  uint16_t tmplID,
1772  const fbTemplate_t *tmpl,
1773  uint16_t numElements,
1774  uint16_t dataLength,
1775  uint8_t *dataPtr);
1776 
1788  fbSubTemplateList_t *STL);
1789 
1796  const fbSubTemplateList_t *subTemplateListPtr);
1797 
1806  const fbSubTemplateList_t *subTemplateListPtr,
1807  uint16_t index);
1808 
1821  const fbSubTemplateList_t *subTemplateListPtr,
1822  void *currentPtr);
1823 
1831  fbSubTemplateList_t *subTemplateListPtr,
1832  uint8_t semantic);
1833 
1840  fbSubTemplateList_t *subTemplateListPtr);
1841 
1848  fbSubTemplateList_t *subTemplateListPtr);
1849 
1856  fbSubTemplateList_t *subTemplateListPtr);
1857 
1869  fbSubTemplateList_t *subTemplateList,
1870  uint16_t newNumElements);
1871 
1881  fbSubTemplateList_t *subTemplateList,
1882  uint16_t numNewElements);
1883 
1898  fbSubTemplateList_t *subTemplateListPtr);
1899 
1909  fbSubTemplateList_t *subTemplateListPtr);
1910 
1919  fbSubTemplateList_t *subTemplateListPtr);
1920 
1921 /********* END OF SUBTEMPLATELIST **********/
1943  uint8_t *dataPtr;
1945  size_t dataLength;
1947  uint16_t tmplID;
1949  uint16_t numElements;
1951 
1960  uint16_t numElements;
1962  uint8_t semantic;
1964 
1976  uint8_t semantic,
1977  uint16_t numElements);
1978 
1987  uint8_t semantic);
1988 
1995  fbSubTemplateMultiList_t *STML);
1996 
2004  fbSubTemplateMultiList_t *STML);
2005 
2016  fbSubTemplateMultiList_t *STML);
2017 
2024  fbSubTemplateMultiList_t *STML);
2025 
2037  uint16_t newNumEntries);
2038 
2049  uint16_t numNewEntries);
2050 
2057  fbSubTemplateMultiList_t *STML);
2058 
2068  uint16_t index);
2069 
2083  fbSubTemplateMultiListEntry_t *currentEntry);
2084 
2098  uint16_t tmplID,
2099  fbTemplate_t *tmpl,
2100  uint16_t numElements);
2101 
2114  uint16_t newNumElements);
2115 
2124 
2133 
2147  void *currentPtr);
2148 
2161  uint16_t index);
2162 
2171 
2180 
2181 /************** END OF STML FUNCTIONS */
2182 
2189  void);
2190 
2201  fbListenerGroup_t *group,
2202  const fbListener_t *listener);
2203 
2214  fbListenerGroup_t *group,
2215  const fbListener_t *listener);
2216 
2228  fbListenerGroup_t *group,
2229  GError **err);
2230 
2242  fbListener_t *listener,
2243  fbAcceptCallback_fn callback,
2244  GError **err);
2245 
2259  fbListenerGroup_t *group,
2260  fbAcceptCallback_fn callback,
2261  GError **err);
2262 
2276  fbListener_t *listener,
2277  int sock,
2278  GError **err);
2279 
2290  fbListener_t *listener,
2291  int sock,
2292  GError **err);
2293 
2299 void fBufInterruptSocket(
2300  fBuf_t *fbuf);
2301 
2302 
2323 typedef gboolean (*fbListenerAppInit_fn) (
2324  fbListener_t *listener,
2325  void **ctx,
2326  int fd,
2327  struct sockaddr *peer,
2328  size_t peerlen,
2329  GError **err);
2330 
2338 typedef void (*fbListenerAppFree_fn) (
2339  void *ctx);
2340 
2341 /*
2342  * Public Function Calls. These calls will remain available and retain
2343  * their functionality in all subsequent versions of libfixbuf.
2344  */
2345 
2346 
2363 gboolean fBufSetInternalTemplate(
2364  fBuf_t *fbuf,
2365  uint16_t int_tid,
2366  GError **err);
2367 
2385 gboolean fBufSetExportTemplate(
2386  fBuf_t *fbuf,
2387  uint16_t ext_tid,
2388  GError **err);
2389 
2390 #if HAVE_SPREAD
2391 
2408 void fBufSetSpreadExportGroup(
2409  fBuf_t *fbuf,
2410  char **groups,
2411  int num_groups,
2412  GError **err);
2413 #endif
2414 
2430  fBuf_t *fbuf,
2431  gboolean automatic);
2432 
2447 gboolean fBufSetAutomaticInsert(
2448  fBuf_t *fbuf,
2449  GError **err);
2450 
2451 
2460  fBuf_t *fbuf);
2461 
2470 void fBufFree(
2471  fBuf_t *fbuf);
2472 
2486  fbSession_t *session,
2487  fbExporter_t *exporter);
2488 
2499  fBuf_t *fbuf);
2500 
2511 void fBufSetExporter(
2512  fBuf_t *fbuf,
2513  fbExporter_t *exporter);
2514 
2515 
2539 gboolean fBufAppend(
2540  fBuf_t *fbuf,
2541  uint8_t *recbase,
2542  size_t recsize,
2543  GError **err);
2544 
2554 gboolean fBufEmit(
2555  fBuf_t *fbuf,
2556  GError **err);
2557 
2569 void fBufSetExportTime(
2570  fBuf_t *fbuf,
2571  uint32_t extime);
2572 
2586  fbSession_t *session,
2587  fbCollector_t *collector);
2588 
2599  fBuf_t *fbuf);
2600 
2611 void fBufSetCollector(
2612  fBuf_t *fbuf,
2613  fbCollector_t *collector);
2614 
2644 gboolean fBufNext(
2645  fBuf_t *fbuf,
2646  uint8_t *recbase,
2647  size_t *recsize,
2648  GError **err);
2649 
2663 gboolean fBufNextMessage(
2664  fBuf_t *fbuf,
2665  GError **err);
2666 
2674 uint32_t fBufGetExportTime(
2675  fBuf_t *fbuf);
2676 
2697  fBuf_t *fbuf,
2698  uint16_t *ext_tid);
2699 
2719  fBuf_t *fbuf,
2720  uint16_t *ext_tid,
2721  GError **err);
2722 
2735 
2744 void fbInfoModelFree(
2745  fbInfoModel_t *model);
2746 
2762  fbInfoModel_t *model,
2763  fbInfoElement_t *ie);
2764 
2780  fbInfoModel_t *model,
2781  fbInfoElement_t *ie);
2782 
2795  fbInfoModel_t *model,
2796  const char *name);
2797 
2812  fbInfoModel_t *model,
2813  uint16_t id,
2814  uint32_t ent);
2815 
2830  fbInfoModel_t *model,
2831  GError **err);
2832 
2847  fBuf_t *fbuf,
2848  const fbInfoElement_t *model_ie,
2849  uint16_t tid,
2850  GError **err);
2851 
2864  fbInfoModel_t *model,
2865  fbInfoElementOptRec_t *rec);
2866 
2876 gboolean fbInfoModelTypeInfoRecord(
2877  fbTemplate_t *tmpl);
2878 
2897  fbInfoModel_t *model);
2898 
2915 gboolean fbTemplateAppend(
2916  fbTemplate_t *tmpl,
2917  fbInfoElement_t *ex_ie,
2918  GError **err);
2919 
2935 gboolean fbTemplateAppendSpec(
2936  fbTemplate_t *tmpl,
2937  fbInfoElementSpec_t *spec,
2938  uint32_t flags,
2939  GError **err);
2940 
2958 gboolean fbTemplateAppendSpecArray(
2959  fbTemplate_t *tmpl,
2960  fbInfoElementSpec_t *spec,
2961  uint32_t flags,
2962  GError **err);
2963 
2971 uint32_t fbTemplateCountElements(
2972  fbTemplate_t *tmpl);
2973 
2984  fbTemplate_t *tmpl,
2985  uint16_t scope_count);
2986 
2994 uint32_t fbTemplateGetOptionsScope(
2995  fbTemplate_t *tmpl);
2996 
3008 gboolean fbTemplateContainsElement(
3009  fbTemplate_t *tmpl,
3010  const fbInfoElement_t *ex_ie);
3011 
3022  fbTemplate_t *tmpl,
3023  fbInfoElementSpec_t *spec);
3024 
3035  fbTemplate_t *tmpl,
3036  fbInfoElementSpec_t *spec);
3037 
3047  fbTemplate_t *tmpl,
3048  uint32_t IEindex);
3049 
3058  fbTemplate_t *tmpl);
3059 
3067 void *fbTemplateGetContext(
3068  fbTemplate_t *tmpl);
3069 
3084  fbInfoModel_t *model);
3085 
3095  fbSession_t *session);
3096 
3097 
3122  fbSession_t *session,
3123  fbNewTemplateCallback_fn callback);
3124 
3157  fbSession_t *session,
3158  fbTemplateCtxCallback_fn callback);
3159 
3160 
3185  fbSession_t *session,
3186  uint16_t ent_tid,
3187  uint16_t int_tid);
3188 
3199  fbSession_t *session,
3200  uint16_t ext_tid);
3201 
3211  fbSession_t *session,
3212  uint16_t ext_tid);
3213 
3223 void fbSessionFree(
3224  fbSession_t *session);
3225 
3239  fbSession_t *session);
3240 
3256 void fbSessionSetDomain(
3257  fbSession_t *session,
3258  uint32_t domain);
3259 
3267 uint32_t fbSessionGetDomain(
3268  fbSession_t *session);
3269 
3270 #if HAVE_SPREAD
3271 
3292 gboolean fbSessionAddTemplatesMulticast(
3293  fbSession_t *session,
3294  char **groups,
3295  gboolean internal,
3296  uint16_t tid,
3297  fbTemplate_t *tmpl,
3298  GError **err);
3299 
3300 #endif
3301 
3314 gboolean fbSessionExportTemplate(
3315  fbSession_t *session,
3316  uint16_t tid,
3317  GError **err);
3318 
3330 gboolean fbSessionExportTemplates(
3331  fbSession_t *session,
3332  GError **err);
3333 
3352 uint16_t fbSessionAddTemplate(
3353  fbSession_t *session,
3354  gboolean internal,
3355  uint16_t tid,
3356  fbTemplate_t *tmpl,
3357  GError **err);
3358 
3371 gboolean fbSessionRemoveTemplate(
3372  fbSession_t *session,
3373  gboolean internal,
3374  uint16_t tid,
3375  GError **err);
3376 
3389  fbSession_t *session,
3390  gboolean internal,
3391  uint16_t tid,
3392  GError **err);
3393 
3407  fbConnSpec_t *spec);
3408 
3409 #if HAVE_SPREAD
3410 
3421 int fbCollectorGetSpreadReturnGroups(
3422  fbCollector_t *collector,
3423  char *groups[]);
3424 
3438 fbExporter_t *fbExporterAllocSpread(
3439  fbSpreadParams_t *params );
3440 
3441 #endif /* HAVE_SPREAD */
3442 
3455  const char *path);
3456 
3466  FILE *fp);
3467 
3480 void fbExporterSetStream(
3481  fbExporter_t *exporter,
3482  int sctp_stream);
3483 
3497  fbExporter_t *exporter);
3498 
3506 void fbExporterClose(
3507  fbExporter_t *exporter);
3508 
3522  void *ctx,
3523  const char *path,
3524  GError **err);
3525 
3537  void *ctx,
3538  FILE *fp);
3539 
3540 
3541 #ifdef HAVE_SPREAD
3542 
3552 fbCollector_t *fbCollectorAllocSpread (
3553  void *ctx,
3554  fbSpreadParams_t *params,
3555  GError **err );
3556 
3557 #endif /* HAVE_SPREAD */
3558 
3569 void *fbCollectorGetContext(
3570  fbCollector_t *collector);
3571 
3582 void fbCollectorClose(
3583  fbCollector_t *collector);
3584 
3585 
3598  fbCollector_t *collector,
3599  struct sockaddr *address,
3600  size_t address_length);
3601 
3628  fbConnSpec_t *spec,
3629  fbSession_t *session,
3630  fbListenerAppInit_fn appinit,
3631  fbListenerAppFree_fn appfree,
3632  GError **err);
3633 
3641 void fbListenerFree(
3642  fbListener_t *listener);
3643 
3666  fbListener_t *listener,
3667  GError **err);
3668 
3680  fbListener_t *listener,
3681  GError **err);
3682 
3690 void fbListenerInterrupt(
3691  fbListener_t *listener);
3692 
3693 
3709 gboolean fbListenerGetCollector(
3710  fbListener_t *listener,
3711  fbCollector_t **collector,
3712  GError **err);
3713 
3714 
3715 
3716 
3733  fbCollector_t *collector,
3734  GError **err);
3735 
3736 
3753  fbCollector_t *collector,
3754  GError **err);
3755 
3777  fbCollector_t *collector,
3778  struct sockaddr *peer,
3779  size_t peerlen,
3780  uint32_t obdomain);
3781 
3788 struct sockaddr* fbCollectorGetPeer(
3789  fbCollector_t *collector);
3790 
3798  fbCollector_t *collector);
3799 
3813  fbCollector_t *collector,
3814  gboolean multi_session);
3815 
3831  fbCollector_t *collector,
3832  gboolean manage_port);
3833 
3834 #ifdef __cplusplus
3835 } /* extern "C" */
3836 #endif
3837 
3838 #endif
fbInfoElement_t * fbTemplateGetIndexedIE(fbTemplate_t *tmpl, uint32_t IEindex)
Return the information element in the template referenced by the index.
uint32_t ent
Private Enterprise Number.
Definition: public.h:1100
struct fbSubTemplateMultiListEntry_st fbSubTemplateMultiListEntry_t
Entries contain the same type of information at SubTemplateLists: template ID and template pointers t...
fbExporter_t * fbExporterAllocFile(const char *path)
Allocate an exporting process endpoint for a named file.
fbListener_t * listener
pointer to the listener that received a new connection
Definition: public.h:1367
void fbTemplateFreeUnused(fbTemplate_t *tmpl)
Free a template if it is not currently in use by any Session.
char * ssl_ca_file
Path to certificate authority file.
Definition: public.h:1259
void * vai
Pointer to address info cache.
Definition: public.h:1270
uint32_t ie_pen
private enterprise number
Definition: public.h:1133
A variable-length field value.
Definition: public.h:750
void fbSubTemplateMultiListClearEntries(fbSubTemplateMultiList_t *STML)
Clears the memory used by the entries of a sub template multi list NOTE: if any of those entries cont...
void fbBasicListClearWithoutFree(fbBasicList_t *basicList)
Clear the parameters of the basic list, but do not free the buffer.
uint32_t fbTemplateGetOptionsScope(fbTemplate_t *tmpl)
Determine number of scope information elements in a template.
fbExporter_t * fbExporterAllocFP(FILE *fp)
Allocate an exporting process endpoint for an opened ANSI C file pointer.
gboolean fBufAppend(fBuf_t *fbuf, uint8_t *recbase, size_t recsize, GError **err)
Append a record to a buffer.
char * ssl_cert_file
Path to certificate file.
Definition: public.h:1261
Partially reliable datagram transport via SCTP.
Definition: public.h:1223
uint64_t ie_range_begin
ie range min
Definition: public.h:1129
uint16_t numElements
number of elements in the list
Definition: public.h:1721
uint64_t min
range min
Definition: public.h:1112
uint64_t ie_range_end
ie range max
Definition: public.h:1131
void fbBasicListFree(fbBasicList_t *basicListPtr)
Clear the basic list, then free the basic list pointer.
const fbInfoElement_t * fbInfoModelGetElementByName(fbInfoModel_t *model, const char *name)
Return a pointer to the canonical information element within an information model given the informati...
void fbExporterClose(fbExporter_t *exporter)
Force the file or socket underlying an exporting process endpoint to close.
fBuf_t * fbuf
pointer to the fbuf created for that new connection
Definition: public.h:1369
uint16_t tmplID
ID of the template used to structure the data in this entry.
Definition: public.h:1947
void * fbBasicListInitWithOwnBuffer(fbBasicList_t *basicListPtr, uint8_t semantic, const fbInfoElement_t *infoElement, uint16_t numElements, uint16_t dataLength, uint8_t *dataPtr)
use this function to initialize the basic list, but it gets the pointer to a buffer and its length al...
void fbSessionSetDomain(fbSession_t *session, uint32_t domain)
Set the current observation domain on a session.
const fbInfoElement_t * fbBasicListGetInfoElement(fbBasicList_t *basicListPtr)
This function returns a pointer to the information element used in the list it is mainly used in coll...
fBuf_t * fbListenerWait(fbListener_t *listener, GError **err)
Wait on a listener.
Multilists just contain the semantic to describe the sub lists, the number of sub lists...
Definition: public.h:1956
struct fbConnSpec_st fbConnSpec_t
Connection specifier.
void fBufSetAutomaticMode(fBuf_t *fbuf, gboolean automatic)
Set the automatic mode flag on a buffer.
void * fbSubTemplateMultiListEntryRealloc(fbSubTemplateMultiListEntry_t *entry, uint16_t newNumElements)
Frees the memory for the data used by the entry, then allocates a new buffer based on the size of the...
struct fbCollector_st fbCollector_t
IPFIX Collecting Process endpoint.
Definition: public.h:1323
struct fbExporter_st fbExporter_t
IPFIX Exporting Process endpoint.
Definition: public.h:1313
uint8_t semantic
value used to describe the contents of the list, all-of, one-of, etc
Definition: public.h:1723
Secure, reliable stream transport via TLS over TCP.
Definition: public.h:1238
const fbTemplate_t * tmpl
pointer to the template used to structure the data
Definition: public.h:1715
void fbSubTemplateMultiListSetSemantic(fbSubTemplateMultiList_t *STML, uint8_t semantic)
Sets the semantic field for the multi list.
struct fbSession_st fbSession_t
An IPFIX Transport Session state container.
Definition: public.h:1215
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListInit(fbSubTemplateMultiList_t *STML, uint8_t semantic, uint16_t numElements)
Initializes the multi list with semantic, numbers of elements, and allocates memory to store numEleme...
size_t dataLength
length of the buffer used to hold the data in this entry
Definition: public.h:1945
void fbSessionRemoveTemplatePair(fbSession_t *session, uint16_t ext_tid)
remove a template pair from the list this is called by fixbuf when a template is revoked from the ses...
void * fbSubTemplateListInit(fbSubTemplateList_t *sTL, uint8_t semantic, uint16_t tmplID, const fbTemplate_t *tmpl, uint16_t numElements)
Initializes a subTemplateList structure and alloc's the dataPtr to get a buffer able to hold numEleme...
struct fbListener_st fbListener_t
IPFIX Collecting Process session listener.
Definition: public.h:1332
size_t len
Length of content in buffer.
Definition: public.h:752
Unreliable datagram transport via UDP.
Definition: public.h:1227
void(* fbTemplateCtxFree_fn)(void *ctx)
A callback function that is called when a template is freed.
Definition: public.h:1429
uint16_t dataLength
length of the buffer used to store the elements in the list
Definition: public.h:1510
void fbSubTemplateListFree(fbSubTemplateList_t *subTemplateListPtr)
Frees and clears a subTemplateList struct.
void fbSubTemplateListClear(fbSubTemplateList_t *subTemplateListPtr)
Clears a subtemplate list struct, notably freeing the dataPtr and setting it to NULL.
uint32_t fbCollectorGetNetflowMissed(fbCollector_t *collector, struct sockaddr *peer, size_t peerlen, uint32_t obdomain)
fbCollectorGetNetflowMissed
gboolean(* fbAcceptCallback_fn)(fBuf_t *buf, fbListener_t *listener, struct sockaddr *sAddr, GError **err)
This callback function will be called when a new connection to a listener has been received...
Definition: public.h:1395
gboolean fbTemplateAppendSpecArray(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags, GError **err)
Append information elements described by a specifier array to a template.
uint8_t * dataPtr
pointer to the memory that stores the elements in the list
Definition: public.h:1506
uint16_t num
Information Element number.
Definition: public.h:1105
fbSubTemplateList_t * fbSubTemplateListAlloc(void)
Allocates a subTemplateList_t Based on how subTemplateLists will be used and set up amidst data struc...
gboolean fbCollectorSetNetflowV9Translator(fbCollector_t *collector, GError **err)
fbCollectorSetNetflowV9Translator
struct sockaddr * fbCollectorGetPeer(fbCollector_t *collector)
Retrieves information about the node connected to this collector.
uint16_t numElements
number of elements in the list
Definition: public.h:1508
gboolean fbTemplateAppend(fbTemplate_t *tmpl, fbInfoElement_t *ex_ie, GError **err)
Append an information element to a template.
gboolean fBufEmit(fBuf_t *fbuf, GError **err)
Emit the message currently in a buffer using the associated exporting process endpoint.
fbSubTemplateMultiListEntry_t * firstEntry
pointer to the first entry in the multi list
Definition: public.h:1958
struct fbInfoElement_st fbInfoElement_t
A single IPFIX Information Element definition.
struct fbBasicList_st fbBasicList_t
A basic list element in a template which structure represents a basic list on the internal side...
fbCollector_t * fbCollectorAllocFP(void *ctx, FILE *fp)
Allocate a collecting process endpoint for an open file.
void fbSessionAddTemplateCallback(fbSession_t *session, fbNewTemplateCallback_fn callback)
This function sets the callback to let the user know when a new template has arrived from the connect...
void fBufInterruptSocket(fBuf_t *fbuf)
Interrupts the select call of a specific collector by way of its fBuf.
uint16_t len
Information element length in octets.
Definition: public.h:1107
fbExporter_t * fbExporterAllocNet(fbConnSpec_t *spec)
Allocate an exporting process endpoint for a network connection.
void fBufSetCollector(fBuf_t *fbuf, fbCollector_t *collector)
Associate an collecting process endpoint with a buffer.
gboolean fbTemplateContainsAllElementsByName(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec)
Determine if a template contains at least one instance of each information element in a given informa...
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListRealloc(fbSubTemplateMultiList_t *STML, uint16_t newNumEntries)
Clears the entries used by the multi list, then if newNumElements is different than numElements...
void fbSessionAddTemplatePair(fbSession_t *session, uint16_t ent_tid, uint16_t int_tid)
Adds an external-internal template pair to the session.
gboolean fBufNext(fBuf_t *fbuf, uint8_t *recbase, size_t *recsize, GError **err)
Retrieve a record from a buffer.
fBuf_t * fBufAllocForCollection(fbSession_t *session, fbCollector_t *collector)
Allocate a new buffer for collection.
void * fbSubTemplateListGetDataPtr(const fbSubTemplateList_t *subTemplateListPtr)
Returns a pointer to the buffer that contains the data for the list.
void fBufFree(fBuf_t *fbuf)
Free a buffer.
void fbBasicListClear(fbBasicList_t *basicListPtr)
Clear the parameters of the basic list and free the data buffer.
const fbInfoElement_t * infoElement
pointer to the information element that is repeated in the list
Definition: public.h:1504
gboolean(* fbListenerAppInit_fn)(fbListener_t *listener, void **ctx, int fd, struct sockaddr *peer, size_t peerlen, GError **err)
Application context initialization function type for fbListener_t.
Definition: public.h:2323
void * fbBasicListGetDataPtr(fbBasicList_t *basicListPtr)
void fbSubTemplateListCollectorInit(fbSubTemplateList_t *STL)
Initializes a sub template list variable on a collector.
void fbSubTemplateListClearWithoutFree(fbSubTemplateList_t *subTemplateListPtr)
Clears the sub template list parameters but does not free the data ptr.
fbSession_t * fbSessionAlloc(fbInfoModel_t *model)
Allocate a transport session state container.
fBuf_t * fbListenerWaitNoCollectors(fbListener_t *listener, GError **err)
Waits for an incoming connection, just like fbListenerWait, except that this function doesn't monitor...
uint16_t fbSessionLookupTemplatePair(fbSession_t *session, uint16_t ext_tid)
Function to find a pair, uniquely identified by the external ID, and return the associated internal t...
struct fbInfoElementOptRec_st fbInfoElementOptRec_t
The corresponding struct to the Information Element Type Options Template.
uint32_t flags
Application flags word.
Definition: public.h:1205
fbExporter_t * fBufGetExporter(fBuf_t *fbuf)
Retrieve the exporting process endpoint associated with a buffer.
struct fbSubTemplateList_st fbSubTemplateList_t
Structure used to hold information of a sub template list.
uint8_t ie_type
ie data type
Definition: public.h:1139
fbTemplate_t * fbInfoElementAllocTypeTemplate(fbInfoModel_t *model, GError **err)
Allocate the Options Template that will be used to define Information Element Type Records...
uint16_t numElements
number of sub template lists in the multi list
Definition: public.h:1960
void fbSubTemplateMultiListFree(fbSubTemplateMultiList_t *STML)
Clears the multi list, then frees the memory pointed to by STML.
void fbSubTemplateMultiListClear(fbSubTemplateMultiList_t *STML)
Clears all of the entries (frees their data pointers), then frees the memory containing the entries...
struct fbInfoElementSpec_st fbInfoElementSpec_t
A single IPFIX Information Element specification.
ListenerEntry's make up a listener group as a linked list.
Definition: public.h:1342
fBuf_t * fBufAllocForExport(fbSession_t *session, fbExporter_t *exporter)
Allocate a new buffer for export.
void(* fbListenerAppFree_fn)(void *ctx)
Application context free function type for fbListener_t.
Definition: public.h:2338
gboolean fbTemplateContainsElement(fbTemplate_t *tmpl, const fbInfoElement_t *ex_ie)
Determine if a template contains a given information element.
void * fbSubTemplateMultiListEntryGetDataPtr(fbSubTemplateMultiListEntry_t *entry)
Retrieves the data pointer for this entry.
void(* fbTemplateCtxCallback_fn)(fbSession_t *session, uint16_t tid, fbTemplate_t *tmpl, void **ctx, fbTemplateCtxFree_fn *fn)
A new callback function that will be called when the session receives a new external template...
Definition: public.h:1454
ListenerGroupResult's contain the listener who's listening socket got a new connection.
Definition: public.h:1362
fbListenerGroup_t * fbListenerGroupAlloc(void)
Allocates and returns a fbListenerGroup with no entries.
gboolean fbListenerGroupWaitAcceptCallback(fbListenerGroup_t *group, fbAcceptCallback_fn callback, GError **err)
A combination of ListenerGroupWait and ListenerWaitAcceptCallback.
enum fbTransport_en fbTransport_t
Transport protocol for connection specifier.
uint8_t * dataPtr
pointer to the buffer used to hold the data
Definition: public.h:1717
fbInfoModel_t * fbInfoModelAlloc(void)
Allocate a new information model.
fbVarfield_t ie_name
information element name
Definition: public.h:1145
uint8_t semantic
value used to describe the list of sub templates
Definition: public.h:1962
void fbCollectorSetAcceptOnly(fbCollector_t *collector, struct sockaddr *address, size_t address_length)
Set the collector to only receive from the given IP address over UDP.
uint8_t fbSubTemplateMultiListGetSemantic(fbSubTemplateMultiList_t *STML)
Get the semantic paramter from the multi list.
Structure used to hold information of a sub template list.
Definition: public.h:1707
char * name
Information element name.
Definition: public.h:1193
void * fbSubTemplateListGetNextPtr(const fbSubTemplateList_t *subTemplateListPtr, void *currentPtr)
This function also traverses the elements in the list by accepting a pointer to the last element the ...
void fBufSetExportTime(fBuf_t *fbuf, uint32_t extime)
Set the export time on the message currently in a buffer.
void * vssl_ctx
Pointer to SSL context cache.
Definition: public.h:1275
uint32_t midx
Multiple IE index.
Definition: public.h:1098
void * fbBasicListGetNextPtr(fbBasicList_t *basicListPtr, void *currentPtr)
Function returns the next element in the list based on the currentPtr.
fbListenerEntry_t * prev
pointer to the previous listener entry in the linked list
Definition: public.h:1347
char * host
Hostname to connect/listen to.
Definition: public.h:1255
gboolean fbSessionExportTemplates(fbSession_t *session, GError **err)
Export all external templates in the current domain of a given session.
fbTemplate_t * fBufNextCollectionTemplate(fBuf_t *fbuf, uint16_t *ext_tid, GError **err)
Retrieve the external template that will be used to read the next record from the buffer...
uint8_t padding[6]
padding to align with template
Definition: public.h:1143
union fbSubTemplateList_st::@2 dataLength
length of the allocated buffer used to hold the data
void fbInfoModelFree(fbInfoModel_t *model)
Free an information model.
uint16_t tmplID
ID of the template used to structure the data.
Definition: public.h:1719
void fbSubTemplateListSetSemantic(fbSubTemplateList_t *subTemplateListPtr, uint8_t semantic)
Sets the semantic parameter of a subTemplateList.
const struct fbInfoElement_st * canon
Pointer to canonical copy of IE.
Definition: public.h:1085
fbTemplate_t * fBufGetCollectionTemplate(fBuf_t *fbuf, uint16_t *ext_tid)
Retrieve the external template used to read the last record from the buffer.
fbCollector_t * fBufGetCollector(fBuf_t *fbuf)
Retrieve the collecting process endpoint associated with a buffer.
gboolean fbInfoElementWriteOptionsRecord(fBuf_t *fbuf, const fbInfoElement_t *model_ie, uint16_t tid, GError **err)
Export an options record to the given fbuf with information element type information about the given ...
void * fbCollectorGetContext(fbCollector_t *collector)
Retrieve the application context associated with a collector.
void(* fbNewTemplateCallback_fn)(fbSession_t *session, uint16_t tid, fbTemplate_t *tmpl)
The callback function to be called when the session receives a new external template from the connect...
Definition: public.h:1417
The corresponding struct to the Information Element Type Options Template.
Definition: public.h:1127
gboolean fBufSetExportTemplate(fBuf_t *fbuf, uint16_t ext_tid, GError **err)
Set the external template for export on a buffer to the given template ID.
void * fbBasicListRealloc(fbBasicList_t *basicList, uint16_t newNumElements)
Free the current data pointer, allocating a new buffer to accomodate the new number of elements...
Secure, unreliable datagram transport via DTLS over UDP.
Definition: public.h:1244
void fbExporterSetStream(fbExporter_t *exporter, int sctp_stream)
Set the SCTP stream for the next message exported.
void * fbSubTemplateMultiListEntryNextDataPtr(fbSubTemplateMultiListEntry_t *entry, void *currentPtr)
This function traverses the elements in the entry by accepting a pointer to the last element the user...
struct fbInfoModel_st fbInfoModel_t
An IPFIX information model.
Definition: public.h:768
void * fbSubTemplateMultiListEntryGetIndexedPtr(fbSubTemplateMultiListEntry_t *entry, uint16_t index)
Returns a pointer to a data element in the entry based on the index.
uint32_t flags
Flags.
Definition: public.h:1110
gboolean fbInfoElementAddOptRecElement(fbInfoModel_t *model, fbInfoElementOptRec_t *rec)
Add an element that we received via an Options Record to the given info model.
const char * description
description
Definition: public.h:1118
uint16_t numElements
number of elements in this entry
Definition: public.h:1949
gboolean fbTemplateContainsElementByName(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec)
Determine if a template contains at least one instance of a given information element, specified by name in the template's information model.
Reliable stream transport via TCP.
Definition: public.h:1225
void fbInfoModelAddElement(fbInfoModel_t *model, fbInfoElement_t *ie)
Add a single information element to an information model.
uint32_t fbSessionGetDomain(fbSession_t *session)
Retrieve the current domain on a session.
void * fbBasicListAddNewElements(fbBasicList_t *basicList, uint16_t numNewElements)
Allocates an additional elememnt into the basic list must be called after calling BasicListInit...
Entries contain the same type of information at SubTemplateLists: template ID and template pointers t...
Definition: public.h:1939
fbVarfield_t ie_desc
information element description
Definition: public.h:1147
void * fbBasicListInit(fbBasicList_t *basicListPtr, uint8_t semantic, const fbInfoElement_t *infoElement, uint16_t numElements)
Initializes the basic list structure based on the parameters.
int fbListenerGroupAddListener(fbListenerGroup_t *group, const fbListener_t *listener)
Adds a previously allocated listener to the previously allocated group.
gboolean fbInfoModelTypeInfoRecord(fbTemplate_t *tmpl)
Checks to see if the template contains all of the elements the RFC 5610 info element type record shou...
gboolean fBufSetAutomaticInsert(fBuf_t *fbuf, GError **err)
Set the automatic insert flag on a buffer.
void fbExporterAutoStream(fbExporter_t *exporter)
Enable automatic SCTP stream selection for the next message exported.
struct fbVarfield_st fbVarfield_t
A variable-length field value.
fbInfoModel_t * fbSessionGetInfoModel(fbSession_t *session)
fbSessionGetInfoModel
enum fbInfoElementDataType_en fbInfoElementDataType_t
From RFC 5610: A description of the abstract data type of an IPFIX information element as registered ...
union fbInfoElement_st::@1 ref
Information element name.
fbTransport_t transport
Transport protocol to use.
Definition: public.h:1253
void fbSubTemplateMultiListEntryClear(fbSubTemplateMultiListEntry_t *entry)
Frees the memory pointed to by the data buffer holding the data elements.
const fbTemplate_t * fbSubTemplateMultiListEntryGetTemplate(fbSubTemplateMultiListEntry_t *entry)
Retrieve the template pointer used to structure the data elements.
char * svc
Service name or port number to connect/listen to.
Definition: public.h:1257
void fbCollectorSetUDPMultiSession(fbCollector_t *collector, gboolean multi_session)
Attempt to maintain backwards compatibility with UDP.
void fbSessionAddTemplateCtxCallback(fbSession_t *session, fbTemplateCtxCallback_fn callback)
This function sets the callback that allows the application to set its own context variable with a ne...
uint8_t * dataPtr
pointer to the buffer used to hold the data in this entry
Definition: public.h:1943
void fbCollectorManageUDPStreamByPort(fbCollector_t *collector, gboolean manage_port)
An attempt to fix what some netflow v9 exporters do wrong.
fbListener_t * fbListenerAlloc(fbConnSpec_t *spec, fbSession_t *session, fbListenerAppInit_fn appinit, fbListenerAppFree_fn appfree, GError **err)
Allocate a listener.
const fbInfoElement_t * fbInfoModelGetElementByID(fbInfoModel_t *model, uint16_t id, uint32_t ent)
Return a pointer to the canonical information element within an information model given the informati...
char * ssl_key_pass
Private key decryption password.
Definition: public.h:1265
uint16_t ie_id
information element id
Definition: public.h:1137
gboolean fBufNextMessage(fBuf_t *fbuf, GError **err)
Read a new message into a buffer using the associated collecting process endpoint.
void * fbSubTemplateListGetIndexedDataPtr(const fbSubTemplateList_t *subTemplateListPtr, uint16_t index)
This function is used to iterate over the elements in the list by passing in a counter to indicate wh...
void * fbBasicListGetIndexedDataPtr(fbBasicList_t *basicListPtr, uint16_t bl_index)
Function retrieves the index'th element in the list index is 0-based.
fbInfoElementDataType_en
From RFC 5610: A description of the abstract data type of an IPFIX information element as registered ...
Definition: public.h:1043
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListGetNextEntry(fbSubTemplateMultiList_t *STML, fbSubTemplateMultiListEntry_t *currentEntry)
This function also traverses the elements in the list by accepting a pointer to the last element the ...
uint32_t fBufGetExportTime(fBuf_t *fbuf)
Retrieve the export time on the message currently in a buffer.
void * tableForDescriptorsToListeners
pointer to a generic structure for future use
Definition: public.h:1380
struct fbListenerGroup_st fbListenerGroup_t
Structure that holds the listeners that are added to the group.
void * fbSubTemplateListInitWithOwnBuffer(fbSubTemplateList_t *subTemplateList, uint8_t semantic, uint16_t tmplID, const fbTemplate_t *tmpl, uint16_t numElements, uint16_t dataLength, uint8_t *dataPtr)
Initializes the subTemplateList but does not allocate a buffer.
uint8_t * buf
Content buffer.
Definition: public.h:759
fbListenerGroupResult_t * fbListenerGroupWait(fbListenerGroup_t *group, GError **err)
Similar to fbListenerWait, except that is looks for connections for multiple listeners.
uint16_t fbSubTemplateListGetTemplateID(fbSubTemplateList_t *subTemplateListPtr)
Gets the template ID for the template used by the list.
fbBasicList_t * fbBasicListAlloc(void)
allocates a Basic List Structure
fbTransport_en
Transport protocol for connection specifier.
Definition: public.h:1218
void * fbSubTemplateListRealloc(fbSubTemplateList_t *subTemplateList, uint16_t newNumElements)
Free the current data pointer, allocating a new buffer to accomodate the new number of elements...
void fBufSetExporter(fBuf_t *fbuf, fbExporter_t *exporter)
Associate an exporting process endpoint with a buffer.
An IPFIX template or options template structure.
Definition: private.h:184
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListGetFirstEntry(fbSubTemplateMultiList_t *STML)
Retrieve the first entry in the multi list.
void * fbTemplateGetContext(fbTemplate_t *tmpl)
Get the ctx pointer associated with a Template.
fbListenerEntry_t * next
pointer to the next listener entry in the linked list
Definition: public.h:1345
fbTemplate_t * fbTemplateAlloc(fbInfoModel_t *model)
Allocate a new empty template.
fbCollector_t * fbCollectorAllocFile(void *ctx, const char *path, GError **err)
Allocate a collecting process endpoint for a named file.
Structure that holds the listeners that are added to the group.
Definition: public.h:1375
struct fbSubTemplateMultiList_st fbSubTemplateMultiList_t
Multilists just contain the semantic to describe the sub lists, the number of sub lists...
fbSession_t * fBufGetSession(fBuf_t *fbuf)
Retrieve the session associated with a buffer.
uint16_t ie_units
ie units
Definition: public.h:1135
void fbBasicListCollectorInit(fbBasicList_t *basicListPtr)
This initializes a basic list structure for collection.
fbListenerEntry_t * head
pointer to the head of the listener group result list
Definition: public.h:1378
fbListenerGroupResult_t * next
Pointer to the next listener group result.
Definition: public.h:1365
Secure, partially reliable datagram transport via DTLS over SCTP.
Definition: public.h:1233
uint32_t fbTemplateCountElements(fbTemplate_t *tmpl)
Determine number of information elements in a template.
uint32_t fbCollectorGetObservationDomain(fbCollector_t *collector)
Retrieves the observation domain of the node connected to the collector.
void fbCollectorClose(fbCollector_t *collector)
Close the file or socket underlying a collecting process endpoint.
A basic list element in a template which structure represents a basic list on the internal side...
Definition: public.h:1502
fBuf_t * fbListenerOwnSocketCollectorTCP(fbListener_t *listener, int sock, GError **err)
Returns an fBuf wrapped around an independently managed socket and a properly created listener for TC...
uint8_t fbBasicListGetSemantic(fbBasicList_t *basicListPtr)
Get Semantic field for Basic List presumably used in collectors after decoding.
Connection specifier.
Definition: public.h:1251
fbListener_t * listener
pointer to the listener to add to the list
Definition: public.h:1349
fbTemplate_t * tmpl
pointer to the template used to structure the data in this entry
Definition: public.h:1941
struct fBuf_st fBuf_t
An IPFIX message buffer.
Definition: public.h:742
uint64_t max
range max
Definition: public.h:1114
fbTemplate_t * fbSessionGetTemplate(fbSession_t *session, gboolean internal, uint16_t tid, GError **err)
Retrieve a template from a session by ID.
uint16_t len_override
Length override; if nonzero, replace the length of the IE from the model with this length...
Definition: public.h:1198
gboolean fbSessionExportTemplate(fbSession_t *session, uint16_t tid, GError **err)
Export a single external template in the current domain of a given session.
uint16_t fbSessionAddTemplate(fbSession_t *session, gboolean internal, uint16_t tid, fbTemplate_t *tmpl, GError **err)
Add a template to a session.
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListAddNewEntries(fbSubTemplateMultiList_t *STML, uint16_t numNewEntries)
Adds entries to the multi list of entries can only be run after the list has been initialized...
void * fbSubTemplateListAddNewElements(fbSubTemplateList_t *subTemplateList, uint16_t numNewElements)
Allocates space for a number of additional element in the sub template list must be called after the ...
uint8_t fbSubTemplateListGetSemantic(fbSubTemplateList_t *subTemplateListPtr)
Gets the semantic value from a sub template list.
gboolean fbTemplateAppendSpec(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags, GError **err)
Append an information element described by specifier to a template.
A single IPFIX Information Element definition.
Definition: public.h:1077
int fbListenerGroupDeleteListener(fbListenerGroup_t *group, const fbListener_t *listener)
Removes the listener from the group.
gboolean fbSessionRemoveTemplate(fbSession_t *session, gboolean internal, uint16_t tid, GError **err)
Remove a template from a session.
uint8_t semantic
semantic field to describe the list
Definition: public.h:1512
const char * name
Information element name.
Definition: public.h:1090
const fbTemplate_t * fbSubTemplateListGetTemplate(fbSubTemplateList_t *subTemplateListPtr)
Gets the template pointer from the list structure.
void fbSessionResetExternal(fbSession_t *session)
Reset the external state (sequence numbers and templates) in a session state container.
uint8_t type
Data Type.
Definition: public.h:1116
uint16_t fbSubTemplateMultiListEntryGetTemplateID(fbSubTemplateMultiListEntry_t *entry)
Retrieve the template ID for the template used to structure the data.
gboolean fbListenerGetCollector(fbListener_t *listener, fbCollector_t **collector, GError **err)
fbListenerGetCollector
A single IPFIX Information Element specification.
Definition: public.h:1191
void fbListenerInterrupt(fbListener_t *listener)
Cause the current or next call to fbListenerWait to unblock and return.
fBuf_t * fbListenerOwnSocketCollectorTLS(fbListener_t *listener, int sock, GError **err)
Same as fbListenerOwnSocketCollectorTCP but for TLS (not tested)
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListGetIndexedEntry(fbSubTemplateMultiList_t *STML, uint16_t index)
Retrieve a pointer to the entry of a specific index.
gboolean fbCollectorClearTranslator(fbCollector_t *collector, GError **err)
fbCollectorClearTranslator
char * ssl_key_file
Path to private key file.
Definition: public.h:1263
void fbInfoModelAddElementArray(fbInfoModel_t *model, fbInfoElement_t *ie)
Add multiple information elements in an array to an information model.
void fbBasicListSetSemantic(fbBasicList_t *basicListPtr, uint8_t semantic)
Sets the semantic for describing a basic list generally used in exporters before decoding.
gboolean fBufSetInternalTemplate(fBuf_t *fbuf, uint16_t int_tid, GError **err)
Set the internal template on a buffer to the given template ID.
uint8_t ie_semantic
ie semantic
Definition: public.h:1141
gboolean fbListenerWaitAcceptCallback(fbListener_t *listener, fbAcceptCallback_fn callback, GError **err)
Takes one listener, and instead of returning the fBuf created from the new collector, like fbListenerWait(), it calls the callback function provided.
void * fbSubTemplateMultiListEntryInit(fbSubTemplateMultiListEntry_t *entry, uint16_t tmplID, fbTemplate_t *tmpl, uint16_t numElements)
Initializes the multi list entry with the template values, and allocates the memory used by the entry...
void fbListenerFree(fbListener_t *listener)
Free a listener.
gboolean fbListValidSemantic(uint8_t semantic)
validates the value of the semantic field,
void fbSessionFree(fbSession_t *session)
Free a transport session state container.
void fbTemplateSetOptionsScope(fbTemplate_t *tmpl, uint16_t scope_count)
Set the number of information elements in a template that are scope.