Merge libosmocore commit '972b502ecaf3b919b7e89c13257dd6ec97aaafb7' into master
[osmocom-bb.git] / src / shared / libosmocore / include / osmocom / core / signal.h
blobb3a5aaee829ea24f44a6aa0886d0cd73b100b948
1 #ifndef OSMO_SIGNAL_H
2 #define OSMO_SIGNAL_H
4 #include <stdint.h>
6 /*! \defgroup signal Intra-application signals
7 * @{
8 */
9 /*! \file signal.h */
11 /* subsystem signaling numbers: we split the numberspace for applications and
12 * libraries: from 0 to UINT_MAX/2 for applications, from UINT_MAX/2 to
13 * UINT_MAX for libraries. */
14 #define OSMO_SIGNAL_SS_APPS 0
15 #define OSMO_SIGNAL_SS_RESERVED 2147483648u
17 /*! \brief signal subsystems */
18 enum {
19 SS_L_GLOBAL = OSMO_SIGNAL_SS_RESERVED,
20 SS_L_INPUT,
21 SS_L_NS,
24 /* application-defined signal types. */
25 #define OSMO_SIGNAL_T_APPS 0
26 #define OSMO_SIGNAL_T_RESERVED 2147483648u
28 /*! \brief signal types. */
29 enum {
30 S_L_GLOBAL_SHUTDOWN = OSMO_SIGNAL_T_RESERVED,
33 /*! signal callback function type */
34 typedef int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data);
37 /* Management */
38 int osmo_signal_register_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data);
39 void osmo_signal_unregister_handler(unsigned int subsys, osmo_signal_cbfn *cbfn, void *data);
41 /* Dispatch */
42 void osmo_signal_dispatch(unsigned int subsys, unsigned int signal, void *signal_data);
44 /*! @} */
46 #endif /* OSMO_SIGNAL_H */