]> git.ipfire.org Git - people/ms/strongswan.git/blob - src/libcharon/plugins/error_notify/error_notify_socket.h
Add an error-notify plugin to send catched alerts to listening applications
[people/ms/strongswan.git] / src / libcharon / plugins / error_notify / error_notify_socket.h
1 /*
2 * Copyright (C) 2012 Martin Willi
3 * Copyright (C) 2012 revosec AG
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 as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup error_notify_socket error_notify_socket
18 * @{ @ingroup error_notify
19 */
20
21 #ifndef ERROR_NOTIFY_SOCKET_H_
22 #define ERROR_NOTIFY_SOCKET_H_
23
24 typedef struct error_notify_socket_t error_notify_socket_t;
25
26 #include "error_notify_listener.h"
27 #include "error_notify_msg.h"
28
29 /**
30 * Error notification socket.
31 */
32 struct error_notify_socket_t {
33
34 /**
35 * Send an error notification message to all registered listeners.
36 *
37 * @param msg msg to send
38 */
39 void (*notify)(error_notify_socket_t *this, error_notify_msg_t *msg);
40
41 /**
42 * Check if we have active listeners on the socket.
43 *
44 * @return TRUE if listeners active
45 */
46 bool (*has_listeners)(error_notify_socket_t *this);
47
48 /**
49 * Destroy a error_notify_socket_t.
50 */
51 void (*destroy)(error_notify_socket_t *this);
52 };
53
54 /**
55 * Create a error_notify_socket instance.
56 */
57 error_notify_socket_t *error_notify_socket_create();
58
59 #endif /** ERROR_NOTIFY_SOCKET_H_ @}*/