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-2019 Carnegie Mellon University. All Rights Reserved.
7  ** ------------------------------------------------------------------------
8  ** Authors: Brian Trammell, Dan Ruef
9  ** ------------------------------------------------------------------------
10  ** @OPENSOURCE_LICENSE_START@
11  ** libfixbuf 2.0
12  **
13  ** Copyright 2018-2019 Carnegie Mellon University. All Rights Reserved.
14  **
15  ** NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE
16  ** ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS"
17  ** BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND,
18  ** EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT
19  ** LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY,
20  ** EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE
21  ** MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF
22  ** ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR
23  ** COPYRIGHT INFRINGEMENT.
24  **
25  ** Released under a GNU-Lesser GPL 3.0-style license, please see
26  ** LICENSE.txt or contact permission@sei.cmu.edu for full terms.
27  **
28  ** [DISTRIBUTION STATEMENT A] This material has been approved for
29  ** public release and unlimited distribution. Please see Copyright
30  ** notice for non-US Government use and distribution.
31  **
32  ** Carnegie Mellon(R) and CERT(R) are registered in the U.S. Patent
33  ** and Trademark Office by Carnegie Mellon University.
34  **
35  ** DM18-0325
36  ** @OPENSOURCE_LICENSE_END@
37  **
38  ** ------------------------------------------------------------------------
39  */
40 
988 #ifndef _FB_PUBLIC_H_
989 #define _FB_PUBLIC_H_
990 #include <fixbuf/autoinc.h>
991 #include <fixbuf/version.h>
992 
993 #ifdef __cplusplus
994 extern "C" {
995 #endif
996 
997 
1002 #define FIXBUF_CHECK_VERSION(major, minor, release) \
1003  (FIXBUF_VERSION_MAJOR > (major) || \
1004  (FIXBUF_VERSION_MAJOR == (major) && FIXBUF_VERSION_MINOR > (minor)) || \
1005  (FIXBUF_VERSION_MAJOR == (major) && FIXBUF_VERSION_MINOR == (minor) && \
1006  FIXBUF_VERSION_RELEASE >= (release)))
1007 
1008 /*
1009  * Error Handling Definitions
1010  */
1011 
1013 #define FB_ERROR_DOMAIN g_quark_from_string("fixbufError")
1014 
1015 #define FB_ERROR_TMPL 1
1016 
1020 #define FB_ERROR_EOM 2
1021 
1026 #define FB_ERROR_EOF 3
1027 
1031 #define FB_ERROR_IPFIX 4
1032 
1037 #define FB_ERROR_BUFSZ 5
1038 
1039 #define FB_ERROR_IMPL 6
1040 
1041 #define FB_ERROR_IO 7
1042 
1046 #define FB_ERROR_NLREAD 8
1047 
1052 #define FB_ERROR_NLWRITE 9
1053 
1056 #define FB_ERROR_NOELEMENT 10
1057 
1060 #define FB_ERROR_CONN 11
1061 
1065 #define FB_ERROR_NETFLOWV9 12
1066 
1069 #define FB_ERROR_TRANSMISC 13
1070 
1073 #define FB_ERROR_SFLOW 14
1074 
1077 #define FB_ERROR_SETUP 15
1078 
1081 #define FB_ERROR_LAXSIZE 16
1082 
1083 /*
1084  * Public Datatypes and Constants
1085  */
1086 
1092 typedef struct fBuf_st fBuf_t;
1093 
1100 typedef struct fbVarfield_st {
1102  size_t len;
1109  uint8_t *buf;
1110 } fbVarfield_t;
1111 
1112 
1117 typedef struct fbInfoModel_st fbInfoModel_t;
1118 
1122 typedef GHashTableIter fbInfoModelIter_t;
1123 
1129 #define FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, _min_, _max_, _type_, _desc_)\
1130  { {(const struct fbInfoElement_st*)_name_}, 0, _ent_, _num_, _len_, _flags_, _min_, _max_, _type_, _desc_ }
1131 
1138 #define FB_IE_INIT(_name_, _ent_, _num_, _len_, _flags_) \
1139  FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, 0, 0, 0, (char*)NULL)
1140 
1141 
1147 #define FB_IE_NULL FB_IE_INIT(NULL, 0, 0, 0, 0)
1148 
1155 #define FB_IE_SEMANTIC(flags) ((flags & 0x0000ff00) >> 8)
1156 
1162 #define FB_IE_UNITS(flags) ((flags & 0xFFFF0000) >> 16)
1163 
1168 #define FB_IE_F_NONE 0x00000000
1169 
1175 #define FB_IE_F_ENDIAN 0x00000001
1176 
1188 #define FB_IE_F_REVERSIBLE 0x00000040
1189 
1198 #define FB_IE_F_ALIEN 0x00000080
1199 
1204 #define FB_IE_QUANTITY 0x00000100
1205 
1211 #define FB_IE_TOTALCOUNTER 0x00000200
1212 
1217 #define FB_IE_DELTACOUNTER 0x00000300
1218 
1223 #define FB_IE_IDENTIFIER 0x00000400
1224 
1229 #define FB_IE_FLAGS 0x00000500
1230 
1236 #define FB_IE_LIST 0x00000600
1237 
1243 #define FB_IE_SNMPCOUNTER 0x00000700
1244 
1250 #define FB_IE_SNMPGAUGE 0x00000800
1251 
1257 #define FB_IE_DEFAULT 0x00000000
1258 
1269 #define FB_UNITS_BITS 0x00010000
1270 
1275 #define FB_UNITS_OCTETS 0x00020000
1276 
1281 #define FB_UNITS_PACKETS 0x00030000
1282 
1287 #define FB_UNITS_FLOWS 0x00040000
1288 
1293 #define FB_UNITS_SECONDS 0x00050000
1294 
1299 #define FB_UNITS_MILLISECONDS 0x00060000
1300 
1305 #define FB_UNITS_MICROSECONDS 0x00070000
1306 
1311 #define FB_UNITS_NANOSECONDS 0x00080000
1312 
1317 #define FB_UNITS_WORDS 0x00090000
1318 
1323 #define FB_UNITS_MESSAGES 0x000A0000
1324 
1329 #define FB_UNITS_HOPS 0x000B0000
1330 
1335 #define FB_UNITS_ENTRIES 0x000C0000
1336 
1341 #define FB_UNITS_FRAMES 0x000D0000
1342 
1347 #define FB_UNITS_PORTS 0x000E0000
1348 
1353 #define FB_UNITS_INFERRED 0x000F0000
1354 
1358 #define FB_IE_VARLEN 65535
1359 
1368 #define FB_IE_BASIC_LIST 291
1369 
1377 #define FB_IE_SUBTEMPLATE_LIST 292
1378 
1386 #define FB_IE_SUBTEMPLATE_MULTILIST 293
1387 
1396 #define FB_IE_PEN_REVERSE 29305
1397 
1406 #define FB_IE_VENDOR_BIT_REVERSE 0x4000
1407 
1413 #define FB_CISCO_GENERIC 9999
1414 
1421 #define FB_CISCO_ASA_EVENT_ID 9998
1422 
1431 #define FB_CISCO_ASA_EVENT_XTRA 9997
1432 
1437 #define FB_IE_REVERSE_STR "reverse"
1438 
1440 #define FB_IE_REVERSE_STRLEN 7
1441 
1523 
1532 typedef struct fbInfoElement_st {
1534  union {
1540  const struct fbInfoElement_st *canon;
1545  const char *name;
1546  } ref;
1547 
1553  uint32_t midx;
1555  uint32_t ent;
1560  uint16_t num;
1562  uint16_t len;
1565  uint32_t flags;
1567  uint64_t min;
1569  uint64_t max;
1571  uint8_t type;
1573  const char *description;
1574 } fbInfoElement_t;
1575 
1600 typedef struct fbInfoElementOptRec_st {
1602  uint32_t ie_pen;
1604  uint16_t ie_id;
1606  uint8_t ie_type;
1608  uint8_t ie_semantic;
1610  uint16_t ie_units;
1612  uint8_t padding[6];
1614  uint64_t ie_range_begin;
1616  uint64_t ie_range_end;
1622 
1623 
1636 #define FB_TID_AUTO 0
1637 
1641 #define FB_TID_TS 2
1642 
1646 #define FB_TID_OTS 3
1647 
1651 #define FB_TID_MIN_DATA 256
1652 
1659 
1665 #define FB_IESPEC_NULL { NULL, 0, 0 }
1666 
1673 typedef struct fbInfoElementSpec_st {
1675  char *name;
1687  uint16_t len_override;
1694  uint32_t flags;
1696 
1703 typedef struct fbSession_st fbSession_t;
1704 
1706 typedef enum fbTransport_en {
1733 } fbTransport_t;
1734 
1739 typedef struct fbConnSpec_st {
1743  char *host;
1745  char *svc;
1758  void *vai;
1763  void *vssl_ctx;
1764 } fbConnSpec_t;
1765 
1769 #define FB_CONNSPEC_INIT { FB_SCTP, NULL, NULL, \
1770  NULL, NULL, NULL, NULL, \
1771  NULL, NULL }
1772 
1773 #if HAVE_SPREAD
1774 
1778 #define FB_SPREADPARAMS_INIT { 0, 0, 0 }
1779 
1785 typedef struct fbSpreadParams_st {
1791  char * daemon;
1794  char ** groups;
1796 
1797 #endif /* HAVE_SPREAD */
1798 
1804 typedef struct fbExporter_st fbExporter_t;
1805 
1813 typedef struct fbCollector_st fbCollector_t;
1814 
1821 typedef struct fbListener_st fbListener_t;
1822 
1823 /*
1824  * ListenerGroup and associated data type definitions
1825  */
1826 
1830 typedef struct fbListenerGroup_st fbListenerGroup_t;
1831 
1835 typedef struct fbListenerEntry_st {
1843 
1857 
1869 typedef void (*fbTemplateCtxFree_fn)(
1870  void *tmpl_ctx,
1871  void *app_ctx);
1872 
1896 typedef void (*fbNewTemplateCallback_fn) (
1897  fbSession_t *session,
1898  uint16_t tid,
1899  fbTemplate_t *tmpl,
1900  void *app_ctx,
1901  void **tmpl_ctx,
1902  fbTemplateCtxFree_fn *tmpl_ctx_free_fn);
1903 
1904 
1912 #define FB_LIST_SEM_UNDEFINED 0xFF
1913 
1916 #define FB_LIST_SEM_NONE_OF 0x00
1917 
1920 #define FB_LIST_SEM_EXACTLY_ONE_OF 0x01
1921 
1924 #define FB_LIST_SEM_ONE_OR_MORE_OF 0x02
1925 
1928 #define FB_LIST_SEM_ALL_OF 0x03
1929 
1932 #define FB_LIST_SEM_ORDERED 0x04
1933 
1941 gboolean fbListValidSemantic(
1942  uint8_t semantic);
1943 
1944 /****** BASICLIST FUNCTIONS AND STRUCTS *******/
1950 typedef struct fbBasicList_st {
1954  uint8_t *dataPtr;
1956  uint16_t numElements;
1958  uint16_t dataLength;
1960  uint8_t semantic;
1961 } fbBasicList_t;
1962 
1963 
1970  void);
1971 
1984 void* fbBasicListInit(
1985  fbBasicList_t *basicList,
1986  uint8_t semantic,
1987  const fbInfoElement_t *infoElement,
1988  uint16_t numElements);
1989 
2005  fbBasicList_t *basicList,
2006  uint8_t semantic,
2007  const fbInfoElement_t *infoElement,
2008  uint16_t numElements,
2009  uint16_t dataLength,
2010  uint8_t *dataPtr);
2011 
2025  fbBasicList_t *basicList);
2026 
2033 uint16_t fbBasicListCountElements(
2034  const fbBasicList_t *basicList);
2035 
2043 uint8_t fbBasicListGetSemantic(
2044  fbBasicList_t *basicList);
2045 
2055  fbBasicList_t *basicList,
2056  uint8_t semantic);
2057 
2066  fbBasicList_t *basicList);
2067 
2073 void* fbBasicListGetDataPtr(
2074  fbBasicList_t *basicList);
2075 
2086  fbBasicList_t *basicList,
2087  uint16_t index);
2088 
2100 void* fbBasicListGetNextPtr(
2101  fbBasicList_t *basicList,
2102  void *currentPtr);
2103 
2117 void* fbBasicListRealloc(
2118  fbBasicList_t *basicList,
2119  uint16_t newNumElements);
2120 
2129  fbBasicList_t *basicList,
2130  uint16_t numNewElements);
2131 
2140 void fbBasicListClear(
2141  fbBasicList_t *basicList);
2142 
2151  fbBasicList_t *basicList);
2152 
2160 void fbBasicListFree(
2161  fbBasicList_t *basicList);
2162 
2163 
2164 /******* END OF BASICLIST ********/
2165 
2166 
2167 
2168 /******* SUBTEMPLATELIST FUNCTIONS ****/
2169 
2177 typedef struct fbSubTemplateList_st {
2180  union {
2181  size_t length;
2182  uint64_t extra;
2183  } dataLength;
2187  uint8_t *dataPtr;
2189  uint16_t tmplID;
2191  uint16_t numElements;
2193  uint8_t semantic;
2195 
2203  void);
2204 
2222 void* fbSubTemplateListInit(
2223  fbSubTemplateList_t *sTL,
2224  uint8_t semantic,
2225  uint16_t tmplID,
2226  const fbTemplate_t *tmpl,
2227  uint16_t numElements);
2228 
2245  fbSubTemplateList_t *subTemplateList,
2246  uint8_t semantic,
2247  uint16_t tmplID,
2248  const fbTemplate_t *tmpl,
2249  uint16_t numElements,
2250  uint16_t dataLength,
2251  uint8_t *dataPtr);
2252 
2268  fbSubTemplateList_t *STL);
2269 
2276  const fbSubTemplateList_t *subTemplateList);
2277 
2288  const fbSubTemplateList_t *subTemplateList,
2289  uint16_t index);
2290 
2303  const fbSubTemplateList_t *subTemplateList,
2304  void *currentPtr);
2305 
2313  const fbSubTemplateList_t *subTemplateList);
2314 
2322  fbSubTemplateList_t *subTemplateList,
2323  uint8_t semantic);
2324 
2331  fbSubTemplateList_t *subTemplateList);
2332 
2339  fbSubTemplateList_t *subTemplateList);
2340 
2347  fbSubTemplateList_t *subTemplateList);
2348 
2365  fbSubTemplateList_t *subTemplateList,
2366  uint16_t newNumElements);
2367 
2378  fbSubTemplateList_t *subTemplateList,
2379  uint16_t numNewElements);
2380 
2397  fbSubTemplateList_t *subTemplateList);
2398 
2408  fbSubTemplateList_t *subTemplateList);
2409 
2419  fbSubTemplateList_t *subTemplateList);
2420 
2421 /********* END OF SUBTEMPLATELIST **********/
2443  uint8_t *dataPtr;
2445  size_t dataLength;
2447  uint16_t tmplID;
2449  uint16_t numElements;
2451 
2460  uint16_t numElements;
2462  uint8_t semantic;
2464 
2465 
2474  void);
2475 
2476 
2488  uint8_t semantic,
2489  uint16_t numElements);
2490 
2499  const fbSubTemplateMultiList_t *STML);
2500 
2509  uint8_t semantic);
2510 
2517  fbSubTemplateMultiList_t *STML);
2518 
2528  fbSubTemplateMultiList_t *STML);
2529 
2545  fbSubTemplateMultiList_t *STML);
2546 
2555  fbSubTemplateMultiList_t *STML);
2556 
2573  uint16_t newNumEntries);
2574 
2585  uint16_t numNewEntries);
2586 
2593  fbSubTemplateMultiList_t *STML);
2594 
2605  uint16_t index);
2606 
2620  fbSubTemplateMultiListEntry_t *currentEntry);
2621 
2638  uint16_t tmplID,
2639  fbTemplate_t *tmpl,
2640  uint16_t numElements);
2641 
2661  uint16_t newNumElements);
2662 
2674  uint16_t numNewElements);
2675 
2687 
2696 
2710  void *currentPtr);
2711 
2724  uint16_t index);
2725 
2734  const fbSubTemplateMultiListEntry_t *entry);
2735 
2744 
2753 
2754 /************** END OF STML FUNCTIONS *********** */
2755 
2772 void fBufListFree(
2773  fbTemplate_t *tmpl,
2774  uint8_t *record);
2775 
2776 
2786  void);
2787 
2794 void fbListenerGroupFree(
2795  fbListenerGroup_t *group);
2796 
2807  fbListenerGroup_t *group,
2808  const fbListener_t *listener);
2809 
2820  fbListenerGroup_t *group,
2821  const fbListener_t *listener);
2822 
2836  fbListenerGroup_t *group,
2837  GError **err);
2838 
2845  fbListenerGroupResult_t *result);
2846 
2860  fbListener_t *listener,
2861  int sock,
2862  GError **err);
2863 
2874  fbListener_t *listener,
2875  int sock,
2876  GError **err);
2877 
2883 void fBufInterruptSocket(
2884  fBuf_t *fbuf);
2885 
2886 
2908 typedef gboolean (*fbListenerAppInit_fn) (
2909  fbListener_t *listener,
2910  void **ctx,
2911  int fd,
2912  struct sockaddr *peer,
2913  size_t peerlen,
2914  GError **err);
2915 
2925 typedef void (*fbListenerAppFree_fn) (
2926  void *ctx);
2927 
2928 /*
2929  * Public Function Calls. These calls will remain available and retain
2930  * their functionality in all subsequent versions of libfixbuf.
2931  */
2932 
2933 
2950 gboolean fBufSetInternalTemplate(
2951  fBuf_t *fbuf,
2952  uint16_t int_tid,
2953  GError **err);
2954 
2972 gboolean fBufSetExportTemplate(
2973  fBuf_t *fbuf,
2974  uint16_t ext_tid,
2975  GError **err);
2976 
2977 #if HAVE_SPREAD
2978 
2994  fBuf_t *fbuf,
2995  char **groups,
2996  int num_groups,
2997  GError **err);
2998 #endif /* HAVE_SPREAD */
2999 
3022  fBuf_t *fbuf,
3023  gboolean automatic);
3024 
3045 gboolean fBufSetAutomaticInsert(
3046  fBuf_t *fbuf,
3047  GError **err);
3048 
3049 
3058  fBuf_t *fbuf);
3059 
3068 void fBufFree(
3069  fBuf_t *fbuf);
3070 
3084  fbSession_t *session,
3085  fbExporter_t *exporter);
3086 
3097  fBuf_t *fbuf);
3098 
3109 void fBufSetExporter(
3110  fBuf_t *fbuf,
3111  fbExporter_t *exporter);
3112 
3113 
3125 size_t fBufRemaining(
3126  fBuf_t *fbuf);
3127 
3128 
3141 void fBufSetBuffer(
3142  fBuf_t *fbuf,
3143  uint8_t *buf,
3144  size_t buflen);
3145 
3146 
3170 gboolean fBufAppend(
3171  fBuf_t *fbuf,
3172  uint8_t *recbase,
3173  size_t recsize,
3174  GError **err);
3175 
3185 gboolean fBufEmit(
3186  fBuf_t *fbuf,
3187  GError **err);
3188 
3200 void fBufSetExportTime(
3201  fBuf_t *fbuf,
3202  uint32_t extime);
3203 
3221  fbSession_t *session,
3222  fbCollector_t *collector);
3223 
3234  fBuf_t *fbuf);
3235 
3246 void fBufSetCollector(
3247  fBuf_t *fbuf,
3248  fbCollector_t *collector);
3249 
3279 gboolean fBufNext(
3280  fBuf_t *fbuf,
3281  uint8_t *recbase,
3282  size_t *recsize,
3283  GError **err);
3284 
3297 gboolean fBufNextMessage(
3298  fBuf_t *fbuf,
3299  GError **err);
3300 
3308 uint32_t fBufGetExportTime(
3309  fBuf_t *fbuf);
3310 
3331  fBuf_t *fbuf,
3332  uint16_t *ext_tid);
3333 
3353  fBuf_t *fbuf,
3354  uint16_t *ext_tid,
3355  GError **err);
3356 
3372  void);
3373 
3382 void fbInfoModelFree(
3383  fbInfoModel_t *model);
3384 
3400  fbInfoModel_t *model,
3401  fbInfoElement_t *ie);
3402 
3422  fbInfoModel_t *model,
3423  fbInfoElement_t *ie);
3424 
3456 gboolean fbInfoModelReadXMLFile(
3457  fbInfoModel_t *model,
3458  const gchar *filename,
3459  GError **err);
3460 
3493 gboolean fbInfoModelReadXMLData(
3494  fbInfoModel_t *model,
3495  const gchar *xml_data,
3496  gssize xml_data_len,
3497  GError **err);
3498 
3511  fbInfoModel_t *model,
3512  const char *name);
3513 
3528  fbInfoModel_t *model,
3529  uint16_t id,
3530  uint32_t ent);
3531 
3540  const fbInfoModel_t *model);
3541 
3551 void fbInfoModelIterInit(
3552  fbInfoModelIter_t *iter,
3553  const fbInfoModel_t *model);
3554 
3566  fbInfoModelIter_t *iter);
3567 
3582  fbInfoModel_t *model,
3583  GError **err);
3584 
3600  fBuf_t *fbuf,
3601  const fbInfoElement_t *model_ie,
3602  uint16_t itid,
3603  uint16_t etid,
3604  GError **err);
3605 
3618  fbInfoModel_t *model,
3619  fbInfoElementOptRec_t *rec);
3620 
3629 gboolean fbInfoModelTypeInfoRecord(
3630  fbTemplate_t *tmpl);
3631 
3650  fbInfoModel_t *model);
3651 
3669 gboolean fbTemplateAppend(
3670  fbTemplate_t *tmpl,
3671  fbInfoElement_t *ex_ie,
3672  GError **err);
3673 
3691 gboolean fbTemplateAppendSpec(
3692  fbTemplate_t *tmpl,
3693  fbInfoElementSpec_t *spec,
3694  uint32_t flags,
3695  GError **err);
3696 
3712 gboolean fbTemplateAppendSpecArray(
3713  fbTemplate_t *tmpl,
3714  fbInfoElementSpec_t *spec,
3715  uint32_t flags,
3716  GError **err);
3717 
3725 uint32_t fbTemplateCountElements(
3726  fbTemplate_t *tmpl);
3727 
3743  fbTemplate_t *tmpl,
3744  uint16_t scope_count);
3745 
3753 uint32_t fbTemplateGetOptionsScope(
3754  fbTemplate_t *tmpl);
3755 
3769 gboolean fbTemplateContainsElement(
3770  fbTemplate_t *tmpl,
3771  const fbInfoElement_t *ex_ie);
3772 
3785  fbTemplate_t *tmpl,
3786  fbInfoElementSpec_t *spec);
3787 
3800  fbTemplate_t *tmpl,
3801  fbInfoElementSpec_t *spec);
3802 
3818  fbTemplate_t *tmpl,
3819  fbInfoElementSpec_t *spec,
3820  uint32_t flags);
3821 
3831  fbTemplate_t *tmpl,
3832  uint32_t IEindex);
3833 
3834 
3843  fbTemplate_t *tmpl);
3844 
3853  fbTemplate_t *tmpl);
3854 
3862 void *fbTemplateGetContext(
3863  fbTemplate_t *tmpl);
3864 
3872  fbTemplate_t *tmpl);
3873 
3892  fbInfoModel_t *model);
3893 
3908  fbSession_t *session,
3909  gboolean enabled,
3910  GError **err);
3911 
3936  fbSession_t *session,
3937  gboolean enabled,
3938  uint16_t tid,
3939  GError **err);
3940 
3956  fbSession_t *session,
3957  gboolean enabled,
3958  GError **err);
3959 
3984  fbSession_t *session,
3985  gboolean enabled,
3986  uint16_t tid,
3987  GError **err);
3988 
4007  fbSession_t *session,
4008  gboolean internal,
4009  uint16_t tid,
4010  fbTemplate_t *tmpl,
4011  const char *name,
4012  const char *description,
4013  GError **err);
4014 
4022  fbSession_t *session);
4023 
4054  fbSession_t *session,
4055  fbNewTemplateCallback_fn callback,
4056  void *app_ctx);
4057 
4082  fbSession_t *session,
4083  uint16_t ent_tid,
4084  uint16_t int_tid);
4085 
4096  fbSession_t *session,
4097  uint16_t ext_tid);
4098 
4108  fbSession_t *session,
4109  uint16_t ext_tid);
4110 
4120 void fbSessionFree(
4121  fbSession_t *session);
4122 
4136  fbSession_t *session);
4137 
4153 void fbSessionSetDomain(
4154  fbSession_t *session,
4155  uint32_t domain);
4156 
4164 uint32_t fbSessionGetDomain(
4165  fbSession_t *session);
4166 
4178  fbSession_t *session);
4179 
4188  fbSession_t *session);
4189 
4190 #if HAVE_SPREAD
4191 
4214  fbSession_t *session,
4215  char **groups,
4216  gboolean internal,
4217  uint16_t tid,
4218  fbTemplate_t *tmpl,
4219  GError **err);
4220 
4245  fbSession_t *session,
4246  char **groups,
4247  gboolean internal,
4248  uint16_t tid,
4249  fbTemplate_t *tmpl,
4250  char *name,
4251  char *description,
4252  GError **err);
4253 
4254 
4271  fbSession_t *session,
4272  char **groups,
4273  gboolean enabled,
4274  GError **err);
4275 
4296  fbSession_t *session,
4297  char **groups,
4298  gboolean enabled,
4299  uint16_t tid,
4300  GError **err);
4301 
4319  fbSession_t *session,
4320  char **groups,
4321  gboolean enabled,
4322  GError **err);
4323 
4343  fbSession_t *session,
4344  char **groups,
4345  gboolean enabled,
4346  uint16_t tid,
4347  GError **err);
4348 #endif /* HAVE_SPREAD */
4349 
4366 gboolean fbSessionExportTemplate(
4367  fbSession_t *session,
4368  uint16_t tid,
4369  GError **err);
4370 
4389 gboolean fbSessionExportTemplates(
4390  fbSession_t *session,
4391  GError **err);
4392 
4413 uint16_t fbSessionAddTemplate(
4414  fbSession_t *session,
4415  gboolean internal,
4416  uint16_t tid,
4417  fbTemplate_t *tmpl,
4418  GError **err);
4419 
4432 gboolean fbSessionRemoveTemplate(
4433  fbSession_t *session,
4434  gboolean internal,
4435  uint16_t tid,
4436  GError **err);
4437 
4450  fbSession_t *session,
4451  gboolean internal,
4452  uint16_t tid,
4453  GError **err);
4454 
4468  fbConnSpec_t *spec);
4469 
4470 #if HAVE_SPREAD
4471 
4481  fbCollector_t *collector,
4482  char *groups[]);
4483 
4498  fbSpreadParams_t *params);
4499 
4500 #endif /* HAVE_SPREAD */
4501 
4514  const char *path);
4515 
4526  uint8_t *buf,
4527  uint16_t bufsize);
4528 
4529 
4539  FILE *fp);
4540 
4553 void fbExporterSetStream(
4554  fbExporter_t *exporter,
4555  int sctp_stream);
4556 
4570  fbExporter_t *exporter);
4571 
4579 void fbExporterClose(
4580  fbExporter_t *exporter);
4581 
4588 size_t fbExporterGetMsgLen(
4589  fbExporter_t *exporter);
4590 
4604  void *ctx,
4605  const char *path,
4606  GError **err);
4607 
4619  void *ctx,
4620  FILE *fp);
4621 
4622 
4623 #if HAVE_SPREAD
4624 
4635  void *ctx,
4636  fbSpreadParams_t *params,
4637  GError **err);
4638 
4639 #endif /* HAVE_SPREAD */
4640 
4651 void *fbCollectorGetContext(
4652  fbCollector_t *collector);
4653 
4664 void fbCollectorClose(
4665  fbCollector_t *collector);
4666 
4667 
4680  fbCollector_t *collector,
4681  struct sockaddr *address,
4682  size_t address_length);
4683 
4713  fbConnSpec_t *spec,
4714  fbSession_t *session,
4715  fbListenerAppInit_fn appinit,
4716  fbListenerAppFree_fn appfree,
4717  GError **err);
4718 
4726 void fbListenerFree(
4727  fbListener_t *listener);
4728 
4752  fbListener_t *listener,
4753  GError **err);
4754 
4766  fbListener_t *listener,
4767  GError **err);
4768 
4776 void fbListenerInterrupt(
4777  fbListener_t *listener);
4778 
4779 
4790 gboolean fbListenerGetCollector(
4791  fbListener_t *listener,
4792  fbCollector_t **collector,
4793  GError **err);
4794 
4795 
4796 
4797 
4810  fbCollector_t *collector,
4811  GError **err);
4812 
4813 
4826  fbCollector_t *collector,
4827  GError **err);
4828 
4829 
4842  fbCollector_t *collector,
4843  GError **err);
4844 
4864  fbCollector_t *collector,
4865  struct sockaddr *peer,
4866  size_t peerlen,
4867  uint32_t obdomain);
4868 
4884 uint32_t fbCollectorGetSFlowMissed(
4885  fbCollector_t *collector,
4886  struct sockaddr *peer,
4887  size_t peerlen,
4888  uint32_t obdomain);
4889 
4896 struct sockaddr* fbCollectorGetPeer(
4897  fbCollector_t *collector);
4898 
4909  fbCollector_t *collector);
4910 
4934  fbCollector_t *collector,
4935  gboolean multi_session);
4936 
4937 
4938 #ifdef __cplusplus
4939 } /* extern "C" */
4940 #endif
4941 
4942 #endif /* _FB_PUBLIC_H_ */
uint32_t flags
Flags.
Definition: public.h:1565
The "dateTimeMilliseconds" data type: An unsigned 64-bit integer containing the number of millisecond...
Definition: public.h:1498
fbInfoElement_t * fbTemplateGetIndexedIE(fbTemplate_t *tmpl, uint32_t IEindex)
Returns the information element in the template referenced by the index.
void * fbBasicListGetIndexedDataPtr(fbBasicList_t *basicList, uint16_t index)
Retrieves the element at position index in the basic list or returns NULL if index is out of range...
struct fbSubTemplateMultiListEntry_st fbSubTemplateMultiListEntry_t
Entries contain the same type of information at SubTemplateLists: template ID and template pointers t...
void * vssl_ctx
Pointer to SSL context cache.
Definition: public.h:1763
fbSubTemplateMultiListEntry_t * firstEntry
pointer to the first entry in the multi list
Definition: public.h:2458
fbExporter_t * fbExporterAllocFile(const char *path)
Allocates an exporting process endpoint for a named file.
uint8_t ie_type
ie data type
Definition: public.h:1606
uint16_t fbBasicListCountElements(const fbBasicList_t *basicList)
Returns the number of elements the basic list is capable of holding.
uint16_t tmplID
ID of the template used to structure the data.
Definition: public.h:2189
The "dateTimeMicroseconds" data type: Two 32-bit fields where the first is the number seconds since t...
Definition: public.h:1503
void fbTemplateFreeUnused(fbTemplate_t *tmpl)
Frees a template if it is not currently in use by any Session.
uint32_t ie_pen
private enterprise number
Definition: public.h:1602
uint16_t fbSessionSetMetadataExportElements(fbSession_t *session, gboolean enabled, uint16_t tid, GError **err)
Configures a session to export type information for enterprise-specific information elements as optio...
fbExporter_t * fbExporterAllocBuffer(uint8_t *buf, uint16_t bufsize)
Allocates an exporting process for a buffer.
size_t dataLength
length of the buffer used to hold the data in this entry
Definition: public.h:2445
void * fbBasicListGetDataPtr(fbBasicList_t *basicList)
Gets a pointer to the data buffer for the basic list.
uint16_t fbSubTemplateMultiListEntryCountElements(const fbSubTemplateMultiListEntry_t *entry)
Returns the number of entries the sub template multi list entry is capable of holding.
void fbSubTemplateMultiListClearEntries(fbSubTemplateMultiList_t *STML)
Clears the memory used by all the entries of a sub template multi list.
void fbBasicListClearWithoutFree(fbBasicList_t *basicList)
Clears the parameters of the basic list, but does not free the buffer.
uint32_t fbTemplateGetOptionsScope(fbTemplate_t *tmpl)
Determines number of scope information elements in a template.
void * fbSubTemplateMultiListEntryAddNewElements(fbSubTemplateMultiListEntry_t *entry, uint16_t numNewElements)
Allocates space for numNewEntries additional elements in the sub template multi list entry...
fbExporter_t * fbExporterAllocFP(FILE *fp)
Allocates an exporting process endpoint for an opened ANSI C file pointer.
gboolean fBufAppend(fBuf_t *fbuf, uint8_t *recbase, size_t recsize, GError **err)
Appends a record to a buffer.
Partially reliable datagram transport via SCTP.
Definition: public.h:1711
void fBufListFree(fbTemplate_t *tmpl, uint8_t *record)
Clears all of the memory that fixbuf allocated during transcode of this record.
The "unsigned32" data type: A non-negative integer value in the range of 0 to 4_294_967_295 (0xFFFFFF...
Definition: public.h:1460
The "subTemplateList" data type: A structured data element as described in RFC6313, Section 4.5.2.
Definition: public.h:1518
The "signed16" data type: An integer value in the range of -32768 to 32767.
Definition: public.h:1470
struct fbListenerGroupResult_st * next
Pointer to the next listener group result.
Definition: public.h:1851
uint8_t semantic
value used to describe the list of sub templates
Definition: public.h:2462
uint16_t fbSubTemplateListGetTemplateID(fbSubTemplateList_t *subTemplateList)
Gets the template ID for the template used by the list.
void fbBasicListFree(fbBasicList_t *basicList)
Clears the basic list (fbBasicListClear()), then frees the basic list itself.
uint16_t fbSessionAddTemplatesMulticastWithMetadata(fbSession_t *session, char **groups, gboolean internal, uint16_t tid, fbTemplate_t *tmpl, char *name, char *description, GError **err)
Sets and sends templates for 1 or more groups.
const fbInfoElement_t * fbInfoModelGetElementByName(fbInfoModel_t *model, const char *name)
Returns a pointer to the canonical information element within an information model given the informat...
void fbExporterClose(fbExporter_t *exporter)
Forces the file or socket underlying an exporting process endpoint to close.
gboolean fbSessionEnableTypeMetadata(fbSession_t *session, gboolean enabled, GError **err)
Configures a session to export type information for enterprise-specific information elements as optio...
char * host
Hostname to connect/listen to.
Definition: public.h:1743
void fbSessionSetDomain(fbSession_t *session, uint32_t domain)
Sets the current observation domain on a session.
fbCollector_t * fbSessionGetCollector(fbSession_t *session)
Retrieves the collector that was created with the session.
fbCollector_t * fbCollectorAllocSpread(void *ctx, fbSpreadParams_t *params, GError **err)
Allocates a collecting process endpoint for the Spread transport.
uint16_t numElements
number of elements in the list
Definition: public.h:2191
struct fbSpreadParams_st fbSpreadParams_t
Spread connection parameters.
fBuf_t * fbListenerWait(fbListener_t *listener, GError **err)
Waits on a listener.
const fbInfoElement_t * infoElement
pointer to the information element that is repeated in the list
Definition: public.h:1952
The "float64" data type: An IEEE double-precision 64-bit floating point type.
Definition: public.h:1482
uint64_t ie_range_end
ie range max
Definition: public.h:1616
const char * description
description
Definition: public.h:1573
struct fbConnSpec_st fbConnSpec_t
Connection specifier.
void * fbBasicListInitWithOwnBuffer(fbBasicList_t *basicList, 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 fBufSetAutomaticMode(fBuf_t *fbuf, gboolean automatic)
Sets the automatic (read/write) mode flag on a buffer.
void * fbSubTemplateMultiListEntryRealloc(fbSubTemplateMultiListEntry_t *entry, uint16_t newNumElements)
Potentially reallocates the entry&#39;s internal buffer and returns a handle to it.
uint64_t min
range min
Definition: public.h:1567
An IPFIX template or options template structure.
Definition: private.h:199
struct fbCollector_st fbCollector_t
IPFIX Collecting Process endpoint.
Definition: public.h:1813
struct fbExporter_st fbExporter_t
IPFIX Exporting Process endpoint.
Definition: public.h:1804
fbSubTemplateMultiList_t * fbSubTemplateMultiListAlloc(void)
Allocates and returns an empty subTemplateMultiList structure.
Secure, reliable stream transport via TLS over TCP.
Definition: public.h:1726
void fbBasicListSetSemantic(fbBasicList_t *basicList, uint8_t semantic)
Sets the semantic for describing a basic list.
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:1703
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListInit(fbSubTemplateMultiList_t *STML, uint8_t semantic, uint16_t numElements)
Initializes the multi list with the list semantic and allocates memory to store numElements entries...
uint16_t fbSessionSpreadSetMetadataExportElements(fbSession_t *session, char **groups, gboolean enabled, uint16_t tid, GError **err)
Enables RFC 5610 information element metadata export for Spread Sessions.
void fbSessionRemoveTemplatePair(fbSession_t *session, uint16_t ext_tid)
Removes a template pair from the list this is called by fixbuf when a template is revoked from the se...
int fbCollectorGetSpreadReturnGroups(fbCollector_t *collector, char *groups[])
This function is useful if need to know what groups were set on the message.
struct fbListenerGroup_st fbListenerGroup_t
Structure that represents a group of listeners.
Definition: public.h:1830
void * fbSubTemplateListInit(fbSubTemplateList_t *sTL, uint8_t semantic, uint16_t tmplID, const fbTemplate_t *tmpl, uint16_t numElements)
Initializes a subTemplateList structure and allocates the internal buffer to a size capable of holdin...
struct fbListener_st fbListener_t
IPFIX Collecting Process session listener.
Definition: public.h:1821
Unreliable datagram transport via UDP.
Definition: public.h:1715
fbVarfield_t ie_desc
information element description
Definition: public.h:1620
uint16_t fbSessionSetMetadataExportTemplates(fbSession_t *session, gboolean enabled, uint16_t tid, GError **err)
Configures a session to export template metadata as options records.
The "unsigned8" data type: A non-negative integer value in the range of 0 to 255 (0xFF).
Definition: public.h:1454
void fbSubTemplateListClearWithoutFree(fbSubTemplateList_t *subTemplateList)
Clears the sub template list parameters but does not free the data ptr.
uint32_t fbCollectorGetNetflowMissed(fbCollector_t *collector, struct sockaddr *peer, size_t peerlen, uint32_t obdomain)
Returns the number of potential missed export packets of the Netflow v9 session that is currently set...
gboolean fbTemplateAppendSpecArray(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags, GError **err)
Appends information elements described by a specifier array to a template.
fbTemplate_t * tmpl
pointer to the template used to structure the data in this entry
Definition: public.h:2441
fbSubTemplateList_t * fbSubTemplateListAlloc(void)
Allocates and returns an empty subTemplateList structure.
The "octetArray" data type: A finite-length string of octets.
Definition: public.h:1451
gboolean fbCollectorSetNetflowV9Translator(fbCollector_t *collector, GError **err)
Sets the collector input translator to convert NetFlowV9 into IPFIX for the given collector...
void * fbSubTemplateListGetIndexedDataPtr(const fbSubTemplateList_t *subTemplateList, uint16_t index)
Returns the data for the record at position index in the sub template list, or returns NULL if index ...
struct sockaddr * fbCollectorGetPeer(fbCollector_t *collector)
Retrieves information about the node connected to this collector.
gboolean fbSessionSpreadEnableTemplateMetadata(fbSession_t *session, char **groups, gboolean enabled, GError **err)
Enables template metadata export for Spread Sessions.
void fBufSetSpreadExportGroup(fBuf_t *fbuf, char **groups, int num_groups, GError **err)
This function checks to see if the groups you are setting on the buffer are different than the groups...
gboolean fbTemplateAppend(fbTemplate_t *tmpl, fbInfoElement_t *ex_ie, GError **err)
Appends an information element to a template.
gboolean fBufEmit(fBuf_t *fbuf, GError **err)
Emits the message currently in a buffer using the associated exporting process endpoint.
uint16_t ie_id
information element id
Definition: public.h:1604
uint16_t numElements
number of elements in this entry
Definition: public.h:2449
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)
Allocates a collecting process endpoint for an open file.
void fBufInterruptSocket(fBuf_t *fbuf)
Interrupts the select call of a specific collector by way of its fBuf.
fbExporter_t * fbExporterAllocNet(fbConnSpec_t *spec)
Allocates an exporting process endpoint for a network connection.
void fBufSetCollector(fBuf_t *fbuf, fbCollector_t *collector)
Associates an collecting process endpoint with a buffer.
void fbSubTemplateListFree(fbSubTemplateList_t *subTemplateList)
Clears the sub template list (fbSubTemplateListClear()) then frees the subTemplateList itself...
gboolean fbTemplateContainsAllElementsByName(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec)
Determines if a template contains at least one instance of each fbInfoElement_t in a given informatio...
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListRealloc(fbSubTemplateMultiList_t *STML, uint16_t newNumEntries)
Potentially reallocates the list&#39;s internal buffer for entries and returns a handle to it...
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)
Retrieves a record from a buffer.
fBuf_t * fBufAllocForCollection(fbSession_t *session, fbCollector_t *collector)
Allocates a new buffer for collection.
gboolean fbTemplateContainsAllFlaggedElementsByName(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags)
Determines if a template contains at least one instance of each information element in a given inform...
char * ssl_ca_file
Path to certificate authority file.
Definition: public.h:1747
union fbInfoElement_st::@1 ref
Information element name.
void fBufFree(fBuf_t *fbuf)
Frees a buffer.
gboolean fbSessionEnableTemplateMetadata(fbSession_t *session, gboolean enabled, GError **err)
Configures a session to export template metadata as options records.
Structure used to hold information of a sub template list.
Definition: public.h:2177
uint32_t flags
Application flags word.
Definition: public.h:1694
Entries contain the same type of information at SubTemplateLists: template ID and template pointers t...
Definition: public.h:2439
void fbSubTemplateListCollectorInit(fbSubTemplateList_t *STL)
Initializes a sub template list variable on a fbCollector_t.
uint16_t tmplID
ID of the template used to structure the data in this entry.
Definition: public.h:2447
fbVarfield_t ie_name
information element name
Definition: public.h:1618
uint8_t semantic
semantic field to describe the list
Definition: public.h:1960
void fBufSetBuffer(fBuf_t *fbuf, uint8_t *buf, size_t buflen)
Sets a buffer on an fBuf for collection.
The "signed32" data type: An integer value in the range of -2_147_483_648 to 2_147_483_647.
Definition: public.h:1473
fbSession_t * fbSessionAlloc(fbInfoModel_t *model)
Allocates 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&#39;t monit...
fbListener_t * listener
pointer to the listener to add to the list
Definition: public.h:1841
void * fbBasicListGetNextPtr(fbBasicList_t *basicList, void *currentPtr)
Retrieves a pointer to the data element in the basicList that follows the one at currentPtr.
Connection specifier.
Definition: public.h:1739
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 C struct for a record whose template is the RFC5610 Information Element Type Option...
void(* fbTemplateCtxFree_fn)(void *tmpl_ctx, void *app_ctx)
A callback function that is called when a template is freed.
Definition: public.h:1869
fbExporter_t * fBufGetExporter(fBuf_t *fbuf)
Retrieves the exporting process endpoint associated with a buffer.
uint16_t fbTemplateGetIELenOfMemBuffer(fbTemplate_t *tmpl)
Gets the length required for a buffer to store a data record described by this template.
struct fbSubTemplateList_st fbSubTemplateList_t
Structure used to hold information of a sub template list.
void fbSessionAddNewTemplateCallback(fbSession_t *session, fbNewTemplateCallback_fn callback, void *app_ctx)
This function sets the callback that allows the application to set its own context variable with a ne...
fbTemplate_t * fbInfoElementAllocTypeTemplate(fbInfoModel_t *model, GError **err)
Allocates and returns the Options Template that will be used to define Information Element Type Recor...
void fbSubTemplateMultiListFree(fbSubTemplateMultiList_t *STML)
Clears the multi list (fbSubTemplateMultiListClear()), then frees the STML itself.
void fbSubTemplateMultiListClear(fbSubTemplateMultiList_t *STML)
Clears all of the fbSubTemplateMultiListEntry_t objects on this STML (see fbSubTemplateMultiListClear...
struct fbInfoElementSpec_st fbInfoElementSpec_t
A single IPFIX Information Element specification.
uint16_t len
Information element length in octets.
Definition: public.h:1562
A ListenerGroupResult contains the fbListener whose listening socket got a new connection (cf...
Definition: public.h:1849
fBuf_t * fBufAllocForExport(fbSession_t *session, fbExporter_t *exporter)
Allocates a new buffer for export.
const fbInfoElement_t * fbBasicListGetInfoElement(fbBasicList_t *basicList)
Returns a pointer to the information element used in the basic list.
gboolean fbTemplateContainsElement(fbTemplate_t *tmpl, const fbInfoElement_t *ex_ie)
Determines if a template contains a given information element.
void * fbSubTemplateListGetNextPtr(const fbSubTemplateList_t *subTemplateList, void *currentPtr)
Retrieves a pointer to the data record in the sub template list that follows the one at currentPtr...
void fbBasicListClear(fbBasicList_t *basicList)
Clears the parameters of the basic list and frees the data buffer.
void * fbSubTemplateMultiListEntryGetDataPtr(fbSubTemplateMultiListEntry_t *entry)
Retrieves the data pointer for this entry.
fbSession_t * session
pointer to the session, this MUST be set to a valid session before the spec is passed to fbExporterAl...
Definition: public.h:1788
void * vai
Pointer to address info cache.
Definition: public.h:1758
fBuf_t * fbuf
pointer to the fbuf created for that new connection
Definition: public.h:1855
struct fbListenerEntry_st * prev
pointer to the previous listener entry in the linked list
Definition: public.h:1839
fbListenerGroup_t * fbListenerGroupAlloc(void)
Allocates and returns an empty listenerGroup.
uint8_t * dataPtr
pointer to the memory that stores the elements in the list
Definition: public.h:1954
Spread connection parameters.
Definition: public.h:1785
struct fbListenerGroupResult_st fbListenerGroupResult_t
A ListenerGroupResult contains the fbListener whose listening socket got a new connection (cf...
enum fbTransport_en fbTransport_t
Transport protocol for connection specifier.
char * ssl_key_pass
Private key decryption password.
Definition: public.h:1753
uint8_t fbBasicListGetSemantic(fbBasicList_t *basicList)
Gets the Semantic field for Basic List.
fbInfoModel_t * fbInfoModelAlloc(void)
Allocates a new information model.
char * ssl_cert_file
Path to certificate file.
Definition: public.h:1749
void fbCollectorSetAcceptOnly(fbCollector_t *collector, struct sockaddr *address, size_t address_length)
Sets the collector to only receive from the given IP address over UDP.
The "subTemplateMultiList" data type: A structured data element as described in RFC6313, Section 4.5.3.
Definition: public.h:1521
uint8_t fbSubTemplateMultiListGetSemantic(fbSubTemplateMultiList_t *STML)
Gets the semantic paramter from the multi list.
uint8_t * dataPtr
pointer to the buffer used to hold the data
Definition: public.h:2187
uint16_t num
Information Element number.
Definition: public.h:1560
char * daemon
pointer to the daemon host address, in Spread format.
Definition: public.h:1791
uint16_t numElements
number of elements in the list
Definition: public.h:1956
void fBufSetExportTime(fBuf_t *fbuf, uint32_t extime)
Sets the export time on the message currently in a buffer.
The "unsigned16" data type: A non-negative integer value in the range of 0 to 65535 (0xFFFF)...
Definition: public.h:1457
size_t fbExporterGetMsgLen(fbExporter_t *exporter)
Gets the (transcoded) message length that was copied to the exporting buffer upon fBufEmit()...
uint8_t ie_semantic
ie semantic
Definition: public.h:1608
gboolean fbSessionExportTemplates(fbSession_t *session, GError **err)
Exports all external templates in the current domain of a given session.
struct fbListenerEntry_st * next
pointer to the next listener entry in the linked list
Definition: public.h:1837
fbTemplate_t * fBufNextCollectionTemplate(fBuf_t *fbuf, uint16_t *ext_tid, GError **err)
Retrieves the external template that will be used to read the next record from the buffer...
uint16_t fbSessionGetLargestInternalTemplateSize(fbSession_t *session)
Gets the largest decoded size of an internal template in the session.
uint16_t numElements
number of sub template lists in the multi list
Definition: public.h:2460
uint16_t dataLength
length of the buffer used to store the elements in the list
Definition: public.h:1958
ListenerEntry&#39;s make up an fbListenerGroup_t as a linked list.
Definition: public.h:1835
uint32_t fbCollectorGetSFlowMissed(fbCollector_t *collector, struct sockaddr *peer, size_t peerlen, uint32_t obdomain)
Returns the number of potential missed export packets of the SFlow session that is identified with th...
void fbInfoModelFree(fbInfoModel_t *model)
Frees an information model.
void * fbBasicListInit(fbBasicList_t *basicList, uint8_t semantic, const fbInfoElement_t *infoElement, uint16_t numElements)
Initializes the basic list structure based on the parameters.
fbTemplate_t * fBufGetCollectionTemplate(fBuf_t *fbuf, uint16_t *ext_tid)
Retrieves the external template used to read the last record from the buffer.
uint16_t fbSubTemplateListCountElements(const fbSubTemplateList_t *subTemplateList)
Returns the number of elements the sub template list is capable of holding.
The "macAddress" data type: A MAC-48 address as a string of 6 octets.
Definition: public.h:1487
gboolean fbInfoModelReadXMLFile(fbInfoModel_t *model, const gchar *filename, GError **err)
Adds information specified in the given XML file to the information model.
fbCollector_t * fBufGetCollector(fBuf_t *fbuf)
Retrieves the collecting process endpoint associated with a buffer.
A variable-length field value.
Definition: public.h:1100
A single IPFIX Information Element definition.
Definition: public.h:1532
gboolean fbSessionSpreadEnableTypeMetadata(fbSession_t *session, char **groups, gboolean enabled, GError **err)
Enables RFC 5610 information element metadata export for Spread Sessions.
char * name
Information element name.
Definition: public.h:1675
void * fbCollectorGetContext(fbCollector_t *collector)
Retrieves the application context associated with a collector.
gboolean fBufSetExportTemplate(fBuf_t *fbuf, uint16_t ext_tid, GError **err)
Sets the external template for export on a buffer to the given template ID.
void * fbBasicListRealloc(fbBasicList_t *basicList, uint16_t newNumElements)
Potentially reallocates the list&#39;s internal buffer and returns a handle to it.
Secure, unreliable datagram transport via DTLS over UDP.
Definition: public.h:1732
void fbExporterSetStream(fbExporter_t *exporter, int sctp_stream)
Sets the SCTP stream for the next message exported.
void * fbSubTemplateMultiListEntryNextDataPtr(fbSubTemplateMultiListEntry_t *entry, void *currentPtr)
Retrieves a pointer to the data record in this entry that follows the one at currentPtr.
uint16_t fbSessionSpreadSetMetadataExportTemplates(fbSession_t *session, char **groups, gboolean enabled, uint16_t tid, GError **err)
Enables template metadata export for Spread Sessions.
struct fbInfoModel_st fbInfoModel_t
An IPFIX information model.
Definition: public.h:1117
void * fbSubTemplateMultiListEntryGetIndexedPtr(fbSubTemplateMultiListEntry_t *entry, uint16_t index)
Retrieves a pointer to the data element in the entry at position index, or returns NULL when index is...
gboolean fbInfoElementAddOptRecElement(fbInfoModel_t *model, fbInfoElementOptRec_t *rec)
Adds an element that we received via an RFC 5610 Options Record to the given info model...
The corresponding C struct for a record whose template is the RFC5610 Information Element Type Option...
Definition: public.h:1600
gboolean fbTemplateContainsElementByName(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec)
Determines if a template contains at least one instance of a given information element, specified by name in the template&#39;s information model.
Reliable stream transport via TCP.
Definition: public.h:1713
void fbInfoModelAddElement(fbInfoModel_t *model, fbInfoElement_t *ie)
Adds a single information element to an information model.
uint64_t ie_range_begin
ie range min
Definition: public.h:1614
uint32_t fbSessionGetDomain(fbSession_t *session)
Retrieves the current domain on a session.
uint8_t * buf
Content buffer.
Definition: public.h:1109
void * fbBasicListAddNewElements(fbBasicList_t *basicList, uint16_t numNewElements)
Allocates numNewElements additional element(s) into the basic list.
char * ssl_key_file
Path to private key file.
Definition: public.h:1751
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:2908
uint32_t midx
Multiple IE index.
Definition: public.h:1553
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 a template contains all of the elements required by RFC 5610 for describing an infor...
gboolean fbInfoElementWriteOptionsRecord(fBuf_t *fbuf, const fbInfoElement_t *model_ie, uint16_t itid, uint16_t etid, GError **err)
Exports an options record to the given fbuf with information element type information about the given...
gboolean fBufSetAutomaticInsert(fBuf_t *fbuf, GError **err)
Enables automatic insertion of RFC 5610 elements on a buffer.
Multilists just contain the semantic to describe the sub lists, the number of sub lists...
Definition: public.h:2456
uint8_t semantic
value used to describe the contents of the list, all-of, one-of, etc
Definition: public.h:2193
void fbExporterAutoStream(fbExporter_t *exporter)
Enables 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)
Gets the info model for the session.
guint fbInfoModelCountElements(const fbInfoModel_t *model)
Returns the number of information elements in the information model.
Fixbuf&#39;s version information.
enum fbInfoElementDataType_en fbInfoElementDataType_t
From RFC 5610: A description of the abstract data type of an IPFIX information element as registered ...
fbTransport_t transport
Transport protocol to use.
Definition: public.h:1741
void fbSubTemplateMultiListEntryClear(fbSubTemplateMultiListEntry_t *entry)
Frees the memory holding the records&#39; data used by this entry.
const fbTemplate_t * fbSubTemplateMultiListEntryGetTemplate(fbSubTemplateMultiListEntry_t *entry)
Retrieves the template pointer used to structure the data elements.
void fbCollectorSetUDPMultiSession(fbCollector_t *collector, gboolean multi_session)
Enables or disables multi-session mode for a fbCollector_t associated with a UDP fbListener_t.
void * fbSubTemplateListGetDataPtr(const fbSubTemplateList_t *subTemplateList)
Returns a pointer to the buffer that contains the data for the list.
fbListener_t * fbListenerAlloc(fbConnSpec_t *spec, fbSession_t *session, fbListenerAppInit_fn appinit, fbListenerAppFree_fn appfree, GError **err)
Allocates a listener.
void fbBasicListCollectorInit(fbBasicList_t *basicList)
Initializes a basic list structure for collection.
const fbInfoElement_t * fbInfoModelGetElementByID(fbInfoModel_t *model, uint16_t id, uint32_t ent)
Returns a pointer to the canonical information element within an information model given the informat...
size_t len
Length of content in buffer.
Definition: public.h:1102
uint16_t fbSubTemplateMultiListCountElements(const fbSubTemplateMultiList_t *STML)
Returns the number of entries the sub template multi list is capable of holding.
uint16_t len_override
The size of the information element in bytes.
Definition: public.h:1687
gboolean fBufNextMessage(fBuf_t *fbuf, GError **err)
Reads a new message into a buffer using the associated collecting process endpoint.
fbExporter_t * fbExporterAllocSpread(fbSpreadParams_t *params)
Allocates an exporting process endpoint for a Spread connection.
The "dateTimeMicroseconds" data type: Two 32-bit fields where the first is the number seconds since t...
Definition: public.h:1508
fbInfoElementDataType_en
From RFC 5610: A description of the abstract data type of an IPFIX information element as registered ...
Definition: public.h:1448
The "signed64" data type: An integer value in the range of -9_223_372_036_854_775_808 to 9_223_372_03...
Definition: public.h:1476
uint64_t max
range max
Definition: public.h:1569
uint8_t * dataPtr
pointer to the buffer used to hold the data in this entry
Definition: public.h:2443
GHashTableIter fbInfoModelIter_t
An iterator over the information elements in an information model.
Definition: public.h:1122
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListGetNextEntry(fbSubTemplateMultiList_t *STML, fbSubTemplateMultiListEntry_t *currentEntry)
Retrieves a pointer to the entry in the mutli list that follows the one at currentEntry.
const fbTemplate_t * fbSubTemplateListGetTemplate(fbSubTemplateList_t *subTemplateList)
Gets the template pointer from the list structure.
uint32_t fBufGetExportTime(fBuf_t *fbuf)
Retrieves the export time on the message currently in a buffer.
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.
fbListenerGroupResult_t * fbListenerGroupWait(fbListenerGroup_t *group, GError **err)
Accepts connections for multiple listeners.
fbBasicList_t * fbBasicListAlloc(void)
Allocates and returns an empty Basic List Structure.
A basic list element in a template which structure represents a basic list on the internal side...
Definition: public.h:1950
The "ipv6Address" data type: A value of an IPv6 address.
Definition: public.h:1512
fbTransport_en
Transport protocol for connection specifier.
Definition: public.h:1706
const fbInfoElement_t * fbInfoModelIterNext(fbInfoModelIter_t *iter)
Returns a pointer to the next information element in the information model.
The "basicList" data type: A structured data element as described in RFC6313, Section 4...
Definition: public.h:1515
void * fbSubTemplateListRealloc(fbSubTemplateList_t *subTemplateList, uint16_t newNumElements)
Potentially reallocates the list&#39;s internal buffer and returns a handle to it.
void fBufSetExporter(fBuf_t *fbuf, fbExporter_t *exporter)
Associates an exporting process endpoint with a buffer.
The "boolean" data type: A binary value: "true" or "false".
Definition: public.h:1484
The "dateTimeSeconds" data type: An unsigned 32-bit integer containing the number of seconds since th...
Definition: public.h:1494
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListGetFirstEntry(fbSubTemplateMultiList_t *STML)
Retrieves the first entry in the multi list.
void(* fbListenerAppFree_fn)(void *ctx)
Application context free function type for fbListener_t.
Definition: public.h:2925
void * fbTemplateGetContext(fbTemplate_t *tmpl)
Gets the ctx pointer associated with a Template.
char ** groups
pointer to array of group names, must have at least one, and must be null term array ...
Definition: public.h:1794
uint16_t ie_units
ie units
Definition: public.h:1610
fbTemplate_t * fbTemplateAlloc(fbInfoModel_t *model)
Allocates a new empty template.
fbCollector_t * fbCollectorAllocFile(void *ctx, const char *path, GError **err)
Allocates a collecting process endpoint for a named file.
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)
Retrieves the session associated with a buffer.
uint32_t ent
Private Enterprise Number.
Definition: public.h:1555
void fbListenerFreeGroupResult(fbListenerGroupResult_t *result)
Frees the listener group result returned from fbListenerGroupWait().
Secure, partially reliable datagram transport via DTLS over SCTP.
Definition: public.h:1721
uint8_t type
Data Type.
Definition: public.h:1571
The "ipv4Address" data type: A value of an IPv4 address.
Definition: public.h:1510
uint32_t fbTemplateCountElements(fbTemplate_t *tmpl)
Determines number of information elements in a template.
uint16_t fbSessionAddTemplateWithMetadata(fbSession_t *session, gboolean internal, uint16_t tid, fbTemplate_t *tmpl, const char *name, const char *description, GError **err)
Adds a template to the session, as fbSessionAddTemplate(), with the provided metadata.
uint32_t fbCollectorGetObservationDomain(fbCollector_t *collector)
Retrieves the observation domain of the node connected to the UDP collector.
size_t fBufRemaining(fBuf_t *fbuf)
Retrieves the length of the buffer that is remaining after processing.
void fbCollectorClose(fbCollector_t *collector)
Closes the file or socket underlying a collecting process endpoint.
void fbListenerGroupFree(fbListenerGroup_t *group)
Frees a listener group.
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...
fbInfoModel_t * fbTemplateGetInfoModel(fbTemplate_t *tmpl)
Returns the information model, as understood by the template.
struct fbListenerEntry_st fbListenerEntry_t
ListenerEntry&#39;s make up an fbListenerGroup_t as a linked list.
The "float32" data type: An IEEE single-precision 32-bit floating point type.
Definition: public.h:1479
The "string" data type: A finite-length string of valid characters from the Unicode character encodin...
Definition: public.h:1490
struct fBuf_st fBuf_t
An IPFIX message buffer.
Definition: public.h:1092
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:1896
void fbSubTemplateListSetSemantic(fbSubTemplateList_t *subTemplateList, uint8_t semantic)
Sets the semantic parameter of a subTemplateList.
fbTemplate_t * fbSessionGetTemplate(fbSession_t *session, gboolean internal, uint16_t tid, GError **err)
Retrieves a template from a session by ID.
A single IPFIX Information Element specification.
Definition: public.h:1673
uint8_t padding[6]
padding to align with template
Definition: public.h:1612
gboolean fbSessionExportTemplate(fbSession_t *session, uint16_t tid, GError **err)
Exports a single external template in the current domain of a given session.
void fbSubTemplateListClear(fbSubTemplateList_t *subTemplateList)
Clears a subTemplateList structure, notably freeing the internal buffer and setting it to NULL...
uint16_t fbSessionAddTemplate(fbSession_t *session, gboolean internal, uint16_t tid, fbTemplate_t *tmpl, GError **err)
Adds a template to a session.
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListAddNewEntries(fbSubTemplateMultiList_t *STML, uint16_t numNewEntries)
Adds numNewElements entries to the multi list of entries.
union fbSubTemplateList_st::@2 dataLength
length of the allocated buffer used to hold the data
void * fbSubTemplateListAddNewElements(fbSubTemplateList_t *subTemplateList, uint16_t numNewElements)
Allocates space for numNewElements additional element in the subTemplateList.
gboolean fbTemplateAppendSpec(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags, GError **err)
Appends an information element described by specifier to a template.
int fbListenerGroupDeleteListener(fbListenerGroup_t *group, const fbListener_t *listener)
Removes the listener from the group.
char * svc
Service name or port number to connect/listen to.
Definition: public.h:1745
gboolean fbSessionRemoveTemplate(fbSession_t *session, gboolean internal, uint16_t tid, GError **err)
Removes a template from a session.
The "signed8" data type: An integer value in the range of -128 to 127.
Definition: public.h:1467
void fbInfoModelIterInit(fbInfoModelIter_t *iter, const fbInfoModel_t *model)
Initializes an information model iterator for iteration over the information elements (fbInfoElement_...
void fbSessionResetExternal(fbSession_t *session)
Resets the external state (sequence numbers and templates) in a session state container.
uint16_t fbSubTemplateMultiListEntryGetTemplateID(fbSubTemplateMultiListEntry_t *entry)
Retrieves the template ID for the template used to structure the data.
gboolean fbListenerGetCollector(fbListener_t *listener, fbCollector_t **collector, GError **err)
If a collector is associated with the listener class, this will return a handle to the collector stat...
The "unsigned64" data type: A non-negative integer value in the range of 0 to 18_446_744_073_709_551_...
Definition: public.h:1464
gboolean fbCollectorSetSFlowTranslator(fbCollector_t *collector, GError **err)
Sets the collector input translator to convert SFlow into IPFIX for the given collector.
gboolean fbInfoModelReadXMLData(fbInfoModel_t *model, const gchar *xml_data, gssize xml_data_len, GError **err)
Adds information specified in the given XML data to the information model.
void fbListenerInterrupt(fbListener_t *listener)
Causes 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)
Retrieves a pointer to the entry at a specific index, or returns NULL if index is out of range...
gboolean fbCollectorClearTranslator(fbCollector_t *collector, GError **err)
Removes an input translator from a given collector such that it will operate on IPFIX protocol again...
uint8_t fbSubTemplateListGetSemantic(fbSubTemplateList_t *subTemplateList)
Gets the semantic value from a sub template list.
fbListener_t * listener
pointer to the listener that received a new connection
Definition: public.h:1853
void fbInfoModelAddElementArray(fbInfoModel_t *model, fbInfoElement_t *ie)
Adds multiple information elements in an array to an information model.
gboolean fBufSetInternalTemplate(fBuf_t *fbuf, uint16_t int_tid, GError **err)
Sets the internal template on a buffer to the given template ID.
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)
Frees a listener.
uint16_t fbSessionAddTemplatesMulticast(fbSession_t *session, char **groups, gboolean internal, uint16_t tid, fbTemplate_t *tmpl, GError **err)
Sets and sends templates for 1 or more groups.
gboolean fbListValidSemantic(uint8_t semantic)
Validates the value of a structured data types semantic field, as defined in RFC 6313 and listed at I...
void fbSessionFree(fbSession_t *session)
Frees a transport session state container.
void fbTemplateSetOptionsScope(fbTemplate_t *tmpl, uint16_t scope_count)
Sets the number of information elements in a template that are scope.
const fbTemplate_t * tmpl
pointer to the template used to structure the data
Definition: public.h:2185