fixes, fully translated tomato, with english dictionary and Polish translation
[tomato.git] / release / src / router / openvpn / sig.h
blob1cbad1b439715aaf108aa2b21bff5d7a3f0c2833
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-2009 OpenVPN Technologies, Inc. <sales@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);
52 void throw_signal_soft (const int signum, const char *signal_text);
54 void pre_init_signal_catch (void);
55 void post_init_signal_catch (void);
56 void restore_signal_state (void);
58 void print_signal (const struct signal_info *si, const char *title, int msglevel);
59 void print_status (const struct context *c, struct status_output *so);
61 void remap_signal (struct context *c);
63 void signal_restart_status (const struct signal_info *si);
65 bool process_signal (struct context *c);
67 #ifdef ENABLE_OCC
68 void process_explicit_exit_notification_timer_wakeup (struct context *c);
69 #endif
71 #ifdef WIN32
73 static inline void
74 get_signal (volatile int *sig)
76 *sig = win32_signal_get (&win32_signal);
79 static inline void
80 halt_non_edge_triggered_signals (void)
82 win32_signal_close (&win32_signal);
85 #else
87 static inline void
88 get_signal (volatile int *sig)
90 const int i = siginfo_static.signal_received;
91 if (i)
92 *sig = i;
95 static inline void
96 halt_non_edge_triggered_signals (void)
100 #endif
102 #endif