syslog-ng source
control-server.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2013 Balabit
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; 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 CONTROL_SERVER_H
24 #define CONTROL_SERVER_H
25 
26 #include "syslog-ng.h"
27 #include "control.h"
28 #include "atomic.h"
29 #include <stdio.h>
30 
31 #define MAX_CONTROL_LINE_LENGTH 4096
32 
34 {
36  gboolean (*start)(ControlServer *s);
37  void (*stop)(ControlServer *s);
38  void (*free_fn)(ControlServer *self);
39 };
40 
41 void control_server_cancel_all_workers(ControlServer *self);
42 void control_server_connection_closed(ControlServer *self, ControlConnection *cc);
43 void control_server_worker_started(ControlServer *self, ControlCommandThread *worker);
44 void control_server_worker_finished(ControlServer *self, ControlCommandThread *worker);
45 
46 gboolean control_server_start_method(ControlServer *self);
47 void control_server_stop_method(ControlServer *self);
48 void control_server_free_method(ControlServer *self);
49 void control_server_free(ControlServer *self);
50 void control_server_init_instance(ControlServer *self);
51 
52 static inline gboolean
53 control_server_start(ControlServer *self)
54 {
55  if (self->start)
56  return self->start(self);
57  return TRUE;
58 }
59 
60 static inline void
61 control_server_stop(ControlServer *self)
62 {
63  if (self->stop)
64  self->stop(self);
65 }
66 
67 #endif
void control_server_worker_finished(ControlServer *self, ControlCommandThread *worker)
Definition: control-server.c:88
void control_server_free_method(ControlServer *self)
Definition: control-server.c:142
void control_server_connection_closed(ControlServer *self, ControlConnection *cc)
Definition: control-server.c:95
void control_server_stop_method(ControlServer *self)
Definition: control-server.c:132
void control_server_init_instance(ControlServer *self)
Definition: control-server.c:147
gboolean control_server_start_method(ControlServer *self)
Definition: control-server.c:103
void control_server_cancel_all_workers(ControlServer *self)
Definition: control-server.c:75
void control_server_free(ControlServer *self)
Definition: control-server.c:156
void control_server_worker_started(ControlServer *self, ControlCommandThread *worker)
Definition: control-server.c:81
#define self
Definition: rcptid.c:38
Definition: control-server.h:34
void(* stop)(ControlServer *s)
Definition: control-server.h:37
void(* free_fn)(ControlServer *self)
Definition: control-server.h:38
gboolean(* start)(ControlServer *s)
Definition: control-server.h:36
GList * worker_threads
Definition: control-server.h:35