syslog-ng source
logproto-http-scraper-responder-server.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025 One Identity
3  * Copyright (c) 2025 Hofi <hofione@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  *
23  */
24 #ifndef LOGPROTO_HTTP_SCRAPER_RESPONDER_INCLUDED
25 #define LOGPROTO_HTTP_SCRAPER_RESPONDER_INCLUDED
26 
28 
29 /* Stat type flags */
30 #define STT_STATS 0x01
31 #define STT_QUERY 0x02
32 
33 /* options */
34 typedef struct _LogProtoHTTPScraperResponderOptions
35 {
39  guint8 stat_type;
40  gchar *stat_query;
41  gchar *stat_format;
42  gboolean single_instance;
45 
47 
48 typedef union _LogProtoHTTPScraperResponderOptionsStoreage
49 {
50  LogProtoServerOptionsStorage storage;
52 
54 // _Static_assert() is a C11 feature, so we use a typedef trick to perform the static assertion
56  sizeof(LogProtoServerOptionsStorage) >= sizeof(LogProtoHTTPScraperResponderOptions) ? 1 : -1];
57 
58 /* LogProtoHTTPScraperResponder */
59 typedef struct _LogProtoHTTPScraperResponder LogProtoHTTPScraperResponder;
61 {
62  LogProtoHTTPServer super;
64 };
65 
66 void log_proto_http_scraper_responder_options_defaults(LogProtoServerOptionsStorage *options);
67 void log_proto_http_scraper_responder_options_init(LogProtoServerOptionsStorage *options,
68  GlobalConfig *cfg);
69 void log_proto_http_scraper_responder_options_destroy(LogProtoServerOptionsStorage *options);
70 gboolean log_proto_http_scraper_responder_options_validate(LogProtoServerOptionsStorage *options);
71 
73  LogProtoServerOptionsStorage *options_storage,
74  const gchar *value);
76  LogProtoServerOptionsStorage *options,
77  gint value);
79  LogProtoServerOptionsStorage *options,
80  gboolean value);
82  LogProtoServerOptionsStorage *options,
83  const gchar *value);
85  LogProtoServerOptionsStorage *options,
86  const gchar *value);
88  LogProtoServerOptionsStorage *options,
89  const gchar *value);
91  LogProtoServerOptionsStorage *options_storage,
92  gboolean value);
94  LogProtoServerOptionsStorage *options_storage,
95  gboolean value);
96 
98  LogTransport *transport,
99  const LogProtoServerOptionsStorage *options);
100 void log_proto_http_scraper_responder_server_init(LogProtoHTTPScraperResponder *self,
101  LogTransport *transport,
102  const LogProtoServerOptionsStorage *options);
103 
104 #endif
void log_proto_http_scraper_responder_options_set_scrape_pattern(LogProtoServerOptionsStorage *options_storage, const gchar *value)
Definition: logproto-http-scraper-responder-server.c:267
void log_proto_http_scraper_responder_options_set_scrape_freq_limit(LogProtoServerOptionsStorage *options, gint value)
Definition: logproto-http-scraper-responder-server.c:277
char static_assert_size_check_LogProtoHTTPScraperResponderOptions[sizeof(LogProtoServerOptionsStorage) >=sizeof(LogProtoHTTPScraperResponderOptions) ? 1 :-1]
Definition: logproto-http-scraper-responder-server.h:56
void log_proto_http_scraper_responder_server_init(LogProtoHTTPScraperResponder *self, LogTransport *transport, const LogProtoServerOptionsStorage *options)
Definition: logproto-http-scraper-responder-server.c:153
void log_proto_http_scraper_responder_options_set_stats_with_legacy(LogProtoServerOptionsStorage *options_storage, gboolean value)
Definition: logproto-http-scraper-responder-server.c:350
void log_proto_http_scraper_responder_options_defaults(LogProtoServerOptionsStorage *options)
Definition: logproto-http-scraper-responder-server.c:199
void log_proto_http_scraper_responder_options_set_stats_without_orpaned(LogProtoServerOptionsStorage *options_storage, gboolean value)
Definition: logproto-http-scraper-responder-server.c:341
gboolean log_proto_http_scraper_responder_options_validate(LogProtoServerOptionsStorage *options)
Definition: logproto-http-scraper-responder-server.c:244
void log_proto_http_scraper_responder_options_set_single_instance(LogProtoServerOptionsStorage *options, gboolean value)
Definition: logproto-http-scraper-responder-server.c:287
gboolean log_proto_http_scraper_responder_options_set_stat_type(LogProtoServerOptionsStorage *options, const gchar *value)
Definition: logproto-http-scraper-responder-server.c:297
void log_proto_http_scraper_responder_options_set_stat_query(LogProtoServerOptionsStorage *options, const gchar *value)
Definition: logproto-http-scraper-responder-server.c:316
void log_proto_http_scraper_responder_options_init(LogProtoServerOptionsStorage *options, GlobalConfig *cfg)
Definition: logproto-http-scraper-responder-server.c:215
void log_proto_http_scraper_responder_options_destroy(LogProtoServerOptionsStorage *options)
Definition: logproto-http-scraper-responder-server.c:230
gboolean log_proto_http_scraper_responder_options_set_stat_format(LogProtoServerOptionsStorage *options, const gchar *value)
Definition: logproto-http-scraper-responder-server.c:326
LogProtoServer * log_proto_http_scraper_responder_server_new(LogTransport *transport, const LogProtoServerOptionsStorage *options)
Definition: logproto-http-scraper-responder-server.c:166
Definition: logproto-http-scraper-responder-server.h:35
guint8 stat_type
Definition: logproto-http-scraper-responder-server.h:39
gboolean stats_without_orphaned
Definition: logproto-http-scraper-responder-server.h:43
gboolean single_instance
Definition: logproto-http-scraper-responder-server.h:42
gchar * stat_format
Definition: logproto-http-scraper-responder-server.h:41
gint scrape_freq_limit
Definition: logproto-http-scraper-responder-server.h:38
gboolean stats_with_legacy
Definition: logproto-http-scraper-responder-server.h:44
LogProtoHTTPServerOptions super
Definition: logproto-http-scraper-responder-server.h:36
gchar * stat_query
Definition: logproto-http-scraper-responder-server.h:40
gchar * scraper_request_hdr_pattern
Definition: logproto-http-scraper-responder-server.h:37
Definition: logproto-http-server.h:35
Definition: logproto-http-scraper-responder-server.h:61
LogProtoHTTPServer super
Definition: logproto-http-scraper-responder-server.h:62
const LogProtoHTTPScraperResponderOptions * options
Definition: logproto-http-scraper-responder-server.h:63
GlobalConfig * cfg
Definition: test_batched_ack_tracker.c:34
GString * value
Definition: test_decode.c:28
Definition: logproto-http-scraper-responder-server.h:49
LogProtoServerOptionsStorage storage
Definition: logproto-http-scraper-responder-server.h:50
LogProtoHTTPScraperResponderOptions super
Definition: logproto-http-scraper-responder-server.h:51