syslog-ng source
transport-mapper-inet.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2013 Balabit
3  * Copyright (c) 1998-2013 Balázs Scheidler
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 #ifndef TRANSPORT_MAPPER_INET_H_INCLUDED
24 #define TRANSPORT_MAPPER_INET_H_INCLUDED
25 
26 #include "transport-mapper.h"
27 #include "transport/tls-context.h"
28 
29 typedef struct _TransportMapperInet
30 {
31  TransportMapper super;
32 
35  /* tls() options are required */
37  /* tls() options are optional, but are permitted */
39 
40  /* tls() options may be specified, but it is up to the transport/logproto
41  * plugin to start TLS.
42  *
43  * If this is TRUE, TLS encapsulation is started by either the
44  * LogTransport or the LogProtoServer instances with an explicit call to
45  * log_transport_stack_switch(LOG_TRANSPORT_TLS). For example, this
46  * mechanism is used by LogProtoAutoServer (when TLS is detected), by
47  * LogTransportHAProxy or any potential LogProto implementations that have
48  * an explicit STARTTLS command (e.g. ALTP, RLTP).
49  *
50  * If this is FALSE, TLS will be started before LogProtoServer has any
51  * chance to read data,
52  */
53 
55 
56  /* HAProxy v1 or v2 protocol is to be used */
57  gboolean proxied;
58  /* switch to TLS after plaintext haproxy negotiation */
60  TLSContext *tls_context;
64 
65 static inline gint
66 transport_mapper_inet_get_server_port(const TransportMapper *self)
67 {
68  return ((TransportMapperInet *) self)->server_port;
69 }
70 
71 static inline void
72 transport_mapper_inet_set_server_port(TransportMapper *self, gint server_port)
73 {
74  ((TransportMapperInet *) self)->server_port = server_port;
75 }
76 
77 static inline const gchar *
78 transport_mapper_inet_get_port_change_warning(TransportMapper *s)
79 {
81 
82  return self->server_port_change_warning;
83 }
84 
85 static inline void
86 transport_mapper_inet_set_tls_context(TransportMapperInet *self, TLSContext *tls_context)
87 {
88  self->tls_context = tls_context;
89 }
90 
91 static inline void
92 transport_mapper_inet_set_tls_verifier(TransportMapperInet *self, TLSVerifier *tls_verifier)
93 {
94  tls_verifier_unref(self->tls_verifier);
95  self->tls_verifier = tls_verifier;
96 }
97 
98 void transport_mapper_inet_init_instance(TransportMapperInet *self, const gchar *transport);
99 TransportMapper *transport_mapper_tcp_new(void);
100 TransportMapper *transport_mapper_tcp6_new(void);
101 TransportMapper *transport_mapper_udp_new(void);
102 TransportMapper *transport_mapper_udp6_new(void);
103 TransportMapper *transport_mapper_network_new(void);
104 TransportMapper *transport_mapper_syslog_new(void);
105 
106 #endif
#define self
Definition: rcptid.c:38
Definition: tls-verifier.h:33
Definition: transport-mapper-inet.h:30
const gchar * server_port_change_warning
Definition: transport-mapper-inet.h:34
gboolean proxied
Definition: transport-mapper-inet.h:57
TLSVerifier * tls_verifier
Definition: transport-mapper-inet.h:61
gboolean allow_tls_configuration
Definition: transport-mapper-inet.h:38
gboolean require_tls_configuration
Definition: transport-mapper-inet.h:36
gpointer secret_store_cb_data
Definition: transport-mapper-inet.h:62
gboolean delegate_tls_start_to_logproto
Definition: transport-mapper-inet.h:54
gboolean proxied_passthrough
Definition: transport-mapper-inet.h:59
TransportMapper super
Definition: transport-mapper-inet.h:31
TLSContext * tls_context
Definition: transport-mapper-inet.h:60
gint server_port
Definition: transport-mapper-inet.h:33
void tls_verifier_unref(TLSVerifier *self)
Definition: tls-verifier.c:70
TransportMapper * transport_mapper_network_new(void)
Definition: transport-mapper-inet.c:483
TransportMapper * transport_mapper_syslog_new(void)
Definition: transport-mapper-inet.c:615
TransportMapper * transport_mapper_udp_new(void)
Definition: transport-mapper-inet.c:341
TransportMapper * transport_mapper_tcp6_new(void)
Definition: transport-mapper-inet.c:331
void transport_mapper_inet_init_instance(TransportMapperInet *self, const gchar *transport)
Definition: transport-mapper-inet.c:279
TransportMapper * transport_mapper_tcp_new(void)
Definition: transport-mapper-inet.c:316
TransportMapper * transport_mapper_udp6_new(void)
Definition: transport-mapper-inet.c:355