syslog-ng source
afinet-dest.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2012 Balabit
3  * Copyright (c) 1998-2012 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 
24 #ifndef AFINET_DEST_H_INCLUDED
25 #define AFINET_DEST_H_INCLUDED
26 
27 #include "afinet.h"
28 #include "afsocket-dest.h"
29 #include "afinet-dest-failover.h"
30 #include "transport/tls-context.h"
31 
32 #if SYSLOG_NG_ENABLE_SPOOF_SOURCE
33 
34 /* this forward declaration avoids having to include libnet, which requires
35  * ugly playing with macros, see that for yourself in the implementation
36  * file */
37 struct libnet_context;
38 #endif
39 
40 
41 
42 typedef struct _AFInetDestDriver
43 {
44  AFSocketDestDriver super;
45 #if SYSLOG_NG_ENABLE_SPOOF_SOURCE
46  gboolean spoof_source;
47  struct libnet_context *lnet_ctx;
48  GMutex lnet_lock;
49  GString *lnet_buffer;
50  guint spoof_source_max_msglen;
51 #endif
52  gchar *primary;
53  AFInetDestDriverFailover *failover;
54 
55  /* character as it can contain a service name from /etc/services */
56  gchar *bind_port;
57  gchar *bind_ip;
58  /* character as it can contain a service name from /etc/services */
59  gchar *dest_port;
61 
62 void afinet_dd_set_localport(LogDriver *self, gchar *service);
63 void afinet_dd_set_destport(LogDriver *self, gchar *service);
64 void afinet_dd_set_localip(LogDriver *self, gchar *ip);
65 void afinet_dd_set_sync_freq(LogDriver *self, gint sync_freq);
66 void afinet_dd_set_spoof_source(LogDriver *self, gboolean enable);
67 void afinet_dd_set_spoof_source_max_msglen(LogDriver *s, guint max_msglen);
68 void afinet_dd_set_tls_context(LogDriver *s, TLSContext *tls_context);
69 
70 gint afinet_dd_determine_port(const TransportMapper *transport_mapper, const gchar *service_port);
71 
72 void afinet_dd_enable_failover(LogDriver *s);
73 void afinet_dd_add_failovers(LogDriver *s, GList *failovers);
74 //void afinet_dd_set_failback_mode(LogDriver *s, gboolean enable);
75 void afinet_dd_enable_failback(LogDriver *s);
76 
77 void afinet_dd_set_failback_tcp_probe_interval(LogDriver *s, gint tcp_probe_interval);
78 void afinet_dd_set_failback_successful_probes_required(LogDriver *s, gint successful_probes_required);
79 
80 const gchar *afinet_dd_get_hostname(const AFInetDestDriver *self);
81 
82 AFInetDestDriver *afinet_dd_new_tcp(gchar *host, GlobalConfig *cfg);
83 AFInetDestDriver *afinet_dd_new_tcp6(gchar *host, GlobalConfig *cfg);
84 AFInetDestDriver *afinet_dd_new_udp(gchar *host, GlobalConfig *cfg);
85 AFInetDestDriver *afinet_dd_new_udp6(gchar *host, GlobalConfig *cfg);
86 AFInetDestDriver *afinet_dd_new_syslog(gchar *host, GlobalConfig *cfg);
87 AFInetDestDriver *afinet_dd_new_network(gchar *host, GlobalConfig *cfg);
88 
89 #endif
void afinet_dd_enable_failback(LogDriver *s)
Definition: afinet-dest.c:278
void afinet_dd_set_spoof_source_max_msglen(LogDriver *s, guint max_msglen)
Definition: afinet-dest.c:117
AFInetDestDriver * afinet_dd_new_udp6(gchar *host, GlobalConfig *cfg)
Definition: afinet-dest.c:812
gint afinet_dd_determine_port(const TransportMapper *transport_mapper, const gchar *service_port)
void afinet_dd_set_sync_freq(LogDriver *self, gint sync_freq)
void afinet_dd_set_localip(LogDriver *self, gchar *ip)
Definition: afinet-dest.c:75
void afinet_dd_set_destport(LogDriver *self, gchar *service)
Definition: afinet-dest.c:95
void afinet_dd_add_failovers(LogDriver *s, GList *failovers)
Definition: afinet-dest.c:259
void afinet_dd_set_failback_successful_probes_required(LogDriver *s, gint successful_probes_required)
Definition: afinet-dest.c:293
AFInetDestDriver * afinet_dd_new_tcp(gchar *host, GlobalConfig *cfg)
Definition: afinet-dest.c:794
void afinet_dd_set_localport(LogDriver *self, gchar *service)
Definition: afinet-dest.c:85
void afinet_dd_set_spoof_source(LogDriver *self, gboolean enable)
Definition: afinet-dest.c:105
AFInetDestDriver * afinet_dd_new_udp(gchar *host, GlobalConfig *cfg)
Definition: afinet-dest.c:806
AFInetDestDriver * afinet_dd_new_network(gchar *host, GlobalConfig *cfg)
Definition: afinet-dest.c:837
void afinet_dd_set_tls_context(LogDriver *s, TLSContext *tls_context)
Definition: afinet-dest.c:224
void afinet_dd_enable_failover(LogDriver *s)
Definition: afinet-dest.c:250
void afinet_dd_set_failback_tcp_probe_interval(LogDriver *s, gint tcp_probe_interval)
Definition: afinet-dest.c:286
AFInetDestDriver * afinet_dd_new_tcp6(gchar *host, GlobalConfig *cfg)
Definition: afinet-dest.c:800
const gchar * afinet_dd_get_hostname(const AFInetDestDriver *self)
AFInetDestDriver * afinet_dd_new_syslog(gchar *host, GlobalConfig *cfg)
Definition: afinet-dest.c:828
Definition: afinet-dest.h:43
gchar * bind_port
Definition: afinet-dest.h:56
gchar * dest_port
Definition: afinet-dest.h:59
AFInetDestDriverFailover * failover
Definition: afinet-dest.h:53
gchar * primary
Definition: afinet-dest.h:52
AFSocketDestDriver super
Definition: afinet-dest.h:44
gchar * bind_ip
Definition: afinet-dest.h:57
GlobalConfig * cfg
Definition: test_batched_ack_tracker.c:34
TransportMapper * transport_mapper
Definition: transport-mapper-lib.c:25