syslog-ng source
control-connection.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2013 Balabit
3  * Copyright (c) 2021 Balazs Scheidler <bazsi77@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 CONTROL_CONNECTION_H
25 #define CONTROL_CONNECTION_H
26 
27 #include "control.h"
28 #include "atomic.h"
29 
30 #include <iv_event.h>
31 
33 {
37  struct iv_event evt_response_added;
40  GString *input_buffer;
41  GString *output_buffer;
42  gsize pos;
43  ControlServer *server;
44  gboolean (*get_attached_fds)(ControlConnection *self, gint *fds, gsize *num_fds);
45  gboolean (*run_command)(ControlConnection *self, ControlCommand *command_desc, GString *command_string);
46  int (*read)(ControlConnection *self, gpointer buffer, gsize size);
47  int (*write)(ControlConnection *self, gpointer buffer, gsize size);
48  void (*handle_input)(gpointer s);
49  void (*handle_output)(gpointer s);
50  void (*free_fn)(ControlConnection *self);
51  struct
52  {
53  void (*start_watches)(ControlConnection *self);
54  void (*update_watches)(ControlConnection *self);
55  void (*stop_watches)(ControlConnection *self);
56  } events;
57 
58 };
59 
60 gboolean control_connection_get_attached_fds(ControlConnection *self, gint *fds, gsize *num_fds);
61 gboolean control_connection_run_command(ControlConnection *self, GString *command_string);
62 void control_connection_send_reply(ControlConnection *self, GString *reply);
63 void control_connection_send_batched_reply(ControlConnection *self, GString *reply);
64 void control_connection_send_close_batch(ControlConnection *self);
65 void control_connection_start_watches(ControlConnection *self);
66 void control_connection_update_watches(ControlConnection *self);
67 void control_connection_stop_watches(ControlConnection *self);
68 void control_connection_init_instance(ControlConnection *self, ControlServer *server);
69 
70 ControlConnection *control_connection_ref(ControlConnection *self);
71 void control_connection_unref(ControlConnection *self);
72 
73 
74 #endif
void control_connection_unref(ControlConnection *self)
Definition: control-connection.c:309
void control_connection_update_watches(ControlConnection *self)
Definition: control-connection.c:328
void control_connection_init_instance(ControlConnection *self, ControlServer *server)
Definition: control-connection.c:277
void control_connection_start_watches(ControlConnection *self)
Definition: control-connection.c:318
void control_connection_stop_watches(ControlConnection *self)
Definition: control-connection.c:338
void control_connection_send_batched_reply(ControlConnection *self, GString *reply)
Definition: control-connection.c:70
void control_connection_send_close_batch(ControlConnection *self)
Definition: control-connection.c:82
gboolean control_connection_run_command(ControlConnection *self, GString *command_string)
Definition: control-connection.c:178
ControlConnection * control_connection_ref(ControlConnection *self)
Definition: control-connection.c:298
gboolean control_connection_get_attached_fds(ControlConnection *self, gint *fds, gsize *num_fds)
Definition: control-connection.c:42
void control_connection_send_reply(ControlConnection *self, GString *reply)
Definition: control-connection.c:101
Definition: control.h:36
Definition: atomic.h:31
Definition: control-connection.h:33
int(* read)(ControlConnection *self, gpointer buffer, gsize size)
Definition: control-connection.h:46
gsize pos
Definition: control-connection.h:42
gboolean watches_are_running
Definition: control-connection.h:39
void(* free_fn)(ControlConnection *self)
Definition: control-connection.h:50
ControlServer * server
Definition: control-connection.h:43
struct iv_event evt_response_added
Definition: control-connection.h:37
struct _ControlConnection::@15 events
GString * output_buffer
Definition: control-connection.h:41
gboolean(* run_command)(ControlConnection *self, ControlCommand *command_desc, GString *command_string)
Definition: control-connection.h:45
void(* handle_output)(gpointer s)
Definition: control-connection.h:49
gboolean(* get_attached_fds)(ControlConnection *self, gint *fds, gsize *num_fds)
Definition: control-connection.h:44
GAtomicCounter ref_cnt
Definition: control-connection.h:34
GString * input_buffer
Definition: control-connection.h:40
void(* update_watches)(ControlConnection *self)
Definition: control-connection.h:54
void(* stop_watches)(ControlConnection *self)
Definition: control-connection.h:55
void(* start_watches)(ControlConnection *self)
Definition: control-connection.h:53
GMutex response_batches_lock
Definition: control-connection.h:36
GQueue * response_batches
Definition: control-connection.h:35
int(* write)(ControlConnection *self, gpointer buffer, gsize size)
Definition: control-connection.h:47
gboolean waiting_for_output
Definition: control-connection.h:38
void(* handle_input)(gpointer s)
Definition: control-connection.h:48
GString * buffer
Definition: test_smart_multi_line.c:69