Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 1 | /* Generic signalling/notification infrastructure */ |
Holger Hans Peter Freyther | b100895 | 2015-05-02 19:55:38 +0200 | [diff] [blame] | 2 | /* (C) 2009-2010, 2015 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 Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 4 | * (C) 2010 by On-Waves |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 5 | * All Rights Reserved |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 8 | * it under the terms of the GNU Affero General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 15 | * GNU Affero General Public License for more details. |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 16 | * |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 17 | * You should have received a copy of the GNU Affero General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 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 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 30 | #include <osmocom/core/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 | c0d83b0 | 2010-03-28 15:58:03 +0800 | [diff] [blame] | 43 | SS_CHALLOC, |
Harald Welte | 549faad | 2010-03-05 19:36:20 +0100 | [diff] [blame] | 44 | SS_IPAC_NWL, |
Holger Hans Peter Freyther | 12b917d | 2010-07-29 02:27:27 +0800 | [diff] [blame] | 45 | SS_RF, |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 46 | SS_MSC, |
Holger Hans Peter Freyther | 6c4d244 | 2011-01-06 13:31:41 +0100 | [diff] [blame] | 47 | SS_HO, |
Holger Hans Peter Freyther | 54fa2c7 | 2012-02-03 20:26:25 +0100 | [diff] [blame] | 48 | SS_CCCH, |
Holger Hans Peter Freyther | b100895 | 2015-05-02 19:55:38 +0200 | [diff] [blame] | 49 | SS_SGSN, |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 50 | }; |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 51 | |
Harald Welte | 595ad7b | 2009-02-16 22:05:44 +0000 | [diff] [blame] | 52 | /* SS_PAGING signals */ |
| 53 | enum signal_paging { |
Sylvain Munaut | ef24dff | 2009-12-19 12:38:10 +0100 | [diff] [blame] | 54 | S_PAGING_SUCCEEDED, |
| 55 | S_PAGING_EXPIRED, |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 56 | }; |
| 57 | |
Harald Welte | 7604218 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 58 | /* SS_SMS signals */ |
| 59 | enum signal_sms { |
| 60 | S_SMS_SUBMITTED, /* A SMS has been successfully submitted to us */ |
| 61 | S_SMS_DELIVERED, /* A SMS has been successfully delivered to a MS */ |
| 62 | S_SMS_SMMA, /* A MS tells us it has more space available */ |
Harald Welte | cb8f443 | 2009-08-09 14:59:02 +0200 | [diff] [blame] | 63 | S_SMS_MEM_EXCEEDED, /* A MS tells us it has no more space available */ |
Holger Hans Peter Freyther | 0eb7666 | 2010-12-24 09:47:04 +0100 | [diff] [blame] | 64 | S_SMS_UNKNOWN_ERROR, /* A MS tells us it has an error */ |
Harald Welte | 7604218 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 65 | }; |
| 66 | |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 67 | /* SS_ABISIP signals */ |
| 68 | enum signal_abisip { |
Holger Hans Peter Freyther | 231163d | 2009-11-18 21:06:12 +0100 | [diff] [blame] | 69 | S_ABISIP_CRCX_ACK, |
Harald Welte | 5e3d91b | 2009-12-19 16:42:06 +0100 | [diff] [blame] | 70 | S_ABISIP_MDCX_ACK, |
Holger Hans Peter Freyther | 231163d | 2009-11-18 21:06:12 +0100 | [diff] [blame] | 71 | S_ABISIP_DLCX_IND, |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 72 | }; |
| 73 | |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 74 | /* SS_NM signals */ |
| 75 | enum signal_nm { |
| 76 | S_NM_SW_ACTIV_REP, /* GSM 12.21 software activated report */ |
| 77 | S_NM_FAIL_REP, /* GSM 12.21 failure event report */ |
Holger Hans Peter Freyther | 500f3ca | 2009-06-10 10:48:14 +0200 | [diff] [blame] | 78 | 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] | 79 | 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] | 80 | 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] | 81 | S_NM_IPACC_RESTART_ACK, /* nanoBTS has send a restart ack */ |
| 82 | S_NM_IPACC_RESTART_NACK,/* nanoBTS has send a restart ack */ |
Harald Welte | c731038 | 2009-08-08 00:02:36 +0200 | [diff] [blame] | 83 | S_NM_TEST_REP, /* GSM 12.21 Test Report */ |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 84 | S_NM_STATECHG_OPER, /* Operational State changed*/ |
| 85 | S_NM_STATECHG_ADM, /* Administrative State changed */ |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 86 | S_NM_OM2K_CONF_RES, /* OM2K Configuration Result */ |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 87 | }; |
| 88 | |
Holger Freyther | 7c19f74 | 2009-06-06 13:54:35 +0000 | [diff] [blame] | 89 | /* SS_LCHAN signals */ |
| 90 | enum signal_lchan { |
| 91 | /* |
| 92 | * The lchan got freed with an use_count != 0 and error |
| 93 | * recovery needs to be carried out from within the |
| 94 | * signal handler. |
| 95 | */ |
| 96 | S_LCHAN_UNEXPECTED_RELEASE, |
Harald Welte | d011e8b | 2009-11-29 22:45:52 +0100 | [diff] [blame] | 97 | S_LCHAN_ACTIVATE_ACK, /* 08.58 Channel Activate ACK */ |
| 98 | S_LCHAN_ACTIVATE_NACK, /* 08.58 Channel Activate NACK */ |
| 99 | S_LCHAN_HANDOVER_COMPL, /* 04.08 Handover Completed */ |
| 100 | S_LCHAN_HANDOVER_FAIL, /* 04.08 Handover Failed */ |
| 101 | S_LCHAN_HANDOVER_DETECT, /* 08.58 Handover Detect */ |
Harald Welte | dbb1d88 | 2009-11-30 19:16:47 +0100 | [diff] [blame] | 102 | S_LCHAN_MEAS_REP, /* 08.58 Measurement Report */ |
Holger Freyther | 7c19f74 | 2009-06-06 13:54:35 +0000 | [diff] [blame] | 103 | }; |
| 104 | |
Harald Welte | c0d83b0 | 2010-03-28 15:58:03 +0800 | [diff] [blame] | 105 | /* SS_CHALLOC signals */ |
| 106 | enum signal_challoc { |
| 107 | S_CHALLOC_ALLOC_FAIL, /* allocation of lchan has failed */ |
| 108 | S_CHALLOC_FREED, /* lchan has been successfully freed */ |
| 109 | }; |
| 110 | |
Harald Welte | ea5cf30 | 2009-07-29 23:14:15 +0200 | [diff] [blame] | 111 | /* SS_SUBSCR signals */ |
| 112 | enum signal_subscr { |
| 113 | S_SUBSCR_ATTACHED, |
| 114 | S_SUBSCR_DETACHED, |
Harald Welte | 7659de1 | 2009-12-13 12:39:18 +0100 | [diff] [blame] | 115 | S_SUBSCR_IDENTITY, /* we've received some identity information */ |
Harald Welte | ea5cf30 | 2009-07-29 23:14:15 +0200 | [diff] [blame] | 116 | }; |
| 117 | |
Harald Welte | a148233 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 118 | /* SS_SCALL signals */ |
| 119 | enum signal_scall { |
| 120 | S_SCALL_SUCCESS, |
| 121 | S_SCALL_EXPIRED, |
| 122 | S_SCALL_DETACHED, |
| 123 | }; |
| 124 | |
Harald Welte | 549faad | 2010-03-05 19:36:20 +0100 | [diff] [blame] | 125 | /* SS_IPAC_NWL signals */ |
| 126 | enum signal_ipaccess { |
| 127 | S_IPAC_NWL_COMPLETE, |
| 128 | }; |
| 129 | |
Harald Welte | 3961fcc | 2009-11-30 19:37:18 +0100 | [diff] [blame] | 130 | enum signal_global { |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 131 | S_GLOBAL_BTS_CLOSE_OM, |
Harald Welte | 3961fcc | 2009-11-30 19:37:18 +0100 | [diff] [blame] | 132 | }; |
| 133 | |
Holger Hans Peter Freyther | 12b917d | 2010-07-29 02:27:27 +0800 | [diff] [blame] | 134 | /* SS_RF signals */ |
| 135 | enum signal_rf { |
| 136 | S_RF_OFF, |
| 137 | S_RF_ON, |
| 138 | S_RF_GRACE, |
| 139 | }; |
| 140 | |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 141 | struct paging_signal_data { |
Harald Welte | 9066b74 | 2016-06-19 18:06:02 +0200 | [diff] [blame^] | 142 | struct vlr_subscr *vsub; |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 143 | struct gsm_bts *bts; |
| 144 | |
Holger Hans Peter Freyther | d3baf41 | 2010-12-23 18:19:17 +0100 | [diff] [blame] | 145 | int paging_result; |
| 146 | |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 147 | /* NULL in case the paging didn't work */ |
Holger Hans Peter Freyther | 86481c2 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 148 | struct gsm_subscriber_connection *conn; |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 149 | }; |
| 150 | |
Harald Welte | a148233 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 151 | struct scall_signal_data { |
Holger Hans Peter Freyther | 86481c2 | 2010-06-17 15:05:57 +0800 | [diff] [blame] | 152 | struct gsm_subscriber_connection *conn; |
Harald Welte | a148233 | 2009-11-14 10:08:40 +0100 | [diff] [blame] | 153 | void *data; |
| 154 | }; |
| 155 | |
Holger Hans Peter Freyther | 2e83782 | 2009-12-30 08:38:43 +0100 | [diff] [blame] | 156 | struct ipacc_ack_signal_data { |
Holger Hans Peter Freyther | 52fd4e4 | 2010-05-12 23:34:51 +0800 | [diff] [blame] | 157 | struct gsm_bts_trx *trx; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 158 | uint8_t msg_type; |
Holger Hans Peter Freyther | 2e83782 | 2009-12-30 08:38:43 +0100 | [diff] [blame] | 159 | }; |
| 160 | |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 161 | struct abis_om2k_mo; |
| 162 | |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 163 | struct nm_statechg_signal_data { |
Harald Welte | f38ca9a | 2011-03-06 22:11:32 +0100 | [diff] [blame] | 164 | struct gsm_bts *bts; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 165 | uint8_t obj_class; |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 166 | void *obj; |
| 167 | struct gsm_nm_state *old_state; |
| 168 | struct gsm_nm_state *new_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 169 | |
| 170 | /* This pointer is vaold for TS 12.21 MO */ |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 171 | struct abis_om_obj_inst *obj_inst; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 172 | /* This pointer is vaold for RBS2000 MO */ |
| 173 | struct abis_om2k_mo *om2k_mo; |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 174 | }; |
| 175 | |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 176 | struct nm_om2k_signal_data { |
| 177 | struct gsm_bts *bts; |
| 178 | void *obj; |
| 179 | struct abis_om2k_mo *om2k_mo; |
| 180 | |
| 181 | uint8_t accordance_ind; |
| 182 | }; |
| 183 | |
Holger Hans Peter Freyther | 6d2b66e | 2010-07-14 02:08:35 +0800 | [diff] [blame] | 184 | struct nm_nack_signal_data { |
| 185 | struct msgb *msg; |
Holger Hans Peter Freyther | de1674a | 2012-11-11 18:26:23 +0100 | [diff] [blame] | 186 | struct gsm_bts *bts; |
Holger Hans Peter Freyther | 6d2b66e | 2010-07-14 02:08:35 +0800 | [diff] [blame] | 187 | uint8_t mt; |
| 188 | }; |
| 189 | |
Harald Welte | c0d83b0 | 2010-03-28 15:58:03 +0800 | [diff] [blame] | 190 | struct challoc_signal_data { |
| 191 | struct gsm_bts *bts; |
| 192 | struct gsm_lchan *lchan; |
| 193 | enum gsm_chan_t type; |
| 194 | }; |
| 195 | |
Holger Hans Peter Freyther | 12b917d | 2010-07-29 02:27:27 +0800 | [diff] [blame] | 196 | struct rf_signal_data { |
| 197 | struct gsm_network *net; |
| 198 | }; |
| 199 | |
Holger Hans Peter Freyther | 04144c1 | 2010-12-24 10:15:55 +0100 | [diff] [blame] | 200 | struct sms_signal_data { |
| 201 | /* The transaction where this occured */ |
| 202 | struct gsm_trans *trans; |
| 203 | /* Can be NULL for SMMA */ |
| 204 | struct gsm_sms *sms; |
| 205 | /* int paging result. Only the ones with > 0 */ |
| 206 | int paging_result; |
| 207 | }; |
| 208 | |
Holger Hans Peter Freyther | 08eebd5 | 2010-12-27 13:28:20 +0100 | [diff] [blame] | 209 | struct lchan_signal_data { |
| 210 | /* The lchan the signal happened on */ |
| 211 | struct gsm_lchan *lchan; |
| 212 | /* Measurement reports on this lchan */ |
| 213 | struct gsm_meas_rep *mr; |
| 214 | }; |
| 215 | |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 216 | /* MSC signals */ |
| 217 | enum signal_msc { |
| 218 | S_MSC_LOST, |
| 219 | S_MSC_CONNECTED, |
Holger Hans Peter Freyther | ed0374f | 2011-08-17 17:37:16 +0200 | [diff] [blame] | 220 | S_MSC_AUTHENTICATED, |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 221 | }; |
| 222 | |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 223 | struct bsc_msc_data; |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 224 | struct msc_signal_data { |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 225 | struct bsc_msc_data *data; |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 226 | }; |
| 227 | |
Holger Hans Peter Freyther | 54fa2c7 | 2012-02-03 20:26:25 +0100 | [diff] [blame] | 228 | /* SS_CCCH signals */ |
| 229 | enum signal_ccch { |
| 230 | S_CCCH_PAGING_LOAD, |
| 231 | S_CCCH_RACH_LOAD, |
| 232 | }; |
| 233 | |
| 234 | struct ccch_signal_data { |
| 235 | struct gsm_bts *bts; |
| 236 | uint16_t pg_buf_space; |
| 237 | uint16_t rach_slot_count; |
| 238 | uint16_t rach_busy_count; |
| 239 | uint16_t rach_access_count; |
| 240 | }; |
| 241 | |
Holger Hans Peter Freyther | b100895 | 2015-05-02 19:55:38 +0200 | [diff] [blame] | 242 | /* GPRS SGSN signals SS_SGSN */ |
| 243 | enum signal_sgsn { |
| 244 | S_SGSN_ATTACH, |
| 245 | S_SGSN_DETACH, |
| 246 | S_SGSN_UPDATE, |
| 247 | S_SGSN_PDP_ACT, |
| 248 | S_SGSN_PDP_DEACT, |
| 249 | S_SGSN_PDP_TERMINATE, |
| 250 | S_SGSN_PDP_FREE, |
| 251 | S_SGSN_MM_FREE, |
| 252 | }; |
| 253 | |
| 254 | struct sgsn_mm_ctx; |
| 255 | struct sgsn_signal_data { |
| 256 | struct sgsn_mm_ctx *mm; |
| 257 | struct sgsn_pdp_ctx *pdp; /* non-NULL for PDP_ACT, PDP_DEACT, PDP_FREE */ |
| 258 | }; |
| 259 | |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 260 | #endif |