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 | |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 28 | #include <osmocom/bsc/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, |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 37 | SS_ABISIP, |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 38 | SS_NM, |
Holger Freyther | 7c19f74 | 2009-06-06 13:54:35 +0000 | [diff] [blame] | 39 | SS_LCHAN, |
Harald Welte | c0d83b0 | 2010-03-28 15:58:03 +0800 | [diff] [blame] | 40 | SS_CHALLOC, |
Harald Welte | 549faad | 2010-03-05 19:36:20 +0100 | [diff] [blame] | 41 | SS_IPAC_NWL, |
Holger Hans Peter Freyther | 12b917d | 2010-07-29 02:27:27 +0800 | [diff] [blame] | 42 | SS_RF, |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 43 | SS_MSC, |
Holger Hans Peter Freyther | 6c4d244 | 2011-01-06 13:31:41 +0100 | [diff] [blame] | 44 | SS_HO, |
Holger Hans Peter Freyther | 54fa2c7 | 2012-02-03 20:26:25 +0100 | [diff] [blame] | 45 | SS_CCCH, |
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 | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 54 | /* SS_ABISIP signals */ |
| 55 | enum signal_abisip { |
Holger Hans Peter Freyther | 231163d | 2009-11-18 21:06:12 +0100 | [diff] [blame] | 56 | S_ABISIP_CRCX_ACK, |
Harald Welte | 5e3d91b | 2009-12-19 16:42:06 +0100 | [diff] [blame] | 57 | S_ABISIP_MDCX_ACK, |
Holger Hans Peter Freyther | 231163d | 2009-11-18 21:06:12 +0100 | [diff] [blame] | 58 | S_ABISIP_DLCX_IND, |
Harald Welte | 167df88 | 2009-02-17 14:35:45 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 61 | /* SS_NM signals */ |
| 62 | enum signal_nm { |
| 63 | S_NM_SW_ACTIV_REP, /* GSM 12.21 software activated report */ |
| 64 | S_NM_FAIL_REP, /* GSM 12.21 failure event report */ |
Holger Hans Peter Freyther | 500f3ca | 2009-06-10 10:48:14 +0200 | [diff] [blame] | 65 | 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] | 66 | 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] | 67 | 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] | 68 | S_NM_IPACC_RESTART_ACK, /* nanoBTS has send a restart ack */ |
| 69 | S_NM_IPACC_RESTART_NACK,/* nanoBTS has send a restart ack */ |
Harald Welte | c731038 | 2009-08-08 00:02:36 +0200 | [diff] [blame] | 70 | S_NM_TEST_REP, /* GSM 12.21 Test Report */ |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 71 | S_NM_STATECHG_OPER, /* Operational State changed*/ |
| 72 | S_NM_STATECHG_ADM, /* Administrative State changed */ |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 73 | S_NM_OM2K_CONF_RES, /* OM2K Configuration Result */ |
Neels Hofmeyr | f0ff9a6 | 2018-06-15 20:39:58 +0200 | [diff] [blame] | 74 | S_NM_OPSTART_ACK, /* Received OPSTART ACK, arg is struct msgb *oml_msg */ |
Pau Espin Pedrol | c74daf0 | 2018-11-08 13:53:40 +0100 | [diff] [blame] | 75 | S_NM_GET_ATTR_REP, /* Received Get Attributes Response, arg is struct msgb *oml_msg */ |
Pau Espin Pedrol | 1a7e3cc | 2020-09-17 18:43:50 +0200 | [diff] [blame^] | 76 | S_NM_SET_RADIO_ATTR_ACK, /* Received Set Radio Carrier Attributes Ack, arg is struct msgb *oml_msg */ |
Harald Welte | f9a8cc3 | 2009-05-01 15:39:49 +0000 | [diff] [blame] | 77 | }; |
| 78 | |
Holger Freyther | 7c19f74 | 2009-06-06 13:54:35 +0000 | [diff] [blame] | 79 | /* SS_LCHAN signals */ |
| 80 | enum signal_lchan { |
| 81 | /* |
| 82 | * The lchan got freed with an use_count != 0 and error |
| 83 | * recovery needs to be carried out from within the |
| 84 | * signal handler. |
| 85 | */ |
| 86 | S_LCHAN_UNEXPECTED_RELEASE, |
Harald Welte | d011e8b | 2009-11-29 22:45:52 +0100 | [diff] [blame] | 87 | S_LCHAN_ACTIVATE_ACK, /* 08.58 Channel Activate ACK */ |
| 88 | S_LCHAN_ACTIVATE_NACK, /* 08.58 Channel Activate NACK */ |
| 89 | S_LCHAN_HANDOVER_COMPL, /* 04.08 Handover Completed */ |
| 90 | S_LCHAN_HANDOVER_FAIL, /* 04.08 Handover Failed */ |
Andreas Eversberg | e0cba56 | 2013-06-02 20:46:32 +0200 | [diff] [blame] | 91 | S_LCHAN_ASSIGNMENT_COMPL, /* 04.08 Assignment Completed */ |
| 92 | S_LCHAN_ASSIGNMENT_FAIL, /* 04.08 Assignment Failed */ |
Harald Welte | d011e8b | 2009-11-29 22:45:52 +0100 | [diff] [blame] | 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 | 549faad | 2010-03-05 19:36:20 +0100 | [diff] [blame] | 103 | /* SS_IPAC_NWL signals */ |
| 104 | enum signal_ipaccess { |
| 105 | S_IPAC_NWL_COMPLETE, |
| 106 | }; |
| 107 | |
Harald Welte | 3961fcc | 2009-11-30 19:37:18 +0100 | [diff] [blame] | 108 | enum signal_global { |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 109 | S_GLOBAL_BTS_CLOSE_OM, |
Harald Welte | 3961fcc | 2009-11-30 19:37:18 +0100 | [diff] [blame] | 110 | }; |
| 111 | |
Holger Hans Peter Freyther | 12b917d | 2010-07-29 02:27:27 +0800 | [diff] [blame] | 112 | /* SS_RF signals */ |
| 113 | enum signal_rf { |
| 114 | S_RF_OFF, |
| 115 | S_RF_ON, |
| 116 | S_RF_GRACE, |
| 117 | }; |
| 118 | |
Holger Hans Peter Freyther | 2e83782 | 2009-12-30 08:38:43 +0100 | [diff] [blame] | 119 | struct ipacc_ack_signal_data { |
Holger Hans Peter Freyther | 52fd4e4 | 2010-05-12 23:34:51 +0800 | [diff] [blame] | 120 | struct gsm_bts_trx *trx; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 121 | uint8_t msg_type; |
Holger Hans Peter Freyther | 2e83782 | 2009-12-30 08:38:43 +0100 | [diff] [blame] | 122 | }; |
| 123 | |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 124 | struct abis_om2k_mo; |
| 125 | |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 126 | struct nm_statechg_signal_data { |
Harald Welte | f38ca9a | 2011-03-06 22:11:32 +0100 | [diff] [blame] | 127 | struct gsm_bts *bts; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 128 | uint8_t obj_class; |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 129 | void *obj; |
| 130 | struct gsm_nm_state *old_state; |
| 131 | struct gsm_nm_state *new_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 132 | |
| 133 | /* This pointer is vaold for TS 12.21 MO */ |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 134 | struct abis_om_obj_inst *obj_inst; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 135 | /* This pointer is vaold for RBS2000 MO */ |
| 136 | struct abis_om2k_mo *om2k_mo; |
Harald Welte | f338a03 | 2011-01-14 15:55:42 +0100 | [diff] [blame] | 137 | }; |
| 138 | |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 139 | struct nm_om2k_signal_data { |
| 140 | struct gsm_bts *bts; |
| 141 | void *obj; |
| 142 | struct abis_om2k_mo *om2k_mo; |
| 143 | |
| 144 | uint8_t accordance_ind; |
| 145 | }; |
| 146 | |
Holger Hans Peter Freyther | 6d2b66e | 2010-07-14 02:08:35 +0800 | [diff] [blame] | 147 | struct nm_nack_signal_data { |
| 148 | struct msgb *msg; |
Holger Hans Peter Freyther | de1674a | 2012-11-11 18:26:23 +0100 | [diff] [blame] | 149 | struct gsm_bts *bts; |
Holger Hans Peter Freyther | 6d2b66e | 2010-07-14 02:08:35 +0800 | [diff] [blame] | 150 | uint8_t mt; |
| 151 | }; |
| 152 | |
Harald Welte | 35d07b7 | 2019-05-25 09:39:53 +0200 | [diff] [blame] | 153 | struct nm_fail_rep_signal_data { |
| 154 | struct gsm_bts *bts; |
| 155 | /* raw data */ |
| 156 | struct msgb *msg; |
Oliver Smith | cd1df99 | 2020-03-24 13:37:17 +0100 | [diff] [blame] | 157 | struct tlv_parsed tp; |
Harald Welte | 35d07b7 | 2019-05-25 09:39:53 +0200 | [diff] [blame] | 158 | /* parsed data */ |
| 159 | struct { |
| 160 | const char *event_type; |
| 161 | const char *severity; |
| 162 | const char *additional_text; |
| 163 | const uint8_t *probable_cause; |
| 164 | } parsed; |
| 165 | }; |
| 166 | |
Harald Welte | c0d83b0 | 2010-03-28 15:58:03 +0800 | [diff] [blame] | 167 | struct challoc_signal_data { |
| 168 | struct gsm_bts *bts; |
| 169 | struct gsm_lchan *lchan; |
| 170 | enum gsm_chan_t type; |
| 171 | }; |
| 172 | |
Holger Hans Peter Freyther | 12b917d | 2010-07-29 02:27:27 +0800 | [diff] [blame] | 173 | struct rf_signal_data { |
| 174 | struct gsm_network *net; |
| 175 | }; |
| 176 | |
Holger Hans Peter Freyther | 08eebd5 | 2010-12-27 13:28:20 +0100 | [diff] [blame] | 177 | struct lchan_signal_data { |
| 178 | /* The lchan the signal happened on */ |
| 179 | struct gsm_lchan *lchan; |
| 180 | /* Measurement reports on this lchan */ |
| 181 | struct gsm_meas_rep *mr; |
| 182 | }; |
| 183 | |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 184 | /* MSC signals */ |
| 185 | enum signal_msc { |
| 186 | S_MSC_LOST, |
| 187 | S_MSC_CONNECTED, |
Holger Hans Peter Freyther | ed0374f | 2011-08-17 17:37:16 +0200 | [diff] [blame] | 188 | S_MSC_AUTHENTICATED, |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 189 | }; |
| 190 | |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 191 | struct bsc_msc_data; |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 192 | struct msc_signal_data { |
Neels Hofmeyr | a369e24 | 2017-02-23 21:57:23 +0100 | [diff] [blame] | 193 | struct bsc_msc_data *data; |
Holger Hans Peter Freyther | 0d71163 | 2010-09-16 02:30:36 +0800 | [diff] [blame] | 194 | }; |
| 195 | |
Holger Hans Peter Freyther | 54fa2c7 | 2012-02-03 20:26:25 +0100 | [diff] [blame] | 196 | /* SS_CCCH signals */ |
| 197 | enum signal_ccch { |
| 198 | S_CCCH_PAGING_LOAD, |
| 199 | S_CCCH_RACH_LOAD, |
| 200 | }; |
| 201 | |
| 202 | struct ccch_signal_data { |
| 203 | struct gsm_bts *bts; |
| 204 | uint16_t pg_buf_space; |
| 205 | uint16_t rach_slot_count; |
| 206 | uint16_t rach_busy_count; |
| 207 | uint16_t rach_access_count; |
| 208 | }; |
| 209 | |
Holger Freyther | 2b2d2e3 | 2009-02-14 22:51:00 +0000 | [diff] [blame] | 210 | #endif |