2014-06-16 08:13:40 +00:00
|
|
|
#pragma once
|
2010-02-20 19:34:29 +00:00
|
|
|
|
2011-07-07 17:46:34 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2011-08-17 14:19:46 +00:00
|
|
|
/*! \defgroup signal Intra-application signals
|
|
|
|
* @{
|
2017-06-20 02:35:06 +00:00
|
|
|
* \file signal.h */
|
2011-08-17 14:19:46 +00:00
|
|
|
|
2016-04-25 10:11:20 +00:00
|
|
|
/*! subsystem signaling numbers: we split the numberspace for
|
|
|
|
* applications and libraries: from 0 to UINT_MAX/2 for applications,
|
|
|
|
* from UINT_MAX/2 to UINT_MAX for libraries. */
|
2011-07-07 17:46:34 +00:00
|
|
|
#define OSMO_SIGNAL_SS_APPS 0
|
2011-08-22 13:31:17 +00:00
|
|
|
#define OSMO_SIGNAL_SS_RESERVED 2147483648u
|
2011-07-07 17:46:34 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! signal subsystems */
|
2011-07-07 17:46:34 +00:00
|
|
|
enum {
|
2011-07-19 12:31:44 +00:00
|
|
|
SS_L_GLOBAL = OSMO_SIGNAL_SS_RESERVED,
|
|
|
|
SS_L_INPUT,
|
2012-06-16 08:37:57 +00:00
|
|
|
SS_L_NS,
|
2013-10-10 18:21:33 +00:00
|
|
|
SS_L_VTY,
|
2011-07-07 17:46:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* application-defined signal types. */
|
|
|
|
#define OSMO_SIGNAL_T_APPS 0
|
2011-08-22 13:31:17 +00:00
|
|
|
#define OSMO_SIGNAL_T_RESERVED 2147483648u
|
2011-07-07 17:46:34 +00:00
|
|
|
|
2017-06-19 22:17:59 +00:00
|
|
|
/*! signal types. */
|
2011-07-07 17:46:34 +00:00
|
|
|
enum {
|
2011-07-19 12:31:44 +00:00
|
|
|
S_L_GLOBAL_SHUTDOWN = OSMO_SIGNAL_T_RESERVED,
|
2011-07-07 17:46:34 +00:00
|
|
|
};
|
|
|
|
|
2011-08-17 14:19:46 +00:00
|
|
|
/*! signal callback function type */
|
2011-05-07 10:42:45 +00:00
|
|
|
typedef int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data);
|
2010-02-20 19:34:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Management */
|
2018-08-16 17:05:19 +00:00
|
|
|
void *osmo_signal_talloc_ctx_init(void *root_ctx);
|
2011-05-07 10:42:45 +00:00
|
|
|
int osmo_signal_register_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data);
|
|
|
|
void osmo_signal_unregister_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data);
|
2010-02-20 19:34:29 +00:00
|
|
|
|
|
|
|
/* Dispatch */
|
2011-05-07 10:42:45 +00:00
|
|
|
void osmo_signal_dispatch(unsigned int subsys, unsigned int signal, void *signal_data);
|
2010-02-20 19:34:29 +00:00
|
|
|
|
2012-04-18 19:53:23 +00:00
|
|
|
/*! @} */
|