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_NETWORK_VERIFIER_H
21+ #define FLB_NETWORK_VERIFIER_H
22+
23+ #include <fluent-bit/flb_info.h>
24+ #include <fluent-bit/flb_config.h>
25+ #include <fluent-bit/flb_config_map.h>
26+
27+ #include <openssl/types.h>
28+
29+ #define FLB_X509_STORE_EX_INDEX 0
30+
31+ struct flb_network_verifier_instance ;
32+
33+ struct flb_network_verifier_plugin {
34+ char * name ; /* Name */
35+ char * description ; /* Description */
36+
37+ /* Config map */
38+ struct flb_config_map * config_map ;
39+
40+ /* Callbacks */
41+ int (* cb_init ) (struct flb_network_verifier_instance * , struct flb_config * );
42+ int (* cb_verify_tls ) (int , X509_STORE_CTX * );
43+ int (* cb_connection_failure ) (struct flb_network_verifier_instance * , const char * , int , int , const char * );
44+ int (* cb_exit ) (void * , struct flb_config * );
45+
46+ struct mk_list _head ; /* Link to parent list (config->network_verifier_plugins) */
47+ };
48+
49+ /*
50+ * Each initialized plugin must have an instance, the same plugin may be
51+ * loaded more than one time.
52+ *
53+ * An instance will contain basic fixed plugin data while also
54+ * allowing for plugin context data, generated when the plugin is invoked.
55+ */
56+ struct flb_network_verifier_instance {
57+ int id ; /* instance id */
58+ int log_level ; /* instance log level */
59+ char name [32 ]; /* numbered name */
60+ char * alias ; /* alias name */
61+ void * context ; /* Instance local context */
62+ struct flb_network_verifier_plugin * plugin ; /* original plugin */
63+
64+ struct mk_list properties ; /* config properties */
65+ struct mk_list * config_map ; /* configuration map */
66+
67+ /* Keep a reference to the original context this instance belongs to */
68+ const struct flb_config * config ;
69+
70+ struct mk_list _head ; /* config->network_verifiers */
71+ };
72+
73+ struct flb_network_verifier_instance * flb_network_verifier_new (
74+ struct flb_config * config , const char * name );
75+
76+ const char * flb_network_verifier_get_alias (
77+ struct flb_network_verifier_instance * ins );
78+
79+ int flb_network_verifier_set_property (
80+ struct flb_network_verifier_instance * ins , const char * k , const char * v );
81+ int flb_network_verifier_plugin_property_check (
82+ struct flb_network_verifier_instance * ins ,
83+ struct flb_config * config );
84+ int flb_network_verifier_init_all (struct flb_config * config );
85+ void flb_network_verifier_exit (struct flb_config * config );
86+
87+ void flb_network_verifier_instance_destroy (
88+ struct flb_network_verifier_instance * ins );
89+
90+ const struct flb_network_verifier_instance * find_network_verifier_instance (
91+ struct flb_config * config ,
92+ const char * alias );
93+
94+
95+ #endif
0 commit comments