-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpack.patch
356 lines (346 loc) · 10.7 KB
/
mpack.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
diff --git a/include/fluent-bit/flb_lib.h b/include/fluent-bit/flb_lib.h
index 7e9275297..1ce70cfab 100644
--- a/include/fluent-bit/flb_lib.h
+++ b/include/fluent-bit/flb_lib.h
@@ -22,6 +22,7 @@
#include <fluent-bit/flb_macros.h>
#include <fluent-bit/flb_config.h>
+#include <fluent-bit/flb_plugin.h>
/* Lib engine status */
#define FLB_LIB_ERROR -1
@@ -79,4 +80,10 @@ FLB_EXPORT int flb_loop(flb_ctx_t *ctx);
FLB_EXPORT int flb_lib_push(flb_ctx_t *ctx, int ffd, const void *data, size_t len);
FLB_EXPORT int flb_lib_config_file(flb_ctx_t *ctx, const char *path);
+/* Flb plugin */
+FLB_EXPORT int flb_plugin_load_wr(char *path, struct flb_plugins *ctx, struct flb_config *config);
+FLB_EXPORT int flb_plugin_load_router_wr(char *path, struct flb_config *config);
+FLB_EXPORT int flb_plugin_load_config_file_wr(const char *file, struct flb_config *config);
+FLB_EXPORT void flb_plugin_destroy_wr(struct flb_plugins *ctx);
+
#endif
diff --git a/lib/cmetrics/lib/mpack/src/mpack/mpack.h b/lib/cmetrics/lib/mpack/src/mpack/mpack.h
index 7c0b3f17e..cfe860eb4 100644
--- a/lib/cmetrics/lib/mpack/src/mpack/mpack.h
+++ b/lib/cmetrics/lib/mpack/src/mpack/mpack.h
@@ -3271,129 +3271,6 @@ MPACK_EXTERN_C_END
#undef mpack_write_kv
#endif
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {
- mpack_write_i8(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) {
- mpack_write_i16(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, int32_t value) {
- mpack_write_i32(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, int64_t value) {
- mpack_write_i64(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint8_t value) {
- mpack_write_u8(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint16_t value) {
- mpack_write_u16(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint32_t value) {
- mpack_write_u32(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint64_t value) {
- mpack_write_u64(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, bool value) {
- mpack_write_bool(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, float value) {
- mpack_write_float(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, double value) {
- mpack_write_double(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, char *value) {
- mpack_write_cstr_or_nil(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, const char *value) {
- mpack_write_cstr_or_nil(writer, value);
-}
-
-/* C++ generic write for key-value pairs */
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int8_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_i8(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int16_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_i16(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int32_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_i32(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int64_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_i64(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint8_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_u8(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint16_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_u16(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint32_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_u32(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint64_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_u64(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, bool value) {
- mpack_write_cstr(writer, key);
- mpack_write_bool(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, float value) {
- mpack_write_cstr(writer, key);
- mpack_write_float(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, double value) {
- mpack_write_cstr(writer, key);
- mpack_write_double(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, char *value) {
- mpack_write_cstr(writer, key);
- mpack_write_cstr_or_nil(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, const char *value) {
- mpack_write_cstr(writer, key);
- mpack_write_cstr_or_nil(writer, value);
-}
-
-/**
- * @}
- */
-
#endif /* __cplusplus */
/**
diff --git a/lib/mpack-amalgamation-1.1/src/mpack/mpack.h b/lib/mpack-amalgamation-1.1/src/mpack/mpack.h
index 803f03e41..7c2ceb338 100644
--- a/lib/mpack-amalgamation-1.1/src/mpack/mpack.h
+++ b/lib/mpack-amalgamation-1.1/src/mpack/mpack.h
@@ -4104,7 +4104,7 @@ MPACK_INLINE void mpack_finish_type(mpack_writer_t* writer, mpack_type_t type) {
* @}
*/
-#if MPACK_HAS_GENERIC && !defined(__cplusplus)
+#if MPACK_HAS_GENERIC
/**
* @name Type-Generic Writers
@@ -4183,146 +4183,6 @@ MPACK_INLINE void mpack_finish_type(mpack_writer_t* writer, mpack_type_t type) {
// The rest of this file contains C++ overloads, so we end extern "C" here.
MPACK_EXTERN_C_END
-#if defined(__cplusplus) || defined(MPACK_DOXYGEN)
-
-/**
- * @name C++ write overloads
- * @{
- */
-
-/*
- * C++ generic writers for primitive values
- */
-
-#ifdef MPACK_DOXYGEN
-#undef mpack_write
-#undef mpack_write_kv
-#endif
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {
- mpack_write_i8(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) {
- mpack_write_i16(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, int32_t value) {
- mpack_write_i32(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, int64_t value) {
- mpack_write_i64(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint8_t value) {
- mpack_write_u8(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint16_t value) {
- mpack_write_u16(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint32_t value) {
- mpack_write_u32(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, uint64_t value) {
- mpack_write_u64(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, bool value) {
- mpack_write_bool(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, float value) {
- mpack_write_float(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, double value) {
- mpack_write_double(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, char *value) {
- mpack_write_cstr_or_nil(writer, value);
-}
-
-MPACK_INLINE void mpack_write(mpack_writer_t* writer, const char *value) {
- mpack_write_cstr_or_nil(writer, value);
-}
-
-/* C++ generic write for key-value pairs */
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int8_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_i8(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int16_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_i16(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int32_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_i32(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, int64_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_i64(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint8_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_u8(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint16_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_u16(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint32_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_u32(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, uint64_t value) {
- mpack_write_cstr(writer, key);
- mpack_write_u64(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, bool value) {
- mpack_write_cstr(writer, key);
- mpack_write_bool(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, float value) {
- mpack_write_cstr(writer, key);
- mpack_write_float(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, double value) {
- mpack_write_cstr(writer, key);
- mpack_write_double(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, char *value) {
- mpack_write_cstr(writer, key);
- mpack_write_cstr_or_nil(writer, value);
-}
-
-MPACK_INLINE void mpack_write_kv(mpack_writer_t* writer, const char *key, const char *value) {
- mpack_write_cstr(writer, key);
- mpack_write_cstr_or_nil(writer, value);
-}
-
-/**
- * @}
- */
-
-#endif /* __cplusplus */
/**
* @}
diff --git a/src/flb_lib.c b/src/flb_lib.c
index 996816e23..a81c64924 100644
--- a/src/flb_lib.c
+++ b/src/flb_lib.c
@@ -24,6 +24,7 @@
#include <fluent-bit/flb_engine.h>
#include <fluent-bit/flb_input.h>
#include <fluent-bit/flb_output.h>
+#include <fluent-bit/flb_plugin.h>
#include <fluent-bit/flb_filter.h>
#include <fluent-bit/flb_utils.h>
#include <fluent-bit/flb_time.h>
@@ -66,6 +67,26 @@ static inline int flb_socket_init_win32(void)
}
#endif
+int flb_plugin_load_wr(char *path, struct flb_plugins *ctx, struct flb_config *config)
+{
+ return flb_plugin_load(path,ctx,config);
+}
+
+int flb_plugin_load_router_wr(char *path, struct flb_config *config)
+{
+ return flb_plugin_load_router(path, config);
+}
+
+int flb_plugin_load_config_file_wr(const char *file, struct flb_config *config)
+{
+ return flb_plugin_load_config_file(file, config);
+}
+
+void flb_plugin_destroy_wr(struct flb_plugins *ctx)
+{
+ flb_plugin_destroy(ctx);
+}
+
static inline struct flb_input_instance *in_instance_get(flb_ctx_t *ctx,
int ffd)
{