syslog-ng source
afinet-dest-failover.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2018 Balabit
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 as published
6  * by the Free Software Foundation, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * As an additional exemption you are allowed to compile & link against the
18  * OpenSSL libraries as published by the OpenSSL project. See the file
19  * COPYING for details.
20  *
21  */
22 
23 #ifndef AFINET_DEST_FAILOVER_H_INCLUDED
24 #define AFINET_DEST_FAILOVER_H_INCLUDED
25 
26 #include "syslog-ng.h"
27 #include "gsocket.h"
28 #include "transport-mapper-inet.h"
29 #include "cfg.h"
30 
31 typedef struct _AFInetDestDriverFailover AFInetDestDriverFailover;
32 typedef void (*AFInetOnPrimaryAvailable)(gpointer cookie, gint fd, GSockAddr *addr);
33 typedef struct _FailoverTransportMapper
34 {
35  TransportMapper *transport_mapper;
36  SocketOptions *socket_options;
37  const gchar *dest_port;
38  const gchar *bind_ip;
39  const gchar *bind_port;
41 
42 AFInetDestDriverFailover *afinet_dd_failover_new(const gchar *primary);
43 
44 void afinet_dd_failover_init(AFInetDestDriverFailover *self, LogExprNode *owner_expr,
45  FailoverTransportMapper *failover_transport_mapper);
46 void afinet_dd_failover_deinit(AFInetDestDriverFailover *self);
47 
48 void afinet_dd_failover_free(AFInetDestDriverFailover *self);
49 
50 void afinet_dd_failover_enable_failback(AFInetDestDriverFailover *self, gpointer cookie,
51  AFInetOnPrimaryAvailable callback);
52 void afinet_dd_failover_add_servers(AFInetDestDriverFailover *self, GList *failovers);
53 void afinet_dd_failover_set_tcp_probe_interval(AFInetDestDriverFailover *self, gint tcp_probe_interval);
54 void afinet_dd_failover_set_successful_probes_required(AFInetDestDriverFailover *self, gint successful_probes_required);
55 
56 void afinet_dd_failover_next(AFInetDestDriverFailover *self);
57 const gchar *afinet_dd_failover_get_hostname(AFInetDestDriverFailover *self);
58 
59 
60 #endif
void afinet_dd_failover_init(AFInetDestDriverFailover *self, LogExprNode *owner_expr, FailoverTransportMapper *failover_transport_mapper)
Definition: afinet-dest-failover.c:420
void afinet_dd_failover_set_tcp_probe_interval(AFInetDestDriverFailover *self, gint tcp_probe_interval)
Definition: afinet-dest-failover.c:54
void afinet_dd_failover_free(AFInetDestDriverFailover *self)
Definition: afinet-dest-failover.c:442
void afinet_dd_failover_add_servers(AFInetDestDriverFailover *self, GList *failovers)
Definition: afinet-dest-failover.c:375
void(* AFInetOnPrimaryAvailable)(gpointer cookie, gint fd, GSockAddr *addr)
Definition: afinet-dest-failover.h:32
const gchar * afinet_dd_failover_get_hostname(AFInetDestDriverFailover *self)
Definition: afinet-dest-failover.c:349
AFInetDestDriverFailover * afinet_dd_failover_new(const gchar *primary)
Definition: afinet-dest-failover.c:431
void afinet_dd_failover_deinit(AFInetDestDriverFailover *self)
Definition: afinet-dest-failover.c:414
void afinet_dd_failover_next(AFInetDestDriverFailover *self)
Definition: afinet-dest-failover.c:360
void afinet_dd_failover_set_successful_probes_required(AFInetDestDriverFailover *self, gint successful_probes_required)
Definition: afinet-dest-failover.c:60
void afinet_dd_failover_enable_failback(AFInetDestDriverFailover *self, gpointer cookie, AFInetOnPrimaryAvailable callback)
Definition: afinet-dest-failover.c:381
Definition: afinet-dest-failover.h:34
TransportMapper * transport_mapper
Definition: afinet-dest-failover.h:35
const gchar * dest_port
Definition: afinet-dest-failover.h:37
const gchar * bind_ip
Definition: afinet-dest-failover.h:38
const gchar * bind_port
Definition: afinet-dest-failover.h:39
SocketOptions * socket_options
Definition: afinet-dest-failover.h:36
Definition: gsockaddr.h:46
Definition: afinet-dest-failover.c:31
struct iv_fd fd
Definition: afinet-dest-failover.c:42