|
| 1 | +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | + |
| 3 | +/* Fluent Bit |
| 4 | + * ========== |
| 5 | + * Copyright (C) 2015-2024 The Fluent Bit Authors |
| 6 | + * |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | + * you may not use this file except in compliance with the License. |
| 9 | + * You may obtain a copy of the License at |
| 10 | + * |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * |
| 13 | + * Unless required by applicable law or agreed to in writing, software |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | + * See the License for the specific language governing permissions and |
| 17 | + * limitations under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +#ifndef FLB_CFL_RECORD_ACCESSOR_H |
| 21 | +#define FLB_CFL_RECORD_ACCESSOR_H |
| 22 | + |
| 23 | +#include <fluent-bit/flb_info.h> |
| 24 | +#include <fluent-bit/flb_regex.h> |
| 25 | +#include <fluent-bit/flb_sds.h> |
| 26 | +#include <fluent-bit/flb_sds_list.h> |
| 27 | +#include <monkey/mk_core.h> |
| 28 | +#include <cfl/cfl.h> |
| 29 | + |
| 30 | +struct flb_cfl_record_accessor { |
| 31 | + size_t size_hint; |
| 32 | + flb_sds_t pattern; |
| 33 | + struct mk_list list; /* List of parsed strings */ |
| 34 | + struct mk_list _head; /* Head to custom list (only used by flb_mp.h) */ |
| 35 | +}; |
| 36 | +void flb_cfl_ra_destroy(struct flb_cfl_record_accessor *cra); |
| 37 | +int flb_cfl_ra_subkey_count(struct flb_cfl_record_accessor *cra); |
| 38 | +struct flb_cfl_record_accessor *flb_cfl_ra_create(char *str, int translate_env); |
| 39 | +flb_sds_t flb_cfl_ra_create_str_from_list(struct flb_sds_list *str_list); |
| 40 | +struct flb_cfl_record_accessor *flb_cfl_ra_create_from_list(struct flb_sds_list *str_list, int translate_env); |
| 41 | +flb_sds_t flb_cfl_ra_translate(struct flb_cfl_record_accessor *cra, |
| 42 | + char *tag, int tag_len, |
| 43 | + struct cfl_variant var, struct flb_regex_search *result); |
| 44 | +flb_sds_t flb_cfl_ra_translate_check(struct flb_cfl_record_accessor *cra, |
| 45 | + char *tag, int tag_len, |
| 46 | + struct cfl_variant var, struct flb_regex_search *result, |
| 47 | + int check); |
| 48 | +void flb_cfl_ra_dump(struct flb_cfl_record_accessor *cra); |
| 49 | +int flb_cfl_ra_is_static(struct flb_cfl_record_accessor *cra); |
| 50 | +int flb_cfl_ra_strcmp(struct flb_cfl_record_accessor *ra, struct cfl_variant var, |
| 51 | + char *str, int len); |
| 52 | +int flb_cfl_ra_regex_match(struct flb_cfl_record_accessor *cra, struct cfl_variant var, |
| 53 | + struct flb_regex *regex, struct flb_regex_search *result); |
| 54 | +int flb_cfl_ra_get_kv_pair(struct flb_cfl_record_accessor *ra, |
| 55 | + struct cfl_variant var, |
| 56 | + cfl_sds_t *start_key, |
| 57 | + cfl_sds_t *out_key, struct cfl_variant **out_val); |
| 58 | +struct flb_cfl_ra_value *flb_cfl_ra_get_value_object(struct flb_cfl_record_accessor *cra, |
| 59 | + struct cfl_variant var); |
| 60 | +int flb_cfl_ra_update_kv_pair(struct flb_cfl_record_accessor *cra, struct cfl_variant var, |
| 61 | + cfl_sds_t in_key, struct cfl_variant *in_val); |
| 62 | +int flb_cfl_ra_append_kv_pair(struct flb_cfl_record_accessor *cra, struct cfl_variant var, |
| 63 | + struct cfl_variant *in_val); |
| 64 | +#endif |
0 commit comments