big svn cleanup
[anytun.git] / src / openvpn / sig.h
blobdd17c4065a494455ab9f4262491969541fda435f
1 /*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
8 * Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program (see the file COPYING included with this
21 * distribution); if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef SIG_H
26 #define SIG_H
28 #include "status.h"
29 #include "win32.h"
32 * Signal information, including signal code
33 * and descriptive text.
35 struct signal_info
37 volatile int signal_received;
38 volatile bool hard;
39 const char *signal_text;
42 #define IS_SIG(c) ((c)->sig->signal_received)
44 struct context;
46 extern struct signal_info siginfo_static;
48 int parse_signal (const char *signame);
49 const char *signal_name (const int sig, const bool upper);
50 const char *signal_description (const int signum, const char *sigtext);
51 void throw_signal (const int signum);
53 void pre_init_signal_catch (void);
54 void post_init_signal_catch (void);
56 void print_signal (const struct signal_info *si, const char *title, int msglevel);
57 void print_status (const struct context *c, struct status_output *so);
59 void remap_signal (struct context *c);
61 void signal_restart_status (const struct signal_info *si);
63 bool process_signal (struct context *c);
65 #ifdef ENABLE_OCC
66 void process_explicit_exit_notification_timer_wakeup (struct context *c);
67 #endif
69 #ifdef WIN32
71 static inline void
72 get_signal (volatile int *sig)
74 *sig = win32_signal_get (&win32_signal);
77 static inline void
78 halt_non_edge_triggered_signals (void)
80 win32_signal_close (&win32_signal);
83 #else
85 static inline void
86 get_signal (volatile int *sig)
88 const int i = siginfo_static.signal_received;
89 if (i)
90 *sig = i;
93 static inline void
94 halt_non_edge_triggered_signals (void)
98 #endif
100 #endif