The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
signal.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: 0a06c22966d8320304bb6cb266df28387b3a2fdb $
20 *
21 * @file lib/server/signal.h
22 * @brief Signals that can be sent to a request.
23 *
24 * @copyright 2018 The FreeRADIUS server project
25 * @copyright 2018 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
26 */
27RCSIDH(signal_h, "$Id: 0a06c22966d8320304bb6cb266df28387b3a2fdb $")
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/** Signals that can be generated/processed by request signal handlers
34 *
35 * This is a bitfield so that it can be used to specify signal masks.
36 */
37DIAG_OFF(attributes) /* Stupid GCC */
38typedef enum CC_HINT(flag_enum) : uint8_t { /* server action */
39 FR_SIGNAL_NONE = 0x00, //!< No signals.
40 FR_SIGNAL_CANCEL = 0x01, //!< Request has been cancelled.
41 ///< If a module is signalled with this, the module
42 ///< should stop processing the request and cleanup
43 ///< anything it's done.
44 FR_SIGNAL_DUP = 0x02, //!< A duplicate request was received.
45 FR_SIGNAL_DETACH = 0x04, //!< Request is being detached from its parent.
46 FR_SIGNAL_RETRY = 0x08, //!< a retry timer has hit
47 FR_SIGNAL_TIMEOUT = 0x10 //!< a retry timeout or max count has hit
49DIAG_ON(attributes)
50
51/** Signal mask which blocks every signal except the ones in _signals
52 *
53 * The sigmask of a yield function lists the signals to block. To allow a
54 * set of signals, the mask blocks the complement of that set.
55 *
56 * @param[in] _signals to allow, e.g. FR_SIGNAL_CANCEL | FR_SIGNAL_DUP.
57 */
58#define FR_SIGNAL_ALLOW(_signals) ((fr_signal_t)~(_signals))
59
60#define fr_signal_is_cancel(_signal) (_signal & FR_SIGNAL_CANCEL)
61#define fr_signal_is_dup(_signal) (_signal & FR_SIGNAL_DUP)
62#define fr_signal_is_detach(_signal) (_signal & FR_SIGNAL_DETACH)
63#define fr_signal_is_retry(_signal) (_signal & FR_SIGNAL_RETRY)
64#define fr_signal_is_timeout(_signal) (_signal & FR_SIGNAL_TIMEOUT)
65
66#ifdef __cplusplus
67}
68#endif
#define DIAG_ON(_x)
Definition build.h:576
#define RCSIDH(h, id)
Definition build.h:604
#define DIAG_OFF(_x)
Definition build.h:575
unsigned char uint8_t
fr_signal_t
Signals that can be generated/processed by request signal handlers.
Definition signal.h:38
@ FR_SIGNAL_DUP
A duplicate request was received.
Definition signal.h:44
@ FR_SIGNAL_RETRY
a retry timer has hit
Definition signal.h:46
@ FR_SIGNAL_NONE
No signals.
Definition signal.h:39
@ FR_SIGNAL_TIMEOUT
a retry timeout or max count has hit
Definition signal.h:47
@ FR_SIGNAL_CANCEL
Request has been cancelled.
Definition signal.h:40
@ FR_SIGNAL_DETACH
Request is being detached from its parent.
Definition signal.h:45