Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1 | /* Ericsson RBS 2xxx GSM O&M (OM2000) messages on the A-bis interface |
| 2 | * implemented based on protocol trace analysis, no formal documentation */ |
| 3 | |
| 4 | /* (C) 2010-2011 by Harald Welte <laforge@gnumonks.org> |
| 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU Affero General Public License as published by |
| 10 | * the Free Software Foundation; either version 3 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU Affero General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Affero General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | |
| 24 | #include <errno.h> |
| 25 | #include <unistd.h> |
| 26 | #include <stdio.h> |
| 27 | #include <stdlib.h> |
| 28 | #include <time.h> |
| 29 | #include <stdint.h> |
| 30 | |
| 31 | #include <arpa/inet.h> |
| 32 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 33 | #include <osmocom/core/msgb.h> |
| 34 | #include <osmocom/gsm/tlv.h> |
| 35 | #include <osmocom/core/talloc.h> |
| 36 | #include <osmocom/core/utils.h> |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 37 | |
| 38 | #include <openbsc/gsm_data.h> |
| 39 | #include <openbsc/debug.h> |
| 40 | #include <openbsc/abis_nm.h> |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 41 | #include <openbsc/abis_om2000.h> |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 42 | #include <openbsc/signal.h> |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 43 | #include <osmocom/abis/e1_input.h> |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 44 | |
| 45 | #define OM_ALLOC_SIZE 1024 |
| 46 | #define OM_HEADROOM_SIZE 128 |
| 47 | |
| 48 | /* use following functions from abis_nm.c: |
| 49 | * om2k_msgb_alloc() |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 50 | * abis_om2k_sendmsg() |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 51 | */ |
| 52 | |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 53 | struct abis_om2k_hdr { |
| 54 | struct abis_om_hdr om; |
| 55 | uint16_t msg_type; |
| 56 | struct abis_om2k_mo mo; |
| 57 | uint8_t data[0]; |
| 58 | } __attribute__ ((packed)); |
| 59 | |
| 60 | enum abis_om2k_msgtype { |
| 61 | OM2K_MSGT_ABORT_SP_CMD = 0x0000, |
| 62 | OM2K_MSGT_ABORT_SP_COMPL = 0x0002, |
| 63 | OM2K_MSGT_ALARM_REP_ACK = 0x0004, |
| 64 | OM2K_MSGT_ALARM_REP_NACK = 0x0005, |
| 65 | OM2K_MSGT_ALARM_REP = 0x0006, |
| 66 | OM2K_MSGT_ALARM_STATUS_REQ = 0x0008, |
| 67 | OM2K_MSGT_ALARM_STATUS_REQ_ACK = 0x000a, |
| 68 | OM2K_MSGT_ALARM_STATUS_REQ_REJ = 0x000b, |
| 69 | OM2K_MSGT_ALARM_STATUS_RES_ACK = 0x000c, |
| 70 | OM2K_MSGT_ALARM_STATUS_RES_NACK = 0x000d, |
| 71 | OM2K_MSGT_ALARM_STATUS_RES = 0x000e, |
| 72 | OM2K_MSGT_CAL_TIME_RESP = 0x0010, |
| 73 | OM2K_MSGT_CAL_TIME_REJ = 0x0011, |
| 74 | OM2K_MSGT_CAL_TIME_REQ = 0x0012, |
| 75 | |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 76 | OM2K_MSGT_CON_CONF_REQ = 0x0014, |
| 77 | OM2K_MSGT_CON_CONF_REQ_ACK = 0x0016, |
| 78 | OM2K_MSGT_CON_CONF_REQ_REJ = 0x0017, |
| 79 | OM2K_MSGT_CON_CONF_RES_ACK = 0x0018, |
| 80 | OM2K_MSGT_CON_CONF_RES_NACK = 0x0019, |
| 81 | OM2K_MSGT_CON_CONF_RES = 0x001a, |
| 82 | |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 83 | OM2K_MSGT_CONNECT_CMD = 0x001c, |
| 84 | OM2K_MSGT_CONNECT_COMPL = 0x001e, |
| 85 | OM2K_MSGT_CONNECT_REJ = 0x001f, |
| 86 | |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 87 | OM2K_MSGT_DISABLE_REQ = 0x0028, |
| 88 | OM2K_MSGT_DISABLE_REQ_ACK = 0x002a, |
| 89 | OM2K_MSGT_DISABLE_REQ_REJ = 0x002b, |
| 90 | OM2K_MSGT_DISABLE_RES_ACK = 0x002c, |
| 91 | OM2K_MSGT_DISABLE_RES_NACK = 0x002d, |
| 92 | OM2K_MSGT_DISABLE_RES = 0x002e, |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 93 | OM2K_MSGT_DISCONNECT_CMD = 0x0030, |
| 94 | OM2K_MSGT_DISCONNECT_COMPL = 0x0032, |
| 95 | OM2K_MSGT_DISCONNECT_REJ = 0x0033, |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 96 | OM2K_MSGT_ENABLE_REQ = 0x0034, |
| 97 | OM2K_MSGT_ENABLE_REQ_ACK = 0x0036, |
| 98 | OM2K_MSGT_ENABLE_REQ_REJ = 0x0037, |
| 99 | OM2K_MSGT_ENABLE_RES_ACK = 0x0038, |
| 100 | OM2K_MSGT_ENABLE_RES_NACK = 0x0039, |
| 101 | OM2K_MSGT_ENABLE_RES = 0x003a, |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 102 | |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 103 | OM2K_MSGT_FAULT_REP_ACK = 0x0040, |
| 104 | OM2K_MSGT_FAULT_REP_NACK = 0x0041, |
| 105 | OM2K_MSGT_FAULT_REP = 0x0042, |
| 106 | |
| 107 | OM2K_MSGT_IS_CONF_REQ = 0x0060, |
| 108 | OM2K_MSGT_IS_CONF_REQ_ACK = 0x0062, |
| 109 | OM2K_MSGT_IS_CONF_REQ_REJ = 0x0063, |
| 110 | OM2K_MSGT_IS_CONF_RES_ACK = 0x0064, |
| 111 | OM2K_MSGT_IS_CONF_RES_NACK = 0x0065, |
| 112 | OM2K_MSGT_IS_CONF_RES = 0x0066, |
| 113 | |
| 114 | OM2K_MSGT_OP_INFO = 0x0074, |
| 115 | OM2K_MSGT_OP_INFO_ACK = 0x0076, |
| 116 | OM2K_MSGT_OP_INFO_REJ = 0x0077, |
| 117 | OM2K_MSGT_RESET_CMD = 0x0078, |
| 118 | OM2K_MSGT_RESET_COMPL = 0x007a, |
| 119 | OM2K_MSGT_RESET_REJ = 0x007b, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 120 | OM2K_MSGT_RX_CONF_REQ = 0x007c, |
| 121 | OM2K_MSGT_RX_CONF_REQ_ACK = 0x007e, |
| 122 | OM2K_MSGT_RX_CONF_REQ_REJ = 0x007f, |
| 123 | OM2K_MSGT_RX_CONF_RES_ACK = 0x0080, |
| 124 | OM2K_MSGT_RX_CONF_RES_NACK = 0x0081, |
| 125 | OM2K_MSGT_RX_CONF_RES = 0x0082, |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 126 | OM2K_MSGT_START_REQ = 0x0084, |
| 127 | OM2K_MSGT_START_REQ_ACK = 0x0086, |
| 128 | OM2K_MSGT_START_REQ_REJ = 0x0087, |
| 129 | OM2K_MSGT_START_RES_ACK = 0x0088, |
| 130 | OM2K_MSGT_START_RES_NACK = 0x0089, |
| 131 | OM2K_MSGT_START_RES = 0x008a, |
Harald Welte | e1d5eca | 2011-02-12 14:42:59 +0100 | [diff] [blame] | 132 | OM2K_MSGT_STATUS_REQ = 0x008c, |
| 133 | OM2K_MSGT_STATUS_RESP = 0x008e, |
| 134 | OM2K_MSGT_STATUS_REJ = 0x008f, |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 135 | |
Harald Welte | 8024d8f | 2011-02-12 15:07:30 +0100 | [diff] [blame] | 136 | OM2K_MSGT_TEST_REQ = 0x0094, |
| 137 | OM2K_MSGT_TEST_REQ_ACK = 0x0096, |
| 138 | OM2K_MSGT_TEST_REQ_REJ = 0x0097, |
| 139 | OM2K_MSGT_TEST_RES_ACK = 0x0098, |
| 140 | OM2K_MSGT_TEST_RES_NACK = 0x0099, |
| 141 | OM2K_MSGT_TEST_RES = 0x009a, |
| 142 | |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 143 | OM2K_MSGT_TF_CONF_REQ = 0x00a0, |
| 144 | OM2K_MSGT_TF_CONF_REQ_ACK = 0x00a2, |
| 145 | OM2K_MSGT_TF_CONF_REQ_REJ = 0x00a3, |
| 146 | OM2K_MSGT_TF_CONF_RES_ACK = 0x00a4, |
| 147 | OM2K_MSGT_TF_CONF_RES_NACK = 0x00a5, |
| 148 | OM2K_MSGT_TF_CONF_RES = 0x00a6, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 149 | OM2K_MSGT_TS_CONF_REQ = 0x00a8, |
| 150 | OM2K_MSGT_TS_CONF_REQ_ACK = 0x00aa, |
| 151 | OM2K_MSGT_TS_CONF_REQ_REJ = 0x00ab, |
| 152 | OM2K_MSGT_TS_CONF_RES_ACK = 0x00ac, |
| 153 | OM2K_MSGT_TS_CONF_RES_NACK = 0x00ad, |
| 154 | OM2K_MSGT_TS_CONF_RES = 0x00ae, |
| 155 | OM2K_MSGT_TX_CONF_REQ = 0x00b0, |
| 156 | OM2K_MSGT_TX_CONF_REQ_ACK = 0x00b2, |
| 157 | OM2K_MSGT_TX_CONF_REQ_REJ = 0x00b3, |
| 158 | OM2K_MSGT_TX_CONF_RES_ACK = 0x00b4, |
| 159 | OM2K_MSGT_TX_CONF_RES_NACK = 0x00b5, |
| 160 | OM2K_MSGT_TX_CONF_RES = 0x00b6, |
| 161 | |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 162 | OM2K_MSGT_NEGOT_REQ_ACK = 0x0104, |
| 163 | OM2K_MSGT_NEGOT_REQ_NACK = 0x0105, |
| 164 | OM2K_MSGT_NEGOT_REQ = 0x0106, |
| 165 | }; |
| 166 | |
| 167 | enum abis_om2k_dei { |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 168 | OM2K_DEI_ACCORDANCE_IND = 0x00, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 169 | OM2K_DEI_BCC = 0x06, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 170 | OM2K_DEI_BS_AG_BKS_RES = 0x07, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 171 | OM2K_DEI_BSIC = 0x09, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 172 | OM2K_DEI_BA_PA_MFRMS = 0x0a, |
| 173 | OM2K_DEI_CBCH_INDICATOR = 0x0b, |
| 174 | OM2K_DEI_CCCH_OPTIONS = 0x0c, |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 175 | OM2K_DEI_CAL_TIME = 0x0d, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 176 | OM2K_DEI_COMBINATION = 0x0f, |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 177 | OM2K_DEI_CON_CONN_LIST = 0x10, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 178 | OM2K_DEI_DRX_DEV_MAX = 0x12, |
Harald Welte | 8bcb1a0 | 2011-02-12 20:23:40 +0100 | [diff] [blame] | 179 | OM2K_DEI_END_LIST_NR = 0x13, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 180 | OM2K_DEI_EXT_COND_MAP_1 = 0x14, |
| 181 | OM2K_DEI_EXT_COND_MAP_2 = 0x15, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 182 | OM2K_DEI_FILLING_MARKER = 0x1c, |
| 183 | OM2K_DEI_FN_OFFSET = 0x1d, |
| 184 | OM2K_DEI_FREQ_LIST = 0x1e, |
| 185 | OM2K_DEI_FREQ_SPEC_RX = 0x1f, |
| 186 | OM2K_DEI_FREQ_SPEC_TX = 0x20, |
| 187 | OM2K_DEI_HSN = 0x21, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 188 | OM2K_DEI_ICM_INDICATOR = 0x22, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 189 | OM2K_DEI_INT_FAULT_MAP_1A = 0x23, |
| 190 | OM2K_DEI_INT_FAULT_MAP_1B = 0x24, |
| 191 | OM2K_DEI_INT_FAULT_MAP_2A = 0x25, |
| 192 | OM2K_DEI_INT_FAULT_MAP_2A_EXT = 0x26, |
Harald Welte | 8bcb1a0 | 2011-02-12 20:23:40 +0100 | [diff] [blame] | 193 | OM2K_DEI_IS_CONN_LIST = 0x27, |
| 194 | OM2K_DEI_LIST_NR = 0x28, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 195 | OM2K_DEI_LOCAL_ACCESS = 0x2a, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 196 | OM2K_DEI_MAIO = 0x2b, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 197 | OM2K_DEI_MO_STATE = 0x2c, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 198 | OM2K_DEI_NY1 = 0x2d, |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 199 | OM2K_DEI_OP_INFO = 0x2e, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 200 | OM2K_DEI_POWER = 0x2f, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 201 | OM2K_DEI_REASON_CODE = 0x32, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 202 | OM2K_DEI_RX_DIVERSITY = 0x33, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 203 | OM2K_DEI_RESULT_CODE = 0x35, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 204 | OM2K_DEI_T3105 = 0x38, |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 205 | OM2K_DEI_TF_MODE = 0x3a, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 206 | OM2K_DEI_TS_NR = 0x3c, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 207 | OM2K_DEI_TSC = 0x3d, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 208 | OM2K_DEI_BTS_VERSION = 0x40, |
| 209 | OM2K_DEI_OML_IWD_VERSION = 0x41, |
| 210 | OM2K_DEI_RSL_IWD_VERSION = 0x42, |
| 211 | OM2K_DEI_OML_FUNC_MAP_1 = 0x43, |
| 212 | OM2K_DEI_OML_FUNC_MAP_2 = 0x44, |
| 213 | OM2K_DEI_RSL_FUNC_MAP_1 = 0x45, |
| 214 | OM2K_DEI_RSL_FUNC_MAP_2 = 0x46, |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 215 | OM2K_DEI_EXT_RANGE = 0x47, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 216 | OM2K_DEI_REQ_IND = 0x48, |
| 217 | OM2K_DEI_REPL_UNIT_MAP = 0x50, |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 218 | OM2K_DEI_ICM_BOUND_PARAMS = 0x74, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 219 | OM2K_DEI_LSC = 0x79, |
| 220 | OM2K_DEI_LSC_FILT_TIME = 0x7a, |
| 221 | OM2K_DEI_CALL_SUPV_TIME = 0x7b, |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 222 | OM2K_DEI_ICM_CHAN_RATE = 0x7e, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 223 | OM2K_DEI_HW_INFO_SIG = 0x84, |
Harald Welte | ba9adbb | 2011-03-06 19:01:16 +0100 | [diff] [blame] | 224 | OM2K_DEI_TF_SYNC_SRC = 0x86, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 225 | OM2K_DEI_TTA = 0x87, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 226 | OM2K_DEI_CAPA_SIG = 0x8a, |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 227 | OM2K_DEI_NEGOT_REC1 = 0x90, |
| 228 | OM2K_DEI_NEGOT_REC2 = 0x91, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 229 | OM2K_DEI_ENCR_ALG = 0x92, |
| 230 | OM2K_DEI_INTERF_REJ_COMB = 0x94, |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 231 | OM2K_DEI_FS_OFFSET = 0x98, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 232 | OM2K_DEI_EXT_COND_MAP_2_EXT = 0x9c, |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 233 | }; |
| 234 | |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 235 | const struct tlv_definition om2k_att_tlvdef = { |
| 236 | .def = { |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 237 | [OM2K_DEI_ACCORDANCE_IND] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 238 | [OM2K_DEI_BCC] = { TLV_TYPE_TV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 239 | [OM2K_DEI_BS_AG_BKS_RES] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 240 | [OM2K_DEI_BSIC] = { TLV_TYPE_TV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 241 | [OM2K_DEI_BA_PA_MFRMS] = { TLV_TYPE_TV }, |
| 242 | [OM2K_DEI_CBCH_INDICATOR] = { TLV_TYPE_TV }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 243 | [OM2K_DEI_INT_FAULT_MAP_1A] = { TLV_TYPE_FIXED, 6 }, |
| 244 | [OM2K_DEI_INT_FAULT_MAP_1B] = { TLV_TYPE_FIXED, 6 }, |
| 245 | [OM2K_DEI_INT_FAULT_MAP_2A] = { TLV_TYPE_FIXED, 6 }, |
| 246 | [OM2K_DEI_INT_FAULT_MAP_2A_EXT]={ TLV_TYPE_FIXED, 6 }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 247 | [OM2K_DEI_CCCH_OPTIONS] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 248 | [OM2K_DEI_CAL_TIME] = { TLV_TYPE_FIXED, 6 }, |
| 249 | [OM2K_DEI_COMBINATION] = { TLV_TYPE_TV }, |
| 250 | [OM2K_DEI_CON_CONN_LIST] = { TLV_TYPE_TLV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 251 | [OM2K_DEI_DRX_DEV_MAX] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 252 | [OM2K_DEI_END_LIST_NR] = { TLV_TYPE_TV }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 253 | [OM2K_DEI_EXT_COND_MAP_1] = { TLV_TYPE_FIXED, 2 }, |
| 254 | [OM2K_DEI_EXT_COND_MAP_2] = { TLV_TYPE_FIXED, 2 }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 255 | [OM2K_DEI_FILLING_MARKER] = { TLV_TYPE_TV }, |
| 256 | [OM2K_DEI_FN_OFFSET] = { TLV_TYPE_FIXED, 2 }, |
| 257 | [OM2K_DEI_FREQ_LIST] = { TLV_TYPE_TLV }, |
| 258 | [OM2K_DEI_FREQ_SPEC_RX] = { TLV_TYPE_FIXED, 2 }, |
| 259 | [OM2K_DEI_FREQ_SPEC_TX] = { TLV_TYPE_FIXED, 2 }, |
| 260 | [OM2K_DEI_HSN] = { TLV_TYPE_TV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 261 | [OM2K_DEI_ICM_INDICATOR] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 262 | [OM2K_DEI_IS_CONN_LIST] = { TLV_TYPE_TLV }, |
| 263 | [OM2K_DEI_LIST_NR] = { TLV_TYPE_TV }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 264 | [OM2K_DEI_LOCAL_ACCESS] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 265 | [OM2K_DEI_MAIO] = { TLV_TYPE_TV }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 266 | [OM2K_DEI_MO_STATE] = { TLV_TYPE_TV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 267 | [OM2K_DEI_NY1] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 268 | [OM2K_DEI_OP_INFO] = { TLV_TYPE_TV }, |
| 269 | [OM2K_DEI_POWER] = { TLV_TYPE_TV }, |
| 270 | [OM2K_DEI_REASON_CODE] = { TLV_TYPE_TV }, |
| 271 | [OM2K_DEI_RX_DIVERSITY] = { TLV_TYPE_TV }, |
| 272 | [OM2K_DEI_RESULT_CODE] = { TLV_TYPE_TV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 273 | [OM2K_DEI_T3105] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 274 | [OM2K_DEI_TF_MODE] = { TLV_TYPE_TV }, |
| 275 | [OM2K_DEI_TS_NR] = { TLV_TYPE_TV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 276 | [OM2K_DEI_TSC] = { TLV_TYPE_TV }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 277 | [OM2K_DEI_BTS_VERSION] = { TLV_TYPE_FIXED, 12 }, |
| 278 | [OM2K_DEI_OML_IWD_VERSION] = { TLV_TYPE_FIXED, 6 }, |
| 279 | [OM2K_DEI_RSL_IWD_VERSION] = { TLV_TYPE_FIXED, 6 }, |
| 280 | [OM2K_DEI_OML_FUNC_MAP_1] = { TLV_TYPE_TLV }, |
| 281 | [OM2K_DEI_OML_FUNC_MAP_2] = { TLV_TYPE_TLV }, |
| 282 | [OM2K_DEI_RSL_FUNC_MAP_1] = { TLV_TYPE_TLV }, |
| 283 | [OM2K_DEI_RSL_FUNC_MAP_2] = { TLV_TYPE_TLV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 284 | [OM2K_DEI_EXT_RANGE] = { TLV_TYPE_TV }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 285 | [OM2K_DEI_REQ_IND] = { TLV_TYPE_TV }, |
| 286 | [OM2K_DEI_REPL_UNIT_MAP] = { TLV_TYPE_FIXED, 6 }, |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 287 | [OM2K_DEI_ICM_BOUND_PARAMS] = { TLV_TYPE_FIXED, 5 }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 288 | [OM2K_DEI_LSC] = { TLV_TYPE_TV }, |
| 289 | [OM2K_DEI_LSC_FILT_TIME] = { TLV_TYPE_TV }, |
| 290 | [OM2K_DEI_CALL_SUPV_TIME] = { TLV_TYPE_TV }, |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 291 | [OM2K_DEI_ICM_CHAN_RATE] = { TLV_TYPE_TV }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 292 | [OM2K_DEI_HW_INFO_SIG] = { TLV_TYPE_FIXED, 2 }, |
Harald Welte | ba9adbb | 2011-03-06 19:01:16 +0100 | [diff] [blame] | 293 | [OM2K_DEI_TF_SYNC_SRC] = { TLV_TYPE_TV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 294 | [OM2K_DEI_TTA] = { TLV_TYPE_TV }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 295 | [OM2K_DEI_CAPA_SIG] = { TLV_TYPE_FIXED, 2 }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 296 | [OM2K_DEI_NEGOT_REC1] = { TLV_TYPE_TLV }, |
| 297 | [OM2K_DEI_NEGOT_REC2] = { TLV_TYPE_TLV }, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 298 | [OM2K_DEI_ENCR_ALG] = { TLV_TYPE_TV }, |
| 299 | [OM2K_DEI_INTERF_REJ_COMB] = { TLV_TYPE_TV }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 300 | [OM2K_DEI_FS_OFFSET] = { TLV_TYPE_FIXED, 5 }, |
Harald Welte | f6d6b21 | 2011-03-05 20:13:52 +0100 | [diff] [blame] | 301 | [OM2K_DEI_EXT_COND_MAP_2_EXT] = { TLV_TYPE_FIXED, 4 }, |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 302 | }, |
| 303 | }; |
| 304 | |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 305 | static const struct value_string om2k_msgcode_vals[] = { |
| 306 | { 0x0000, "Abort SP Command" }, |
| 307 | { 0x0002, "Abort SP Complete" }, |
| 308 | { 0x0004, "Alarm Report ACK" }, |
| 309 | { 0x0005, "Alarm Report NACK" }, |
| 310 | { 0x0006, "Alarm Report" }, |
| 311 | { 0x0008, "Alarm Status Request" }, |
| 312 | { 0x000a, "Alarm Status Request Accept" }, |
| 313 | { 0x000b, "Alarm Status Request Reject" }, |
| 314 | { 0x000c, "Alarm Status Result ACK" }, |
| 315 | { 0x000d, "Alarm Status Result NACK" }, |
| 316 | { 0x000e, "Alarm Status Result" }, |
| 317 | { 0x0010, "Calendar Time Response" }, |
| 318 | { 0x0011, "Calendar Time Reject" }, |
| 319 | { 0x0012, "Calendar Time Request" }, |
| 320 | { 0x0014, "CON Configuration Request" }, |
| 321 | { 0x0016, "CON Configuration Request Accept" }, |
| 322 | { 0x0017, "CON Configuration Request Reject" }, |
| 323 | { 0x0018, "CON Configuration Result ACK" }, |
| 324 | { 0x0019, "CON Configuration Result NACK" }, |
| 325 | { 0x001a, "CON Configuration Result" }, |
| 326 | { 0x001c, "Connect Command" }, |
| 327 | { 0x001e, "Connect Complete" }, |
Harald Welte | 3ede723 | 2011-03-05 17:58:13 +0100 | [diff] [blame] | 328 | { 0x001f, "Connect Reject" }, |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 329 | { 0x0028, "Disable Request" }, |
| 330 | { 0x002a, "Disable Request Accept" }, |
| 331 | { 0x002b, "Disable Request Reject" }, |
| 332 | { 0x002c, "Disable Result ACK" }, |
| 333 | { 0x002d, "Disable Result NACK" }, |
| 334 | { 0x002e, "Disable Result" }, |
| 335 | { 0x0030, "Disconnect Command" }, |
| 336 | { 0x0032, "Disconnect Complete" }, |
| 337 | { 0x0033, "Disconnect Reject" }, |
| 338 | { 0x0034, "Enable Request" }, |
| 339 | { 0x0036, "Enable Request Accept" }, |
| 340 | { 0x0037, "Enable Request Reject" }, |
| 341 | { 0x0038, "Enable Result ACK" }, |
| 342 | { 0x0039, "Enable Result NACK" }, |
| 343 | { 0x003a, "Enable Result" }, |
| 344 | { 0x003c, "Escape Downlink Normal" }, |
| 345 | { 0x003d, "Escape Downlink NACK" }, |
| 346 | { 0x003e, "Escape Uplink Normal" }, |
| 347 | { 0x003f, "Escape Uplink NACK" }, |
| 348 | { 0x0040, "Fault Report ACK" }, |
| 349 | { 0x0041, "Fault Report NACK" }, |
| 350 | { 0x0042, "Fault Report" }, |
| 351 | { 0x0044, "File Package End Command" }, |
| 352 | { 0x0046, "File Package End Result" }, |
| 353 | { 0x0047, "File Package End Reject" }, |
| 354 | { 0x0048, "File Relation Request" }, |
| 355 | { 0x004a, "File Relation Response" }, |
| 356 | { 0x004b, "File Relation Request Reject" }, |
| 357 | { 0x004c, "File Segment Transfer" }, |
| 358 | { 0x004e, "File Segment Transfer Complete" }, |
| 359 | { 0x004f, "File Segment Transfer Reject" }, |
| 360 | { 0x0050, "HW Information Request" }, |
| 361 | { 0x0052, "HW Information Request Accept" }, |
| 362 | { 0x0053, "HW Information Request Reject" }, |
| 363 | { 0x0054, "HW Information Result ACK" }, |
| 364 | { 0x0055, "HW Information Result NACK" }, |
| 365 | { 0x0056, "HW Information Result" }, |
| 366 | { 0x0060, "IS Configuration Request" }, |
| 367 | { 0x0062, "IS Configuration Request Accept" }, |
| 368 | { 0x0063, "IS Configuration Request Reject" }, |
| 369 | { 0x0064, "IS Configuration Result ACK" }, |
| 370 | { 0x0065, "IS Configuration Result NACK" }, |
| 371 | { 0x0066, "IS Configuration Result" }, |
| 372 | { 0x0068, "Load Data End" }, |
| 373 | { 0x006a, "Load Data End Result" }, |
| 374 | { 0x006b, "Load Data End Reject" }, |
| 375 | { 0x006c, "Load Data Init" }, |
| 376 | { 0x006e, "Load Data Init Accept" }, |
| 377 | { 0x006f, "Load Data Init Reject" }, |
| 378 | { 0x0070, "Loop Control Command" }, |
| 379 | { 0x0072, "Loop Control Complete" }, |
| 380 | { 0x0073, "Loop Control Reject" }, |
| 381 | { 0x0074, "Operational Information" }, |
| 382 | { 0x0076, "Operational Information Accept" }, |
| 383 | { 0x0077, "Operational Information Reject" }, |
| 384 | { 0x0078, "Reset Command" }, |
| 385 | { 0x007a, "Reset Complete" }, |
| 386 | { 0x007b, "Reset Reject" }, |
| 387 | { 0x007c, "RX Configuration Request" }, |
| 388 | { 0x007e, "RX Configuration Request Accept" }, |
| 389 | { 0x007f, "RX Configuration Request Reject" }, |
| 390 | { 0x0080, "RX Configuration Result ACK" }, |
| 391 | { 0x0081, "RX Configuration Result NACK" }, |
| 392 | { 0x0082, "RX Configuration Result" }, |
| 393 | { 0x0084, "Start Request" }, |
| 394 | { 0x0086, "Start Request Accept" }, |
| 395 | { 0x0087, "Start Request Reject" }, |
| 396 | { 0x0088, "Start Result ACK" }, |
| 397 | { 0x0089, "Start Result NACK" }, |
| 398 | { 0x008a, "Start Result" }, |
| 399 | { 0x008c, "Status Request" }, |
| 400 | { 0x008e, "Status Response" }, |
| 401 | { 0x008f, "Status Reject" }, |
| 402 | { 0x0094, "Test Request" }, |
| 403 | { 0x0096, "Test Request Accept" }, |
| 404 | { 0x0097, "Test Request Reject" }, |
| 405 | { 0x0098, "Test Result ACK" }, |
| 406 | { 0x0099, "Test Result NACK" }, |
| 407 | { 0x009a, "Test Result" }, |
| 408 | { 0x00a0, "TF Configuration Request" }, |
| 409 | { 0x00a2, "TF Configuration Request Accept" }, |
| 410 | { 0x00a3, "TF Configuration Request Reject" }, |
| 411 | { 0x00a4, "TF Configuration Result ACK" }, |
| 412 | { 0x00a5, "TF Configuration Result NACK" }, |
| 413 | { 0x00a6, "TF Configuration Result" }, |
| 414 | { 0x00a8, "TS Configuration Request" }, |
| 415 | { 0x00aa, "TS Configuration Request Accept" }, |
| 416 | { 0x00ab, "TS Configuration Request Reject" }, |
| 417 | { 0x00ac, "TS Configuration Result ACK" }, |
| 418 | { 0x00ad, "TS Configuration Result NACK" }, |
| 419 | { 0x00ae, "TS Configuration Result" }, |
| 420 | { 0x00b0, "TX Configuration Request" }, |
| 421 | { 0x00b2, "TX Configuration Request Accept" }, |
| 422 | { 0x00b3, "TX Configuration Request Reject" }, |
| 423 | { 0x00b4, "TX Configuration Result ACK" }, |
| 424 | { 0x00b5, "TX Configuration Result NACK" }, |
| 425 | { 0x00b6, "TX Configuration Result" }, |
| 426 | { 0x00bc, "DIP Alarm Report ACK" }, |
| 427 | { 0x00bd, "DIP Alarm Report NACK" }, |
| 428 | { 0x00be, "DIP Alarm Report" }, |
| 429 | { 0x00c0, "DIP Alarm Status Request" }, |
| 430 | { 0x00c2, "DIP Alarm Status Response" }, |
| 431 | { 0x00c3, "DIP Alarm Status Reject" }, |
| 432 | { 0x00c4, "DIP Quality Report I ACK" }, |
| 433 | { 0x00c5, "DIP Quality Report I NACK" }, |
| 434 | { 0x00c6, "DIP Quality Report I" }, |
| 435 | { 0x00c8, "DIP Quality Report II ACK" }, |
| 436 | { 0x00c9, "DIP Quality Report II NACK" }, |
| 437 | { 0x00ca, "DIP Quality Report II" }, |
| 438 | { 0x00dc, "DP Configuration Request" }, |
| 439 | { 0x00de, "DP Configuration Request Accept" }, |
| 440 | { 0x00df, "DP Configuration Request Reject" }, |
| 441 | { 0x00e0, "DP Configuration Result ACK" }, |
| 442 | { 0x00e1, "DP Configuration Result NACK" }, |
| 443 | { 0x00e2, "DP Configuration Result" }, |
| 444 | { 0x00e4, "Capabilities HW Info Report ACK" }, |
| 445 | { 0x00e5, "Capabilities HW Info Report NACK" }, |
| 446 | { 0x00e6, "Capabilities HW Info Report" }, |
| 447 | { 0x00e8, "Capabilities Request" }, |
| 448 | { 0x00ea, "Capabilities Request Accept" }, |
| 449 | { 0x00eb, "Capabilities Request Reject" }, |
| 450 | { 0x00ec, "Capabilities Result ACK" }, |
| 451 | { 0x00ed, "Capabilities Result NACK" }, |
| 452 | { 0x00ee, "Capabilities Result" }, |
| 453 | { 0x00f0, "FM Configuration Request" }, |
| 454 | { 0x00f2, "FM Configuration Request Accept" }, |
| 455 | { 0x00f3, "FM Configuration Request Reject" }, |
| 456 | { 0x00f4, "FM Configuration Result ACK" }, |
| 457 | { 0x00f5, "FM Configuration Result NACK" }, |
| 458 | { 0x00f6, "FM Configuration Result" }, |
| 459 | { 0x00f8, "FM Report Request" }, |
| 460 | { 0x00fa, "FM Report Response" }, |
| 461 | { 0x00fb, "FM Report Reject" }, |
| 462 | { 0x00fc, "FM Start Command" }, |
| 463 | { 0x00fe, "FM Start Complete" }, |
| 464 | { 0x00ff, "FM Start Reject" }, |
| 465 | { 0x0100, "FM Stop Command" }, |
| 466 | { 0x0102, "FM Stop Complete" }, |
| 467 | { 0x0103, "FM Stop Reject" }, |
| 468 | { 0x0104, "Negotiation Request ACK" }, |
| 469 | { 0x0105, "Negotiation Request NACK" }, |
| 470 | { 0x0106, "Negotiation Request" }, |
| 471 | { 0x0108, "BTS Initiated Request ACK" }, |
| 472 | { 0x0109, "BTS Initiated Request NACK" }, |
| 473 | { 0x010a, "BTS Initiated Request" }, |
| 474 | { 0x010c, "Radio Channels Release Command" }, |
| 475 | { 0x010e, "Radio Channels Release Complete" }, |
| 476 | { 0x010f, "Radio Channels Release Reject" }, |
| 477 | { 0x0118, "Feature Control Command" }, |
| 478 | { 0x011a, "Feature Control Complete" }, |
| 479 | { 0x011b, "Feature Control Reject" }, |
| 480 | |
| 481 | { 0, NULL } |
| 482 | }; |
| 483 | |
| 484 | /* TS 12.21 Section 9.4: Attributes */ |
| 485 | static const struct value_string om2k_attr_vals[] = { |
| 486 | { 0x00, "Accordance indication" }, |
| 487 | { 0x01, "Alarm Id" }, |
| 488 | { 0x02, "Alarm Data" }, |
| 489 | { 0x03, "Alarm Severity" }, |
| 490 | { 0x04, "Alarm Status" }, |
| 491 | { 0x05, "Alarm Status Type" }, |
| 492 | { 0x06, "BCC" }, |
| 493 | { 0x07, "BS_AG_BKS_RES" }, |
| 494 | { 0x09, "BSIC" }, |
| 495 | { 0x0a, "BA_PA_MFRMS" }, |
| 496 | { 0x0b, "CBCH Indicator" }, |
| 497 | { 0x0c, "CCCH Options" }, |
| 498 | { 0x0d, "Calendar Time" }, |
| 499 | { 0x0f, "Channel Combination" }, |
| 500 | { 0x10, "CON Connection List" }, |
| 501 | { 0x11, "Data End Indication" }, |
| 502 | { 0x12, "DRX_DEV_MAX" }, |
| 503 | { 0x13, "End List Number" }, |
| 504 | { 0x14, "External Condition Map Class 1" }, |
| 505 | { 0x15, "External Condition Map Class 2" }, |
| 506 | { 0x16, "File Relation Indication" }, |
| 507 | { 0x17, "File Revision" }, |
| 508 | { 0x18, "File Segment Data" }, |
| 509 | { 0x19, "File Segment Length" }, |
| 510 | { 0x1a, "File Segment Sequence Number" }, |
| 511 | { 0x1b, "File Size" }, |
| 512 | { 0x1c, "Filling Marker" }, |
| 513 | { 0x1d, "FN Offset" }, |
| 514 | { 0x1e, "Frequency List" }, |
| 515 | { 0x1f, "Frequency Specifier RX" }, |
| 516 | { 0x20, "Frequency Specifier TX" }, |
| 517 | { 0x21, "HSN" }, |
| 518 | { 0x22, "ICM Indicator" }, |
| 519 | { 0x23, "Internal Fault Map Class 1A" }, |
| 520 | { 0x24, "Internal Fault Map Class 1B" }, |
| 521 | { 0x25, "Internal Fault Map Class 2A" }, |
| 522 | { 0x26, "Internal Fault Map Class 2A Extension" }, |
| 523 | { 0x27, "IS Connection List" }, |
| 524 | { 0x28, "List Number" }, |
| 525 | { 0x29, "File Package State Indication" }, |
| 526 | { 0x2a, "Local Access State" }, |
| 527 | { 0x2b, "MAIO" }, |
| 528 | { 0x2c, "MO State" }, |
| 529 | { 0x2d, "Ny1" }, |
| 530 | { 0x2e, "Operational Information" }, |
| 531 | { 0x2f, "Power" }, |
| 532 | { 0x30, "RU Position Data" }, |
| 533 | { 0x31, "Protocol Error" }, |
| 534 | { 0x32, "Reason Code" }, |
| 535 | { 0x33, "Receiver Diversity" }, |
| 536 | { 0x34, "Replacement Unit Map" }, |
| 537 | { 0x35, "Result Code" }, |
| 538 | { 0x36, "RU Revision Data" }, |
| 539 | { 0x38, "T3105" }, |
| 540 | { 0x39, "Test Loop Setting" }, |
| 541 | { 0x3a, "TF Mode" }, |
| 542 | { 0x3b, "TF Compensation Value" }, |
| 543 | { 0x3c, "Time Slot Number" }, |
| 544 | { 0x3d, "TSC" }, |
| 545 | { 0x3e, "RU Logical Id" }, |
| 546 | { 0x3f, "RU Serial Number Data" }, |
| 547 | { 0x40, "BTS Version" }, |
| 548 | { 0x41, "OML IWD Version" }, |
| 549 | { 0x42, "RWL IWD Version" }, |
| 550 | { 0x43, "OML Function Map 1" }, |
| 551 | { 0x44, "OML Function Map 2" }, |
| 552 | { 0x45, "RSL Function Map 1" }, |
| 553 | { 0x46, "RSL Function Map 2" }, |
| 554 | { 0x47, "Extended Range Indicator" }, |
| 555 | { 0x48, "Request Indicators" }, |
| 556 | { 0x49, "DIP Alarm Condition Map" }, |
| 557 | { 0x4a, "ES Incoming" }, |
| 558 | { 0x4b, "ES Outgoing" }, |
| 559 | { 0x4e, "SES Incoming" }, |
| 560 | { 0x4f, "SES Outgoing" }, |
| 561 | { 0x50, "Replacement Unit Map Extension" }, |
| 562 | { 0x52, "UAS Incoming" }, |
| 563 | { 0x53, "UAS Outgoing" }, |
| 564 | { 0x58, "DF Incoming" }, |
| 565 | { 0x5a, "DF Outgoing" }, |
| 566 | { 0x5c, "SF" }, |
| 567 | { 0x60, "S Bits Setting" }, |
| 568 | { 0x61, "CRC-4 Use Option" }, |
| 569 | { 0x62, "T Parameter" }, |
| 570 | { 0x63, "N Parameter" }, |
| 571 | { 0x64, "N1 Parameter" }, |
| 572 | { 0x65, "N3 Parameter" }, |
| 573 | { 0x66, "N4 Parameter" }, |
| 574 | { 0x67, "P Parameter" }, |
| 575 | { 0x68, "Q Parameter" }, |
| 576 | { 0x69, "BI_Q1" }, |
| 577 | { 0x6a, "BI_Q2" }, |
| 578 | { 0x74, "ICM Boundary Parameters" }, |
| 579 | { 0x77, "AFT" }, |
| 580 | { 0x78, "AFT RAI" }, |
| 581 | { 0x79, "Link Supervision Control" }, |
| 582 | { 0x7a, "Link Supervision Filtering Time" }, |
| 583 | { 0x7b, "Call Supervision Time" }, |
| 584 | { 0x7c, "Interval Length UAS Incoming" }, |
| 585 | { 0x7d, "Interval Length UAS Outgoing" }, |
| 586 | { 0x7e, "ICM Channel Rate" }, |
| 587 | { 0x7f, "Attribute Identifier" }, |
| 588 | { 0x80, "FM Frequency List" }, |
| 589 | { 0x81, "FM Frequency Report" }, |
| 590 | { 0x82, "FM Percentile" }, |
| 591 | { 0x83, "FM Clear Indication" }, |
| 592 | { 0x84, "HW Info Signature" }, |
| 593 | { 0x85, "MO Record" }, |
| 594 | { 0x86, "TF Synchronisation Source" }, |
| 595 | { 0x87, "TTA" }, |
| 596 | { 0x88, "End Segment Number" }, |
| 597 | { 0x89, "Segment Number" }, |
| 598 | { 0x8a, "Capabilities Signature" }, |
| 599 | { 0x8c, "File Relation List" }, |
| 600 | { 0x90, "Negotiation Record I" }, |
| 601 | { 0x91, "Negotiation Record II" }, |
| 602 | { 0x92, "Encryption Algorithm" }, |
| 603 | { 0x94, "Interference Rejection Combining" }, |
| 604 | { 0x95, "Dedication Information" }, |
| 605 | { 0x97, "Feature Code" }, |
| 606 | { 0x98, "FS Offset" }, |
| 607 | { 0x99, "ESB Timeslot" }, |
| 608 | { 0x9a, "Master TG Instance" }, |
| 609 | { 0x9b, "Master TX Chain Delay" }, |
| 610 | { 0x9c, "External Condition Class 2 Extension" }, |
| 611 | { 0x9d, "TSs MO State" }, |
| 612 | { 0, NULL } |
| 613 | }; |
| 614 | |
Harald Welte | e1d5eca | 2011-02-12 14:42:59 +0100 | [diff] [blame] | 615 | const struct value_string om2k_mo_class_short_vals[] = { |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 616 | { 0x01, "TRXC" }, |
| 617 | { 0x03, "TS" }, |
| 618 | { 0x04, "TF" }, |
| 619 | { 0x05, "IS" }, |
| 620 | { 0x06, "CON" }, |
| 621 | { 0x07, "DP" }, |
| 622 | { 0x0a, "CF" }, |
| 623 | { 0x0b, "TX" }, |
| 624 | { 0x0c, "RX" }, |
| 625 | { 0, NULL } |
| 626 | }; |
| 627 | |
| 628 | static struct msgb *om2k_msgb_alloc(void) |
| 629 | { |
| 630 | return msgb_alloc_headroom(OM_ALLOC_SIZE, OM_HEADROOM_SIZE, |
| 631 | "OM2000"); |
| 632 | } |
| 633 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 634 | static int abis_om2k_tlv_parse(struct tlv_parsed *tp, const uint8_t *buf, int len) |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 635 | { |
| 636 | return tlv_parse(tp, &om2k_att_tlvdef, buf, len, 0, 0); |
| 637 | } |
| 638 | |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 639 | static int abis_om2k_msg_tlv_parse(struct tlv_parsed *tp, struct abis_om2k_hdr *oh) |
| 640 | { |
| 641 | return abis_om2k_tlv_parse(tp, oh->data, oh->om.length - 6); |
| 642 | } |
| 643 | |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 644 | static char *om2k_mo_name(const struct abis_om2k_mo *mo) |
| 645 | { |
| 646 | static char mo_buf[64]; |
| 647 | |
| 648 | memset(mo_buf, 0, sizeof(mo_buf)); |
| 649 | snprintf(mo_buf, sizeof(mo_buf), "%s/%02x/%02x/%02x", |
| 650 | get_value_string(om2k_mo_class_short_vals, mo->class), |
| 651 | mo->bts, mo->assoc_so, mo->inst); |
| 652 | return mo_buf; |
| 653 | } |
| 654 | |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 655 | /* resolve the gsm_nm_state data structure for a given MO */ |
| 656 | static struct gsm_nm_state * |
| 657 | mo2nm_state(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
| 658 | { |
| 659 | struct gsm_bts_trx *trx; |
| 660 | struct gsm_nm_state *nm_state = NULL; |
| 661 | |
| 662 | switch (mo->class) { |
| 663 | case OM2K_MO_CLS_TRXC: |
| 664 | trx = gsm_bts_trx_num(bts, mo->assoc_so); |
| 665 | if (!trx) |
| 666 | return NULL; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 667 | nm_state = &trx->mo.nm_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 668 | break; |
| 669 | case OM2K_MO_CLS_TS: |
| 670 | trx = gsm_bts_trx_num(bts, mo->assoc_so); |
| 671 | if (!trx) |
| 672 | return NULL; |
| 673 | if (mo->inst >= ARRAY_SIZE(trx->ts)) |
| 674 | return NULL; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 675 | nm_state = &trx->ts[mo->inst].mo.nm_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 676 | break; |
| 677 | case OM2K_MO_CLS_TF: |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 678 | nm_state = &bts->rbs2000.tf.mo.nm_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 679 | break; |
| 680 | case OM2K_MO_CLS_IS: |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 681 | nm_state = &bts->rbs2000.is.mo.nm_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 682 | break; |
| 683 | case OM2K_MO_CLS_CON: |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 684 | nm_state = &bts->rbs2000.con.mo.nm_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 685 | break; |
| 686 | case OM2K_MO_CLS_DP: |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 687 | nm_state = &bts->rbs2000.con.mo.nm_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 688 | break; |
| 689 | case OM2K_MO_CLS_CF: |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 690 | nm_state = &bts->mo.nm_state; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 691 | break; |
| 692 | case OM2K_MO_CLS_TX: |
| 693 | trx = gsm_bts_trx_num(bts, mo->assoc_so); |
| 694 | if (!trx) |
| 695 | return NULL; |
| 696 | break; |
| 697 | case OM2K_MO_CLS_RX: |
| 698 | trx = gsm_bts_trx_num(bts, mo->assoc_so); |
| 699 | if (!trx) |
| 700 | return NULL; |
| 701 | break; |
| 702 | } |
| 703 | |
| 704 | return nm_state; |
| 705 | } |
| 706 | |
| 707 | static void *mo2obj(struct gsm_bts *bts, struct abis_om2k_mo *mo) |
| 708 | { |
| 709 | struct gsm_bts_trx *trx; |
| 710 | |
| 711 | switch (mo->class) { |
| 712 | case OM2K_MO_CLS_TX: |
| 713 | case OM2K_MO_CLS_RX: |
| 714 | case OM2K_MO_CLS_TRXC: |
| 715 | return gsm_bts_trx_num(bts, mo->assoc_so); |
| 716 | case OM2K_MO_CLS_TS: |
| 717 | trx = gsm_bts_trx_num(bts, mo->assoc_so); |
| 718 | if (!trx) |
| 719 | return NULL; |
| 720 | if (mo->inst >= ARRAY_SIZE(trx->ts)) |
| 721 | return NULL; |
| 722 | return &trx->ts[mo->inst]; |
| 723 | case OM2K_MO_CLS_TF: |
| 724 | case OM2K_MO_CLS_IS: |
| 725 | case OM2K_MO_CLS_CON: |
| 726 | case OM2K_MO_CLS_DP: |
| 727 | case OM2K_MO_CLS_CF: |
| 728 | return bts; |
| 729 | } |
| 730 | |
| 731 | return NULL; |
| 732 | } |
| 733 | |
| 734 | static void update_mo_state(struct gsm_bts *bts, struct abis_om2k_mo *mo, |
| 735 | uint8_t mo_state) |
| 736 | { |
| 737 | struct gsm_nm_state *nm_state = mo2nm_state(bts, mo); |
| 738 | struct gsm_nm_state new_state; |
| 739 | struct nm_statechg_signal_data nsd; |
| 740 | |
| 741 | if (!nm_state) |
| 742 | return; |
| 743 | |
| 744 | new_state = *nm_state; |
| 745 | /* NOTICE: 12.21 Availability state values != OM2000 */ |
| 746 | new_state.availability = mo_state; |
| 747 | |
| 748 | memset(&nsd, 0, sizeof(nsd)); |
| 749 | |
Harald Welte | 8b277ac | 2011-03-06 23:00:32 +0100 | [diff] [blame] | 750 | nsd.bts = bts; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 751 | nsd.obj = mo2obj(bts, mo); |
| 752 | nsd.old_state = nm_state; |
| 753 | nsd.new_state = &new_state; |
| 754 | nsd.om2k_mo = mo; |
| 755 | |
Pablo Neira Ayuso | bbc5b99 | 2011-05-06 12:12:31 +0200 | [diff] [blame] | 756 | osmo_signal_dispatch(SS_NM, S_NM_STATECHG_ADM, &nsd); |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 757 | |
| 758 | nm_state->availability = new_state.availability; |
| 759 | } |
| 760 | |
| 761 | static void update_op_state(struct gsm_bts *bts, const struct abis_om2k_mo *mo, |
| 762 | uint8_t op_state) |
| 763 | { |
| 764 | struct gsm_nm_state *nm_state = mo2nm_state(bts, mo); |
| 765 | struct gsm_nm_state new_state; |
| 766 | |
| 767 | if (!nm_state) |
| 768 | return; |
| 769 | |
| 770 | new_state = *nm_state; |
| 771 | switch (op_state) { |
| 772 | case 1: |
| 773 | new_state.operational = NM_OPSTATE_ENABLED; |
| 774 | break; |
| 775 | case 0: |
| 776 | new_state.operational = NM_OPSTATE_DISABLED; |
| 777 | break; |
| 778 | default: |
| 779 | new_state.operational = NM_OPSTATE_NULL; |
| 780 | break; |
| 781 | } |
| 782 | |
| 783 | nm_state->operational = new_state.operational; |
| 784 | } |
| 785 | |
| 786 | static void signal_op_state(struct gsm_bts *bts, struct abis_om2k_mo *mo) |
| 787 | { |
| 788 | struct gsm_nm_state *nm_state = mo2nm_state(bts, mo); |
| 789 | struct nm_statechg_signal_data nsd; |
| 790 | |
Harald Welte | 8b277ac | 2011-03-06 23:00:32 +0100 | [diff] [blame] | 791 | nsd.bts = bts; |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 792 | nsd.obj = mo2obj(bts, mo); |
| 793 | nsd.old_state = nm_state; |
| 794 | nsd.new_state = nm_state; |
| 795 | nsd.om2k_mo = mo; |
| 796 | |
Pablo Neira Ayuso | bbc5b99 | 2011-05-06 12:12:31 +0200 | [diff] [blame] | 797 | osmo_signal_dispatch(SS_NM, S_NM_STATECHG_OPER, &nsd); |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 798 | } |
| 799 | |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 800 | static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg) |
| 801 | { |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 802 | struct abis_om2k_hdr *o2h; |
Harald Welte | 15eae8d | 2011-09-26 23:43:23 +0200 | [diff] [blame] | 803 | struct gsm_bts_trx *trx; |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 804 | |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 805 | msg->l2h = msg->data; |
| 806 | o2h = (struct abis_om2k_hdr *) msg->l2h; |
| 807 | |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 808 | /* Compute the length in the OML header */ |
| 809 | o2h->om.length = 6 + msgb_l2len(msg)-sizeof(*o2h); |
| 810 | |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 811 | switch (o2h->mo.class) { |
| 812 | case OM2K_MO_CLS_TRXC: |
| 813 | case OM2K_MO_CLS_TX: |
| 814 | case OM2K_MO_CLS_RX: |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 815 | /* Route through per-TRX OML Link to the appropriate TRX */ |
Harald Welte | 15eae8d | 2011-09-26 23:43:23 +0200 | [diff] [blame] | 816 | trx = gsm_bts_trx_by_nr(bts, o2h->mo.inst); |
| 817 | if (!trx) { |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 818 | LOGP(DNM, LOGL_ERROR, "MO=%s Tx Dropping msg to " |
| 819 | "non-existing TRX\n", om2k_mo_name(&o2h->mo)); |
| 820 | return -ENODEV; |
| 821 | } |
| 822 | break; |
Harald Welte | 8aeac19 | 2011-03-05 20:15:09 +0100 | [diff] [blame] | 823 | case OM2K_MO_CLS_TS: |
| 824 | /* Route through per-TRX OML Link to the appropriate TRX */ |
Harald Welte | 15eae8d | 2011-09-26 23:43:23 +0200 | [diff] [blame] | 825 | trx = gsm_bts_trx_by_nr(bts, o2h->mo.assoc_so); |
| 826 | if (!trx) { |
Harald Welte | 8aeac19 | 2011-03-05 20:15:09 +0100 | [diff] [blame] | 827 | LOGP(DNM, LOGL_ERROR, "MO=%s Tx Dropping msg to " |
| 828 | "non-existing TRX\n", om2k_mo_name(&o2h->mo)); |
| 829 | return -ENODEV; |
| 830 | } |
| 831 | break; |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 832 | default: |
| 833 | /* Route through the IXU/DXU OML Link */ |
Harald Welte | 15eae8d | 2011-09-26 23:43:23 +0200 | [diff] [blame] | 834 | trx = bts->c0; |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 835 | break; |
| 836 | } |
Harald Welte | 15eae8d | 2011-09-26 23:43:23 +0200 | [diff] [blame] | 837 | msg->dst = trx->oml_link; |
Harald Welte | d88a387 | 2011-02-14 15:26:13 +0100 | [diff] [blame] | 838 | |
Harald Welte | 15eae8d | 2011-09-26 23:43:23 +0200 | [diff] [blame] | 839 | return _abis_nm_sendmsg(msg); |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 840 | } |
| 841 | |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 842 | static void fill_om2k_hdr(struct abis_om2k_hdr *o2h, const struct abis_om2k_mo *mo, |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 843 | uint16_t msg_type) |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 844 | { |
| 845 | o2h->om.mdisc = ABIS_OM_MDISC_FOM; |
| 846 | o2h->om.placement = ABIS_OM_PLACEMENT_ONLY; |
| 847 | o2h->om.sequence = 0; |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 848 | /* We fill o2h->om.length later during om2k_sendmsg() */ |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 849 | o2h->msg_type = htons(msg_type); |
| 850 | memcpy(&o2h->mo, mo, sizeof(o2h->mo)); |
| 851 | } |
| 852 | |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 853 | const struct abis_om2k_mo om2k_mo_cf = { OM2K_MO_CLS_CF, 0, 0xFF, 0 }; |
Harald Welte | 8bcb1a0 | 2011-02-12 20:23:40 +0100 | [diff] [blame] | 854 | const struct abis_om2k_mo om2k_mo_is = { OM2K_MO_CLS_IS, 0, 0xFF, 0 }; |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 855 | const struct abis_om2k_mo om2k_mo_con = { OM2K_MO_CLS_CON, 0, 0xFF, 0 }; |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 856 | const struct abis_om2k_mo om2k_mo_tf = { OM2K_MO_CLS_TF, 0, 0xFF, 0 }; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 857 | |
| 858 | static int abis_om2k_cal_time_resp(struct gsm_bts *bts) |
| 859 | { |
| 860 | struct msgb *msg = om2k_msgb_alloc(); |
| 861 | struct abis_om2k_hdr *o2k; |
| 862 | time_t tm_t; |
| 863 | struct tm *tm; |
| 864 | |
| 865 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 866 | fill_om2k_hdr(o2k, &om2k_mo_cf, OM2K_MSGT_CAL_TIME_RESP); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 867 | |
| 868 | tm_t = time(NULL); |
| 869 | tm = localtime(&tm_t); |
| 870 | |
| 871 | msgb_put_u8(msg, OM2K_DEI_CAL_TIME); |
| 872 | msgb_put_u8(msg, tm->tm_year % 100); |
| 873 | msgb_put_u8(msg, tm->tm_mon + 1); |
| 874 | msgb_put_u8(msg, tm->tm_mday); |
| 875 | msgb_put_u8(msg, tm->tm_hour); |
| 876 | msgb_put_u8(msg, tm->tm_min); |
| 877 | msgb_put_u8(msg, tm->tm_sec); |
| 878 | |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 879 | return abis_om2k_sendmsg(bts, msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 880 | } |
| 881 | |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 882 | static int abis_om2k_tx_simple(struct gsm_bts *bts, const struct abis_om2k_mo *mo, |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 883 | uint8_t msg_type) |
| 884 | { |
| 885 | struct msgb *msg = om2k_msgb_alloc(); |
| 886 | struct abis_om2k_hdr *o2k; |
| 887 | |
| 888 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 889 | fill_om2k_hdr(o2k, mo, msg_type); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 890 | |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 891 | DEBUGP(DNM, "Tx MO=%s %s\n", om2k_mo_name(mo), |
| 892 | get_value_string(om2k_msgcode_vals, msg_type)); |
| 893 | |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 894 | return abis_om2k_sendmsg(bts, msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 895 | } |
| 896 | |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 897 | int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 898 | { |
| 899 | return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_RESET_CMD); |
| 900 | } |
| 901 | |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 902 | int abis_om2k_tx_start_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 903 | { |
| 904 | return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_START_REQ); |
| 905 | } |
| 906 | |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 907 | int abis_om2k_tx_status_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
Harald Welte | e1d5eca | 2011-02-12 14:42:59 +0100 | [diff] [blame] | 908 | { |
| 909 | return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_STATUS_REQ); |
| 910 | } |
| 911 | |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 912 | int abis_om2k_tx_connect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
| 913 | { |
| 914 | return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_CONNECT_CMD); |
| 915 | } |
| 916 | |
| 917 | int abis_om2k_tx_disconnect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
| 918 | { |
| 919 | return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_DISCONNECT_CMD); |
| 920 | } |
| 921 | |
Harald Welte | 8024d8f | 2011-02-12 15:07:30 +0100 | [diff] [blame] | 922 | int abis_om2k_tx_test_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
| 923 | { |
| 924 | return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_TEST_REQ); |
| 925 | } |
| 926 | |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 927 | int abis_om2k_tx_enable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
| 928 | { |
| 929 | return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_ENABLE_REQ); |
| 930 | } |
| 931 | |
| 932 | int abis_om2k_tx_disable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo) |
| 933 | { |
| 934 | return abis_om2k_tx_simple(bts, mo, OM2K_MSGT_DISABLE_REQ); |
| 935 | } |
| 936 | |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 937 | int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo, |
| 938 | uint8_t operational) |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 939 | { |
| 940 | struct msgb *msg = om2k_msgb_alloc(); |
| 941 | struct abis_om2k_hdr *o2k; |
| 942 | |
| 943 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 944 | fill_om2k_hdr(o2k, mo, OM2K_MSGT_OP_INFO); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 945 | |
| 946 | msgb_tv_put(msg, OM2K_DEI_OP_INFO, operational); |
| 947 | |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 948 | DEBUGP(DNM, "Tx MO=%s %s\n", om2k_mo_name(mo), |
| 949 | get_value_string(om2k_msgcode_vals, OM2K_MSGT_OP_INFO)); |
| 950 | |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 951 | /* we update the state here... and send the signal at ACK */ |
| 952 | update_op_state(bts, mo, operational); |
| 953 | |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 954 | return abis_om2k_sendmsg(bts, msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 955 | } |
| 956 | |
Harald Welte | d529db6 | 2011-03-06 21:49:21 +0100 | [diff] [blame] | 957 | static void om2k_fill_is_conn_grp(struct om2k_is_conn_grp *grp, uint16_t icp1, |
| 958 | uint16_t icp2, uint8_t cont_idx) |
| 959 | { |
| 960 | grp->icp1 = htons(icp1); |
| 961 | grp->icp2 = htons(icp2); |
| 962 | grp->cont_idx = cont_idx; |
| 963 | } |
| 964 | |
| 965 | int abis_om2k_tx_is_conf_req(struct gsm_bts *bts) |
Harald Welte | 8bcb1a0 | 2011-02-12 20:23:40 +0100 | [diff] [blame] | 966 | { |
| 967 | struct msgb *msg = om2k_msgb_alloc(); |
| 968 | struct abis_om2k_hdr *o2k; |
Harald Welte | d529db6 | 2011-03-06 21:49:21 +0100 | [diff] [blame] | 969 | struct is_conn_group *grp; |
| 970 | unsigned int num_grps = 0, i = 0; |
| 971 | struct om2k_is_conn_grp *cg; |
| 972 | |
| 973 | /* count number of groups in linked list */ |
| 974 | llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list) |
| 975 | num_grps++; |
| 976 | |
| 977 | if (!num_grps) |
| 978 | return -EINVAL; |
| 979 | |
| 980 | /* allocate buffer for oml group array */ |
| 981 | cg = talloc_zero_array(bts, struct om2k_is_conn_grp, num_grps); |
| 982 | |
| 983 | /* fill array with data from linked list */ |
| 984 | llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list) |
| 985 | om2k_fill_is_conn_grp(&cg[i++], grp->icp1, grp->icp2, grp->ci); |
Harald Welte | 8bcb1a0 | 2011-02-12 20:23:40 +0100 | [diff] [blame] | 986 | |
| 987 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 988 | fill_om2k_hdr(o2k, &om2k_mo_is, OM2K_MSGT_IS_CONF_REQ); |
Harald Welte | 8bcb1a0 | 2011-02-12 20:23:40 +0100 | [diff] [blame] | 989 | |
| 990 | msgb_tv_put(msg, OM2K_DEI_LIST_NR, 1); |
| 991 | msgb_tv_put(msg, OM2K_DEI_END_LIST_NR, 1); |
| 992 | |
| 993 | msgb_tlv_put(msg, OM2K_DEI_IS_CONN_LIST, |
Harald Welte | d529db6 | 2011-03-06 21:49:21 +0100 | [diff] [blame] | 994 | num_grps * sizeof(*cg), (uint8_t *)cg); |
| 995 | |
| 996 | talloc_free(cg); |
Harald Welte | 8bcb1a0 | 2011-02-12 20:23:40 +0100 | [diff] [blame] | 997 | |
| 998 | return abis_om2k_sendmsg(bts, msg); |
| 999 | } |
| 1000 | |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1001 | int abis_om2k_tx_con_conf_req(struct gsm_bts *bts, uint8_t *data, |
| 1002 | unsigned int len) |
| 1003 | { |
| 1004 | struct msgb *msg = om2k_msgb_alloc(); |
| 1005 | struct abis_om2k_hdr *o2k; |
| 1006 | |
| 1007 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1008 | fill_om2k_hdr(o2k, &om2k_mo_con, OM2K_MSGT_CON_CONF_REQ); |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1009 | |
| 1010 | msgb_tv_put(msg, OM2K_DEI_LIST_NR, 1); |
| 1011 | msgb_tv_put(msg, OM2K_DEI_END_LIST_NR, 1); |
| 1012 | |
| 1013 | msgb_tlv_put(msg, OM2K_DEI_CON_CONN_LIST, len, data); |
| 1014 | |
| 1015 | return abis_om2k_sendmsg(bts, msg); |
| 1016 | } |
| 1017 | |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1018 | static void om2k_trx_to_mo(struct abis_om2k_mo *mo, |
| 1019 | const struct gsm_bts_trx *trx, |
| 1020 | enum abis_om2k_mo_cls cls) |
| 1021 | { |
| 1022 | mo->class = cls; |
| 1023 | mo->bts = 0; |
| 1024 | mo->inst = trx->nr; |
Harald Welte | 53492c8 | 2011-03-05 16:21:01 +0100 | [diff] [blame] | 1025 | mo->assoc_so = 255; |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1026 | } |
| 1027 | |
| 1028 | static void om2k_ts_to_mo(struct abis_om2k_mo *mo, |
| 1029 | const struct gsm_bts_trx_ts *ts) |
| 1030 | { |
| 1031 | mo->class = OM2K_MO_CLS_TS; |
| 1032 | mo->bts = 0; |
| 1033 | mo->inst = ts->nr; |
| 1034 | mo->assoc_so = ts->trx->nr; |
| 1035 | } |
| 1036 | |
| 1037 | /* Configure a Receiver MO */ |
| 1038 | int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx) |
| 1039 | { |
| 1040 | struct msgb *msg = om2k_msgb_alloc(); |
| 1041 | struct abis_om2k_hdr *o2k; |
| 1042 | struct abis_om2k_mo mo; |
| 1043 | |
| 1044 | om2k_trx_to_mo(&mo, trx, OM2K_MO_CLS_RX); |
| 1045 | |
| 1046 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1047 | fill_om2k_hdr(o2k, &mo, OM2K_MSGT_RX_CONF_REQ); |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1048 | |
| 1049 | msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_RX, trx->arfcn); |
Harald Welte | 1edc2b4 | 2011-03-06 19:01:54 +0100 | [diff] [blame] | 1050 | msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x02); /* A */ |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1051 | |
| 1052 | return abis_om2k_sendmsg(trx->bts, msg); |
| 1053 | } |
| 1054 | |
| 1055 | /* Configure a Transmitter MO */ |
| 1056 | int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx) |
| 1057 | { |
| 1058 | struct msgb *msg = om2k_msgb_alloc(); |
| 1059 | struct abis_om2k_hdr *o2k; |
| 1060 | struct abis_om2k_mo mo; |
| 1061 | |
| 1062 | om2k_trx_to_mo(&mo, trx, OM2K_MO_CLS_TX); |
| 1063 | |
| 1064 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1065 | fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TX_CONF_REQ); |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1066 | |
| 1067 | msgb_tv16_put(msg, OM2K_DEI_FREQ_SPEC_TX, trx->arfcn); |
| 1068 | msgb_tv_put(msg, OM2K_DEI_POWER, trx->nominal_power-trx->max_power_red); |
| 1069 | msgb_tv_put(msg, OM2K_DEI_FILLING_MARKER, 0); /* Filling enabled */ |
| 1070 | msgb_tv_put(msg, OM2K_DEI_BCC, trx->bts->bsic & 0x7); |
| 1071 | /* Dedication Information is optional */ |
| 1072 | |
| 1073 | return abis_om2k_sendmsg(trx->bts, msg); |
| 1074 | } |
| 1075 | |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 1076 | enum abis_om2k_tf_mode { |
| 1077 | OM2K_TF_MODE_MASTER = 0x00, |
| 1078 | OM2K_TF_MODE_STANDALONE = 0x01, |
| 1079 | OM2K_TF_MODE_SLAVE = 0x02, |
| 1080 | OM2K_TF_MODE_UNDEFINED = 0xff, |
| 1081 | }; |
| 1082 | |
| 1083 | static const uint8_t fs_offset_undef[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 1084 | |
| 1085 | int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts) |
| 1086 | { |
| 1087 | struct msgb *msg = om2k_msgb_alloc(); |
| 1088 | struct abis_om2k_hdr *o2k; |
| 1089 | |
| 1090 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1091 | fill_om2k_hdr(o2k, &om2k_mo_tf, OM2K_MSGT_TF_CONF_REQ); |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 1092 | |
| 1093 | msgb_tv_put(msg, OM2K_DEI_TF_MODE, OM2K_TF_MODE_STANDALONE); |
Harald Welte | ba9adbb | 2011-03-06 19:01:16 +0100 | [diff] [blame] | 1094 | msgb_tv_put(msg, OM2K_DEI_TF_SYNC_SRC, 0x00); |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 1095 | msgb_tv_fixed_put(msg, OM2K_DEI_FS_OFFSET, |
| 1096 | sizeof(fs_offset_undef), fs_offset_undef); |
| 1097 | |
| 1098 | return abis_om2k_sendmsg(bts, msg); |
| 1099 | } |
| 1100 | |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1101 | static uint8_t pchan2comb(enum gsm_phys_chan_config pchan) |
| 1102 | { |
| 1103 | switch (pchan) { |
| 1104 | case GSM_PCHAN_CCCH: |
| 1105 | return 4; |
| 1106 | case GSM_PCHAN_CCCH_SDCCH4: |
| 1107 | return 5; |
| 1108 | case GSM_PCHAN_SDCCH8_SACCH8C: |
| 1109 | return 3; |
| 1110 | case GSM_PCHAN_TCH_F: |
| 1111 | case GSM_PCHAN_TCH_H: |
| 1112 | case GSM_PCHAN_PDCH: |
| 1113 | case GSM_PCHAN_TCH_F_PDCH: |
| 1114 | return 8; |
| 1115 | default: |
| 1116 | return 0; |
| 1117 | } |
| 1118 | } |
| 1119 | |
Harald Welte | 5748c20 | 2011-03-05 17:30:07 +0100 | [diff] [blame] | 1120 | static int put_freq_list(uint8_t *buf, uint16_t arfcn) |
| 1121 | { |
| 1122 | buf[0] = 0x00; /* TX/RX address */ |
| 1123 | buf[1] = (arfcn >> 8); |
| 1124 | buf[2] = (arfcn & 0xff); |
| 1125 | |
| 1126 | return 3; |
| 1127 | } |
| 1128 | |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1129 | /* Compute a frequency list in OM2000 fomrmat */ |
| 1130 | static int om2k_gen_freq_list(uint8_t *list, struct gsm_bts_trx_ts *ts) |
| 1131 | { |
| 1132 | uint8_t *cur = list; |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 1133 | int len; |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1134 | |
| 1135 | if (ts->hopping.enabled) { |
| 1136 | unsigned int i; |
| 1137 | for (i = 0; i < ts->hopping.arfcns.data_len*8; i++) { |
Harald Welte | 5748c20 | 2011-03-05 17:30:07 +0100 | [diff] [blame] | 1138 | if (bitvec_get_bit_pos(&ts->hopping.arfcns, i)) |
| 1139 | cur += put_freq_list(cur, i); |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1140 | } |
Harald Welte | 5748c20 | 2011-03-05 17:30:07 +0100 | [diff] [blame] | 1141 | } else |
| 1142 | cur += put_freq_list(cur, ts->trx->arfcn); |
| 1143 | |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 1144 | len = cur - list; |
| 1145 | |
| 1146 | return len; |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1147 | } |
| 1148 | |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 1149 | const uint8_t icm_bound_params[] = { 0x02, 0x06, 0x0c, 0x16, 0x06 }; |
| 1150 | |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1151 | int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts) |
| 1152 | { |
| 1153 | struct msgb *msg = om2k_msgb_alloc(); |
| 1154 | struct abis_om2k_hdr *o2k; |
| 1155 | struct abis_om2k_mo mo; |
| 1156 | uint8_t freq_list[64*3]; /* BA max size: 64 ARFCN */ |
| 1157 | int freq_list_len; |
| 1158 | |
| 1159 | om2k_ts_to_mo(&mo, ts); |
| 1160 | |
Harald Welte | 5748c20 | 2011-03-05 17:30:07 +0100 | [diff] [blame] | 1161 | memset(freq_list, 0, sizeof(freq_list)); |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1162 | freq_list_len = om2k_gen_freq_list(freq_list, ts); |
| 1163 | if (freq_list_len < 0) |
| 1164 | return freq_list_len; |
| 1165 | |
| 1166 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1167 | fill_om2k_hdr(o2k, &mo, OM2K_MSGT_TS_CONF_REQ); |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1168 | |
| 1169 | msgb_tv_put(msg, OM2K_DEI_COMBINATION, pchan2comb(ts->pchan)); |
| 1170 | msgb_tv_put(msg, OM2K_DEI_TS_NR, ts->nr); |
| 1171 | msgb_tlv_put(msg, OM2K_DEI_FREQ_LIST, freq_list_len, freq_list); |
| 1172 | msgb_tv_put(msg, OM2K_DEI_HSN, ts->hopping.hsn); |
| 1173 | msgb_tv_put(msg, OM2K_DEI_MAIO, ts->hopping.maio); |
| 1174 | msgb_tv_put(msg, OM2K_DEI_BSIC, ts->trx->bts->bsic); |
Harald Welte | 1edc2b4 | 2011-03-06 19:01:54 +0100 | [diff] [blame] | 1175 | msgb_tv_put(msg, OM2K_DEI_RX_DIVERSITY, 0x02); /* A */ |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1176 | msgb_tv16_put(msg, OM2K_DEI_FN_OFFSET, 0); |
| 1177 | msgb_tv_put(msg, OM2K_DEI_EXT_RANGE, 0); /* Off */ |
| 1178 | /* Optional: Interference Rejection Combining */ |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1179 | msgb_tv_put(msg, OM2K_DEI_INTERF_REJ_COMB, 0x00); |
| 1180 | switch (ts->pchan) { |
| 1181 | case GSM_PCHAN_CCCH: |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1182 | msgb_tv_put(msg, OM2K_DEI_BA_PA_MFRMS, 0x06); |
| 1183 | msgb_tv_put(msg, OM2K_DEI_BS_AG_BKS_RES, 0x01); |
| 1184 | msgb_tv_put(msg, OM2K_DEI_DRX_DEV_MAX, 0x05); |
| 1185 | /* Repeat Paging/IMM.ASS: True, Allow Paging Type 3: Yes, Page for 5 seconds (default) */ |
| 1186 | msgb_tv_put(msg, OM2K_DEI_CCCH_OPTIONS, 0x01); |
| 1187 | break; |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 1188 | case GSM_PCHAN_CCCH_SDCCH4: |
Harald Welte | 67161f2 | 2012-06-03 13:01:47 +0200 | [diff] [blame] | 1189 | msgb_tv_put(msg, OM2K_DEI_T3105, ts->trx->bts->network->T3105 / 10); |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 1190 | msgb_tv_put(msg, OM2K_DEI_NY1, 35); |
| 1191 | msgb_tv_put(msg, OM2K_DEI_BA_PA_MFRMS, 0x06); |
| 1192 | msgb_tv_put(msg, OM2K_DEI_CBCH_INDICATOR, 0); |
| 1193 | msgb_tv_put(msg, OM2K_DEI_TSC, ts->trx->bts->tsc); |
| 1194 | msgb_tv_put(msg, OM2K_DEI_BS_AG_BKS_RES, 0x01); |
| 1195 | msgb_tv_put(msg, OM2K_DEI_ICM_INDICATOR, 0); |
| 1196 | msgb_tv_put(msg, OM2K_DEI_DRX_DEV_MAX, 0x05); |
| 1197 | /* Repeat Paging/IMM.ASS: True, Allow Paging Type 3: Yes, Page for 5 seconds (default) */ |
| 1198 | msgb_tv_put(msg, OM2K_DEI_CCCH_OPTIONS, 0x01); |
| 1199 | msgb_tv_fixed_put(msg, OM2K_DEI_ICM_BOUND_PARAMS, |
| 1200 | sizeof(icm_bound_params), icm_bound_params); |
| 1201 | break; |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1202 | case GSM_PCHAN_SDCCH8_SACCH8C: |
Harald Welte | 67161f2 | 2012-06-03 13:01:47 +0200 | [diff] [blame] | 1203 | msgb_tv_put(msg, OM2K_DEI_T3105, ts->trx->bts->network->T3105 / 10); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1204 | msgb_tv_put(msg, OM2K_DEI_NY1, 35); |
| 1205 | msgb_tv_put(msg, OM2K_DEI_CBCH_INDICATOR, 0); |
| 1206 | msgb_tv_put(msg, OM2K_DEI_TSC, ts->trx->bts->tsc); |
| 1207 | /* Disable RF RESOURCE INDICATION on idle channels */ |
| 1208 | msgb_tv_put(msg, OM2K_DEI_ICM_INDICATOR, 0); |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 1209 | msgb_tv_fixed_put(msg, OM2K_DEI_ICM_BOUND_PARAMS, |
| 1210 | sizeof(icm_bound_params), icm_bound_params); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1211 | break; |
| 1212 | default: |
Harald Welte | 67161f2 | 2012-06-03 13:01:47 +0200 | [diff] [blame] | 1213 | msgb_tv_put(msg, OM2K_DEI_T3105, ts->trx->bts->network->T3105 / 10); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1214 | msgb_tv_put(msg, OM2K_DEI_NY1, 35); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1215 | msgb_tv_put(msg, OM2K_DEI_TSC, ts->trx->bts->tsc); |
| 1216 | /* Disable RF RESOURCE INDICATION on idle channels */ |
| 1217 | msgb_tv_put(msg, OM2K_DEI_ICM_INDICATOR, 0); |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 1218 | msgb_tv_fixed_put(msg, OM2K_DEI_ICM_BOUND_PARAMS, |
| 1219 | sizeof(icm_bound_params), icm_bound_params); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1220 | msgb_tv_put(msg, OM2K_DEI_TTA, 10); /* Timer for Time Alignment */ |
Harald Welte | 75755c5 | 2011-03-05 20:38:35 +0100 | [diff] [blame] | 1221 | if (ts->pchan == GSM_PCHAN_TCH_H) |
| 1222 | msgb_tv_put(msg, OM2K_DEI_ICM_CHAN_RATE, 1); /* TCH/H */ |
| 1223 | else |
| 1224 | msgb_tv_put(msg, OM2K_DEI_ICM_CHAN_RATE, 0); /* TCH/F */ |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1225 | msgb_tv_put(msg, OM2K_DEI_LSC, 1); /* enabled */ |
Harald Welte | 1edc2b4 | 2011-03-06 19:01:54 +0100 | [diff] [blame] | 1226 | msgb_tv_put(msg, OM2K_DEI_LSC_FILT_TIME, 10); /* units of 100ms */ |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1227 | msgb_tv_put(msg, OM2K_DEI_CALL_SUPV_TIME, 8); |
| 1228 | msgb_tv_put(msg, OM2K_DEI_ENCR_ALG, 0x00); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1229 | break; |
| 1230 | } |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1231 | |
| 1232 | return abis_om2k_sendmsg(ts->trx->bts, msg); |
| 1233 | } |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1234 | |
Harald Welte | 6fec79d | 2011-02-12 14:57:17 +0100 | [diff] [blame] | 1235 | static int abis_om2k_tx_negot_req_ack(struct gsm_bts *bts, const struct abis_om2k_mo *mo, |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 1236 | uint8_t *data, unsigned int len) |
| 1237 | { |
| 1238 | struct msgb *msg = om2k_msgb_alloc(); |
| 1239 | struct abis_om2k_hdr *o2k; |
| 1240 | |
| 1241 | o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k)); |
Harald Welte | 1164dce | 2011-03-05 19:21:26 +0100 | [diff] [blame] | 1242 | fill_om2k_hdr(o2k, mo, OM2K_MSGT_NEGOT_REQ_ACK); |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 1243 | |
| 1244 | msgb_tlv_put(msg, OM2K_DEI_NEGOT_REC2, len, data); |
| 1245 | |
| 1246 | DEBUGP(DNM, "Tx MO=%s %s\n", om2k_mo_name(mo), |
| 1247 | get_value_string(om2k_msgcode_vals, OM2K_MSGT_NEGOT_REQ_ACK)); |
| 1248 | |
| 1249 | return abis_om2k_sendmsg(bts, msg); |
| 1250 | } |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1251 | |
Harald Welte | 563d316 | 2011-02-12 18:11:16 +0100 | [diff] [blame] | 1252 | struct iwd_version { |
| 1253 | uint8_t gen_char[3+1]; |
| 1254 | uint8_t rev_char[3+1]; |
| 1255 | }; |
| 1256 | |
| 1257 | struct iwd_type { |
| 1258 | uint8_t num_vers; |
| 1259 | struct iwd_version v[8]; |
| 1260 | }; |
| 1261 | |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1262 | static int om2k_rx_negot_req(struct msgb *msg) |
| 1263 | { |
Pablo Neira Ayuso | 7abecfc | 2011-08-17 22:43:54 +0200 | [diff] [blame] | 1264 | struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1265 | struct abis_om2k_hdr *o2h = msgb_l2(msg); |
Harald Welte | 563d316 | 2011-02-12 18:11:16 +0100 | [diff] [blame] | 1266 | struct iwd_type iwd_types[16]; |
| 1267 | uint8_t num_iwd_types = o2h->data[2]; |
| 1268 | uint8_t *cur = o2h->data+3; |
| 1269 | unsigned int i, v; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1270 | |
Harald Welte | 563d316 | 2011-02-12 18:11:16 +0100 | [diff] [blame] | 1271 | uint8_t out_buf[1024]; |
| 1272 | uint8_t *out_cur = out_buf+1; |
| 1273 | uint8_t out_num_types = 0; |
| 1274 | |
| 1275 | memset(iwd_types, 0, sizeof(iwd_types)); |
| 1276 | |
| 1277 | /* Parse the RBS-supported IWD versions into iwd_types array */ |
| 1278 | for (i = 0; i < num_iwd_types; i++) { |
| 1279 | uint8_t num_versions = *cur++; |
| 1280 | uint8_t iwd_type = *cur++; |
| 1281 | |
| 1282 | iwd_types[iwd_type].num_vers = num_versions; |
| 1283 | |
| 1284 | for (v = 0; v < num_versions; v++) { |
| 1285 | struct iwd_version *iwd_v = &iwd_types[iwd_type].v[v]; |
| 1286 | |
| 1287 | memcpy(iwd_v->gen_char, cur, 3); |
Harald Welte | 56ee6b8 | 2011-02-12 18:13:37 +0100 | [diff] [blame] | 1288 | cur += 3; |
| 1289 | memcpy(iwd_v->rev_char, cur, 3); |
| 1290 | cur += 3; |
| 1291 | |
Harald Welte | 563d316 | 2011-02-12 18:11:16 +0100 | [diff] [blame] | 1292 | DEBUGP(DNM, "\tIWD Type %u Gen %s Rev %s\n", iwd_type, |
| 1293 | iwd_v->gen_char, iwd_v->rev_char); |
| 1294 | } |
| 1295 | } |
| 1296 | |
| 1297 | /* Select the last version for each IWD type */ |
| 1298 | for (i = 0; i < ARRAY_SIZE(iwd_types); i++) { |
| 1299 | struct iwd_type *type = &iwd_types[i]; |
| 1300 | struct iwd_version *last_v; |
| 1301 | |
| 1302 | if (type->num_vers == 0) |
| 1303 | continue; |
| 1304 | |
| 1305 | out_num_types++; |
| 1306 | |
| 1307 | last_v = &type->v[type->num_vers-1]; |
| 1308 | |
| 1309 | *out_cur++ = i; |
| 1310 | memcpy(out_cur, last_v->gen_char, 3); |
| 1311 | out_cur += 3; |
| 1312 | memcpy(out_cur, last_v->rev_char, 3); |
| 1313 | out_cur += 3; |
| 1314 | } |
| 1315 | |
| 1316 | out_buf[0] = out_num_types; |
| 1317 | |
Pablo Neira Ayuso | 7abecfc | 2011-08-17 22:43:54 +0200 | [diff] [blame] | 1318 | return abis_om2k_tx_negot_req_ack(sign_link->trx->bts, &o2h->mo, out_buf, out_cur - out_buf); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1319 | } |
| 1320 | |
| 1321 | static int om2k_rx_start_res(struct msgb *msg) |
| 1322 | { |
Pablo Neira Ayuso | 7abecfc | 2011-08-17 22:43:54 +0200 | [diff] [blame] | 1323 | struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1324 | struct abis_om2k_hdr *o2h = msgb_l2(msg); |
| 1325 | int rc; |
| 1326 | |
Pablo Neira Ayuso | 7abecfc | 2011-08-17 22:43:54 +0200 | [diff] [blame] | 1327 | rc = abis_om2k_tx_simple(sign_link->trx->bts, &o2h->mo, OM2K_MSGT_START_RES_ACK); |
| 1328 | rc = abis_om2k_tx_op_info(sign_link->trx->bts, &o2h->mo, 1); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1329 | |
| 1330 | return rc; |
| 1331 | } |
| 1332 | |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 1333 | static int om2k_rx_op_info_ack(struct msgb *msg) |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1334 | { |
Pablo Neira Ayuso | 7abecfc | 2011-08-17 22:43:54 +0200 | [diff] [blame] | 1335 | struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1336 | struct abis_om2k_hdr *o2h = msgb_l2(msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1337 | |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 1338 | /* This Acknowledgement does not contain the actual operational state, |
| 1339 | * so we signal whatever state we saved when we sent the Op Info |
| 1340 | * request */ |
| 1341 | |
Pablo Neira Ayuso | 7abecfc | 2011-08-17 22:43:54 +0200 | [diff] [blame] | 1342 | signal_op_state(sign_link->trx->bts, &o2h->mo); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1343 | |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 1344 | return 0; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1345 | } |
| 1346 | |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 1347 | const struct value_string om2k_result_strings[] = { |
| 1348 | { 0x02, "Wrong state or out of sequence" }, |
| 1349 | { 0x03, "File error" }, |
| 1350 | { 0x04, "Fault, unspecified" }, |
| 1351 | { 0x05, "Tuning fault" }, |
| 1352 | { 0x06, "Protocol error" }, |
| 1353 | { 0x07, "MO not connected" }, |
| 1354 | { 0x08, "Parameter error" }, |
| 1355 | { 0x09, "Optional function not supported" }, |
| 1356 | { 0x0a, "Local access state LOCALLY DISCONNECTED" }, |
| 1357 | { 0, NULL } |
| 1358 | }; |
| 1359 | |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 1360 | const struct value_string om2k_accordance_strings[] = { |
| 1361 | { 0x00, "Data according to request" }, |
| 1362 | { 0x01, "Data not according to request" }, |
| 1363 | { 0x02, "Inconsistent MO data" }, |
| 1364 | { 0x03, "Capability constraint violation" }, |
| 1365 | { 0, NULL } |
| 1366 | }; |
| 1367 | |
| 1368 | const struct value_string om2k_mostate_vals[] = { |
| 1369 | { 0x00, "RESET" }, |
| 1370 | { 0x01, "STARTED" }, |
| 1371 | { 0x02, "ENABLED" }, |
| 1372 | { 0x03, "DISABLED" }, |
| 1373 | { 0, NULL } |
| 1374 | }; |
| 1375 | |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 1376 | static int om2k_rx_nack(struct msgb *msg) |
| 1377 | { |
| 1378 | struct abis_om2k_hdr *o2h = msgb_l2(msg); |
| 1379 | uint16_t msg_type = ntohs(o2h->msg_type); |
| 1380 | struct tlv_parsed tp; |
| 1381 | |
| 1382 | LOGP(DNM, LOGL_ERROR, "Rx MO=%s %s", om2k_mo_name(&o2h->mo), |
| 1383 | get_value_string(om2k_msgcode_vals, msg_type)); |
| 1384 | |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 1385 | abis_om2k_msg_tlv_parse(&tp, o2h); |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 1386 | if (TLVP_PRESENT(&tp, OM2K_DEI_REASON_CODE)) |
| 1387 | LOGPC(DNM, LOGL_ERROR, ", Reason 0x%02x", |
| 1388 | *TLVP_VAL(&tp, OM2K_DEI_REASON_CODE)); |
| 1389 | |
| 1390 | if (TLVP_PRESENT(&tp, OM2K_DEI_RESULT_CODE)) |
| 1391 | LOGPC(DNM, LOGL_ERROR, ", Result %s", |
| 1392 | get_value_string(om2k_result_strings, |
| 1393 | *TLVP_VAL(&tp, OM2K_DEI_RESULT_CODE))); |
| 1394 | LOGPC(DNM, LOGL_ERROR, "\n"); |
| 1395 | |
| 1396 | return 0; |
| 1397 | } |
| 1398 | |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 1399 | /* Process a Configuration Result message */ |
| 1400 | static int process_conf_res(struct gsm_bts *bts, struct msgb *msg) |
| 1401 | { |
| 1402 | struct abis_om2k_hdr *o2h = msgb_l2(msg); |
| 1403 | uint16_t msg_type = ntohs(o2h->msg_type); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1404 | struct nm_om2k_signal_data nsd; |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 1405 | struct tlv_parsed tp; |
| 1406 | uint8_t acc; |
| 1407 | unsigned int log_level; |
| 1408 | int ret; |
| 1409 | |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1410 | memset(&nsd, 0, sizeof(nsd)); |
| 1411 | |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 1412 | abis_om2k_msg_tlv_parse(&tp, o2h); |
| 1413 | if (!TLVP_PRESENT(&tp, OM2K_DEI_ACCORDANCE_IND)) |
| 1414 | return -EIO; |
| 1415 | |
| 1416 | acc = *TLVP_VAL(&tp, OM2K_DEI_ACCORDANCE_IND); |
| 1417 | |
| 1418 | switch (acc) { |
| 1419 | case 0: |
| 1420 | log_level = LOGL_DEBUG; |
| 1421 | ret = 0; |
| 1422 | break; |
| 1423 | default: |
| 1424 | log_level = LOGL_ERROR; |
| 1425 | ret = -EINVAL; |
| 1426 | break; |
| 1427 | } |
| 1428 | |
| 1429 | LOGP(DNM, log_level, "Rx MO=%s %s, Accordance: %s\n", |
| 1430 | om2k_mo_name(&o2h->mo), |
| 1431 | get_value_string(om2k_msgcode_vals, msg_type), |
| 1432 | get_value_string(om2k_accordance_strings, acc)); |
| 1433 | |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1434 | nsd.bts = bts; |
| 1435 | nsd.obj = mo2obj(bts, &o2h->mo); |
| 1436 | nsd.om2k_mo = &o2h->mo; |
| 1437 | nsd.accordance_ind = acc; |
Pablo Neira Ayuso | bbc5b99 | 2011-05-06 12:12:31 +0200 | [diff] [blame] | 1438 | osmo_signal_dispatch(SS_NM, S_NM_OM2K_CONF_RES, &nsd); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1439 | |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 1440 | return ret; |
| 1441 | } |
| 1442 | |
| 1443 | static int process_mo_state(struct gsm_bts *bts, struct msgb *msg) |
| 1444 | { |
| 1445 | struct abis_om2k_hdr *o2h = msgb_l2(msg); |
| 1446 | uint16_t msg_type = ntohs(o2h->msg_type); |
| 1447 | struct tlv_parsed tp; |
| 1448 | uint8_t mo_state; |
| 1449 | |
| 1450 | abis_om2k_msg_tlv_parse(&tp, o2h); |
| 1451 | if (!TLVP_PRESENT(&tp, OM2K_DEI_MO_STATE)) |
| 1452 | return -EIO; |
| 1453 | mo_state = *TLVP_VAL(&tp, OM2K_DEI_MO_STATE); |
| 1454 | |
| 1455 | LOGP(DNM, LOGL_DEBUG, "Rx MO=%s %s, MO State: %s\n", |
| 1456 | om2k_mo_name(&o2h->mo), |
| 1457 | get_value_string(om2k_msgcode_vals, msg_type), |
| 1458 | get_value_string(om2k_mostate_vals, mo_state)); |
| 1459 | |
Harald Welte | af9b810 | 2011-03-06 21:20:38 +0100 | [diff] [blame] | 1460 | update_mo_state(bts, &o2h->mo, mo_state); |
| 1461 | |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 1462 | return 0; |
| 1463 | } |
| 1464 | |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1465 | int abis_om2k_rcvmsg(struct msgb *msg) |
| 1466 | { |
Pablo Neira Ayuso | 7abecfc | 2011-08-17 22:43:54 +0200 | [diff] [blame] | 1467 | struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst; |
| 1468 | struct gsm_bts *bts = sign_link->trx->bts; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1469 | struct abis_om2k_hdr *o2h = msgb_l2(msg); |
| 1470 | struct abis_om_hdr *oh = &o2h->om; |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 1471 | uint16_t msg_type = ntohs(o2h->msg_type); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1472 | int rc = 0; |
| 1473 | |
| 1474 | /* Various consistency checks */ |
| 1475 | if (oh->placement != ABIS_OM_PLACEMENT_ONLY) { |
| 1476 | LOGP(DNM, LOGL_ERROR, "ABIS OML placement 0x%x not supported\n", |
| 1477 | oh->placement); |
| 1478 | if (oh->placement != ABIS_OM_PLACEMENT_FIRST) |
| 1479 | return -EINVAL; |
| 1480 | } |
| 1481 | if (oh->sequence != 0) { |
| 1482 | LOGP(DNM, LOGL_ERROR, "ABIS OML sequence 0x%x != 0x00\n", |
| 1483 | oh->sequence); |
| 1484 | return -EINVAL; |
| 1485 | } |
| 1486 | |
| 1487 | msg->l3h = (unsigned char *)o2h + sizeof(*o2h); |
| 1488 | |
| 1489 | if (oh->mdisc != ABIS_OM_MDISC_FOM) { |
| 1490 | LOGP(DNM, LOGL_ERROR, "unknown ABIS OM2000 message discriminator 0x%x\n", |
| 1491 | oh->mdisc); |
| 1492 | return -EINVAL; |
| 1493 | } |
| 1494 | |
Harald Welte | 7354107 | 2011-02-12 13:44:14 +0100 | [diff] [blame] | 1495 | DEBUGP(DNM, "Rx MO=%s %s (%s)\n", om2k_mo_name(&o2h->mo), |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 1496 | get_value_string(om2k_msgcode_vals, msg_type), |
Pablo Neira Ayuso | c0d17f2 | 2011-05-07 12:12:48 +0200 | [diff] [blame] | 1497 | osmo_hexdump(msg->l2h, msgb_l2len(msg))); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1498 | |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 1499 | switch (msg_type) { |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1500 | case OM2K_MSGT_CAL_TIME_REQ: |
| 1501 | rc = abis_om2k_cal_time_resp(bts); |
| 1502 | break; |
| 1503 | case OM2K_MSGT_FAULT_REP: |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1504 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_FAULT_REP_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1505 | process_mo_state(bts, msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1506 | break; |
| 1507 | case OM2K_MSGT_NEGOT_REQ: |
| 1508 | rc = om2k_rx_negot_req(msg); |
| 1509 | break; |
| 1510 | case OM2K_MSGT_START_RES: |
| 1511 | rc = om2k_rx_start_res(msg); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1512 | process_mo_state(bts, msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1513 | break; |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 1514 | case OM2K_MSGT_OP_INFO_ACK: |
| 1515 | rc = om2k_rx_op_info_ack(msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1516 | break; |
| 1517 | case OM2K_MSGT_IS_CONF_RES: |
| 1518 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_IS_CONF_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1519 | process_conf_res(bts, msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1520 | break; |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1521 | case OM2K_MSGT_CON_CONF_RES: |
| 1522 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_CON_CONF_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1523 | process_conf_res(bts, msg); |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1524 | break; |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1525 | case OM2K_MSGT_TX_CONF_RES: |
| 1526 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TX_CONF_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1527 | process_conf_res(bts, msg); |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1528 | break; |
| 1529 | case OM2K_MSGT_RX_CONF_RES: |
| 1530 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_RX_CONF_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1531 | process_conf_res(bts, msg); |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1532 | break; |
| 1533 | case OM2K_MSGT_TS_CONF_RES: |
| 1534 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TS_CONF_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1535 | process_conf_res(bts, msg); |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1536 | break; |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 1537 | case OM2K_MSGT_TF_CONF_RES: |
| 1538 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TF_CONF_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1539 | process_conf_res(bts, msg); |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 1540 | break; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1541 | case OM2K_MSGT_CONNECT_COMPL: |
| 1542 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_RESET_CMD); |
| 1543 | break; |
| 1544 | case OM2K_MSGT_RESET_COMPL: |
| 1545 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_START_REQ); |
| 1546 | break; |
Harald Welte | b3d70fd | 2011-02-13 12:43:44 +0100 | [diff] [blame] | 1547 | case OM2K_MSGT_ENABLE_RES: |
| 1548 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_ENABLE_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1549 | process_mo_state(bts, msg); |
Harald Welte | b3d70fd | 2011-02-13 12:43:44 +0100 | [diff] [blame] | 1550 | break; |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1551 | case OM2K_MSGT_DISABLE_RES: |
| 1552 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_DISABLE_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1553 | process_mo_state(bts, msg); |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1554 | break; |
| 1555 | case OM2K_MSGT_TEST_RES: |
| 1556 | rc = abis_om2k_tx_simple(bts, &o2h->mo, OM2K_MSGT_TEST_RES_ACK); |
Harald Welte | 40d1c3f | 2011-03-06 23:20:28 +0100 | [diff] [blame] | 1557 | process_mo_state(bts, msg); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1558 | break; |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 1559 | case OM2K_MSGT_STATUS_RESP: |
Harald Welte | e898ecc | 2011-03-06 19:26:11 +0100 | [diff] [blame] | 1560 | process_mo_state(bts, msg); |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 1561 | break; |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1562 | case OM2K_MSGT_START_REQ_ACK: |
| 1563 | case OM2K_MSGT_CON_CONF_REQ_ACK: |
| 1564 | case OM2K_MSGT_IS_CONF_REQ_ACK: |
Harald Welte | a0ce349 | 2011-03-05 14:13:14 +0100 | [diff] [blame] | 1565 | case OM2K_MSGT_TX_CONF_REQ_ACK: |
| 1566 | case OM2K_MSGT_RX_CONF_REQ_ACK: |
| 1567 | case OM2K_MSGT_TS_CONF_REQ_ACK: |
Harald Welte | f9cf961 | 2011-03-05 14:36:47 +0100 | [diff] [blame] | 1568 | case OM2K_MSGT_TF_CONF_REQ_ACK: |
Harald Welte | fdb7194 | 2011-02-14 15:31:43 +0100 | [diff] [blame] | 1569 | case OM2K_MSGT_ENABLE_REQ_ACK: |
| 1570 | case OM2K_MSGT_ALARM_STATUS_REQ_ACK: |
| 1571 | case OM2K_MSGT_DISABLE_REQ_ACK: |
| 1572 | break; |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 1573 | case OM2K_MSGT_START_REQ_REJ: |
Harald Welte | 3ede723 | 2011-03-05 17:58:13 +0100 | [diff] [blame] | 1574 | case OM2K_MSGT_CONNECT_REJ: |
Harald Welte | aff63bc | 2011-03-05 19:42:16 +0100 | [diff] [blame] | 1575 | case OM2K_MSGT_OP_INFO_REJ: |
Harald Welte | 3ede723 | 2011-03-05 17:58:13 +0100 | [diff] [blame] | 1576 | case OM2K_MSGT_DISCONNECT_REJ: |
Harald Welte | aff63bc | 2011-03-05 19:42:16 +0100 | [diff] [blame] | 1577 | case OM2K_MSGT_TEST_REQ_REJ: |
Harald Welte | e6e8383 | 2011-03-05 17:52:09 +0100 | [diff] [blame] | 1578 | case OM2K_MSGT_CON_CONF_REQ_REJ: |
| 1579 | case OM2K_MSGT_IS_CONF_REQ_REJ: |
| 1580 | case OM2K_MSGT_TX_CONF_REQ_REJ: |
| 1581 | case OM2K_MSGT_RX_CONF_REQ_REJ: |
| 1582 | case OM2K_MSGT_TS_CONF_REQ_REJ: |
| 1583 | case OM2K_MSGT_TF_CONF_REQ_REJ: |
| 1584 | case OM2K_MSGT_ENABLE_REQ_REJ: |
| 1585 | case OM2K_MSGT_ALARM_STATUS_REQ_REJ: |
| 1586 | case OM2K_MSGT_DISABLE_REQ_REJ: |
| 1587 | rc = om2k_rx_nack(msg); |
| 1588 | break; |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1589 | default: |
Harald Welte | 0741ffe | 2011-02-12 18:48:53 +0100 | [diff] [blame] | 1590 | LOGP(DNM, LOGL_NOTICE, "Rx unhandled OM2000 msg %s\n", |
Harald Welte | bc867d9 | 2011-02-12 13:09:38 +0100 | [diff] [blame] | 1591 | get_value_string(om2k_msgcode_vals, msg_type)); |
Harald Welte | 9a311ec | 2011-02-12 12:33:06 +0100 | [diff] [blame] | 1592 | } |
| 1593 | |
| 1594 | msgb_free(msg); |
| 1595 | return rc; |
| 1596 | } |