public.h
Go to the documentation of this file.
1/*
2 * Copyright 2006-2025 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
42/* Tell uncrustify to ignore the next part of the file */
43/* *INDENT-OFF* */
44
1119/* Reenable uncrustify */
1120/* *INDENT-ON* */
1121
1129#ifndef _FB_PUBLIC_H_
1130#define _FB_PUBLIC_H_
1131#include <fixbuf/autoinc.h>
1132#include <fixbuf/version.h>
1133
1134/* Hide from uncrustify */
1135/* *INDENT-OFF* */
1136#ifdef __cplusplus
1137extern "C" {
1138#endif
1139/* *INDENT-ON* */
1140
1141
1146#define FIXBUF_CHECK_VERSION(major, minor, release) \
1147 (FIXBUF_VERSION_MAJOR > (major) \
1148 || (FIXBUF_VERSION_MAJOR == (major) \
1149 && FIXBUF_VERSION_MINOR > (minor)) \
1150 || (FIXBUF_VERSION_MAJOR == (major) \
1151 && FIXBUF_VERSION_MINOR == (minor) \
1152 && FIXBUF_VERSION_RELEASE >= (release)))
1153
1154/*
1155 * Error Handling Definitions
1156 */
1157
1159#define FB_ERROR_DOMAIN g_quark_from_string("fixbufError")
1161#define FB_ERROR_TMPL 1
1166#define FB_ERROR_EOM 2
1172#define FB_ERROR_EOF 3
1177#define FB_ERROR_IPFIX 4
1183#define FB_ERROR_BUFSZ 5
1185#define FB_ERROR_IMPL 6
1187#define FB_ERROR_IO 7
1192#define FB_ERROR_NLREAD 8
1198#define FB_ERROR_NLWRITE 9
1202#define FB_ERROR_NOELEMENT 10
1206#define FB_ERROR_CONN 11
1211#define FB_ERROR_NETFLOWV9 12
1215#define FB_ERROR_TRANSMISC 13
1219#define FB_ERROR_SFLOW 14
1223#define FB_ERROR_SETUP 15
1227#define FB_ERROR_LAXSIZE 16
1228
1229/*
1230 * Public Datatypes and Constants
1231 */
1232
1238typedef struct fBuf_st fBuf_t;
1239
1246typedef struct fbVarfield_st {
1248 size_t len;
1255 uint8_t *buf;
1257
1258
1263typedef struct fbInfoModel_st fbInfoModel_t;
1264
1268typedef GHashTableIter fbInfoModelIter_t;
1269
1275#define FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, \
1276 _min_, _max_, _type_, _desc_) \
1277 { {(const struct fbInfoElement_st *)_name_}, 0, _ent_, _num_, \
1278 _len_, _flags_, _min_, _max_, _type_, _desc_ }
1279
1286#define FB_IE_INIT(_name_, _ent_, _num_, _len_, _flags_) \
1287 FB_IE_INIT_FULL(_name_, _ent_, _num_, _len_, _flags_, \
1288 0, 0, 0, (char *)NULL)
1289
1290
1296#define FB_IE_NULL FB_IE_INIT(NULL, 0, 0, 0, 0)
1297
1305#define FB_IE_SEMANTIC(flags) ((flags & 0x0000ff00) >> 8)
1306
1313#define FB_IE_UNITS(flags) ((flags & 0xFFFF0000) >> 16)
1314
1319#define FB_IE_F_NONE 0x00000000
1320
1326#define FB_IE_F_ENDIAN 0x00000001
1327
1339#define FB_IE_F_REVERSIBLE 0x00000040
1340
1349#define FB_IE_F_ALIEN 0x00000080
1350
1355#define FB_IE_QUANTITY 0x00000100
1356
1362#define FB_IE_TOTALCOUNTER 0x00000200
1363
1368#define FB_IE_DELTACOUNTER 0x00000300
1369
1374#define FB_IE_IDENTIFIER 0x00000400
1375
1380#define FB_IE_FLAGS 0x00000500
1381
1387#define FB_IE_LIST 0x00000600
1388
1394#define FB_IE_SNMPCOUNTER 0x00000700
1395
1401#define FB_IE_SNMPGAUGE 0x00000800
1402
1408#define FB_IE_DEFAULT 0x00000000
1409
1420#define FB_UNITS_BITS 0x00010000
1426#define FB_UNITS_OCTETS 0x00020000
1432#define FB_UNITS_PACKETS 0x00030000
1438#define FB_UNITS_FLOWS 0x00040000
1444#define FB_UNITS_SECONDS 0x00050000
1450#define FB_UNITS_MILLISECONDS 0x00060000
1456#define FB_UNITS_MICROSECONDS 0x00070000
1462#define FB_UNITS_NANOSECONDS 0x00080000
1468#define FB_UNITS_WORDS 0x00090000
1474#define FB_UNITS_MESSAGES 0x000A0000
1480#define FB_UNITS_HOPS 0x000B0000
1486#define FB_UNITS_ENTRIES 0x000C0000
1492#define FB_UNITS_FRAMES 0x000D0000
1498#define FB_UNITS_PORTS 0x000E0000
1504#define FB_UNITS_INFERRED 0x000F0000
1505
1509#define FB_IE_VARLEN 65535
1510
1519#define FB_IE_BASIC_LIST 291
1528#define FB_IE_SUBTEMPLATE_LIST 292
1537#define FB_IE_SUBTEMPLATE_MULTILIST 293
1538
1547#define FB_IE_PEN_REVERSE 29305
1548
1557#define FB_IE_VENDOR_BIT_REVERSE 0x4000
1558
1564#define FB_CISCO_GENERIC 9999
1572#define FB_CISCO_ASA_EVENT_ID 9998
1582#define FB_CISCO_ASA_EVENT_XTRA 9997
1588#define FB_IE_REVERSE_STR "reverse"
1589
1591#define FB_IE_REVERSE_STRLEN 7
1592
1674
1688typedef struct fbInfoElement_st {
1690 union {
1696 const struct fbInfoElement_st *canon;
1701 const char *name;
1703
1709 uint32_t midx;
1711 uint32_t ent;
1716 uint16_t num;
1718 uint16_t len;
1721 uint32_t flags;
1723 uint64_t min;
1725 uint64_t max;
1727 uint8_t type;
1729 const char *description;
1731
1779
1780
1793#define FB_TID_AUTO 0
1794
1798#define FB_TID_TS 2
1799
1803#define FB_TID_OTS 3
1804
1808#define FB_TID_MIN_DATA 256
1809
1816
1822#define FB_IESPEC_NULL { NULL, 0, 0 }
1823
1853
1860typedef struct fbSession_st fbSession_t;
1861
1891
1922
1926#define FB_CONNSPEC_INIT \
1927 { FB_SCTP, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
1928
1929#if HAVE_SPREAD
1930
1934#define FB_SPREADPARAMS_INIT { 0, 0, 0 }
1935
1954
1955#endif /* HAVE_SPREAD */
1956
1962typedef struct fbExporter_st fbExporter_t;
1963
1971typedef struct fbCollector_st fbCollector_t;
1972
1979typedef struct fbListener_st fbListener_t;
1980
1981/*
1982 * ListenerGroup and associated data type definitions
1983 */
1984
1988typedef struct fbListenerGroup_st fbListenerGroup_t;
1989
2001
2015
2026typedef void
2028 void *tmpl_ctx,
2029 void *app_ctx);
2030
2053typedef void
2055 fbSession_t *session,
2056 uint16_t tid,
2057 fbTemplate_t *tmpl,
2058 void *app_ctx,
2059 void **tmpl_ctx,
2060 fbTemplateCtxFree_fn *tmpl_ctx_free_fn);
2061
2062
2070#define FB_LIST_SEM_UNDEFINED 0xFF
2074#define FB_LIST_SEM_NONE_OF 0x00
2078#define FB_LIST_SEM_EXACTLY_ONE_OF 0x01
2082#define FB_LIST_SEM_ONE_OR_MORE_OF 0x02
2086#define FB_LIST_SEM_ALL_OF 0x03
2090#define FB_LIST_SEM_ORDERED 0x04
2091
2102gboolean
2104 uint8_t semantic);
2105
2106/****** BASICLIST FUNCTIONS AND STRUCTS *******/
2124
2125
2133 void);
2134
2147void *
2149 fbBasicList_t *basicList,
2150 uint8_t semantic,
2151 const fbInfoElement_t *infoElement,
2152 uint16_t numElements);
2153
2171void *
2173 fbBasicList_t *basicList,
2174 uint8_t semantic,
2175 const fbInfoElement_t *infoElement,
2176 uint16_t numElements,
2177 uint16_t dataLength,
2178 uint8_t *dataPtr);
2179
2191void
2193 fbBasicList_t *basicList);
2194
2201uint16_t
2203 const fbBasicList_t *basicList);
2204
2212uint8_t
2214 fbBasicList_t *basicList);
2215
2223void
2225 fbBasicList_t *basicList,
2226 uint8_t semantic);
2227
2235const fbInfoElement_t *
2237 fbBasicList_t *basicList);
2238
2244void *
2246 fbBasicList_t *basicList);
2247
2257void *
2259 fbBasicList_t *basicList,
2260 uint16_t index);
2261
2273void *
2275 fbBasicList_t *basicList,
2276 void *currentPtr);
2277
2294void *
2296 fbBasicList_t *basicList,
2297 uint16_t newNumElements);
2298
2306void *
2308 fbBasicList_t *basicList,
2309 uint16_t numNewElements);
2310
2318void
2320 fbBasicList_t *basicList);
2321
2328void
2330 fbBasicList_t *basicList);
2331
2338void
2340 fbBasicList_t *basicList);
2341
2342
2343/******* END OF BASICLIST ********/
2344
2345
2346
2347/******* SUBTEMPLATELIST FUNCTIONS ****/
2348
2356typedef struct fbSubTemplateList_st {
2359 union {
2360 size_t length;
2361 uint64_t extra;
2366 uint8_t *dataPtr;
2368 uint16_t tmplID;
2370 uint16_t numElements;
2372 uint8_t semantic;
2374
2383 void);
2384
2402void *
2405 uint8_t semantic,
2406 uint16_t tmplID,
2407 const fbTemplate_t *tmpl,
2408 uint16_t numElements);
2409
2428void *
2430 fbSubTemplateList_t *subTemplateList,
2431 uint8_t semantic,
2432 uint16_t tmplID,
2433 const fbTemplate_t *tmpl,
2434 uint16_t numElements,
2435 uint16_t dataLength,
2436 uint8_t *dataPtr);
2437
2451void
2453 fbSubTemplateList_t *STL);
2454
2460void *
2462 const fbSubTemplateList_t *subTemplateList);
2463
2473void *
2475 const fbSubTemplateList_t *subTemplateList,
2476 uint16_t index);
2477
2489void *
2491 const fbSubTemplateList_t *subTemplateList,
2492 void *currentPtr);
2493
2500uint16_t
2502 const fbSubTemplateList_t *subTemplateList);
2503
2509void
2511 fbSubTemplateList_t *subTemplateList,
2512 uint8_t semantic);
2513
2519uint8_t
2521 fbSubTemplateList_t *subTemplateList);
2522
2528const fbTemplate_t *
2530 fbSubTemplateList_t *subTemplateList);
2531
2537uint16_t
2539 fbSubTemplateList_t *subTemplateList);
2540
2559void *
2561 fbSubTemplateList_t *subTemplateList,
2562 uint16_t newNumElements);
2563
2573void *
2575 fbSubTemplateList_t *subTemplateList,
2576 uint16_t numNewElements);
2577
2592void
2594 fbSubTemplateList_t *subTemplateList);
2595
2603void
2605 fbSubTemplateList_t *subTemplateList);
2606
2614void
2616 fbSubTemplateList_t *subTemplateList);
2617
2618/********* END OF SUBTEMPLATELIST **********/
2648
2661
2662
2672 void);
2673
2674
2687 uint8_t semantic,
2688 uint16_t numElements);
2689
2697uint16_t
2699 const fbSubTemplateMultiList_t *STML);
2700
2706void
2709 uint8_t semantic);
2710
2716uint8_t
2719
2727void
2730
2744void
2747
2754void
2757
2778 uint16_t newNumEntries);
2779
2791 uint16_t numNewEntries);
2792
2801
2813 uint16_t index);
2814
2829 fbSubTemplateMultiListEntry_t *currentEntry);
2830
2845void *
2848 uint16_t tmplID,
2849 fbTemplate_t *tmpl,
2850 uint16_t numElements);
2851
2872void *
2875 uint16_t newNumElements);
2876
2886void *
2889 uint16_t numNewElements);
2890
2899void
2902
2909void *
2912
2924void *
2927 void *currentPtr);
2928
2939void *
2942 uint16_t index);
2943
2951uint16_t
2953 const fbSubTemplateMultiListEntry_t *entry);
2954
2961const fbTemplate_t *
2964
2971uint16_t
2974
2975/************** END OF STML FUNCTIONS *********** */
2976
2992void
2994 fbTemplate_t *tmpl,
2995 uint8_t *record);
2996
2997
3008 void);
3009
3015void
3017 fbListenerGroup_t *group);
3018
3028int
3030 fbListenerGroup_t *group,
3031 const fbListener_t *listener);
3032
3042int
3044 fbListenerGroup_t *group,
3045 const fbListener_t *listener);
3046
3061 fbListenerGroup_t *group,
3062 GError **err);
3063
3069void
3071 fbListenerGroupResult_t *result);
3072
3085fBuf_t *
3087 fbListener_t *listener,
3088 int sock,
3089 GError **err);
3090
3100fBuf_t *
3102 fbListener_t *listener,
3103 int sock,
3104 GError **err);
3105
3111void
3113 fBuf_t *fbuf);
3114
3115
3137typedef gboolean
3139 fbListener_t *listener,
3140 void **ctx,
3141 int fd,
3142 struct sockaddr *peer,
3143 size_t peerlen,
3144 GError **err);
3145
3155typedef void
3157 void *ctx);
3158
3159/*
3160 * Public Function Calls. These calls will remain available and retain
3161 * their functionality in all subsequent versions of libfixbuf.
3162 */
3163
3164
3181gboolean
3183 fBuf_t *fbuf,
3184 uint16_t int_tid,
3185 GError **err);
3186
3204gboolean
3206 fBuf_t *fbuf,
3207 uint16_t ext_tid,
3208 GError **err);
3209
3210#if HAVE_SPREAD
3228void
3230 fBuf_t *fbuf,
3231 char **groups,
3232 int num_groups,
3233 GError **err);
3234#endif /* HAVE_SPREAD */
3235
3260void
3262 fBuf_t *fbuf,
3263 gboolean automatic);
3264
3289gboolean
3291 fBuf_t *fbuf,
3292 GError **err);
3293
3294
3304 fBuf_t *fbuf);
3305
3314void
3316 fBuf_t *fbuf);
3317
3330fBuf_t *
3332 fbSession_t *session,
3333 fbExporter_t *exporter);
3334
3346 fBuf_t *fbuf);
3347
3358void
3360 fBuf_t *fbuf,
3361 fbExporter_t *exporter);
3362
3363
3375size_t
3377 fBuf_t *fbuf);
3378
3379
3392void
3394 fBuf_t *fbuf,
3395 uint8_t *buf,
3396 size_t buflen);
3397
3398
3422gboolean
3424 fBuf_t *fbuf,
3425 uint8_t *recbase,
3426 size_t recsize,
3427 GError **err);
3428
3438gboolean
3440 fBuf_t *fbuf,
3441 GError **err);
3442
3454void
3456 fBuf_t *fbuf,
3457 uint32_t extime);
3458
3475fBuf_t *
3477 fbSession_t *session,
3478 fbCollector_t *collector);
3479
3491 fBuf_t *fbuf);
3492
3503void
3505 fBuf_t *fbuf,
3506 fbCollector_t *collector);
3507
3538gboolean
3540 fBuf_t *fbuf,
3541 uint8_t *recbase,
3542 size_t *recsize,
3543 GError **err);
3544
3557gboolean
3559 fBuf_t *fbuf,
3560 GError **err);
3561
3569uint32_t
3571 fBuf_t *fbuf);
3572
3594 fBuf_t *fbuf,
3595 uint16_t *ext_tid);
3596
3617 fBuf_t *fbuf,
3618 uint16_t *ext_tid,
3619 GError **err);
3620
3637 void);
3638
3647void
3649 fbInfoModel_t *model);
3650
3665void
3667 fbInfoModel_t *model,
3668 fbInfoElement_t *ie);
3669
3688void
3690 fbInfoModel_t *model,
3691 fbInfoElement_t *ie);
3692
3724gboolean
3726 fbInfoModel_t *model,
3727 const gchar *filename,
3728 GError **err);
3729
3762gboolean
3764 fbInfoModel_t *model,
3765 const gchar *xml_data,
3766 gssize xml_data_len,
3767 GError **err);
3768
3780const fbInfoElement_t *
3782 fbInfoModel_t *model,
3783 const char *name);
3784
3798const fbInfoElement_t *
3800 fbInfoModel_t *model,
3801 uint16_t id,
3802 uint32_t ent);
3803
3811guint
3813 const fbInfoModel_t *model);
3814
3824void
3826 fbInfoModelIter_t *iter,
3827 const fbInfoModel_t *model);
3828
3839const fbInfoElement_t *
3841 fbInfoModelIter_t *iter);
3842
3858 fbInfoModel_t *model,
3859 GError **err);
3860
3875gboolean
3877 fBuf_t *fbuf,
3878 const fbInfoElement_t *model_ie,
3879 uint16_t itid,
3880 uint16_t etid,
3881 GError **err);
3882
3894gboolean
3896 fbInfoModel_t *model,
3898
3910gboolean
3912 fbTemplate_t *tmpl);
3913
3934 fbInfoModel_t *model);
3935
3953gboolean
3955 fbTemplate_t *tmpl,
3956 fbInfoElement_t *ex_ie,
3957 GError **err);
3958
3976gboolean
3978 fbTemplate_t *tmpl,
3979 fbInfoElementSpec_t *spec,
3980 uint32_t flags,
3981 GError **err);
3982
3998gboolean
4000 fbTemplate_t *tmpl,
4001 fbInfoElementSpec_t *spec,
4002 uint32_t flags,
4003 GError **err);
4004
4012uint32_t
4014 fbTemplate_t *tmpl);
4015
4030void
4032 fbTemplate_t *tmpl,
4033 uint16_t scope_count);
4034
4042uint32_t
4044 fbTemplate_t *tmpl);
4045
4059gboolean
4061 fbTemplate_t *tmpl,
4062 const fbInfoElement_t *ex_ie);
4063
4075gboolean
4077 fbTemplate_t *tmpl,
4078 fbInfoElementSpec_t *spec);
4079
4091gboolean
4093 fbTemplate_t *tmpl,
4094 fbInfoElementSpec_t *spec);
4095
4110gboolean
4112 fbTemplate_t *tmpl,
4113 fbInfoElementSpec_t *spec,
4114 uint32_t flags);
4115
4129 fbTemplate_t *tmpl,
4130 uint32_t IEindex);
4131
4132
4142 fbTemplate_t *tmpl);
4143
4151void
4153 fbTemplate_t *tmpl);
4154
4162void *
4164 fbTemplate_t *tmpl);
4165
4173uint16_t
4175 fbTemplate_t *tmpl);
4176
4196 fbInfoModel_t *model);
4197
4214gboolean
4216 fbSession_t *session,
4217 gboolean enabled,
4218 GError **err);
4219
4243uint16_t
4245 fbSession_t *session,
4246 gboolean enabled,
4247 uint16_t tid,
4248 GError **err);
4249
4267gboolean
4269 fbSession_t *session,
4270 gboolean enabled,
4271 GError **err);
4272
4298uint16_t
4300 fbSession_t *session,
4301 gboolean enabled,
4302 uint16_t tid,
4303 GError **err);
4304
4325uint16_t
4327 fbSession_t *session,
4328 gboolean internal,
4329 uint16_t tid,
4330 fbTemplate_t *tmpl,
4331 const char *name,
4332 const char *description,
4333 GError **err);
4334
4343 fbSession_t *session);
4344
4373void
4375 fbSession_t *session,
4376 fbNewTemplateCallback_fn callback,
4377 void *app_ctx);
4378
4401void
4403 fbSession_t *session,
4404 uint16_t ent_tid,
4405 uint16_t int_tid);
4406
4415void
4417 fbSession_t *session,
4418 uint16_t ext_tid);
4419
4428uint16_t
4430 fbSession_t *session,
4431 uint16_t ext_tid);
4432
4442void
4444 fbSession_t *session);
4445
4458void
4460 fbSession_t *session);
4461
4477void
4479 fbSession_t *session,
4480 uint32_t domain);
4481
4489uint32_t
4491 fbSession_t *session);
4492
4503uint16_t
4505 fbSession_t *session);
4506
4516 fbSession_t *session);
4517
4518#if HAVE_SPREAD
4543uint16_t
4545 fbSession_t *session,
4546 char **groups,
4547 gboolean internal,
4548 uint16_t tid,
4549 fbTemplate_t *tmpl,
4550 GError **err);
4551
4575uint16_t
4577 fbSession_t *session,
4578 char **groups,
4579 gboolean internal,
4580 uint16_t tid,
4581 fbTemplate_t *tmpl,
4582 char *name,
4583 char *description,
4584 GError **err);
4585
4586
4604gboolean
4606 fbSession_t *session,
4607 char **groups,
4608 gboolean enabled,
4609 GError **err);
4610
4631uint16_t
4633 fbSession_t *session,
4634 char **groups,
4635 gboolean enabled,
4636 uint16_t tid,
4637 GError **err);
4638
4657gboolean
4659 fbSession_t *session,
4660 char **groups,
4661 gboolean enabled,
4662 GError **err);
4663
4684uint16_t
4686 fbSession_t *session,
4687 char **groups,
4688 gboolean enabled,
4689 uint16_t tid,
4690 GError **err);
4691#endif /* HAVE_SPREAD */
4692
4709gboolean
4711 fbSession_t *session,
4712 uint16_t tid,
4713 GError **err);
4714
4733gboolean
4735 fbSession_t *session,
4736 GError **err);
4737
4761uint16_t
4763 fbSession_t *session,
4764 gboolean internal,
4765 uint16_t tid,
4766 fbTemplate_t *tmpl,
4767 GError **err);
4768
4781gboolean
4783 fbSession_t *session,
4784 gboolean internal,
4785 uint16_t tid,
4786 GError **err);
4787
4801 fbSession_t *session,
4802 gboolean internal,
4803 uint16_t tid,
4804 GError **err);
4805
4820 fbConnSpec_t *spec);
4821
4822#if HAVE_SPREAD
4834int
4836 fbCollector_t *collector,
4837 char *groups[]);
4838
4856 fbSpreadParams_t *params);
4857
4858#endif /* HAVE_SPREAD */
4859
4873 const char *path);
4874
4888 uint8_t *buf,
4889 uint16_t bufsize);
4890
4891
4902 FILE *fp);
4903
4916void
4918 fbExporter_t *exporter,
4919 int sctp_stream);
4920
4933void
4935 fbExporter_t *exporter);
4936
4944void
4946 fbExporter_t *exporter);
4947
4954size_t
4956 fbExporter_t *exporter);
4957
4966void
4968 fbExporter_t *exporter,
4969 const char *source_ip_v4);
4970
4979void
4981 fbExporter_t *exporter,
4982 const char *source_ip_v6);
4983
4998 void *ctx,
4999 const char *path,
5000 GError **err);
5001
5014 void *ctx,
5015 FILE *fp);
5016
5017
5018#if HAVE_SPREAD
5033 void *ctx,
5034 fbSpreadParams_t *params,
5035 GError **err);
5036
5037#endif /* HAVE_SPREAD */
5038
5049void *
5051 fbCollector_t *collector);
5052
5063void
5065 fbCollector_t *collector);
5066
5067
5079void
5081 fbCollector_t *collector,
5082 struct sockaddr *address,
5083 size_t address_length);
5084
5115 fbConnSpec_t *spec,
5116 fbSession_t *session,
5117 fbListenerAppInit_fn appinit,
5118 fbListenerAppFree_fn appfree,
5119 GError **err);
5120
5128void
5130 fbListener_t *listener);
5131
5154fBuf_t *
5156 fbListener_t *listener,
5157 GError **err);
5158
5169fBuf_t *
5171 fbListener_t *listener,
5172 GError **err);
5173
5181void
5183 fbListener_t *listener);
5184
5185
5196gboolean
5198 fbListener_t *listener,
5199 fbCollector_t **collector,
5200 GError **err);
5201
5202
5214gboolean
5216 fbCollector_t *collector,
5217 GError **err);
5218
5219
5231gboolean
5233 fbCollector_t *collector,
5234 GError **err);
5235
5236
5248gboolean
5250 fbCollector_t *collector,
5251 GError **err);
5252
5271uint32_t
5273 fbCollector_t *collector,
5274 struct sockaddr *peer,
5275 size_t peerlen,
5276 uint32_t obdomain);
5277
5293uint32_t
5295 fbCollector_t *collector,
5296 struct sockaddr *peer,
5297 size_t peerlen,
5298 uint32_t obdomain);
5299
5306struct sockaddr *
5308 fbCollector_t *collector);
5309
5319uint32_t
5321 fbCollector_t *collector);
5322
5345void
5347 fbCollector_t *collector,
5348 gboolean multi_session);
5349
5350
5351/* Hide this from uncrustify */
5352/* *INDENT-OFF* */
5353#ifdef __cplusplus
5354} /* extern "C" */
5355#endif
5356/* *INDENT-ON* */
5357
5358#endif /* _FB_PUBLIC_H_ */
An IPFIX template or options template structure.
Definition private.h:207
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:2027
uint8_t ie_semantic
ie semantic
Definition public.h:1765
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:2009
struct fbExporter_st fbExporter_t
IPFIX Exporting Process endpoint.
Definition public.h:1962
const char * description
description
Definition public.h:1729
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:1727
char * daemon
pointer to the daemon host address, in Spread format.
Definition public.h:1949
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:2054
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:1844
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:2368
uint8_t padding[6]
padding to align with template
Definition public.h:1769
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:3156
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:2366
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:2370
fbListener_t * listener
pointer to the listener that received a new connection
Definition public.h:2011
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:1761
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:2116
void * vai
Pointer to address info cache.
Definition public.h:1915
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:1979
fbTransport_en
Transport protocol for connection specifier.
Definition public.h:1863
@ FB_DTLS_SCTP
Secure, partially reliable datagram transport via DTLS over SCTP.
Definition public.h:1878
@ FB_DTLS_UDP
Secure, unreliable datagram transport via DTLS over UDP.
Definition public.h:1889
@ FB_TLS_TCP
Secure, reliable stream transport via TLS over TCP.
Definition public.h:1883
@ FB_TCP
Reliable stream transport via TCP.
Definition public.h:1870
@ FB_SCTP
Partially reliable datagram transport via SCTP.
Definition public.h:1868
@ FB_UDP
Unreliable datagram transport via UDP.
Definition public.h:1872
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:3138
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:2364
uint16_t numElements
number of elements in the list
Definition public.h:2118
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:2114
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:1952
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:1767
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:1268
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:1599
@ FB_DT_MICROSEC
The "dateTimeMicroseconds" data type: Two 32-bit fields where the first is the number seconds since t...
Definition public.h:1654
@ FB_STRING
The "string" data type: A finite-length string of valid characters from the Unicode character encodin...
Definition public.h:1641
@ FB_DT_SEC
The "dateTimeSeconds" data type: An unsigned 32-bit integer containing the number of seconds since th...
Definition public.h:1645
@ FB_INT_8
The "signed8" data type: An integer value in the range of -128 to 127.
Definition public.h:1618
@ FB_UINT_16
The "unsigned16" data type: A non-negative integer value in the range of 0 to 65535 (0xFFFF).
Definition public.h:1608
@ 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:1615
@ FB_FLOAT_64
The "float64" data type: An IEEE double-precision 64-bit floating point type.
Definition public.h:1633
@ FB_SUB_TMPL_MULTI_LIST
The "subTemplateMultiList" data type: A structured data element as described in RFC6313,...
Definition public.h:1672
@ FB_SUB_TMPL_LIST
The "subTemplateList" data type: A structured data element as described in RFC6313,...
Definition public.h:1669
@ FB_BOOL
The "boolean" data type: A binary value: "true" or "false".
Definition public.h:1635
@ 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:1611
@ FB_IP6_ADDR
The "ipv6Address" data type: A value of an IPv6 address.
Definition public.h:1663
@ 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:1624
@ FB_UINT_8
The "unsigned8" data type: A non-negative integer value in the range of 0 to 255 (0xFF).
Definition public.h:1605
@ 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:1627
@ FB_OCTET_ARRAY
The "octetArray" data type: A finite-length string of octets.
Definition public.h:1602
@ FB_DT_NANOSEC
The "dateTimeMicroseconds" data type: Two 32-bit fields where the first is the number seconds since t...
Definition public.h:1659
@ FB_FLOAT_32
The "float32" data type: An IEEE single-precision 32-bit floating point type.
Definition public.h:1630
@ FB_BASIC_LIST
The "basicList" data type: A structured data element as described in RFC6313, Section 4....
Definition public.h:1666
@ FB_MAC_ADDR
The "macAddress" data type: A MAC-48 address as a string of 6 octets.
Definition public.h:1638
@ FB_INT_16
The "signed16" data type: An integer value in the range of -32768 to 32767.
Definition public.h:1621
@ FB_DT_MILSEC
The "dateTimeMilliseconds" data type: An unsigned 64-bit integer containing the number of millisecond...
Definition public.h:1649
@ FB_IP4_ADDR
The "ipv4Address" data type: A value of an IPv4 address.
Definition public.h:1661
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:1832
uint32_t flags
Application flags word.
Definition public.h:1851
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:2013
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:2122
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:1263
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:2120
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:2638
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:1904
struct fbSession_st fbSession_t
An IPFIX Transport Session state container.
Definition public.h:1860
fbTransport_t transport
Transport protocol to use.
Definition public.h:1898
struct fbListenerEntry_st * next
pointer to the next listener entry in the linked list
Definition public.h:1995
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:2644
void * vssl_ctx
Pointer to SSL context cache.
Definition public.h:1920
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:1709
uint8_t * buf
Content buffer.
Definition public.h:1255
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:2372
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:1725
char * svc
Service name or port number to connect/listen to.
Definition public.h:1902
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:2657
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:1906
struct fbListenerGroup_st fbListenerGroup_t
Structure that represents a group of listeners.
Definition public.h:1988
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:1908
uint16_t numElements
number of elements in this entry
Definition public.h:2646
struct fbListenerEntry_st * prev
pointer to the previous listener entry in the linked list
Definition public.h:1997
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:1238
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:1721
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:1759
uint8_t ie_type
ie data type
Definition public.h:1763
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:1946
size_t len
Length of content in buffer.
Definition public.h:1248
uint64_t ie_range_begin
ie range min
Definition public.h:1771
char * host
Hostname to connect/listen to.
Definition public.h:1900
uint16_t len
Information element length in octets.
Definition public.h:1718
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:1777
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:1910
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:1723
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:1775
uint8_t semantic
value used to describe the list of sub templates
Definition public.h:2659
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:2655
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:1999
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:1971
uint16_t num
Information Element number.
Definition public.h:1716
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:1773
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:2642
uint8_t * dataPtr
pointer to the buffer used to hold the data in this entry
Definition public.h:2640
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:1711
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:2112
Connection specifier.
Definition public.h:1896
A single IPFIX Information Element definition.
Definition public.h:1688
The corresponding C struct for a record whose template is the RFC5610 Information Element Type Option...
Definition public.h:1757
A single IPFIX Information Element specification.
Definition public.h:1830
ListenerEntry's make up an fbListenerGroup_t as a linked list.
Definition public.h:1993
A ListenerGroupResult contains the fbListener whose listening socket got a new connection (cf.
Definition public.h:2007
Spread connection parameters.
Definition public.h:1943
Structure used to hold information of a sub template list.
Definition public.h:2356
Multilists just contain the semantic to describe the sub lists, the number of sub lists,...
Definition public.h:2653
Entries contain the same type of information at SubTemplateLists: template ID and template pointers t...
Definition public.h:2636
A variable-length field value.
Definition public.h:1246
Fixbuf's version information.