Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 1 | /* Generic signalling/notification infrastructure */ |
| 2 | /* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 3 | * (C) 2009 by Harald Welte <laforge@gnumonks.org> |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 4 | * All Rights Reserved |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along |
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef OPENBSC_SIGNAL_H |
| 23 | #define OPENBSC_SIGNAL_H |
| 24 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 25 | #include <stdlib.h> |
| 26 | #include <errno.h> |
| 27 | |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 28 | #include <openbsc/gsm_data.h> |
| 29 | #include <openbsc/gsm_subscriber.h> |
| 30 | |
| 31 | |
| 32 | /* |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 33 | * Signalling subsystems |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 34 | */ |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 35 | enum signal_subsystems { |
| 36 | SS_PAGING, |
| 37 | SS_SMS, |
| 38 | SS_ABISIP, |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 39 | SS_NM, |
Holger Freyther | 7c19f74 | 2009-06-06 13:54:35 +0000 | [diff] [blame^] | 40 | SS_LCHAN, |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 41 | }; |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 42 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 43 | /* SS_PAGING signals */ |
| 44 | enum signal_paging { |
| 45 | S_PAGING_COMPLETED, |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 48 | /* SS_ABISIP signals */ |
| 49 | enum signal_abisip { |
| 50 | S_ABISIP_BIND_ACK, |
| 51 | }; |
| 52 | |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 53 | /* SS_NM signals */ |
| 54 | enum signal_nm { |
| 55 | S_NM_SW_ACTIV_REP, /* GSM 12.21 software activated report */ |
| 56 | S_NM_FAIL_REP, /* GSM 12.21 failure event report */ |
| 57 | }; |
| 58 | |
Holger Freyther | 7c19f74 | 2009-06-06 13:54:35 +0000 | [diff] [blame^] | 59 | /* SS_LCHAN signals */ |
| 60 | enum signal_lchan { |
| 61 | /* |
| 62 | * The lchan got freed with an use_count != 0 and error |
| 63 | * recovery needs to be carried out from within the |
| 64 | * signal handler. |
| 65 | */ |
| 66 | S_LCHAN_UNEXPECTED_RELEASE, |
| 67 | }; |
| 68 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 69 | typedef int signal_cbfn(unsigned int subsys, unsigned int signal, |
| 70 | void *handler_data, void *signal_data); |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 71 | |
| 72 | struct paging_signal_data { |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 73 | struct gsm_subscriber *subscr; |
| 74 | struct gsm_bts *bts; |
| 75 | |
| 76 | /* NULL in case the paging didn't work */ |
| 77 | struct gsm_lchan *lchan; |
| 78 | }; |
| 79 | |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 80 | /* Management */ |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 81 | int register_signal_handler(unsigned int subsys, signal_cbfn *cbfn, void *data); |
| 82 | void unregister_signal_handler(unsigned int subsys, signal_cbfn *cbfn, void *data); |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 83 | |
| 84 | /* Dispatch */ |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 85 | void dispatch_signal(unsigned int subsys, unsigned int signal, void *signal_data); |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 86 | |
| 87 | |
| 88 | #endif |