summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/signal.h
blob: 2442e510e7c5c03eed7ebe694597a2b972093739 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef OSMO_SIGNAL_H
#define OSMO_SIGNAL_H

#include <stdint.h>

/* 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. */
#define OSMO_SIGNAL_SS_APPS		0
#define OSMO_SIGNAL_SS_RESERVED		2147483648

/* signal subsystems. */
enum {
	SS_L_GLOBAL		= OSMO_SIGNAL_SS_RESERVED,
	SS_L_INPUT,
};

/* application-defined signal types. */
#define OSMO_SIGNAL_T_APPS		0
#define OSMO_SIGNAL_T_RESERVED		2147483648

/* signal types. */
enum {
	S_L_GLOBAL_SHUTDOWN	= OSMO_SIGNAL_T_RESERVED,
};

typedef int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data);


/* Management */
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);

/* Dispatch */
void osmo_signal_dispatch(unsigned int subsys, unsigned int signal, void *signal_data);

#endif /* OSMO_SIGNAL_H */