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> |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 29 | |
Harald Welte | dfe6c7d | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 30 | #include <osmocore/signal.h> |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 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 | ea5cf30 | 2009-07-29 23:14:15 +0200 | [diff] [blame] | 41 | SS_SUBSCR, |
Harald Welte | a148233 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 42 | SS_SCALL, |
Harald Welte | 3961fcc | 2009-11-30 19:37:18 +0100 | [diff] [blame] | 43 | SS_GLOBAL, |
Harald Welte | c0d83b0 | 2010-03-28 15:58:03 +0800 | [diff] [blame] | 44 | SS_CHALLOC, |
Harald Welte | 99e3248 | 2010-05-11 06:20:54 +0200 | [diff] [blame] | 45 | SS_NS, |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 46 | }; |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 47 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 48 | /* SS_PAGING signals */ |
| 49 | enum signal_paging { |
Sylvain Munaut | ef24dff | 2009-12-19 12:38:10 +0100 | [diff] [blame] | 50 | S_PAGING_SUCCEEDED, |
| 51 | S_PAGING_EXPIRED, |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
Harald Welte | 7604218 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 54 | /* SS_SMS signals */ |
| 55 | enum signal_sms { |
| 56 | S_SMS_SUBMITTED, /* A SMS has been successfully submitted to us */ |
| 57 | S_SMS_DELIVERED, /* A SMS has been successfully delivered to a MS */ |
| 58 | S_SMS_SMMA, /* A MS tells us it has more space available */ |
Harald Welte | cb8f443 | 2009-08-09 14:59:02 +0200 | [diff] [blame] | 59 | S_SMS_MEM_EXCEEDED, /* A MS tells us it has no more space available */ |
Harald Welte | 7604218 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 60 | }; |
| 61 | |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 62 | /* SS_ABISIP signals */ |
| 63 | enum signal_abisip { |
Holger Hans Peter Freyther | 231163d | 2009-11-18 21:06:12 +0100 | [diff] [blame] | 64 | S_ABISIP_CRCX_ACK, |
Harald Welte | 5e3d91b | 2009-12-19 16:42:06 +0100 | [diff] [blame] | 65 | S_ABISIP_MDCX_ACK, |
Holger Hans Peter Freyther | 231163d | 2009-11-18 21:06:12 +0100 | [diff] [blame] | 66 | S_ABISIP_DLCX_IND, |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 69 | /* SS_NM signals */ |
| 70 | enum signal_nm { |
| 71 | S_NM_SW_ACTIV_REP, /* GSM 12.21 software activated report */ |
| 72 | S_NM_FAIL_REP, /* GSM 12.21 failure event report */ |
Holger Hans Peter Freyther | 500f3ca | 2009-06-10 10:48:14 +0200 | [diff] [blame] | 73 | S_NM_NACK, /* GSM 12.21 various NM_MT_*_NACK happened */ |
Holger Hans Peter Freyther | a7cd9fc | 2009-07-07 12:40:07 +0200 | [diff] [blame] | 74 | S_NM_IPACC_NACK, /* GSM 12.21 nanoBTS extensions NM_MT_IPACC_*_*_NACK happened */ |
Holger Hans Peter Freyther | 086ffa5 | 2009-12-29 11:26:38 +0100 | [diff] [blame] | 75 | S_NM_IPACC_ACK, /* GSM 12.21 nanoBTS extensions NM_MT_IPACC_*_*_ACK happened */ |
Holger Hans Peter Freyther | 1356c08 | 2009-12-30 09:00:01 +0100 | [diff] [blame] | 76 | S_NM_IPACC_RESTART_ACK, /* nanoBTS has send a restart ack */ |
| 77 | S_NM_IPACC_RESTART_NACK,/* nanoBTS has send a restart ack */ |
Harald Welte | c731038 | 2009-08-08 00:02:36 +0200 | [diff] [blame] | 78 | S_NM_TEST_REP, /* GSM 12.21 Test Report */ |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 79 | }; |
| 80 | |
Holger Freyther | 7c19f74 | 2009-06-06 13:54:35 +0000 | [diff] [blame] | 81 | /* SS_LCHAN signals */ |
| 82 | enum signal_lchan { |
| 83 | /* |
| 84 | * The lchan got freed with an use_count != 0 and error |
| 85 | * recovery needs to be carried out from within the |
| 86 | * signal handler. |
| 87 | */ |
| 88 | S_LCHAN_UNEXPECTED_RELEASE, |
Harald Welte | d011e8b | 2009-11-29 22:45:52 +0100 | [diff] [blame] | 89 | S_LCHAN_ACTIVATE_ACK, /* 08.58 Channel Activate ACK */ |
| 90 | S_LCHAN_ACTIVATE_NACK, /* 08.58 Channel Activate NACK */ |
| 91 | S_LCHAN_HANDOVER_COMPL, /* 04.08 Handover Completed */ |
| 92 | S_LCHAN_HANDOVER_FAIL, /* 04.08 Handover Failed */ |
| 93 | S_LCHAN_HANDOVER_DETECT, /* 08.58 Handover Detect */ |
Harald Welte | dbb1d88 | 2009-11-30 19:16:47 +0100 | [diff] [blame] | 94 | S_LCHAN_MEAS_REP, /* 08.58 Measurement Report */ |
Holger Freyther | 7c19f74 | 2009-06-06 13:54:35 +0000 | [diff] [blame] | 95 | }; |
| 96 | |
Harald Welte | c0d83b0 | 2010-03-28 15:58:03 +0800 | [diff] [blame] | 97 | /* SS_CHALLOC signals */ |
| 98 | enum signal_challoc { |
| 99 | S_CHALLOC_ALLOC_FAIL, /* allocation of lchan has failed */ |
| 100 | S_CHALLOC_FREED, /* lchan has been successfully freed */ |
| 101 | }; |
| 102 | |
Harald Welte | ea5cf30 | 2009-07-29 23:14:15 +0200 | [diff] [blame] | 103 | /* SS_SUBSCR signals */ |
| 104 | enum signal_subscr { |
| 105 | S_SUBSCR_ATTACHED, |
| 106 | S_SUBSCR_DETACHED, |
Harald Welte | 7659de1 | 2009-12-13 12:39:18 +0100 | [diff] [blame] | 107 | S_SUBSCR_IDENTITY, /* we've received some identity information */ |
Harald Welte | ea5cf30 | 2009-07-29 23:14:15 +0200 | [diff] [blame] | 108 | }; |
| 109 | |
Harald Welte | a148233 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 110 | /* SS_SCALL signals */ |
| 111 | enum signal_scall { |
| 112 | S_SCALL_SUCCESS, |
| 113 | S_SCALL_EXPIRED, |
| 114 | S_SCALL_DETACHED, |
| 115 | }; |
| 116 | |
Harald Welte | 3961fcc | 2009-11-30 19:37:18 +0100 | [diff] [blame] | 117 | enum signal_global { |
| 118 | S_GLOBAL_SHUTDOWN, |
| 119 | }; |
| 120 | |
Harald Welte | b7bd65e | 2010-04-26 21:55:29 +0200 | [diff] [blame] | 121 | struct gsm_subscriber; |
| 122 | |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 123 | struct paging_signal_data { |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 124 | struct gsm_subscriber *subscr; |
| 125 | struct gsm_bts *bts; |
| 126 | |
| 127 | /* NULL in case the paging didn't work */ |
| 128 | struct gsm_lchan *lchan; |
| 129 | }; |
| 130 | |
Harald Welte | a148233 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 131 | struct scall_signal_data { |
| 132 | struct gsm_subscriber *subscr; |
| 133 | struct gsm_lchan *lchan; |
| 134 | void *data; |
| 135 | }; |
| 136 | |
Holger Hans Peter Freyther | 2e83782 | 2009-12-30 08:38:43 +0100 | [diff] [blame] | 137 | struct ipacc_ack_signal_data { |
Holger Hans Peter Freyther | 52fd4e4 | 2010-05-12 23:34:51 +0800 | [diff] [blame] | 138 | struct gsm_bts_trx *trx; |
Holger Hans Peter Freyther | 2e83782 | 2009-12-30 08:38:43 +0100 | [diff] [blame] | 139 | u_int8_t msg_type; |
| 140 | }; |
| 141 | |
Harald Welte | c0d83b0 | 2010-03-28 15:58:03 +0800 | [diff] [blame] | 142 | struct challoc_signal_data { |
| 143 | struct gsm_bts *bts; |
| 144 | struct gsm_lchan *lchan; |
| 145 | enum gsm_chan_t type; |
| 146 | }; |
| 147 | |
Harald Welte | 99e3248 | 2010-05-11 06:20:54 +0200 | [diff] [blame] | 148 | enum signal_ns { |
| 149 | S_NS_RESET, |
| 150 | S_NS_BLOCK, |
| 151 | S_NS_UNBLOCK, |
Harald Welte | b778d2c | 2010-05-12 13:28:25 +0000 | [diff] [blame] | 152 | S_NS_ALIVE_EXP, /* Tns-alive expired more than N times */ |
Harald Welte | 99e3248 | 2010-05-11 06:20:54 +0200 | [diff] [blame] | 153 | }; |
| 154 | |
| 155 | struct ns_signal_data { |
| 156 | struct gprs_nsvc *nsvc; |
| 157 | uint8_t cause; |
| 158 | }; |
| 159 | |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 160 | #endif |