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-2018 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 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 
964 #ifndef _FB_PUBLIC_H_
965 #define _FB_PUBLIC_H_
966 #include <fixbuf/autoinc.h>
967 #include <fixbuf/version.h>
968 
969 #ifdef __cplusplus
970 extern "C" {
971 #endif
972 
973 
978 #define FIXBUF_CHECK_VERSION(major, minor, release) \
979  (FIXBUF_VERSION_MAJOR > (major) || \
980  (FIXBUF_VERSION_MAJOR == (major) && FIXBUF_VERSION_MINOR > (minor)) || \
981  (FIXBUF_VERSION_MAJOR == (major) && FIXBUF_VERSION_MINOR == (minor) && \
982  FIXBUF_VERSION_RELEASE >= (release)))
983 
984 /*
985  * Error Handling Definitions
986  */
987 
989 #define FB_ERROR_DOMAIN g_quark_from_string("fixbufError")
990 
991 #define FB_ERROR_TMPL 1
992 
996 #define FB_ERROR_EOM 2
997 
1002 #define FB_ERROR_EOF 3
1003 
1007 #define FB_ERROR_IPFIX 4
1008 
1013 #define FB_ERROR_BUFSZ 5
1014 
1015 #define FB_ERROR_IMPL 6
1016 
1017 #define FB_ERROR_IO 7
1018 
1022 #define FB_ERROR_NLREAD 8
1023 
1028 #define FB_ERROR_NLWRITE 9
1029 
1032 #define FB_ERROR_NOELEMENT 10
1033 
1036 #define FB_ERROR_CONN 11
1037 
1041 #define FB_ERROR_NETFLOWV9 12
1042 
1045 #define FB_ERROR_TRANSMISC 13
1046 
1049 #define FB_ERROR_SFLOW 14
1050 
1053 #define FB_ERROR_SETUP 15
1054 
1057 #define FB_ERROR_LAXSIZE 16
1058 
1059 /*
1060  * Public Datatypes and Constants
1061  */
1062 
1068 typedef struct fBuf_st fBuf_t;
1069 
1076 typedef struct fbVarfield_st {
1078  size_t len;
1085  uint8_t *buf;
1086 } fbVarfield_t;
1087 
1088 
1093 typedef struct fbInfoModel_st fbInfoModel_t;
1094 
1098 typedef GHashTableIter fbInfoModelIter_t;
1099 
1105 #define FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, _min_, _max_, _type_, _desc_)\
1106  { {(const struct fbInfoElement_st*)_name_}, 0, _ent_, _num_, _len_, _flags_, _min_, _max_, _type_, _desc_ }
1107 
1114 #define FB_IE_INIT(_name_, _ent_, _num_, _len_, _flags_) \
1115  FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, 0, 0, 0, (char*)NULL)
1116 
1117 
1123 #define FB_IE_NULL FB_IE_INIT(NULL, 0, 0, 0, 0)
1124 
1131 #define FB_IE_SEMANTIC(flags) ((flags & 0x0000ff00) >> 8)
1132 
1138 #define FB_IE_UNITS(flags) ((flags & 0xFFFF0000) >> 16)
1139 
1144 #define FB_IE_F_NONE 0x00000000
1145 
1151 #define FB_IE_F_ENDIAN 0x00000001
1152 
1164 #define FB_IE_F_REVERSIBLE 0x00000040
1165 
1174 #define FB_IE_F_ALIEN 0x00000080
1175 
1180 #define FB_IE_QUANTITY 0x00000100
1181 
1187 #define FB_IE_TOTALCOUNTER 0x00000200
1188 
1193 #define FB_IE_DELTACOUNTER 0x00000300
1194 
1199 #define FB_IE_IDENTIFIER 0x00000400
1200 
1205 #define FB_IE_FLAGS 0x00000500
1206 
1212 #define FB_IE_LIST 0x00000600
1213 
1219 #define FB_IE_SNMPCOUNTER 0x00000700
1220 
1226 #define FB_IE_SNMPGAUGE 0x00000800
1227 
1233 #define FB_IE_DEFAULT 0x00000000
1234 
1245 #define FB_UNITS_BITS 0x00010000
1246 
1251 #define FB_UNITS_OCTETS 0x00020000
1252 
1257 #define FB_UNITS_PACKETS 0x00030000
1258 
1263 #define FB_UNITS_FLOWS 0x00040000
1264 
1269 #define FB_UNITS_SECONDS 0x00050000
1270 
1275 #define FB_UNITS_MILLISECONDS 0x00060000
1276 
1281 #define FB_UNITS_MICROSECONDS 0x00070000
1282 
1287 #define FB_UNITS_NANOSECONDS 0x00080000
1288 
1293 #define FB_UNITS_WORDS 0x00090000
1294 
1299 #define FB_UNITS_MESSAGES 0x000A0000
1300 
1305 #define FB_UNITS_HOPS 0x000B0000
1306 
1311 #define FB_UNITS_ENTRIES 0x000C0000
1312 
1317 #define FB_UNITS_FRAMES 0x000D0000
1318 
1323 #define FB_UNITS_PORTS 0x000E0000
1324 
1329 #define FB_UNITS_INFERRED 0x000F0000
1330 
1334 #define FB_IE_VARLEN 65535
1335 
1340 #define FB_IE_BASIC_LIST 291
1341 
1345 #define FB_IE_SUBTEMPLATE_LIST 292
1346 
1350 #define FB_IE_SUBTEMPLATE_MULTILIST 293
1351 
1360 #define FB_IE_PEN_REVERSE 29305
1361 
1370 #define FB_IE_VENDOR_BIT_REVERSE 0x4000
1371 
1377 #define FB_CISCO_GENERIC 9999
1378 
1385 #define FB_CISCO_ASA_EVENT_ID 9998
1386 
1395 #define FB_CISCO_ASA_EVENT_XTRA 9997
1396 
1401 #define FB_IE_REVERSE_STR "reverse"
1402 
1404 #define FB_IE_REVERSE_STRLEN 7
1405 
1487 
1496 typedef struct fbInfoElement_st {
1498  union {
1504  const struct fbInfoElement_st *canon;
1509  const char *name;
1510  } ref;
1511 
1517  uint32_t midx;
1519  uint32_t ent;
1524  uint16_t num;
1526  uint16_t len;
1529  uint32_t flags;
1531  uint64_t min;
1533  uint64_t max;
1535  uint8_t type;
1537  const char *description;
1538 } fbInfoElement_t;
1539 
1546 typedef struct fbInfoElementOptRec_st {
1548  uint32_t ie_pen;
1550  uint16_t ie_id;
1552  uint8_t ie_type;
1554  uint8_t ie_semantic;
1556  uint16_t ie_units;
1558  uint8_t padding[6];
1560  uint64_t ie_range_begin;
1562  uint64_t ie_range_end;
1568 
1569 
1574 #define FB_TID_AUTO 0
1575 
1579 #define FB_TID_TS 2
1580 
1584 #define FB_TID_OTS 3
1585 
1589 #define FB_TID_MIN_DATA 256
1590 
1597 
1603 #define FB_IESPEC_NULL { NULL, 0, 0 }
1604 
1610 typedef struct fbInfoElementSpec_st {
1612  char *name;
1624  uint16_t len_override;
1631  uint32_t flags;
1633 
1640 typedef struct fbSession_st fbSession_t;
1641 
1643 typedef enum fbTransport_en {
1670 } fbTransport_t;
1671 
1676 typedef struct fbConnSpec_st {
1678  fbTransport_t transport;
1680  char *host;
1682  char *svc;
1695  void *vai;
1700  void *vssl_ctx;
1701 } fbConnSpec_t;
1702 
1706 #define FB_CONNSPEC_INIT { FB_SCTP, NULL, NULL, \
1707  NULL, NULL, NULL, NULL, \
1708  NULL, NULL }
1709 
1710 #if HAVE_SPREAD
1711 
1715 #define FB_SPREADPARAMS_INIT { 0, 0, 0 }
1716 
1722 typedef struct fbSpreadParams_st {
1728  char * daemon;
1731  char ** groups;
1733 
1734 #endif /* HAVE_SPREAD */
1735 
1741 typedef struct fbExporter_st fbExporter_t;
1742 
1750 typedef struct fbCollector_st fbCollector_t;
1751 
1758 typedef struct fbListener_st fbListener_t;
1759 
1760 /*
1761  * ListenerGroup and associated data type definitions
1762  */
1763 
1767 typedef struct fbListenerGroup_st fbListenerGroup_t;
1768 
1772 typedef struct fbListenerEntry_st {
1780 
1794 
1806 typedef void (*fbTemplateCtxFree_fn)(
1807  void *tmpl_ctx,
1808  void *app_ctx);
1809 
1833 typedef void (*fbNewTemplateCallback_fn) (
1834  fbSession_t *session,
1835  uint16_t tid,
1836  fbTemplate_t *tmpl,
1837  void *app_ctx,
1838  void **tmpl_ctx,
1839  fbTemplateCtxFree_fn *tmpl_ctx_free_fn);
1840 
1841 
1849 #define FB_LIST_SEM_UNDEFINED 0xFF
1850 
1853 #define FB_LIST_SEM_NONE_OF 0x00
1854 
1857 #define FB_LIST_SEM_EXACTLY_ONE_OF 0x01
1858 
1861 #define FB_LIST_SEM_ONE_OR_MORE_OF 0x02
1862 
1865 #define FB_LIST_SEM_ALL_OF 0x03
1866 
1869 #define FB_LIST_SEM_ORDERED 0x04
1870 
1877 gboolean fbListValidSemantic(
1878  uint8_t semantic);
1879 
1880 /****** BASICLIST FUNCTIONS AND STRUCTS *******/
1886 typedef struct fbBasicList_st {
1890  uint8_t *dataPtr;
1892  uint16_t numElements;
1894  uint16_t dataLength;
1896  uint8_t semantic;
1897 } fbBasicList_t;
1898 
1899 
1906  void);
1907 
1920 void* fbBasicListInit(
1921  fbBasicList_t *basicList,
1922  uint8_t semantic,
1923  const fbInfoElement_t *infoElement,
1924  uint16_t numElements);
1925 
1941  fbBasicList_t *basicList,
1942  uint8_t semantic,
1943  const fbInfoElement_t *infoElement,
1944  uint16_t numElements,
1945  uint16_t dataLength,
1946  uint8_t *dataPtr);
1947 
1961  fbBasicList_t *basicList);
1962 
1963 
1971 uint8_t fbBasicListGetSemantic(
1972  fbBasicList_t *basicList);
1973 
1983  fbBasicList_t *basicList,
1984  uint8_t semantic);
1985 
1986 
1995  fbBasicList_t *basicList);
1996 
2002 void* fbBasicListGetDataPtr(
2003  fbBasicList_t *basicList);
2004 
2014  fbBasicList_t *basicList,
2015  uint16_t bl_index);
2016 
2025 void* fbBasicListGetNextPtr(
2026  fbBasicList_t *basicList,
2027  void *currentPtr);
2028 
2038 void* fbBasicListRealloc(
2039  fbBasicList_t *basicList,
2040  uint16_t newNumElements);
2041 
2050  fbBasicList_t *basicList,
2051  uint16_t numNewElements);
2052 
2058 void fbBasicListClear(
2059  fbBasicList_t *basicList);
2060 
2068  fbBasicList_t *basicList);
2069 
2075 void fbBasicListFree(
2076  fbBasicList_t *basicList);
2077 
2078 
2079 /******* END OF BASICLIST ********/
2080 
2081 
2082 
2083 /******* SUBTEMPLATELIST FUNCTIONS ****/
2084 
2092 typedef struct fbSubTemplateList_st {
2095  union {
2096  size_t length;
2097  uint64_t extra;
2098  } dataLength;
2102  uint8_t *dataPtr;
2104  uint16_t tmplID;
2106  uint16_t numElements;
2108  uint8_t semantic;
2110 
2118  void);
2119 
2132 void* fbSubTemplateListInit(
2133  fbSubTemplateList_t *sTL,
2134  uint8_t semantic,
2135  uint16_t tmplID,
2136  const fbTemplate_t *tmpl,
2137  uint16_t numElements);
2138 
2154  fbSubTemplateList_t *subTemplateList,
2155  uint8_t semantic,
2156  uint16_t tmplID,
2157  const fbTemplate_t *tmpl,
2158  uint16_t numElements,
2159  uint16_t dataLength,
2160  uint8_t *dataPtr);
2161 
2173  fbSubTemplateList_t *STL);
2174 
2181  const fbSubTemplateList_t *subTemplateList);
2182 
2191  const fbSubTemplateList_t *subTemplateList,
2192  uint16_t index);
2193 
2206  const fbSubTemplateList_t *subTemplateList,
2207  void *currentPtr);
2208 
2216  fbSubTemplateList_t *subTemplateList,
2217  uint8_t semantic);
2218 
2225  fbSubTemplateList_t *subTemplateList);
2226 
2233  fbSubTemplateList_t *subTemplateList);
2234 
2241  fbSubTemplateList_t *subTemplateList);
2242 
2254  fbSubTemplateList_t *subTemplateList,
2255  uint16_t newNumElements);
2256 
2267  fbSubTemplateList_t *subTemplateList,
2268  uint16_t numNewElements);
2269 
2285  fbSubTemplateList_t *subTemplateList);
2286 
2296  fbSubTemplateList_t *subTemplateList);
2297 
2306  fbSubTemplateList_t *subTemplateList);
2307 
2308 /********* END OF SUBTEMPLATELIST **********/
2330  uint8_t *dataPtr;
2332  size_t dataLength;
2334  uint16_t tmplID;
2336  uint16_t numElements;
2338 
2347  uint16_t numElements;
2349  uint8_t semantic;
2351 
2352 
2361  void);
2362 
2363 
2375  uint8_t semantic,
2376  uint16_t numElements);
2377 
2386  uint8_t semantic);
2387 
2394  fbSubTemplateMultiList_t *STML);
2395 
2403  fbSubTemplateMultiList_t *STML);
2404 
2415  fbSubTemplateMultiList_t *STML);
2416 
2423  fbSubTemplateMultiList_t *STML);
2424 
2436  uint16_t newNumEntries);
2437 
2448  uint16_t numNewEntries);
2449 
2456  fbSubTemplateMultiList_t *STML);
2457 
2467  uint16_t index);
2468 
2482  fbSubTemplateMultiListEntry_t *currentEntry);
2483 
2497  uint16_t tmplID,
2498  fbTemplate_t *tmpl,
2499  uint16_t numElements);
2500 
2513  uint16_t newNumElements);
2514 
2526  uint16_t numNewElements);
2527 
2536 
2545 
2559  void *currentPtr);
2560 
2573  uint16_t index);
2574 
2583 
2592 
2593 /************** END OF STML FUNCTIONS *********** */
2594 
2610 void fBufListFree(
2611  fbTemplate_t *tmpl,
2612  uint8_t *record);
2613 
2614 
2621  void);
2622 
2629 void fbListenerGroupFree(
2630  fbListenerGroup_t *group);
2631 
2642  fbListenerGroup_t *group,
2643  const fbListener_t *listener);
2644 
2655  fbListenerGroup_t *group,
2656  const fbListener_t *listener);
2657 
2669  fbListenerGroup_t *group,
2670  GError **err);
2671 
2672 
2680  fbListenerGroupResult_t *result);
2681 
2695  fbListener_t *listener,
2696  int sock,
2697  GError **err);
2698 
2709  fbListener_t *listener,
2710  int sock,
2711  GError **err);
2712 
2718 void fBufInterruptSocket(
2719  fBuf_t *fbuf);
2720 
2721 
2743 typedef gboolean (*fbListenerAppInit_fn) (
2744  fbListener_t *listener,
2745  void **ctx,
2746  int fd,
2747  struct sockaddr *peer,
2748  size_t peerlen,
2749  GError **err);
2750 
2759 typedef void (*fbListenerAppFree_fn) (
2760  void *ctx);
2761 
2762 /*
2763  * Public Function Calls. These calls will remain available and retain
2764  * their functionality in all subsequent versions of libfixbuf.
2765  */
2766 
2767 
2784 gboolean fBufSetInternalTemplate(
2785  fBuf_t *fbuf,
2786  uint16_t int_tid,
2787  GError **err);
2788 
2806 gboolean fBufSetExportTemplate(
2807  fBuf_t *fbuf,
2808  uint16_t ext_tid,
2809  GError **err);
2810 
2811 #if HAVE_SPREAD
2812 
2828  fBuf_t *fbuf,
2829  char **groups,
2830  int num_groups,
2831  GError **err);
2832 #endif
2833 
2849  fBuf_t *fbuf,
2850  gboolean automatic);
2851 
2866 gboolean fBufSetAutomaticInsert(
2867  fBuf_t *fbuf,
2868  GError **err);
2869 
2870 
2879  fBuf_t *fbuf);
2880 
2889 void fBufFree(
2890  fBuf_t *fbuf);
2891 
2905  fbSession_t *session,
2906  fbExporter_t *exporter);
2907 
2918  fBuf_t *fbuf);
2919 
2930 void fBufSetExporter(
2931  fBuf_t *fbuf,
2932  fbExporter_t *exporter);
2933 
2934 
2946 size_t fBufRemaining(
2947  fBuf_t *fbuf);
2948 
2949 
2962 void fBufSetBuffer(
2963  fBuf_t *fbuf,
2964  uint8_t *buf,
2965  size_t buflen);
2966 
2967 
2991 gboolean fBufAppend(
2992  fBuf_t *fbuf,
2993  uint8_t *recbase,
2994  size_t recsize,
2995  GError **err);
2996 
3006 gboolean fBufEmit(
3007  fBuf_t *fbuf,
3008  GError **err);
3009 
3021 void fBufSetExportTime(
3022  fBuf_t *fbuf,
3023  uint32_t extime);
3024 
3038  fbSession_t *session,
3039  fbCollector_t *collector);
3040 
3051  fBuf_t *fbuf);
3052 
3063 void fBufSetCollector(
3064  fBuf_t *fbuf,
3065  fbCollector_t *collector);
3066 
3096 gboolean fBufNext(
3097  fBuf_t *fbuf,
3098  uint8_t *recbase,
3099  size_t *recsize,
3100  GError **err);
3101 
3115 gboolean fBufNextMessage(
3116  fBuf_t *fbuf,
3117  GError **err);
3118 
3126 uint32_t fBufGetExportTime(
3127  fBuf_t *fbuf);
3128 
3149  fBuf_t *fbuf,
3150  uint16_t *ext_tid);
3151 
3171  fBuf_t *fbuf,
3172  uint16_t *ext_tid,
3173  GError **err);
3174 
3188 
3197 void fbInfoModelFree(
3198  fbInfoModel_t *model);
3199 
3215  fbInfoModel_t *model,
3216  fbInfoElement_t *ie);
3217 
3237  fbInfoModel_t *model,
3238  fbInfoElement_t *ie);
3239 
3270 gboolean fbInfoModelReadXMLFile(
3271  fbInfoModel_t *model,
3272  const gchar *filename,
3273  GError **error);
3274 
3306 gboolean fbInfoModelReadXMLData(
3307  fbInfoModel_t *model,
3308  const gchar *xml_data,
3309  gssize xml_data_len,
3310  GError **error);
3311 
3324  fbInfoModel_t *model,
3325  const char *name);
3326 
3341  fbInfoModel_t *model,
3342  uint16_t id,
3343  uint32_t ent);
3344 
3353  const fbInfoModel_t *model);
3354 
3362 void fbInfoModelIterInit(
3363  fbInfoModelIter_t *iter,
3364  const fbInfoModel_t *model);
3365 
3377  fbInfoModelIter_t *iter);
3378 
3393  fbInfoModel_t *model,
3394  GError **err);
3395 
3411  fBuf_t *fbuf,
3412  const fbInfoElement_t *model_ie,
3413  uint16_t itid,
3414  uint16_t etid,
3415  GError **err);
3416 
3429  fbInfoModel_t *model,
3430  fbInfoElementOptRec_t *rec);
3431 
3441 gboolean fbInfoModelTypeInfoRecord(
3442  fbTemplate_t *tmpl);
3443 
3462  fbInfoModel_t *model);
3463 
3480 gboolean fbTemplateAppend(
3481  fbTemplate_t *tmpl,
3482  fbInfoElement_t *ex_ie,
3483  GError **err);
3484 
3500 gboolean fbTemplateAppendSpec(
3501  fbTemplate_t *tmpl,
3502  fbInfoElementSpec_t *spec,
3503  uint32_t flags,
3504  GError **err);
3505 
3523 gboolean fbTemplateAppendSpecArray(
3524  fbTemplate_t *tmpl,
3525  fbInfoElementSpec_t *spec,
3526  uint32_t flags,
3527  GError **err);
3528 
3536 uint32_t fbTemplateCountElements(
3537  fbTemplate_t *tmpl);
3538 
3554  fbTemplate_t *tmpl,
3555  uint16_t scope_count);
3556 
3564 uint32_t fbTemplateGetOptionsScope(
3565  fbTemplate_t *tmpl);
3566 
3578 gboolean fbTemplateContainsElement(
3579  fbTemplate_t *tmpl,
3580  const fbInfoElement_t *ex_ie);
3581 
3592  fbTemplate_t *tmpl,
3593  fbInfoElementSpec_t *spec);
3594 
3605  fbTemplate_t *tmpl,
3606  fbInfoElementSpec_t *spec);
3607 
3619  fbTemplate_t *tmpl,
3620  fbInfoElementSpec_t *spec,
3621  uint32_t flags);
3622 
3632  fbTemplate_t *tmpl,
3633  uint32_t IEindex);
3634 
3635 
3644  fbTemplate_t *tmpl);
3645 
3654  fbTemplate_t *tmpl);
3655 
3663 void *fbTemplateGetContext(
3664  fbTemplate_t *tmpl);
3665 
3673  fbTemplate_t *tmpl);
3674 
3693  fbInfoModel_t *model);
3694 
3705  fbSession_t *session,
3706  gboolean enabled,
3707  GError **err);
3708 
3718  fbSession_t *session,
3719  gboolean enabled,
3720  GError **err);
3721 
3738  fbSession_t *session,
3739  gboolean internal,
3740  uint16_t tid,
3741  fbTemplate_t *tmpl,
3742  const char *name,
3743  const char *description,
3744  GError **err);
3745 
3757  fbSession_t *session,
3758  uint16_t tid,
3759  const char *name,
3760  const char *description,
3761  GError **err);
3762 
3770  fbSession_t *session);
3771 
3802  fbSession_t *session,
3803  fbNewTemplateCallback_fn callback,
3804  void *app_ctx);
3805 
3830  fbSession_t *session,
3831  uint16_t ent_tid,
3832  uint16_t int_tid);
3833 
3844  fbSession_t *session,
3845  uint16_t ext_tid);
3846 
3856  fbSession_t *session,
3857  uint16_t ext_tid);
3858 
3868 void fbSessionFree(
3869  fbSession_t *session);
3870 
3884  fbSession_t *session);
3885 
3901 void fbSessionSetDomain(
3902  fbSession_t *session,
3903  uint32_t domain);
3904 
3912 uint32_t fbSessionGetDomain(
3913  fbSession_t *session);
3914 
3926  fbSession_t *session);
3927 
3936  fbSession_t *session);
3937 
3938 #if HAVE_SPREAD
3939 
3960  fbSession_t *session,
3961  char **groups,
3962  gboolean internal,
3963  uint16_t tid,
3964  fbTemplate_t *tmpl,
3965  GError **err);
3966 
3990  fbSession_t *session,
3991  char **groups,
3992  gboolean internal,
3993  uint16_t tid,
3994  fbTemplate_t *tmpl,
3995  char *name,
3996  char *description,
3997  GError **err);
3998 
4013  fbSession_t *session,
4014  char **groups,
4015  gboolean enabled,
4016  GError **err);
4017 
4031  fbSession_t *session,
4032  char **groups,
4033  gboolean enabled,
4034  GError **err);
4035 
4036 #endif
4037 
4050 gboolean fbSessionExportTemplate(
4051  fbSession_t *session,
4052  uint16_t tid,
4053  GError **err);
4054 
4066 gboolean fbSessionExportTemplates(
4067  fbSession_t *session,
4068  GError **err);
4069 
4088 uint16_t fbSessionAddTemplate(
4089  fbSession_t *session,
4090  gboolean internal,
4091  uint16_t tid,
4092  fbTemplate_t *tmpl,
4093  GError **err);
4094 
4107 gboolean fbSessionRemoveTemplate(
4108  fbSession_t *session,
4109  gboolean internal,
4110  uint16_t tid,
4111  GError **err);
4112 
4125  fbSession_t *session,
4126  gboolean internal,
4127  uint16_t tid,
4128  GError **err);
4129 
4143  fbConnSpec_t *spec);
4144 
4145 #if HAVE_SPREAD
4146 
4156  fbCollector_t *collector,
4157  char *groups[]);
4158 
4173  fbSpreadParams_t *params );
4174 
4175 #endif /* HAVE_SPREAD */
4176 
4189  const char *path);
4190 
4201  uint8_t *buf,
4202  uint16_t bufsize);
4203 
4204 
4214  FILE *fp);
4215 
4228 void fbExporterSetStream(
4229  fbExporter_t *exporter,
4230  int sctp_stream);
4231 
4245  fbExporter_t *exporter);
4246 
4254 void fbExporterClose(
4255  fbExporter_t *exporter);
4256 
4263 size_t fbExporterGetMsgLen(
4264  fbExporter_t *exporter);
4265 
4279  void *ctx,
4280  const char *path,
4281  GError **err);
4282 
4294  void *ctx,
4295  FILE *fp);
4296 
4297 
4298 #if HAVE_SPREAD
4299 
4310  void *ctx,
4311  fbSpreadParams_t *params,
4312  GError **err );
4313 
4314 #endif /* HAVE_SPREAD */
4315 
4326 void *fbCollectorGetContext(
4327  fbCollector_t *collector);
4328 
4339 void fbCollectorClose(
4340  fbCollector_t *collector);
4341 
4342 
4355  fbCollector_t *collector,
4356  struct sockaddr *address,
4357  size_t address_length);
4358 
4388  fbConnSpec_t *spec,
4389  fbSession_t *session,
4390  fbListenerAppInit_fn appinit,
4391  fbListenerAppFree_fn appfree,
4392  GError **err);
4393 
4401 void fbListenerFree(
4402  fbListener_t *listener);
4403 
4427  fbListener_t *listener,
4428  GError **err);
4429 
4441  fbListener_t *listener,
4442  GError **err);
4443 
4451 void fbListenerInterrupt(
4452  fbListener_t *listener);
4453 
4454 
4468 gboolean fbListenerGetCollector(
4469  fbListener_t *listener,
4470  fbCollector_t **collector,
4471  GError **err);
4472 
4473 
4474 
4475 
4488  fbCollector_t *collector,
4489  GError **err);
4490 
4491 
4504  fbCollector_t *collector,
4505  GError **err);
4506 
4507 
4520  fbCollector_t *collector,
4521  GError **err);
4522 
4542  fbCollector_t *collector,
4543  struct sockaddr *peer,
4544  size_t peerlen,
4545  uint32_t obdomain);
4546 
4562 uint32_t fbCollectorGetSFlowMissed(
4563  fbCollector_t *collector,
4564  struct sockaddr *peer,
4565  size_t peerlen,
4566  uint32_t obdomain);
4567 
4574 struct sockaddr* fbCollectorGetPeer(
4575  fbCollector_t *collector);
4576 
4587  fbCollector_t *collector);
4588 
4602  fbCollector_t *collector,
4603  gboolean multi_session);
4604 
4605 
4606 #ifdef __cplusplus
4607 } /* extern "C" */
4608 #endif
4609 
4610 #endif /* _FB_PUBLIC_H_ */
uint32_t flags
Flags.
Definition: public.h:1529
The "dateTimeMilliseconds" data type: An unsigned 64-bit integer containing the number of millisecond...
Definition: public.h:1462
fbInfoElement_t * fbTemplateGetIndexedIE(fbTemplate_t *tmpl, uint32_t IEindex)
Return the information element in the template referenced by the index.
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:1700
fbSubTemplateMultiListEntry_t * firstEntry
pointer to the first entry in the multi list
Definition: public.h:2345
fbExporter_t * fbExporterAllocFile(const char *path)
Allocate an exporting process endpoint for a named file.
uint8_t ie_type
ie data type
Definition: public.h:1552
uint16_t tmplID
ID of the template used to structure the data.
Definition: public.h:2104
The "dateTimeMicroseconds" data type: Two 32-bit fields where the first is the number seconds since t...
Definition: public.h:1467
void fbTemplateFreeUnused(fbTemplate_t *tmpl)
Free a template if it is not currently in use by any Session.
uint32_t ie_pen
private enterprise number
Definition: public.h:1548
fbExporter_t * fbExporterAllocBuffer(uint8_t *buf, uint16_t bufsize)
Allocate an exporting process for a buffer.
size_t dataLength
length of the buffer used to hold the data in this entry
Definition: public.h:2332
void * fbBasicListGetDataPtr(fbBasicList_t *basicList)
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.
void * fbSubTemplateMultiListEntryAddNewElements(fbSubTemplateMultiListEntry_t *entry, uint16_t numNewElements)
Allocates space for a number of additional elements in the sub template multi list entry...
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.
Partially reliable datagram transport via SCTP.
Definition: public.h:1648
void fBufListFree(fbTemplate_t *tmpl, uint8_t *record)
Clear 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:1424
The "subTemplateList" data type: A structured data element as described in RFC6313, Section 4.5.2.
Definition: public.h:1482
The "signed16" data type: An integer value in the range of -32768 to 32767.
Definition: public.h:1434
struct fbListenerGroupResult_st * next
Pointer to the next listener group result.
Definition: public.h:1788
uint8_t semantic
value used to describe the list of sub templates
Definition: public.h:2349
uint16_t fbSubTemplateListGetTemplateID(fbSubTemplateList_t *subTemplateList)
Gets the template ID for the template used by the list.
void fbBasicListFree(fbBasicList_t *basicList)
Clear the basic list, then free the basic list pointer.
uint16_t fbSessionAddTemplatesMulticastWithMetadata(fbSession_t *session, char **groups, gboolean internal, uint16_t tid, fbTemplate_t *tmpl, char *name, char *description, GError **err)
Set and send templates for 1 or more groups.
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.
gboolean fbSessionEnableTypeMetadata(fbSession_t *session, gboolean enabled, GError **err)
Configure a session to export type information for enterprise-specific information elements as option...
char * host
Hostname to connect/listen to.
Definition: public.h:1680
void fbSessionSetDomain(fbSession_t *session, uint32_t domain)
Set the current observation domain on a session.
fbCollector_t * fbSessionGetCollector(fbSession_t *session)
Retrieve collector that was created with the session.
fbCollector_t * fbCollectorAllocSpread(void *ctx, fbSpreadParams_t *params, GError **err)
Allocate a collecting process endpoint for the Spread transport.
uint16_t numElements
number of elements in the list
Definition: public.h:2106
struct fbSpreadParams_st fbSpreadParams_t
Spread connection parameters.
fBuf_t * fbListenerWait(fbListener_t *listener, GError **err)
Wait on a listener.
const fbInfoElement_t * infoElement
pointer to the information element that is repeated in the list
Definition: public.h:1888
The "float64" data type: An IEEE double-precision 64-bit floating point type.
Definition: public.h:1446
uint64_t ie_range_end
ie range max
Definition: public.h:1562
const char * description
description
Definition: public.h:1537
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)
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...
uint64_t min
range min
Definition: public.h:1531
An IPFIX template or options template structure.
Definition: private.h:197
struct fbCollector_st fbCollector_t
IPFIX Collecting Process endpoint.
Definition: public.h:1750
struct fbExporter_st fbExporter_t
IPFIX Exporting Process endpoint.
Definition: public.h:1741
fbSubTemplateMultiList_t * fbSubTemplateMultiListAlloc(void)
Allocates a subTemplateMultiList_t Based on how subTemplateMultiLists will be used and set up amidst ...
Secure, reliable stream transport via TLS over TCP.
Definition: public.h:1663
void fbBasicListSetSemantic(fbBasicList_t *basicList, uint8_t semantic)
Sets the semantic for describing a basic list generally used in exporters before decoding.
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:1640
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...
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...
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:1767
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:1758
Unreliable datagram transport via UDP.
Definition: public.h:1652
fbVarfield_t ie_desc
information element description
Definition: public.h:1566
The "unsigned8" data type: A non-negative integer value in the range of 0 to 255 (0xFF).
Definition: public.h:1418
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)
Append 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:2328
fbSubTemplateList_t * fbSubTemplateListAlloc(void)
Allocates a subTemplateList_t Based on how subTemplateLists will be used and set up amidst data struc...
The "octetArray" data type: A finite-length string of octets.
Definition: public.h:1415
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)
This function is used to iterate over the elements in the list by passing in a counter to indicate wh...
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)
Enable 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)
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.
uint16_t ie_id
information element id
Definition: public.h:1550
uint16_t numElements
number of elements in this entry
Definition: public.h:2336
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 fBufInterruptSocket(fBuf_t *fbuf)
Interrupts the select call of a specific collector by way of its fBuf.
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.
void fbSubTemplateListFree(fbSubTemplateList_t *subTemplateList)
Frees and clears a subTemplateList struct.
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.
gboolean fbTemplateContainsAllFlaggedElementsByName(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags)
Determine if a template contains at least one instance of each information element in a given informa...
char * ssl_ca_file
Path to certificate authority file.
Definition: public.h:1684
union fbInfoElement_st::@1 ref
Information element name.
void fBufFree(fBuf_t *fbuf)
Free a buffer.
gboolean fbSessionEnableTemplateMetadata(fbSession_t *session, gboolean enabled, GError **err)
Configure a session to export template metadata as options records.
Structure used to hold information of a sub template list.
Definition: public.h:2092
uint32_t flags
Application flags word.
Definition: public.h:1631
Entries contain the same type of information at SubTemplateLists: template ID and template pointers t...
Definition: public.h:2326
void fbSubTemplateListCollectorInit(fbSubTemplateList_t *STL)
Initializes a sub template list variable on a collector.
uint16_t tmplID
ID of the template used to structure the data in this entry.
Definition: public.h:2334
fbVarfield_t ie_name
information element name
Definition: public.h:1564
uint8_t semantic
semantic field to describe the list
Definition: public.h:1896
gboolean fbInfoModelReadXMLData(fbInfoModel_t *model, const gchar *xml_data, gssize xml_data_len, GError **error)
Add information specified in the given XML data to the information model.
void fBufSetBuffer(fBuf_t *fbuf, uint8_t *buf, size_t buflen)
Set 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:1437
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&#39;t monit...
fbListener_t * listener
pointer to the listener to add to the list
Definition: public.h:1778
void * fbBasicListGetNextPtr(fbBasicList_t *basicList, void *currentPtr)
Function returns the next element in the list based on the currentPtr.
Connection specifier.
Definition: public.h:1676
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.
void(* fbTemplateCtxFree_fn)(void *tmpl_ctx, void *app_ctx)
A callback function that is called when a template is freed.
Definition: public.h:1806
fbExporter_t * fBufGetExporter(fBuf_t *fbuf)
Retrieve the exporting process endpoint associated with a buffer.
uint16_t fbTemplateGetIELenOfMemBuffer(fbTemplate_t *tmpl)
Get 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)
Allocate the Options Template that will be used to define Information Element Type Records...
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.
uint16_t len
Information element length in octets.
Definition: public.h:1526
A ListenerGroupResult contains the fbListener whose listening socket got a new connection (cf...
Definition: public.h:1786
fBuf_t * fBufAllocForExport(fbSession_t *session, fbExporter_t *exporter)
Allocate a new buffer for export.
gboolean fbInfoModelReadXMLFile(fbInfoModel_t *model, const gchar *filename, GError **error)
Add information specified in the given XML file to the information model.
const fbInfoElement_t * fbBasicListGetInfoElement(fbBasicList_t *basicList)
This function returns a pointer to the information element used in the list it is mainly used in coll...
gboolean fbTemplateContainsElement(fbTemplate_t *tmpl, const fbInfoElement_t *ex_ie)
Determine if a template contains a given information element.
void * fbSubTemplateListGetNextPtr(const fbSubTemplateList_t *subTemplateList, void *currentPtr)
This function also traverses the elements in the list by accepting a pointer to the last element the ...
void fbBasicListClear(fbBasicList_t *basicList)
Clear the parameters of the basic list and free 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:1725
void * vai
Pointer to address info cache.
Definition: public.h:1695
fBuf_t * fbuf
pointer to the fbuf created for that new connection
Definition: public.h:1792
struct fbListenerEntry_st * prev
pointer to the previous listener entry in the linked list
Definition: public.h:1776
fbListenerGroup_t * fbListenerGroupAlloc(void)
Allocates and returns a fbListenerGroup with no entries.
uint8_t * dataPtr
pointer to the memory that stores the elements in the list
Definition: public.h:1890
Spread connection parameters.
Definition: public.h:1722
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:1690
uint8_t fbBasicListGetSemantic(fbBasicList_t *basicList)
Get Semantic field for Basic List presumably used in collectors after decoding.
fbInfoModel_t * fbInfoModelAlloc(void)
Allocate a new information model.
char * ssl_cert_file
Path to certificate file.
Definition: public.h:1686
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.
The "subTemplateMultiList" data type: A structured data element as described in RFC6313, Section 4.5.3.
Definition: public.h:1485
uint8_t fbSubTemplateMultiListGetSemantic(fbSubTemplateMultiList_t *STML)
Get the semantic paramter from the multi list.
uint8_t * dataPtr
pointer to the buffer used to hold the data
Definition: public.h:2102
uint16_t num
Information Element number.
Definition: public.h:1524
char * daemon
pointer to the daemon host address, in Spread format.
Definition: public.h:1728
uint16_t numElements
number of elements in the list
Definition: public.h:1892
void fBufSetExportTime(fBuf_t *fbuf, uint32_t extime)
Set 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:1421
size_t fbExporterGetMsgLen(fbExporter_t *exporter)
Get the (transcoded) message length that was copied to the exporting buffer upon fBufEmit().
uint8_t ie_semantic
ie semantic
Definition: public.h:1554
gboolean fbSessionExportTemplates(fbSession_t *session, GError **err)
Export 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:1774
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...
uint16_t fbSessionGetLargestInternalTemplateSize(fbSession_t *session)
Get the largest decoded size of an internal template in the session.
gboolean fbSessionSetTemplateMetadata(fbSession_t *session, uint16_t tid, const char *name, const char *description, GError **err)
Add template metadata for a given template.
uint16_t numElements
number of sub template lists in the multi list
Definition: public.h:2347
uint16_t dataLength
length of the buffer used to store the elements in the list
Definition: public.h:1894
ListenerEntry&#39;s make up an fbListenerGroup_t as a linked list.
Definition: public.h:1772
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)
Free 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)
Retrieve the external template used to read the last record from the buffer.
The "macAddress" data type: A MAC-48 address as a string of 6 octets.
Definition: public.h:1451
fbCollector_t * fBufGetCollector(fBuf_t *fbuf)
Retrieve the collecting process endpoint associated with a buffer.
A variable-length field value.
Definition: public.h:1076
A single IPFIX Information Element definition.
Definition: public.h:1496
gboolean fbSessionSpreadEnableTypeMetadata(fbSession_t *session, char **groups, gboolean enabled, GError **err)
Enable information element metadata export for Spread Sessions.
char * name
Information element name.
Definition: public.h:1612
void * fbCollectorGetContext(fbCollector_t *collector)
Retrieve the application context associated with a collector.
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:1669
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:1093
void * fbSubTemplateMultiListEntryGetIndexedPtr(fbSubTemplateMultiListEntry_t *entry, uint16_t index)
Returns a pointer to a data element in the entry based on the index.
gboolean fbInfoElementAddOptRecElement(fbInfoModel_t *model, fbInfoElementOptRec_t *rec)
Add an element that we received via an Options Record to the given info model.
The corresponding struct to the Information Element Type Options Template.
Definition: public.h:1546
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&#39;s information model.
Reliable stream transport via TCP.
Definition: public.h:1650
void fbInfoModelAddElement(fbInfoModel_t *model, fbInfoElement_t *ie)
Add a single information element to an information model.
uint64_t ie_range_begin
ie range min
Definition: public.h:1560
uint32_t fbSessionGetDomain(fbSession_t *session)
Retrieve the current domain on a session.
uint8_t * buf
Content buffer.
Definition: public.h:1085
void * fbBasicListAddNewElements(fbBasicList_t *basicList, uint16_t numNewElements)
Allocates an additional elememnt into the basic list must be called after calling BasicListInit...
char * ssl_key_file
Path to private key file.
Definition: public.h:1688
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:2743
uint32_t midx
Multiple IE index.
Definition: public.h:1517
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 fbInfoElementWriteOptionsRecord(fBuf_t *fbuf, const fbInfoElement_t *model_ie, uint16_t itid, uint16_t etid, GError **err)
Export an options record to the given fbuf with information element type information about the given ...
gboolean fBufSetAutomaticInsert(fBuf_t *fbuf, GError **err)
Set the automatic insert flag on a buffer.
Multilists just contain the semantic to describe the sub lists, the number of sub lists...
Definition: public.h:2343
uint8_t semantic
value used to describe the contents of the list, all-of, one-of, etc
Definition: public.h:2108
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)
Gets the info model for the session.
guint fbInfoModelCountElements(const fbInfoModel_t *model)
Return 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:1678
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.
void fbCollectorSetUDPMultiSession(fbCollector_t *collector, gboolean multi_session)
Attempt to maintain backwards compatibility with UDP.
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)
Allocate a listener.
void fbBasicListCollectorInit(fbBasicList_t *basicList)
This initializes a basic list structure for collection.
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...
size_t len
Length of content in buffer.
Definition: public.h:1078
uint16_t len_override
The size of the information element in bytes.
Definition: public.h:1624
gboolean fBufNextMessage(fBuf_t *fbuf, GError **err)
Read a new message into a buffer using the associated collecting process endpoint.
fbExporter_t * fbExporterAllocSpread(fbSpreadParams_t *params)
Allocate 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:1472
fbInfoElementDataType_en
From RFC 5610: A description of the abstract data type of an IPFIX information element as registered ...
Definition: public.h:1412
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:1440
uint64_t max
range max
Definition: public.h:1533
uint8_t * dataPtr
pointer to the buffer used to hold the data in this entry
Definition: public.h:2330
GHashTableIter fbInfoModelIter_t
An iterator over the information elements in an information model.
Definition: public.h:1098
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 ...
const fbTemplate_t * fbSubTemplateListGetTemplate(fbSubTemplateList_t *subTemplateList)
Gets the template pointer from the list structure.
uint32_t fBufGetExportTime(fBuf_t *fbuf)
Retrieve 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)
Similar to fbListenerWait(), except that is looks for connections for multiple listeners.
fbBasicList_t * fbBasicListAlloc(void)
allocates a Basic List Structure
A basic list element in a template which structure represents a basic list on the internal side...
Definition: public.h:1886
The "ipv6Address" data type: A value of an IPv6 address.
Definition: public.h:1476
fbTransport_en
Transport protocol for connection specifier.
Definition: public.h:1643
const fbInfoElement_t * fbInfoModelIterNext(fbInfoModelIter_t *iter)
Return 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:1479
void * fbSubTemplateListRealloc(fbSubTemplateList_t *subTemplateList, uint16_t newNumElements)
Frees 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.
The "boolean" data type: A binary value: "true" or "false".
Definition: public.h:1448
The "dateTimeSeconds" data type: An unsigned 32-bit integer containing the number of seconds since th...
Definition: public.h:1458
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListGetFirstEntry(fbSubTemplateMultiList_t *STML)
Retrieve the first entry in the multi list.
void(* fbListenerAppFree_fn)(void *ctx)
Application context free function type for fbListener_t.
Definition: public.h:2759
void * fbTemplateGetContext(fbTemplate_t *tmpl)
Get 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:1731
uint16_t ie_units
ie units
Definition: public.h:1556
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.
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.
void * fbBasicListGetIndexedDataPtr(fbBasicList_t *basicList, uint16_t bl_index)
Function retrieves the index&#39;th element in the list index is 0-based.
uint32_t ent
Private Enterprise Number.
Definition: public.h:1519
void fbListenerFreeGroupResult(fbListenerGroupResult_t *result)
Free the fbListenerGroupResult_t returned from fbListenerGroupWait()
Secure, partially reliable datagram transport via DTLS over SCTP.
Definition: public.h:1658
uint8_t type
Data Type.
Definition: public.h:1535
The "ipv4Address" data type: A value of an IPv4 address.
Definition: public.h:1474
uint32_t fbTemplateCountElements(fbTemplate_t *tmpl)
Determine 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)
Add a template to the session 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)
Retrieve the length of the buffer that is remaining after processing.
void fbCollectorClose(fbCollector_t *collector)
Close 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)
Return 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:1443
The "string" data type: A finite-length string of valid characters from the Unicode character encodin...
Definition: public.h:1454
struct fBuf_st fBuf_t
An IPFIX message buffer.
Definition: public.h:1068
void(* fbNewTemplateCallback_fn)(fbSession_t *session, uint16_t tid, fbTemplate_t *tmpl, void *app_ctx, void **tmpl_ctx, fbTemplateCtxFree_fn *tmpl_ctx_free_fn)
A callback function that will be called when the session receives a new external template.
Definition: public.h:1833
void 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)
Retrieve a template from a session by ID.
A single IPFIX Information Element specification.
Definition: public.h:1610
gboolean fbSessionExportTemplate(fbSession_t *session, uint16_t tid, GError **err)
Export 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)
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 subTemplateList.
gboolean fbTemplateAppendSpec(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags, GError **err)
Append 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:1682
gboolean fbSessionRemoveTemplate(fbSession_t *session, gboolean internal, uint16_t tid, GError **err)
Remove a template from a session.
The "signed8" data type: An integer value in the range of -128 to 127.
Definition: public.h:1431
void fbInfoModelIterInit(fbInfoModelIter_t *iter, const fbInfoModel_t *model)
Initialize an information model iterator for iteration.
void fbSessionResetExternal(fbSession_t *session)
Reset the external state (sequence numbers and templates) in a session state container.
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)
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:1428
gboolean fbCollectorSetSFlowTranslator(fbCollector_t *collector, GError **err)
Sets the collector input translator to convert SFlow into IPFIX for the given collector.
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)
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:1790
void fbInfoModelAddElementArray(fbInfoModel_t *model, fbInfoElement_t *ie)
Add multiple information elements in an array to an information model.
gboolean fBufSetInternalTemplate(fBuf_t *fbuf, uint16_t int_tid, GError **err)
Set 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)
Free a listener.
uint16_t fbSessionAddTemplatesMulticast(fbSession_t *session, char **groups, gboolean internal, uint16_t tid, fbTemplate_t *tmpl, GError **err)
Set and send templates for 1 or more groups.
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.
const fbTemplate_t * tmpl
pointer to the template used to structure the data
Definition: public.h:2100