Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame^] | 1 | /* GSM Mobile Radio Interface Layer 3 messages on the A-bis interface |
| 2 | * 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0 */ |
| 3 | |
| 4 | /* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org> |
| 5 | * (C) 2008, 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 6 | * |
| 7 | * All Rights Reserved |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along |
| 20 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef _MNCC_H |
| 26 | #define _MNCC_H |
| 27 | |
| 28 | #include <openbsc/linuxlist.h> |
| 29 | |
| 30 | /* One end of a call */ |
| 31 | struct gsm_call { |
| 32 | struct llist_head entry; |
| 33 | |
| 34 | /* network handle */ |
| 35 | void *net; |
| 36 | |
| 37 | /* the 'local' transaction */ |
| 38 | u_int32_t callref; |
| 39 | /* the 'remote' transaction */ |
| 40 | u_int32_t remote_ref; |
| 41 | }; |
| 42 | |
| 43 | #define MNCC_SETUP_REQ 0x0101 |
| 44 | #define MNCC_SETUP_IND 0x0102 |
| 45 | #define MNCC_SETUP_RSP 0x0103 |
| 46 | #define MNCC_SETUP_CNF 0x0104 |
| 47 | #define MNCC_SETUP_COMPL_REQ 0x0105 |
| 48 | #define MNCC_SETUP_COMPL_IND 0x0106 |
| 49 | /* MNCC_REJ_* is perfomed via MNCC_REL_* */ |
| 50 | #define MNCC_CALL_CONF_IND 0x0107 |
| 51 | #define MNCC_CALL_PROC_REQ 0x0108 |
| 52 | #define MNCC_PROGRESS_REQ 0x0109 |
| 53 | #define MNCC_ALERT_REQ 0x010a |
| 54 | #define MNCC_ALERT_IND 0x010b |
| 55 | #define MNCC_NOTIFY_REQ 0x010c |
| 56 | #define MNCC_NOTIFY_IND 0x010d |
| 57 | #define MNCC_DISC_REQ 0x010e |
| 58 | #define MNCC_DISC_IND 0x010f |
| 59 | #define MNCC_REL_REQ 0x0110 |
| 60 | #define MNCC_REL_IND 0x0111 |
| 61 | #define MNCC_REL_CNF 0x0112 |
| 62 | #define MNCC_FACILITY_REQ 0x0113 |
| 63 | #define MNCC_FACILITY_IND 0x0114 |
| 64 | #define MNCC_START_DTMF_IND 0x0115 |
| 65 | #define MNCC_START_DTMF_RSP 0x0116 |
| 66 | #define MNCC_START_DTMF_REJ 0x0117 |
| 67 | #define MNCC_STOP_DTMF_IND 0x0118 |
| 68 | #define MNCC_STOP_DTMF_RSP 0x0119 |
| 69 | #define MNCC_MODIFY_REQ 0x011a |
| 70 | #define MNCC_MODIFY_IND 0x011b |
| 71 | #define MNCC_MODIFY_RSP 0x011c |
| 72 | #define MNCC_MODIFY_CNF 0x011d |
| 73 | #define MNCC_MODIFY_REJ 0x011e |
| 74 | #define MNCC_HOLD_IND 0x011f |
| 75 | #define MNCC_HOLD_CNF 0x0120 |
| 76 | #define MNCC_HOLD_REJ 0x0121 |
| 77 | #define MNCC_RETRIEVE_IND 0x0122 |
| 78 | #define MNCC_RETRIEVE_CNF 0x0123 |
| 79 | #define MNCC_RETRIEVE_REJ 0x0124 |
| 80 | #define MNCC_USERINFO_REQ 0x0125 |
| 81 | #define MNCC_USERINFO_IND 0x0126 |
| 82 | #define MNCC_REJ_REQ 0x0127 |
| 83 | #define MNCC_REJ_IND 0x0128 |
| 84 | |
| 85 | #define MNCC_BRIDGE 0x0200 |
| 86 | #define MNCC_FRAME_RECV 0x0201 |
| 87 | #define MNCC_FRAME_DROP 0x0202 |
| 88 | #define MNCC_LCHAN_MODIFY 0x0203 |
| 89 | |
| 90 | #define GSM_TRAU_FRAME 0x0300 |
| 91 | |
| 92 | #define GSM_MAX_FACILITY 128 |
| 93 | #define GSM_MAX_SSVERSION 128 |
| 94 | #define GSM_MAX_USERUSER 128 |
| 95 | |
| 96 | #define MNCC_F_BEARER_CAP 0x0001 |
| 97 | #define MNCC_F_CALLED 0x0002 |
| 98 | #define MNCC_F_CALLING 0x0004 |
| 99 | #define MNCC_F_REDIRECTING 0x0008 |
| 100 | #define MNCC_F_CONNECTED 0x0010 |
| 101 | #define MNCC_F_CAUSE 0x0020 |
| 102 | #define MNCC_F_USERUSER 0x0040 |
| 103 | #define MNCC_F_PROGRESS 0x0080 |
| 104 | #define MNCC_F_EMERGENCY 0x0100 |
| 105 | #define MNCC_F_FACILITY 0x0200 |
| 106 | #define MNCC_F_SSVERSION 0x0400 |
| 107 | #define MNCC_F_CCCAP 0x0800 |
| 108 | #define MNCC_F_KEYPAD 0x1000 |
| 109 | #define MNCC_F_SIGNAL 0x2000 |
| 110 | |
| 111 | struct gsm_mncc_bearer_cap { |
| 112 | int transfer; |
| 113 | int mode; |
| 114 | int coding; |
| 115 | int radio; |
| 116 | int speech_ctm; |
| 117 | int speech_ver[8]; |
| 118 | }; |
| 119 | |
| 120 | struct gsm_mncc_number { |
| 121 | int type; |
| 122 | int plan; |
| 123 | int present; |
| 124 | int screen; |
| 125 | char number[33]; |
| 126 | }; |
| 127 | |
| 128 | struct gsm_mncc_cause { |
| 129 | int location; |
| 130 | int coding; |
| 131 | int rec; |
| 132 | int rec_val; |
| 133 | int value; |
| 134 | int diag_len; |
| 135 | char diag[32]; |
| 136 | }; |
| 137 | |
| 138 | struct gsm_mncc_useruser { |
| 139 | int proto; |
| 140 | char info[GSM_MAX_USERUSER + 1]; /* + termination char */ |
| 141 | }; |
| 142 | |
| 143 | struct gsm_mncc_progress { |
| 144 | int coding; |
| 145 | int location; |
| 146 | int descr; |
| 147 | }; |
| 148 | |
| 149 | struct gsm_mncc_facility { |
| 150 | int len; |
| 151 | char info[GSM_MAX_FACILITY]; |
| 152 | }; |
| 153 | |
| 154 | struct gsm_mncc_ssversion { |
| 155 | int len; |
| 156 | char info[GSM_MAX_SSVERSION]; |
| 157 | }; |
| 158 | |
| 159 | struct gsm_mncc_cccap { |
| 160 | int dtmf; |
| 161 | int pcp; |
| 162 | }; |
| 163 | |
| 164 | |
| 165 | struct gsm_mncc { |
| 166 | /* context based information */ |
| 167 | u_int32_t msg_type; |
| 168 | u_int32_t callref; |
| 169 | |
| 170 | /* which fields are present */ |
| 171 | u_int32_t fields; |
| 172 | |
| 173 | /* data derived informations (MNCC_F_ based) */ |
| 174 | struct gsm_mncc_bearer_cap bearer_cap; |
| 175 | struct gsm_mncc_number called; |
| 176 | struct gsm_mncc_number calling; |
| 177 | struct gsm_mncc_number redirecting; |
| 178 | struct gsm_mncc_number connected; |
| 179 | struct gsm_mncc_cause cause; |
| 180 | struct gsm_mncc_progress progress; |
| 181 | struct gsm_mncc_useruser useruser; |
| 182 | struct gsm_mncc_facility facility; |
| 183 | struct gsm_mncc_cccap cccap; |
| 184 | struct gsm_mncc_ssversion ssversion; |
| 185 | struct { |
| 186 | int sup; |
| 187 | int inv; |
| 188 | } clir; |
| 189 | int signal; |
| 190 | |
| 191 | /* data derived information, not MNCC_F based */ |
| 192 | int keypad; |
| 193 | int more; |
| 194 | int notify; /* 0..127 */ |
| 195 | int emergency; |
| 196 | |
| 197 | unsigned char lchan_mode; |
| 198 | }; |
| 199 | |
| 200 | struct gsm_trau_frame { |
| 201 | u_int32_t msg_type; |
| 202 | u_int32_t callref; |
| 203 | unsigned char data[0]; |
| 204 | }; |
| 205 | |
| 206 | char *get_mncc_name(int value); |
| 207 | int mncc_recv(struct gsm_network *net, int msg_type, void *arg); |
| 208 | void mncc_set_cause(struct gsm_mncc *data, int loc, int val); |
| 209 | |
| 210 | #endif |