syslog-ng source
http.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 One Identity LLC.
3  * Copyright (c) 2018 Balazs Scheidler
4  * Copyright (c) 2016 Marc Falzon
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published
8  * by the Free Software Foundation, or (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; 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 
25 #ifndef HTTP_H_INCLUDED
26 #define HTTP_H_INCLUDED 1
27 
28 #define HTTP_DEFAULT_URL "http://localhost/"
29 #define METHOD_TYPE_POST 1
30 #define METHOD_TYPE_PUT 2
31 
33 #include "http-loadbalancer.h"
34 #include "response-handler.h"
35 
36 typedef struct
37 {
38  LogThreadedDestDriver super;
39  HTTPLoadBalancer *load_balancer;
40 
41  /* this is the first URL in load-balanced configurations and serves as the
42  * identifier in persist/stats. TODO: Templated URLs should have dynamic counters. */
43  const gchar *url;
44  gchar *user;
45  gchar *password;
46  GList *headers;
47  gchar *user_agent;
48  gchar *ca_dir;
49  gchar *ca_file;
50  gchar *cert_file;
51  gchar *key_file;
52  gchar *ciphers;
53  gchar *tls13_ciphers;
54  gchar *proxy;
55  GString *body_prefix;
56  GString *body_suffix;
57  GString *delimiter;
59  GString *accept_encoding;
61  gboolean peer_verify;
63  gboolean accept_redirects;
65  short int method_type;
66  glong timeout;
67  glong batch_bytes;
68  LogTemplate *body_template;
69  LogTemplateOptions template_options;
72 
73 gboolean http_dd_init(LogPipe *s);
74 gboolean http_dd_deinit(LogPipe *s);
75 LogDriver *http_dd_new(GlobalConfig *cfg);
76 
77 gboolean http_dd_set_urls(LogDriver *d, GList *urls, GError **error);
78 void http_dd_set_user(LogDriver *d, const gchar *user);
79 void http_dd_set_password(LogDriver *d, const gchar *password);
80 void http_dd_set_method(LogDriver *d, const gchar *method);
81 void http_dd_set_user_agent(LogDriver *d, const gchar *user_agent);
82 void http_dd_set_headers(LogDriver *d, GList *headers);
83 void http_dd_set_body(LogDriver *d, LogTemplate *body);
84 void http_dd_set_accept_redirects(LogDriver *d, gboolean accept_redirects);
85 void http_dd_set_ca_dir(LogDriver *d, const gchar *ca_dir);
86 void http_dd_set_ca_file(LogDriver *d, const gchar *ca_file);
87 void http_dd_set_cert_file(LogDriver *d, const gchar *cert_file);
88 void http_dd_set_key_file(LogDriver *d, const gchar *key_file);
89 void http_dd_set_cipher_suite(LogDriver *d, const gchar *ciphers);
90 gboolean http_dd_set_tls13_cipher_suite(LogDriver *d, const gchar *tls13_ciphers);
91 void http_dd_set_proxy(LogDriver *d, const gchar *proxy);
92 gboolean http_dd_set_ssl_version(LogDriver *d, const gchar *value);
93 void http_dd_set_peer_verify(LogDriver *d, gboolean verify);
94 void http_dd_set_send_message_data_in_header(LogDriver *d, gboolean value);
95 gboolean http_dd_set_ocsp_stapling_verify(LogDriver *d, gboolean verify);
96 void http_dd_set_timeout(LogDriver *d, glong timeout);
97 void http_dd_set_batch_bytes(LogDriver *d, glong batch_bytes);
98 void http_dd_set_body_prefix(LogDriver *d, const gchar *body_prefix);
99 void http_dd_set_body_suffix(LogDriver *d, const gchar *body_suffix);
100 void http_dd_set_delimiter(LogDriver *d, const gchar *delimiter);
101 void http_dd_insert_response_handler(LogDriver *d, HttpResponseHandler *response_handler);
102 LogTemplateOptions *http_dd_get_template_options(LogDriver *d);
103 void http_dd_set_accept_encoding(LogDriver *d, const gchar *encoding);
104 gboolean http_dd_set_content_compression(LogDriver *d, const gchar *encoding);
105 
106 #endif
const gchar * user
Definition: gprocess.c:120
void http_dd_set_accept_redirects(LogDriver *d, gboolean accept_redirects)
Definition: http.c:345
void http_dd_set_user(LogDriver *d, const gchar *user)
Definition: http.c:77
LogTemplateOptions * http_dd_get_template_options(LogDriver *d)
Definition: http.c:147
void http_dd_set_cipher_suite(LogDriver *d, const gchar *ciphers)
Definition: http.c:191
void http_dd_set_cert_file(LogDriver *d, const gchar *cert_file)
Definition: http.c:173
void http_dd_set_body_prefix(LogDriver *d, const gchar *body_prefix)
Definition: http.c:369
void http_dd_set_accept_encoding(LogDriver *d, const gchar *encoding)
Definition: http.c:288
void http_dd_set_peer_verify(LogDriver *d, gboolean verify)
Definition: http.c:316
void http_dd_set_user_agent(LogDriver *d, const gchar *user_agent)
Definition: http.c:95
gboolean http_dd_set_ocsp_stapling_verify(LogDriver *d, gboolean verify)
Definition: http.c:332
void http_dd_set_send_message_data_in_header(LogDriver *d, gboolean value)
Definition: http.c:324
void http_dd_set_proxy(LogDriver *d, const gchar *proxy)
Definition: http.c:214
void http_dd_insert_response_handler(LogDriver *d, HttpResponseHandler *response_handler)
Definition: http.c:31
void http_dd_set_headers(LogDriver *d, GList *headers)
Definition: http.c:104
gboolean http_dd_deinit(LogPipe *s)
Definition: http.c:410
void http_dd_set_body_suffix(LogDriver *d, const gchar *body_suffix)
Definition: http.c:377
void http_dd_set_batch_bytes(LogDriver *d, glong batch_bytes)
Definition: http.c:361
void http_dd_set_body(LogDriver *d, LogTemplate *body)
Definition: http.c:130
gboolean http_dd_set_tls13_cipher_suite(LogDriver *d, const gchar *tls13_ciphers)
Definition: http.c:200
void http_dd_set_key_file(LogDriver *d, const gchar *key_file)
Definition: http.c:182
gboolean http_dd_init(LogPipe *s)
Definition: http.c:418
gboolean http_dd_set_urls(LogDriver *d, GList *urls, GError **error)
Definition: http.c:44
void http_dd_set_timeout(LogDriver *d, glong timeout)
Definition: http.c:353
void http_dd_set_ca_file(LogDriver *d, const gchar *ca_file)
Definition: http.c:164
void http_dd_set_password(LogDriver *d, const gchar *password)
Definition: http.c:86
gboolean http_dd_set_ssl_version(LogDriver *d, const gchar *value)
Definition: http.c:223
gboolean http_dd_set_content_compression(LogDriver *d, const gchar *encoding)
Definition: http.c:307
void http_dd_set_method(LogDriver *d, const gchar *method)
Definition: http.c:113
void http_dd_set_delimiter(LogDriver *d, const gchar *delimiter)
Definition: http.c:139
void http_dd_set_ca_dir(LogDriver *d, const gchar *ca_dir)
Definition: http.c:155
LogDriver * http_dd_new(GlobalConfig *cfg)
Definition: http.c:512
GHashTable HttpResponseHandlers
Definition: response-handler.h:50
Definition: http.h:37
HTTPLoadBalancer * load_balancer
Definition: http.h:39
int ssl_version
Definition: http.h:58
short int method_type
Definition: http.h:65
gchar * user
Definition: http.h:44
const gchar * url
Definition: http.h:43
glong batch_bytes
Definition: http.h:67
gchar * cert_file
Definition: http.h:50
GString * delimiter
Definition: http.h:57
gboolean peer_verify
Definition: http.h:61
gint8 content_compression
Definition: http.h:60
LogTemplate * body_template
Definition: http.h:68
gchar * ca_dir
Definition: http.h:48
GList * headers
Definition: http.h:46
gchar * password
Definition: http.h:45
GString * body_prefix
Definition: http.h:55
gboolean send_message_data_in_header
Definition: http.h:64
gchar * proxy
Definition: http.h:54
gboolean accept_redirects
Definition: http.h:63
LogTemplateOptions template_options
Definition: http.h:69
LogThreadedDestDriver super
Definition: http.h:38
GString * accept_encoding
Definition: http.h:59
glong timeout
Definition: http.h:66
GString * body_suffix
Definition: http.h:56
gchar * ca_file
Definition: http.h:49
gchar * tls13_ciphers
Definition: http.h:53
gchar * key_file
Definition: http.h:51
HttpResponseHandlers * response_handlers
Definition: http.h:70
gboolean ocsp_stapling_verify
Definition: http.h:62
gchar * ciphers
Definition: http.h:52
gchar * user_agent
Definition: http.h:47
Definition: response-handler.h:44
GlobalConfig * cfg
Definition: test_batched_ack_tracker.c:34
GString * value
Definition: test_decode.c:28