public.h
Go to the documentation of this file.
1/*
2 * Copyright 2006-2024 Carnegie Mellon University
3 * See license information in LICENSE.txt.
4 */
9/*
10 * ------------------------------------------------------------------------
11 * Authors: Brian Trammell, Dan Ruef
12 * ------------------------------------------------------------------------
13 * @DISTRIBUTION_STATEMENT_BEGIN@
14 * libfixbuf 2.5
15 *
16 * Copyright 2024 Carnegie Mellon University.
17 *
18 * NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING
19 * INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON
20 * UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR
21 * IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF
22 * FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS
23 * OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
24 * MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT,
25 * TRADEMARK, OR COPYRIGHT INFRINGEMENT.
26 *
27 * Licensed under a GNU-Lesser GPL 3.0-style license, please see
28 * LICENSE.txt or contact permission@sei.cmu.edu for full terms.
29 *
30 * [DISTRIBUTION STATEMENT A] This material has been approved for public
31 * release and unlimited distribution. Please see Copyright notice for
32 * non-US Government use and distribution.
33 *
34 * This Software includes and/or makes use of Third-Party Software each
35 * subject to its own license.
36 *
37 * DM24-1020
38 * @DISTRIBUTION_STATEMENT_END@
39 * ------------------------------------------------------------------------
40 */
41
1124#ifndef _FB_PUBLIC_H_
1125#define _FB_PUBLIC_H_
1126#include <fixbuf/autoinc.h>
1127#include <fixbuf/version.h>
1128
1129#ifdef __cplusplus
1130extern "C" {
1131#endif
1132
1133
1138#define FIXBUF_CHECK_VERSION(major, minor, release) \
1139 (FIXBUF_VERSION_MAJOR > (major) || \
1140 (FIXBUF_VERSION_MAJOR == (major) && FIXBUF_VERSION_MINOR > (minor)) || \
1141 (FIXBUF_VERSION_MAJOR == (major) && FIXBUF_VERSION_MINOR == (minor) && \
1142 FIXBUF_VERSION_RELEASE >= (release)))
1143
1144/*
1145 * Error Handling Definitions
1146 */
1147
1149#define FB_ERROR_DOMAIN g_quark_from_string("fixbufError")
1151#define FB_ERROR_TMPL 1
1156#define FB_ERROR_EOM 2
1162#define FB_ERROR_EOF 3
1167#define FB_ERROR_IPFIX 4
1173#define FB_ERROR_BUFSZ 5
1175#define FB_ERROR_IMPL 6
1177#define FB_ERROR_IO 7
1182#define FB_ERROR_NLREAD 8
1188#define FB_ERROR_NLWRITE 9
1192#define FB_ERROR_NOELEMENT 10
1196#define FB_ERROR_CONN 11
1201#define FB_ERROR_NETFLOWV9 12
1205#define FB_ERROR_TRANSMISC 13
1209#define FB_ERROR_SFLOW 14
1213#define FB_ERROR_SETUP 15
1217#define FB_ERROR_LAXSIZE 16
1218
1219/*
1220 * Public Datatypes and Constants
1221 */
1222
1228typedef struct fBuf_st fBuf_t;
1229
1236typedef struct fbVarfield_st {
1238 size_t len;
1245 uint8_t *buf;
1247
1248
1253typedef struct fbInfoModel_st fbInfoModel_t;
1254
1258typedef GHashTableIter fbInfoModelIter_t;
1259
1265#define FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, _min_, _max_, _type_, _desc_)\
1266 { {(const struct fbInfoElement_st*)_name_}, 0, _ent_, _num_, _len_, _flags_, _min_, _max_, _type_, _desc_ }
1267
1274#define FB_IE_INIT(_name_, _ent_, _num_, _len_, _flags_) \
1275 FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, 0, 0, 0, (char*)NULL)
1276
1277
1283#define FB_IE_NULL FB_IE_INIT(NULL, 0, 0, 0, 0)
1284
1291#define FB_IE_SEMANTIC(flags) ((flags & 0x0000ff00) >> 8)
1292
1298#define FB_IE_UNITS(flags) ((flags & 0xFFFF0000) >> 16)
1299
1304#define FB_IE_F_NONE 0x00000000
1305
1311#define FB_IE_F_ENDIAN 0x00000001
1312
1324#define FB_IE_F_REVERSIBLE 0x00000040
1325
1334#define FB_IE_F_ALIEN 0x00000080
1335
1340#define FB_IE_QUANTITY 0x00000100
1341
1347#define FB_IE_TOTALCOUNTER 0x00000200
1348
1353#define FB_IE_DELTACOUNTER 0x00000300
1354
1359#define FB_IE_IDENTIFIER 0x00000400
1360
1365#define FB_IE_FLAGS 0x00000500
1366
1372#define FB_IE_LIST 0x00000600
1373
1379#define FB_IE_SNMPCOUNTER 0x00000700
1380
1386#define FB_IE_SNMPGAUGE 0x00000800
1387
1393#define FB_IE_DEFAULT 0x00000000
1394
1405#define FB_UNITS_BITS 0x00010000
1411#define FB_UNITS_OCTETS 0x00020000
1417#define FB_UNITS_PACKETS 0x00030000
1423#define FB_UNITS_FLOWS 0x00040000
1429#define FB_UNITS_SECONDS 0x00050000
1435#define FB_UNITS_MILLISECONDS 0x00060000
1441#define FB_UNITS_MICROSECONDS 0x00070000
1447#define FB_UNITS_NANOSECONDS 0x00080000
1453#define FB_UNITS_WORDS 0x00090000
1459#define FB_UNITS_MESSAGES 0x000A0000
1465#define FB_UNITS_HOPS 0x000B0000
1471#define FB_UNITS_ENTRIES 0x000C0000
1477#define FB_UNITS_FRAMES 0x000D0000
1483#define FB_UNITS_PORTS 0x000E0000
1489#define FB_UNITS_INFERRED 0x000F0000
1490
1494#define FB_IE_VARLEN 65535
1495
1504#define FB_IE_BASIC_LIST 291
1513#define FB_IE_SUBTEMPLATE_LIST 292
1522#define FB_IE_SUBTEMPLATE_MULTILIST 293
1523
1532#define FB_IE_PEN_REVERSE 29305
1533
1542#define FB_IE_VENDOR_BIT_REVERSE 0x4000
1543
1549#define FB_CISCO_GENERIC 9999
1557#define FB_CISCO_ASA_EVENT_ID 9998
1567#define FB_CISCO_ASA_EVENT_XTRA 9997
1573#define FB_IE_REVERSE_STR "reverse"
1574
1576#define FB_IE_REVERSE_STRLEN 7
1577
1659
1673typedef struct fbInfoElement_st {
1675 union {
1681 const struct fbInfoElement_st *canon;
1686 const char *name;
1688
1694 uint32_t midx;
1696 uint32_t ent;
1701 uint16_t num;
1703 uint16_t len;
1706 uint32_t flags;
1708 uint64_t min;
1710 uint64_t max;
1712 uint8_t type;
1714 const char *description;
1716
1764
1765
1778#define FB_TID_AUTO 0
1779
1783#define FB_TID_TS 2
1784
1788#define FB_TID_OTS 3
1789
1793#define FB_TID_MIN_DATA 256
1794
1801
1807#define FB_IESPEC_NULL { NULL, 0, 0 }
1808
1838
1845typedef struct fbSession_st fbSession_t;
1846
1876
1907
1911#define FB_CONNSPEC_INIT { FB_SCTP, NULL, NULL, \
1912 NULL, NULL, NULL, NULL, \
1913 NULL, NULL }
1914
1915#if HAVE_SPREAD
1916
1920#define FB_SPREADPARAMS_INIT { 0, 0, 0 }
1921
1940
1941#endif /* HAVE_SPREAD */
1942
1948typedef struct fbExporter_st fbExporter_t;
1949
1957typedef struct fbCollector_st fbCollector_t;
1958
1965typedef struct fbListener_st fbListener_t;
1966
1967/*
1968 * ListenerGroup and associated data type definitions
1969 */
1970
1974typedef struct fbListenerGroup_st fbListenerGroup_t;
1975
1987
2001
2012typedef void (*fbTemplateCtxFree_fn)(
2013 void *tmpl_ctx,
2014 void *app_ctx);
2015
2039 fbSession_t *session,
2040 uint16_t tid,
2041 fbTemplate_t *tmpl,
2042 void *app_ctx,
2043 void **tmpl_ctx,
2044 fbTemplateCtxFree_fn *tmpl_ctx_free_fn);
2045
2046
2054#define FB_LIST_SEM_UNDEFINED 0xFF
2058#define FB_LIST_SEM_NONE_OF 0x00
2062#define FB_LIST_SEM_EXACTLY_ONE_OF 0x01
2066#define FB_LIST_SEM_ONE_OR_MORE_OF 0x02
2070#define FB_LIST_SEM_ALL_OF 0x03
2074#define FB_LIST_SEM_ORDERED 0x04
2075
2087 uint8_t semantic);
2088
2089/****** BASICLIST FUNCTIONS AND STRUCTS *******/
2107
2108
2115 void);
2116
2130 fbBasicList_t *basicList,
2131 uint8_t semantic,
2132 const fbInfoElement_t *infoElement,
2133 uint16_t numElements);
2134
2153 fbBasicList_t *basicList,
2154 uint8_t semantic,
2155 const fbInfoElement_t *infoElement,
2156 uint16_t numElements,
2157 uint16_t dataLength,
2158 uint8_t *dataPtr);
2159
2172 fbBasicList_t *basicList);
2173
2181 const fbBasicList_t *basicList);
2182
2191 fbBasicList_t *basicList);
2192
2201 fbBasicList_t *basicList,
2202 uint8_t semantic);
2203
2212 fbBasicList_t *basicList);
2213
2220 fbBasicList_t *basicList);
2221
2232 fbBasicList_t *basicList,
2233 uint16_t index);
2234
2247 fbBasicList_t *basicList,
2248 void *currentPtr);
2249
2267 fbBasicList_t *basicList,
2268 uint16_t newNumElements);
2269
2278 fbBasicList_t *basicList,
2279 uint16_t numNewElements);
2280
2289 fbBasicList_t *basicList);
2290
2298 fbBasicList_t *basicList);
2299
2307 fbBasicList_t *basicList);
2308
2309
2310/******* END OF BASICLIST ********/
2311
2312
2313
2314/******* SUBTEMPLATELIST FUNCTIONS ****/
2315
2323typedef struct fbSubTemplateList_st {
2326 union {
2327 size_t length;
2328 uint64_t extra;
2333 uint8_t *dataPtr;
2335 uint16_t tmplID;
2337 uint16_t numElements;
2339 uint8_t semantic;
2341
2349 void);
2350
2370 uint8_t semantic,
2371 uint16_t tmplID,
2372 const fbTemplate_t *tmpl,
2373 uint16_t numElements);
2374
2394 fbSubTemplateList_t *subTemplateList,
2395 uint8_t semantic,
2396 uint16_t tmplID,
2397 const fbTemplate_t *tmpl,
2398 uint16_t numElements,
2399 uint16_t dataLength,
2400 uint8_t *dataPtr);
2401
2416 fbSubTemplateList_t *STL);
2417
2424 const fbSubTemplateList_t *subTemplateList);
2425
2436 const fbSubTemplateList_t *subTemplateList,
2437 uint16_t index);
2438
2451 const fbSubTemplateList_t *subTemplateList,
2452 void *currentPtr);
2453
2461 const fbSubTemplateList_t *subTemplateList);
2462
2469 fbSubTemplateList_t *subTemplateList,
2470 uint8_t semantic);
2471
2478 fbSubTemplateList_t *subTemplateList);
2479
2486 fbSubTemplateList_t *subTemplateList);
2487
2494 fbSubTemplateList_t *subTemplateList);
2495
2515 fbSubTemplateList_t *subTemplateList,
2516 uint16_t newNumElements);
2517
2528 fbSubTemplateList_t *subTemplateList,
2529 uint16_t numNewElements);
2530
2546 fbSubTemplateList_t *subTemplateList);
2547
2556 fbSubTemplateList_t *subTemplateList);
2557
2566 fbSubTemplateList_t *subTemplateList);
2567
2568/********* END OF SUBTEMPLATELIST **********/
2598
2611
2612
2621 void);
2622
2623
2635 uint8_t semantic,
2636 uint16_t numElements);
2637
2646 const fbSubTemplateMultiList_t *STML);
2647
2655 uint8_t semantic);
2656
2664
2674
2690
2699
2719 uint16_t newNumEntries);
2720
2731 uint16_t numNewEntries);
2732
2740
2751 uint16_t index);
2752
2766 fbSubTemplateMultiListEntry_t *currentEntry);
2767
2784 uint16_t tmplID,
2785 fbTemplate_t *tmpl,
2786 uint16_t numElements);
2787
2810 uint16_t newNumElements);
2811
2823 uint16_t numNewElements);
2824
2835
2844
2858 void *currentPtr);
2859
2872 uint16_t index);
2873
2882 const fbSubTemplateMultiListEntry_t *entry);
2883
2892
2901
2902/************** END OF STML FUNCTIONS *********** */
2903
2920 fbTemplate_t *tmpl,
2921 uint8_t *record);
2922
2923
2933 void);
2934
2941 fbListenerGroup_t *group);
2942
2953 fbListenerGroup_t *group,
2954 const fbListener_t *listener);
2955
2966 fbListenerGroup_t *group,
2967 const fbListener_t *listener);
2968
2982 fbListenerGroup_t *group,
2983 GError **err);
2984
2991 fbListenerGroupResult_t *result);
2992
3006 fbListener_t *listener,
3007 int sock,
3008 GError **err);
3009
3020 fbListener_t *listener,
3021 int sock,
3022 GError **err);
3023
3030 fBuf_t *fbuf);
3031
3032
3054typedef gboolean (*fbListenerAppInit_fn) (
3055 fbListener_t *listener,
3056 void **ctx,
3057 int fd,
3058 struct sockaddr *peer,
3059 size_t peerlen,
3060 GError **err);
3061
3071typedef void (*fbListenerAppFree_fn) (
3072 void *ctx);
3073
3074/*
3075 * Public Function Calls. These calls will remain available and retain
3076 * their functionality in all subsequent versions of libfixbuf.
3077 */
3078
3079
3097 fBuf_t *fbuf,
3098 uint16_t int_tid,
3099 GError **err);
3100
3119 fBuf_t *fbuf,
3120 uint16_t ext_tid,
3121 GError **err);
3122
3123#if HAVE_SPREAD
3142 fBuf_t *fbuf,
3143 char **groups,
3144 int num_groups,
3145 GError **err);
3146#endif /* HAVE_SPREAD */
3147
3173 fBuf_t *fbuf,
3174 gboolean automatic);
3175
3201 fBuf_t *fbuf,
3202 GError **err);
3203
3204
3213 fBuf_t *fbuf);
3214
3224 fBuf_t *fbuf);
3225
3239 fbSession_t *session,
3240 fbExporter_t *exporter);
3241
3252 fBuf_t *fbuf);
3253
3265 fBuf_t *fbuf,
3266 fbExporter_t *exporter);
3267
3268
3281 fBuf_t *fbuf);
3282
3283
3297 fBuf_t *fbuf,
3298 uint8_t *buf,
3299 size_t buflen);
3300
3301
3325gboolean fBufAppend(
3326 fBuf_t *fbuf,
3327 uint8_t *recbase,
3328 size_t recsize,
3329 GError **err);
3330
3340gboolean fBufEmit(
3341 fBuf_t *fbuf,
3342 GError **err);
3343
3356 fBuf_t *fbuf,
3357 uint32_t extime);
3358
3376 fbSession_t *session,
3377 fbCollector_t *collector);
3378
3389 fBuf_t *fbuf);
3390
3402 fBuf_t *fbuf,
3403 fbCollector_t *collector);
3404
3435gboolean fBufNext(
3436 fBuf_t *fbuf,
3437 uint8_t *recbase,
3438 size_t *recsize,
3439 GError **err);
3440
3454 fBuf_t *fbuf,
3455 GError **err);
3456
3465 fBuf_t *fbuf);
3466
3487 fBuf_t *fbuf,
3488 uint16_t *ext_tid);
3489
3509 fBuf_t *fbuf,
3510 uint16_t *ext_tid,
3511 GError **err);
3512
3528 void);
3529
3539 fbInfoModel_t *model);
3540
3556 fbInfoModel_t *model,
3557 fbInfoElement_t *ie);
3558
3578 fbInfoModel_t *model,
3579 fbInfoElement_t *ie);
3580
3613 fbInfoModel_t *model,
3614 const gchar *filename,
3615 GError **err);
3616
3650 fbInfoModel_t *model,
3651 const gchar *xml_data,
3652 gssize xml_data_len,
3653 GError **err);
3654
3667 fbInfoModel_t *model,
3668 const char *name);
3669
3684 fbInfoModel_t *model,
3685 uint16_t id,
3686 uint32_t ent);
3687
3696 const fbInfoModel_t *model);
3697
3708 fbInfoModelIter_t *iter,
3709 const fbInfoModel_t *model);
3710
3722 fbInfoModelIter_t *iter);
3723
3738 fbInfoModel_t *model,
3739 GError **err);
3740
3756 fBuf_t *fbuf,
3757 const fbInfoElement_t *model_ie,
3758 uint16_t itid,
3759 uint16_t etid,
3760 GError **err);
3761
3774 fbInfoModel_t *model,
3776
3789 fbTemplate_t *tmpl);
3790
3810 fbInfoModel_t *model);
3811
3830 fbTemplate_t *tmpl,
3831 fbInfoElement_t *ex_ie,
3832 GError **err);
3833
3852 fbTemplate_t *tmpl,
3853 fbInfoElementSpec_t *spec,
3854 uint32_t flags,
3855 GError **err);
3856
3873 fbTemplate_t *tmpl,
3874 fbInfoElementSpec_t *spec,
3875 uint32_t flags,
3876 GError **err);
3877
3886 fbTemplate_t *tmpl);
3887
3903 fbTemplate_t *tmpl,
3904 uint16_t scope_count);
3905
3914 fbTemplate_t *tmpl);
3915
3930 fbTemplate_t *tmpl,
3931 const fbInfoElement_t *ex_ie);
3932
3945 fbTemplate_t *tmpl,
3946 fbInfoElementSpec_t *spec);
3947
3960 fbTemplate_t *tmpl,
3961 fbInfoElementSpec_t *spec);
3962
3978 fbTemplate_t *tmpl,
3979 fbInfoElementSpec_t *spec,
3980 uint32_t flags);
3981
3994 fbTemplate_t *tmpl,
3995 uint32_t IEindex);
3996
3997
4006 fbTemplate_t *tmpl);
4007
4016 fbTemplate_t *tmpl);
4017
4026 fbTemplate_t *tmpl);
4027
4036 fbTemplate_t *tmpl);
4037
4056 fbInfoModel_t *model);
4057
4075 fbSession_t *session,
4076 gboolean enabled,
4077 GError **err);
4078
4103 fbSession_t *session,
4104 gboolean enabled,
4105 uint16_t tid,
4106 GError **err);
4107
4126 fbSession_t *session,
4127 gboolean enabled,
4128 GError **err);
4129
4156 fbSession_t *session,
4157 gboolean enabled,
4158 uint16_t tid,
4159 GError **err);
4160
4182 fbSession_t *session,
4183 gboolean internal,
4184 uint16_t tid,
4185 fbTemplate_t *tmpl,
4186 const char *name,
4187 const char *description,
4188 GError **err);
4189
4197 fbSession_t *session);
4198
4228 fbSession_t *session,
4229 fbNewTemplateCallback_fn callback,
4230 void *app_ctx);
4231
4255 fbSession_t *session,
4256 uint16_t ent_tid,
4257 uint16_t int_tid);
4258
4268 fbSession_t *session,
4269 uint16_t ext_tid);
4270
4280 fbSession_t *session,
4281 uint16_t ext_tid);
4282
4293 fbSession_t *session);
4294
4308 fbSession_t *session);
4309
4326 fbSession_t *session,
4327 uint32_t domain);
4328
4337 fbSession_t *session);
4338
4350 fbSession_t *session);
4351
4360 fbSession_t *session);
4361
4362#if HAVE_SPREAD
4388 fbSession_t *session,
4389 char **groups,
4390 gboolean internal,
4391 uint16_t tid,
4392 fbTemplate_t *tmpl,
4393 GError **err);
4394
4419 fbSession_t *session,
4420 char **groups,
4421 gboolean internal,
4422 uint16_t tid,
4423 fbTemplate_t *tmpl,
4424 char *name,
4425 char *description,
4426 GError **err);
4427
4428
4447 fbSession_t *session,
4448 char **groups,
4449 gboolean enabled,
4450 GError **err);
4451
4473 fbSession_t *session,
4474 char **groups,
4475 gboolean enabled,
4476 uint16_t tid,
4477 GError **err);
4478
4498 fbSession_t *session,
4499 char **groups,
4500 gboolean enabled,
4501 GError **err);
4502
4524 fbSession_t *session,
4525 char **groups,
4526 gboolean enabled,
4527 uint16_t tid,
4528 GError **err);
4529#endif /* HAVE_SPREAD */
4530
4548 fbSession_t *session,
4549 uint16_t tid,
4550 GError **err);
4551
4571 fbSession_t *session,
4572 GError **err);
4573
4598 fbSession_t *session,
4599 gboolean internal,
4600 uint16_t tid,
4601 fbTemplate_t *tmpl,
4602 GError **err);
4603
4617 fbSession_t *session,
4618 gboolean internal,
4619 uint16_t tid,
4620 GError **err);
4621
4634 fbSession_t *session,
4635 gboolean internal,
4636 uint16_t tid,
4637 GError **err);
4638
4652 fbConnSpec_t *spec);
4653
4654#if HAVE_SPREAD
4667 fbCollector_t *collector,
4668 char *groups[]);
4669
4686 fbSpreadParams_t *params);
4687
4688#endif /* HAVE_SPREAD */
4689
4702 const char *path);
4703
4716 uint8_t *buf,
4717 uint16_t bufsize);
4718
4719
4729 FILE *fp);
4730
4744 fbExporter_t *exporter,
4745 int sctp_stream);
4746
4760 fbExporter_t *exporter);
4761
4770 fbExporter_t *exporter);
4771
4779 fbExporter_t *exporter);
4780
4790 fbExporter_t *exporter,
4791 const char *source_ip_v4);
4792
4802 fbExporter_t *exporter,
4803 const char *source_ip_v6);
4804
4818 void *ctx,
4819 const char *path,
4820 GError **err);
4821
4833 void *ctx,
4834 FILE *fp);
4835
4836
4837#if HAVE_SPREAD
4851 void *ctx,
4852 fbSpreadParams_t *params,
4853 GError **err);
4854
4855#endif /* HAVE_SPREAD */
4856
4868 fbCollector_t *collector);
4869
4881 fbCollector_t *collector);
4882
4883
4896 fbCollector_t *collector,
4897 struct sockaddr *address,
4898 size_t address_length);
4899
4929 fbConnSpec_t *spec,
4930 fbSession_t *session,
4931 fbListenerAppInit_fn appinit,
4932 fbListenerAppFree_fn appfree,
4933 GError **err);
4934
4943 fbListener_t *listener);
4944
4968 fbListener_t *listener,
4969 GError **err);
4970
4982 fbListener_t *listener,
4983 GError **err);
4984
4993 fbListener_t *listener);
4994
4995
5007 fbListener_t *listener,
5008 fbCollector_t **collector,
5009 GError **err);
5010
5011
5012
5013
5026 fbCollector_t *collector,
5027 GError **err);
5028
5029
5042 fbCollector_t *collector,
5043 GError **err);
5044
5045
5058 fbCollector_t *collector,
5059 GError **err);
5060
5080 fbCollector_t *collector,
5081 struct sockaddr *peer,
5082 size_t peerlen,
5083 uint32_t obdomain);
5084
5101 fbCollector_t *collector,
5102 struct sockaddr *peer,
5103 size_t peerlen,
5104 uint32_t obdomain);
5105
5112struct sockaddr* fbCollectorGetPeer(
5113 fbCollector_t *collector);
5114
5125 fbCollector_t *collector);
5126
5150 fbCollector_t *collector,
5151 gboolean multi_session);
5152
5153
5154#ifdef __cplusplus
5155} /* extern "C" */
5156#endif
5157
5158#endif /* _FB_PUBLIC_H_ */
An IPFIX template or options template structure.
Definition private.h:208
gboolean fbSessionSpreadEnableTemplateMetadata(fbSession_t *session, char **groups, gboolean enabled, GError **err)
Enables template metadata export for Spread Sessions.
void(* fbTemplateCtxFree_fn)(void *tmpl_ctx, void *app_ctx)
A callback function that is called when a template is freed.
Definition public.h:2012
uint8_t ie_semantic
ie semantic
Definition public.h:1750
void * fbSubTemplateMultiListEntryAddNewElements(fbSubTemplateMultiListEntry_t *entry, uint16_t numNewElements)
Allocates space for numNewEntries additional elements in the sub template multi list entry.
struct fbListenerGroupResult_st * next
Pointer to the next listener group result.
Definition public.h:1995
struct fbExporter_st fbExporter_t
IPFIX Exporting Process endpoint.
Definition public.h:1948
const char * description
description
Definition public.h:1714
void fBufFree(fBuf_t *fbuf)
Frees a buffer.
gboolean fbTemplateAppend(fbTemplate_t *tmpl, fbInfoElement_t *ex_ie, GError **err)
Appends an information element to a template.
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 fbBasicListCollectorInit(fbBasicList_t *basicList)
Initializes a basic list structure for collection.
void fbTemplateFreeUnused(fbTemplate_t *tmpl)
Frees a template if it is not currently in use by any Session.
fbTemplate_t * fBufGetCollectionTemplate(fBuf_t *fbuf, uint16_t *ext_tid)
Retrieves the external template used to read the last record from the buffer.
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...
uint8_t type
Data Type.
Definition public.h:1712
char * daemon
pointer to the daemon host address, in Spread format.
Definition public.h:1935
uint16_t fbTemplateGetIELenOfMemBuffer(fbTemplate_t *tmpl)
Returns the number of octets required for a data buffer (an octet array) to store a data record descr...
uint16_t fbBasicListCountElements(const fbBasicList_t *basicList)
Returns the number of elements the basic list is capable of holding.
enum fbInfoElementDataType_en fbInfoElementDataType_t
From RFC 5610: A description of the abstract data type of an IPFIX information element as registered ...
gboolean fBufNext(fBuf_t *fbuf, uint8_t *recbase, size_t *recsize, GError **err)
Retrieves a record from a Buffer associated with a collecting process.
gboolean fbTemplateContainsElement(fbTemplate_t *tmpl, const fbInfoElement_t *ex_ie)
Determines if a template contains a given information element.
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:2038
gboolean fbInfoModelTypeInfoRecord(fbTemplate_t *tmpl)
Checks to see if a template contains all of the elements required by RFC 5610 for describing an infor...
fBuf_t * fbListenerOwnSocketCollectorTLS(fbListener_t *listener, int sock, GError **err)
Same as fbListenerOwnSocketCollectorTCP() but for TLS (not tested)
const fbInfoElement_t * fbInfoModelIterNext(fbInfoModelIter_t *iter)
Returns a pointer to the next information element in the information model.
struct fbSpreadParams_st fbSpreadParams_t
Spread connection parameters.
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.
void fbSubTemplateListSetSemantic(fbSubTemplateList_t *subTemplateList, uint8_t semantic)
Sets the semantic parameter of a subTemplateList.
fbSession_t * fbSessionAlloc(fbInfoModel_t *model)
Allocates a transport session state container.
void fbSessionAddTemplatePair(fbSession_t *session, uint16_t ent_tid, uint16_t int_tid)
Adds an external-internal template pair to the session.
void fbCollectorSetUDPMultiSession(fbCollector_t *collector, gboolean multi_session)
Enables or disables multi-session mode for a fbCollector_t associated with a UDP fbListener_t.
struct fbSubTemplateList_st fbSubTemplateList_t
Structure used to hold information of a sub template list.
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...
fbCollector_t * fbCollectorAllocSpread(void *ctx, fbSpreadParams_t *params, GError **err)
Allocates a collecting process endpoint for the Spread transport.
uint16_t len_override
The size of the information element in bytes.
Definition public.h:1829
void fbInfoModelAddElementArray(fbInfoModel_t *model, fbInfoElement_t *ie)
Adds multiple information elements in an array to an information model.
fbBasicList_t * fbBasicListAlloc(void)
Allocates and returns an empty Basic List Structure.
uint16_t tmplID
ID of the template used to structure the data.
Definition public.h:2335
uint8_t padding[6]
padding to align with template
Definition public.h:1754
uint16_t fbSubTemplateListGetTemplateID(fbSubTemplateList_t *subTemplateList)
Gets the template ID for the template used by the list.
fbInfoModel_t * fbInfoModelAlloc(void)
Allocates a new information model.
void * fbSubTemplateListRealloc(fbSubTemplateList_t *subTemplateList, uint16_t newNumElements)
Potentially reallocates the list's internal buffer and returns a handle to it.
gboolean fbSessionRemoveTemplate(fbSession_t *session, gboolean internal, uint16_t tid, GError **err)
Removes a template from a session.
gboolean fBufSetInternalTemplate(fBuf_t *fbuf, uint16_t int_tid, GError **err)
Sets the internal template on a buffer to the given template ID.
void fBufSetBuffer(fBuf_t *fbuf, uint8_t *buf, size_t buflen)
Sets a buffer on an fBuf for collection.
guint fbInfoModelCountElements(const fbInfoModel_t *model)
Returns the number of information elements in the information model.
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 fbSubTemplateListClear(fbSubTemplateList_t *subTemplateList)
Clears a subTemplateList structure, notably freeing the internal buffer and setting it to NULL.
fbSubTemplateMultiList_t * fbSubTemplateMultiListAlloc(void)
Allocates and returns an empty subTemplateMultiList structure.
uint16_t fbSessionAddTemplate(fbSession_t *session, gboolean internal, uint16_t tid, fbTemplate_t *tmpl, GError **err)
Adds a template to a session.
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...
void(* fbListenerAppFree_fn)(void *ctx)
Application context free function type for fbListener_t.
Definition public.h:3071
struct sockaddr * fbCollectorGetPeer(fbCollector_t *collector)
Retrieves information about the node connected to this collector.
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListAddNewEntries(fbSubTemplateMultiList_t *STML, uint16_t numNewEntries)
Adds numNewElements entries to the multi list of entries.
uint8_t * dataPtr
pointer to the buffer used to hold the data
Definition public.h:2333
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.
struct fbSubTemplateMultiList_st fbSubTemplateMultiList_t
Multilists just contain the semantic to describe the sub lists, the number of sub lists,...
gboolean fbTemplateAppendSpec(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags, GError **err)
Appends an information element described by specifier to a template.
gboolean fbListValidSemantic(uint8_t semantic)
Validates the value of a structured data types semantic field, as defined in RFC 6313 and listed at I...
uint32_t fbTemplateGetOptionsScope(fbTemplate_t *tmpl)
Determines number of scope information elements in a template.
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...
uint16_t numElements
number of elements in the list
Definition public.h:2337
fbListener_t * listener
pointer to the listener that received a new connection
Definition public.h:1997
struct fbConnSpec_st fbConnSpec_t
Connection specifier.
void * fbBasicListGetNextPtr(fbBasicList_t *basicList, void *currentPtr)
Retrieves a pointer to the data element in the basicList that follows the one at currentPtr.
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...
uint16_t ie_id
information element id
Definition public.h:1746
gboolean fBufEmit(fBuf_t *fbuf, GError **err)
Emits the message currently in a buffer using the associated exporting process endpoint.
uint8_t * dataPtr
pointer to the memory that stores the elements in the list
Definition public.h:2099
void * vai
Pointer to address info cache.
Definition public.h:1900
union fbSubTemplateList_st::@2 dataLength
length of the allocated buffer used to hold the data
struct fbListener_st fbListener_t
IPFIX Collecting Process session listener.
Definition public.h:1965
fbTransport_en
Transport protocol for connection specifier.
Definition public.h:1848
@ FB_DTLS_SCTP
Secure, partially reliable datagram transport via DTLS over SCTP.
Definition public.h:1863
@ FB_DTLS_UDP
Secure, unreliable datagram transport via DTLS over UDP.
Definition public.h:1874
@ FB_TLS_TCP
Secure, reliable stream transport via TLS over TCP.
Definition public.h:1868
@ FB_TCP
Reliable stream transport via TCP.
Definition public.h:1855
@ FB_SCTP
Partially reliable datagram transport via SCTP.
Definition public.h:1853
@ FB_UDP
Unreliable datagram transport via UDP.
Definition public.h:1857
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:3054
fbListenerGroupResult_t * fbListenerGroupWait(fbListenerGroup_t *group, GError **err)
Accepts connections for multiple listeners.
const fbTemplate_t * tmpl
pointer to the template used to structure the data
Definition public.h:2331
uint16_t numElements
number of elements in the list
Definition public.h:2101
struct fbInfoElementOptRec_st fbInfoElementOptRec_t
The corresponding C struct for a record whose template is the RFC5610 Information Element Type Option...
const fbInfoElement_t * infoElement
pointer to the information element that is repeated in the list
Definition public.h:2097
void fbSubTemplateMultiListSetSemantic(fbSubTemplateMultiList_t *STML, uint8_t semantic)
Sets the semantic field for the multi list.
uint32_t fbSessionGetDomain(fbSession_t *session)
Retrieves the current domain on a session.
char ** groups
pointer to array of group names, must have at least one, and must be null term array
Definition public.h:1938
void fbSessionFree(fbSession_t *session)
Frees a transport session state container.
fBuf_t * fBufAllocForCollection(fbSession_t *session, fbCollector_t *collector)
Allocates a new buffer for collection.
gboolean fbSessionExportTemplates(fbSession_t *session, GError **err)
Exports all external templates in the current domain of a given session.
union fbInfoElement_st::@1 ref
Information element name.
uint16_t ie_units
ie units
Definition public.h:1752
gboolean fbCollectorClearTranslator(fbCollector_t *collector, GError **err)
Removes an input translator from a given collector such that it will operate on IPFIX protocol again.
GHashTableIter fbInfoModelIter_t
An iterator over the information elements in an information model.
Definition public.h:1258
uint8_t fbBasicListGetSemantic(fbBasicList_t *basicList)
Gets the Semantic field for Basic List.
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...
fbInfoElementDataType_en
From RFC 5610: A description of the abstract data type of an IPFIX information element as registered ...
Definition public.h:1584
@ FB_DT_MICROSEC
The "dateTimeMicroseconds" data type: Two 32-bit fields where the first is the number seconds since t...
Definition public.h:1639
@ FB_STRING
The "string" data type: A finite-length string of valid characters from the Unicode character encodin...
Definition public.h:1626
@ FB_DT_SEC
The "dateTimeSeconds" data type: An unsigned 32-bit integer containing the number of seconds since th...
Definition public.h:1630
@ FB_INT_8
The "signed8" data type: An integer value in the range of -128 to 127.
Definition public.h:1603
@ FB_UINT_16
The "unsigned16" data type: A non-negative integer value in the range of 0 to 65535 (0xFFFF).
Definition public.h:1593
@ FB_UINT_64
The "unsigned64" data type: A non-negative integer value in the range of 0 to 18_446_744_073_709_551_...
Definition public.h:1600
@ FB_FLOAT_64
The "float64" data type: An IEEE double-precision 64-bit floating point type.
Definition public.h:1618
@ FB_SUB_TMPL_MULTI_LIST
The "subTemplateMultiList" data type: A structured data element as described in RFC6313,...
Definition public.h:1657
@ FB_SUB_TMPL_LIST
The "subTemplateList" data type: A structured data element as described in RFC6313,...
Definition public.h:1654
@ FB_BOOL
The "boolean" data type: A binary value: "true" or "false".
Definition public.h:1620
@ FB_UINT_32
The "unsigned32" data type: A non-negative integer value in the range of 0 to 4_294_967_295 (0xFFFFFF...
Definition public.h:1596
@ FB_IP6_ADDR
The "ipv6Address" data type: A value of an IPv6 address.
Definition public.h:1648
@ FB_INT_32
The "signed32" data type: An integer value in the range of -2_147_483_648 to 2_147_483_647.
Definition public.h:1609
@ FB_UINT_8
The "unsigned8" data type: A non-negative integer value in the range of 0 to 255 (0xFF).
Definition public.h:1590
@ FB_INT_64
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:1612
@ FB_OCTET_ARRAY
The "octetArray" data type: A finite-length string of octets.
Definition public.h:1587
@ FB_DT_NANOSEC
The "dateTimeMicroseconds" data type: Two 32-bit fields where the first is the number seconds since t...
Definition public.h:1644
@ FB_FLOAT_32
The "float32" data type: An IEEE single-precision 32-bit floating point type.
Definition public.h:1615
@ FB_BASIC_LIST
The "basicList" data type: A structured data element as described in RFC6313, Section 4....
Definition public.h:1651
@ FB_MAC_ADDR
The "macAddress" data type: A MAC-48 address as a string of 6 octets.
Definition public.h:1623
@ FB_INT_16
The "signed16" data type: An integer value in the range of -32768 to 32767.
Definition public.h:1606
@ FB_DT_MILSEC
The "dateTimeMilliseconds" data type: An unsigned 64-bit integer containing the number of millisecond...
Definition public.h:1634
@ FB_IP4_ADDR
The "ipv4Address" data type: A value of an IPv4 address.
Definition public.h:1646
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...
fbSubTemplateList_t * fbSubTemplateListAlloc(void)
Allocates and returns an empty subTemplateList structure.
fbInfoElement_t * fbTemplateGetIndexedIE(fbTemplate_t *tmpl, uint32_t IEindex)
Returns the information element in the template referenced by the index.
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.
void fbBasicListSetSemantic(fbBasicList_t *basicList, uint8_t semantic)
Sets the semantic for describing a basic list.
char * name
Information element name.
Definition public.h:1817
uint32_t flags
Application flags word.
Definition public.h:1836
int fbListenerGroupAddListener(fbListenerGroup_t *group, const fbListener_t *listener)
Adds a previously allocated listener to the previously allocated group.
fBuf_t * fbuf
pointer to the fbuf created for that new connection
Definition public.h:1999
uint32_t fBufGetExportTime(fBuf_t *fbuf)
Retrieves the export time on the message currently in a buffer.
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 fbListenerFreeGroupResult(fbListenerGroupResult_t *result)
Frees the listener group result returned from fbListenerGroupWait().
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.
void * fbTemplateGetContext(fbTemplate_t *tmpl)
Gets the ctx pointer associated with a Template.
void * fbBasicListInit(fbBasicList_t *basicList, uint8_t semantic, const fbInfoElement_t *infoElement, uint16_t numElements)
Initializes the basic list structure based on the parameters.
void fBufListFree(fbTemplate_t *tmpl, uint8_t *record)
Clears all of the memory that fixbuf allocated during transcode of this record.
void fBufSetAutomaticMode(fBuf_t *fbuf, gboolean automatic)
Sets the automatic (read/write) mode flag on a buffer.
fbExporter_t * fbExporterAllocFile(const char *path)
Allocates an exporting process endpoint for a named file.
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 ...
void * fbSubTemplateMultiListEntryRealloc(fbSubTemplateMultiListEntry_t *entry, uint16_t newNumElements)
Potentially reallocates the entry's internal buffer and returns a handle to it.
uint32_t fbCollectorGetObservationDomain(fbCollector_t *collector)
Retrieves the observation domain of the node connected to the UDP collector.
fBuf_t * fbListenerWait(fbListener_t *listener, GError **err)
Waits on a listener.
fbCollector_t * fBufGetCollector(fBuf_t *fbuf)
Retrieves the collecting process endpoint associated with a buffer.
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.
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListGetFirstEntry(fbSubTemplateMultiList_t *STML)
Retrieves the first entry in the multi list.
uint8_t semantic
semantic field to describe the list
Definition public.h:2105
uint16_t fbSessionSpreadSetMetadataExportTemplates(fbSession_t *session, char **groups, gboolean enabled, uint16_t tid, GError **err)
Enables template metadata export for Spread Sessions.
fBuf_t * fbListenerWaitNoCollectors(fbListener_t *listener, GError **err)
Waits for an incoming connection, just like fbListenerWait(), except that this function doesn't monit...
struct fbInfoModel_st fbInfoModel_t
An IPFIX information model.
Definition public.h:1253
fbInfoModel_t * fbTemplateGetInfoModel(fbTemplate_t *tmpl)
Returns the information model, as understood by the template.
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 fbTemplateContainsAllElementsByName(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec)
Determines if a template contains at least one instance of each fbInfoElement_t in a given informatio...
uint16_t dataLength
length of the buffer used to store the elements in the list
Definition public.h:2103
fbExporter_t * fbExporterAllocBuffer(uint8_t *buf, uint16_t bufsize)
Allocates an exporting process to use the existing buffer buf having the specified size.
fbTemplate_t * tmpl
pointer to the template used to structure the data in this entry
Definition public.h:2588
fbInfoModel_t * fbSessionGetInfoModel(fbSession_t *session)
Gets the info model for the session.
void fbListenerGroupFree(fbListenerGroup_t *group)
Frees a listener group.
struct fbListenerEntry_st fbListenerEntry_t
ListenerEntry's make up an fbListenerGroup_t as a linked list.
fbSession_t * fBufGetSession(fBuf_t *fbuf)
Retrieves the session associated with a buffer.
gboolean fBufNextMessage(fBuf_t *fbuf, GError **err)
Reads a new message into a buffer using the associated collecting process endpoint.
fbExporter_t * fBufGetExporter(fBuf_t *fbuf)
Retrieves the exporting process endpoint associated with a buffer.
uint16_t fbSubTemplateListCountElements(const fbSubTemplateList_t *subTemplateList)
Returns the number of elements the sub template list is capable of holding.
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...
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...
void fbBasicListFree(fbBasicList_t *basicList)
Clears the basic list (fbBasicListClear()), then frees the basic list itself.
void fbListenerInterrupt(fbListener_t *listener)
Causes the current or next call to fbListenerWait() to unblock and return.
void fbExporterAutoStream(fbExporter_t *exporter)
Enables automatic SCTP stream selection for the next message exported.
void fbSessionSetDomain(fbSession_t *session, uint32_t domain)
Sets the current observation domain on a session.
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.
char * ssl_ca_file
Path to certificate authority file.
Definition public.h:1889
struct fbSession_st fbSession_t
An IPFIX Transport Session state container.
Definition public.h:1845
fbTransport_t transport
Transport protocol to use.
Definition public.h:1883
struct fbListenerEntry_st * next
pointer to the next listener entry in the linked list
Definition public.h:1981
void fbInfoModelFree(fbInfoModel_t *model)
Frees an information model.
fbTemplate_t * fbInfoElementAllocTypeTemplate(fbInfoModel_t *model, GError **err)
Allocates and returns the Options Template that will be used to define Information Element Type Recor...
uint16_t fbSubTemplateMultiListEntryGetTemplateID(fbSubTemplateMultiListEntry_t *entry)
Retrieves the template ID for the template used to structure the data.
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 tmplID
ID of the template used to structure the data in this entry.
Definition public.h:2594
void * vssl_ctx
Pointer to SSL context cache.
Definition public.h:1905
struct fbInfoElement_st fbInfoElement_t
A single IPFIX Information Element definition.
uint16_t fbSessionSetMetadataExportTemplates(fbSession_t *session, gboolean enabled, uint16_t tid, GError **err)
Configures a session to export template metadata as options records.
void fbSubTemplateListFree(fbSubTemplateList_t *subTemplateList)
Clears the sub template list (fbSubTemplateListClear()) then frees the subTemplateList itself.
void fbBasicListClearWithoutFree(fbBasicList_t *basicList)
Clears the parameters of the basic list, but does not free the buffer.
void fbExporterSetStream(fbExporter_t *exporter, int sctp_stream)
Sets the SCTP stream for the next message exported.
int fbCollectorGetSpreadReturnGroups(fbCollector_t *collector, char *groups[])
This function is useful if need to know what groups were set on the message.
gboolean fbCollectorSetSFlowTranslator(fbCollector_t *collector, GError **err)
Sets the collector input translator to convert SFlow into IPFIX for the given collector.
gboolean fbSessionExportTemplate(fbSession_t *session, uint16_t tid, GError **err)
Exports a single external template in the current domain of a given session.
uint32_t midx
Multiple IE index.
Definition public.h:1694
uint8_t * buf
Content buffer.
Definition public.h:1245
fBuf_t * fBufAllocForExport(fbSession_t *session, fbExporter_t *exporter)
Allocates a new buffer for export.
void fbInfoModelIterInit(fbInfoModelIter_t *iter, const fbInfoModel_t *model)
Initializes an information model iterator for iteration over the information elements (fbInfoElement_...
uint8_t semantic
value used to describe the contents of the list, all-of, one-of, etc
Definition public.h:2339
fbListener_t * fbListenerAlloc(fbConnSpec_t *spec, fbSession_t *session, fbListenerAppInit_fn appinit, fbListenerAppFree_fn appfree, GError **err)
Allocates a listener.
uint64_t max
range max
Definition public.h:1710
char * svc
Service name or port number to connect/listen to.
Definition public.h:1887
void * fbCollectorGetContext(fbCollector_t *collector)
Retrieves the application context associated with a collector.
void fbTemplateSetOptionsScope(fbTemplate_t *tmpl, uint16_t scope_count)
Sets the number of information elements in a template that are scope.
uint16_t numElements
number of sub template lists in the multi list
Definition public.h:2607
void * fbSubTemplateListAddNewElements(fbSubTemplateList_t *subTemplateList, uint16_t numNewElements)
Allocates space for numNewElements additional element in the subTemplateList.
void * fbBasicListRealloc(fbBasicList_t *basicList, uint16_t newNumElements)
Potentially reallocates the list's internal buffer and returns a handle to it.
size_t fbExporterGetMsgLen(fbExporter_t *exporter)
Gets the (transcoded) message length that was copied to the exporting buffer upon fBufEmit() when usi...
char * ssl_cert_file
Path to certificate file.
Definition public.h:1891
struct fbListenerGroup_st fbListenerGroup_t
Structure that represents a group of listeners.
Definition public.h:1974
void * fbSubTemplateListGetDataPtr(const fbSubTemplateList_t *subTemplateList)
Returns a pointer to the buffer that contains the data for the list.
void fbSubTemplateMultiListClearEntries(fbSubTemplateMultiList_t *STML)
Clears the memory used by all the entries of a sub template multi list.
char * ssl_key_file
Path to private key file.
Definition public.h:1893
uint16_t numElements
number of elements in this entry
Definition public.h:2596
struct fbListenerEntry_st * prev
pointer to the previous listener entry in the linked list
Definition public.h:1983
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...
gboolean fbCollectorSetNetflowV9Translator(fbCollector_t *collector, GError **err)
Sets the collector input translator to convert NetFlowV9 into IPFIX for the given collector.
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.
void fBufInterruptSocket(fBuf_t *fbuf)
Interrupts the select call of a specific collector by way of its fBuf.
void fbSubTemplateMultiListEntryClear(fbSubTemplateMultiListEntry_t *entry)
Frees the memory holding the records' data used by this entry.
struct fbSubTemplateMultiListEntry_st fbSubTemplateMultiListEntry_t
Entries contain the same type of information at SubTemplateLists: template ID and template pointers t...
uint16_t fbSessionGetLargestInternalTemplateSize(fbSession_t *session)
Gets the largest decoded size of an internal template in the session.
struct fbListenerGroupResult_st fbListenerGroupResult_t
A ListenerGroupResult contains the fbListener whose listening socket got a new connection (cf.
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.
struct fBuf_st fBuf_t
An IPFIX message buffer.
Definition public.h:1228
void * fbSubTemplateMultiListEntryNextDataPtr(fbSubTemplateMultiListEntry_t *entry, void *currentPtr)
Retrieves a pointer to the data record in this entry that follows the one at currentPtr.
fbExporter_t * fbExporterAllocFP(FILE *fp)
Allocates an exporting process endpoint for an opened ANSI C file pointer.
uint32_t flags
Flags.
Definition public.h:1706
uint8_t fbSubTemplateListGetSemantic(fbSubTemplateList_t *subTemplateList)
Gets the semantic value from a sub template list.
fbTemplate_t * fbSessionGetTemplate(fbSession_t *session, gboolean internal, uint16_t tid, GError **err)
Retrieves a template from a session by ID.
void fbSubTemplateMultiListFree(fbSubTemplateMultiList_t *STML)
Clears the multi list (fbSubTemplateMultiListClear()), then frees the STML itself.
void fbSubTemplateListClearWithoutFree(fbSubTemplateList_t *subTemplateList)
Clears the sub template list parameters but does not free the data ptr.
struct fbBasicList_st fbBasicList_t
A basic list element in a template which structure represents a basic list on the internal side,...
uint32_t ie_pen
private enterprise number
Definition public.h:1744
uint8_t ie_type
ie data type
Definition public.h:1748
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:1932
size_t len
Length of content in buffer.
Definition public.h:1238
uint64_t ie_range_begin
ie range min
Definition public.h:1756
char * host
Hostname to connect/listen to.
Definition public.h:1885
uint16_t len
Information element length in octets.
Definition public.h:1703
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.
fbExporter_t * fbExporterAllocSpread(fbSpreadParams_t *params)
Allocates an exporting process endpoint for a Spread connection.
fbVarfield_t ie_desc
information element description
Definition public.h:1762
const fbInfoElement_t * fbBasicListGetInfoElement(fbBasicList_t *basicList)
Returns a pointer to the information element used in the basic list.
fbExporter_t * fbExporterAllocNet(fbConnSpec_t *spec)
Allocates an exporting process endpoint for a network connection.
char * ssl_key_pass
Private key decryption password.
Definition public.h:1895
fbCollector_t * fbCollectorAllocFile(void *ctx, const char *path, GError **err)
Allocates a collecting process endpoint for a named file.
enum fbTransport_en fbTransport_t
Transport protocol for connection specifier.
void fbExporterAddSourceIP6(fbExporter_t *exporter, const char *source_ip_v6)
Allows exporter to specify a IPv6 source interface to bind its socket connection to.
fbCollector_t * fbCollectorAllocFP(void *ctx, FILE *fp)
Allocates a collecting process endpoint for an open file.
void fbSessionResetExternal(fbSession_t *session)
Resets the external state (sequence numbers and templates) in a session state container.
gboolean fbSessionEnableTemplateMetadata(fbSession_t *session, gboolean enabled, GError **err)
Configures a session to export template metadata as options records.
void fbExporterClose(fbExporter_t *exporter)
Forces the file or socket underlying an exporting process endpoint to close.
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...
gboolean fbTemplateAppendSpecArray(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec, uint32_t flags, GError **err)
Appends information elements described by a specifier array to a template.
int fbListenerGroupDeleteListener(fbListenerGroup_t *group, const fbListener_t *listener)
Removes the listener from the group.
void * fbBasicListGetDataPtr(fbBasicList_t *basicList)
Gets a pointer to the data buffer for the basic list.
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 fbListenerFree(fbListener_t *listener)
Frees a listener.
uint64_t min
range min
Definition public.h:1708
fbTemplate_t * fbTemplateAlloc(fbInfoModel_t *model)
Allocates a new empty template.
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.
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 fBufAppend(fBuf_t *fbuf, uint8_t *recbase, size_t recsize, GError **err)
Appends a record to a buffer.
gboolean fBufSetAutomaticInsert(fBuf_t *fbuf, GError **err)
Enables automatic insertion of RFC 5610 elements read from a Buffer.
fbVarfield_t ie_name
information element name
Definition public.h:1760
uint8_t semantic
value used to describe the list of sub templates
Definition public.h:2609
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.
const fbTemplate_t * fbSubTemplateMultiListEntryGetTemplate(fbSubTemplateMultiListEntry_t *entry)
Retrieves the template pointer used to structure the data elements.
fbSubTemplateMultiListEntry_t * firstEntry
pointer to the first entry in the multi list
Definition public.h:2605
fbSubTemplateMultiListEntry_t * fbSubTemplateMultiListRealloc(fbSubTemplateMultiList_t *STML, uint16_t newNumEntries)
Potentially reallocates the list's internal buffer for entries and returns a handle to it.
gboolean fbSessionSpreadEnableTypeMetadata(fbSession_t *session, char **groups, gboolean enabled, GError **err)
Enables RFC 5610 information element metadata export for Spread Sessions.
fbListener_t * listener
pointer to the listener to add to the list
Definition public.h:1985
void fbExporterAddSourceIP(fbExporter_t *exporter, const char *source_ip_v4)
Allows exporter to specify a IPv4 source interface to bind its socket connection to.
struct fbCollector_st fbCollector_t
IPFIX Collecting Process endpoint.
Definition public.h:1957
uint16_t num
Information Element number.
Definition public.h:1701
void fbInfoModelAddElement(fbInfoModel_t *model, fbInfoElement_t *ie)
Adds a single information element to an information model.
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...
void * fbBasicListAddNewElements(fbBasicList_t *basicList, uint16_t numNewElements)
Allocates numNewElements additional element(s) into the basic list.
const fbTemplate_t * fbSubTemplateListGetTemplate(fbSubTemplateList_t *subTemplateList)
Gets the template pointer from the list structure.
uint32_t fbTemplateCountElements(fbTemplate_t *tmpl)
Determines number of information elements in a template.
void fBufSetCollector(fBuf_t *fbuf, fbCollector_t *collector)
Associates an collecting process endpoint with a buffer.
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...
uint64_t ie_range_end
ie range max
Definition public.h:1758
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 fbSubTemplateListCollectorInit(fbSubTemplateList_t *STL)
Initializes a sub template list variable on a fbCollector_t.
size_t dataLength
length of the buffer used to hold the data in this entry
Definition public.h:2592
uint8_t * dataPtr
pointer to the buffer used to hold the data in this entry
Definition public.h:2590
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.
struct fbVarfield_st fbVarfield_t
A variable-length field value.
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 * fbSubTemplateMultiListEntryGetDataPtr(fbSubTemplateMultiListEntry_t *entry)
Retrieves the data pointer for this entry.
gboolean fbInfoModelReadXMLFile(fbInfoModel_t *model, const gchar *filename, GError **err)
Adds information specified in the given XML file to the information model.
fbCollector_t * fbSessionGetCollector(fbSession_t *session)
Retrieves the collector that was created with the session.
uint8_t fbSubTemplateMultiListGetSemantic(fbSubTemplateMultiList_t *STML)
Gets the semantic paramter from the multi list.
uint32_t ent
Private Enterprise Number.
Definition public.h:1696
fbListenerGroup_t * fbListenerGroupAlloc(void)
Allocates and returns an empty listenerGroup.
void fBufSetExporter(fBuf_t *fbuf, fbExporter_t *exporter)
Associates an exporting process endpoint with a buffer.
gboolean fbSessionEnableTypeMetadata(fbSession_t *session, gboolean enabled, GError **err)
Configures a session to export type information for enterprise-specific information elements as optio...
uint16_t fbSubTemplateMultiListEntryCountElements(const fbSubTemplateMultiListEntry_t *entry)
Returns the number of entries the sub template multi list entry is capable of holding.
uint16_t fbSubTemplateMultiListCountElements(const fbSubTemplateMultiList_t *STML)
Returns the number of entries the sub template multi list is capable of holding.
gboolean fbTemplateContainsElementByName(fbTemplate_t *tmpl, fbInfoElementSpec_t *spec)
Determines if a template contains at least one instance of a given information element,...
void fBufSetExportTime(fBuf_t *fbuf, uint32_t extime)
Sets the export time on the message currently in a buffer.
A basic list element in a template which structure represents a basic list on the internal side,...
Definition public.h:2095
Connection specifier.
Definition public.h:1881
A single IPFIX Information Element definition.
Definition public.h:1673
The corresponding C struct for a record whose template is the RFC5610 Information Element Type Option...
Definition public.h:1742
A single IPFIX Information Element specification.
Definition public.h:1815
ListenerEntry's make up an fbListenerGroup_t as a linked list.
Definition public.h:1979
A ListenerGroupResult contains the fbListener whose listening socket got a new connection (cf.
Definition public.h:1993
Spread connection parameters.
Definition public.h:1929
Structure used to hold information of a sub template list.
Definition public.h:2323
Multilists just contain the semantic to describe the sub lists, the number of sub lists,...
Definition public.h:2603
Entries contain the same type of information at SubTemplateLists: template ID and template pointers t...
Definition public.h:2586
A variable-length field value.
Definition public.h:1236
Fixbuf's version information.