Harald Welte | 0374084 | 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 |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 10 | * it under the terms of the GNU Affero General Public License as published by |
| 11 | * the Free Software Foundation; either version 3 of the License, or |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 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 |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 17 | * GNU Affero General Public License for more details. |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 18 | * |
Harald Welte | 0e3e88e | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 19 | * You should have received a copy of the GNU Affero General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 21 | * |
| 22 | */ |
| 23 | |
| 24 | #ifndef _MNCC_H |
| 25 | #define _MNCC_H |
| 26 | |
Harald Welte | f4625b1 | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 27 | #include <osmocore/linuxlist.h> |
Harald Welte | fdc93d9 | 2010-03-07 23:40:35 +0100 | [diff] [blame] | 28 | #include <osmocore/mncc.h> |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 29 | |
Holger Hans Peter Freyther | ddfda9e | 2011-01-06 14:42:15 +0100 | [diff] [blame^] | 30 | #include <stdint.h> |
| 31 | |
Sylvain Munaut | 5f431d9 | 2010-12-01 22:38:51 +0100 | [diff] [blame] | 32 | struct gsm_network; |
Harald Welte | 5c05ed3 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 33 | struct msgb; |
Sylvain Munaut | 5f431d9 | 2010-12-01 22:38:51 +0100 | [diff] [blame] | 34 | |
| 35 | |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 36 | /* One end of a call */ |
| 37 | struct gsm_call { |
| 38 | struct llist_head entry; |
| 39 | |
| 40 | /* network handle */ |
| 41 | void *net; |
| 42 | |
| 43 | /* the 'local' transaction */ |
Holger Hans Peter Freyther | ddfda9e | 2011-01-06 14:42:15 +0100 | [diff] [blame^] | 44 | uint32_t callref; |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 45 | /* the 'remote' transaction */ |
Holger Hans Peter Freyther | ddfda9e | 2011-01-06 14:42:15 +0100 | [diff] [blame^] | 46 | uint32_t remote_ref; |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | #define MNCC_SETUP_REQ 0x0101 |
| 50 | #define MNCC_SETUP_IND 0x0102 |
| 51 | #define MNCC_SETUP_RSP 0x0103 |
| 52 | #define MNCC_SETUP_CNF 0x0104 |
| 53 | #define MNCC_SETUP_COMPL_REQ 0x0105 |
| 54 | #define MNCC_SETUP_COMPL_IND 0x0106 |
| 55 | /* MNCC_REJ_* is perfomed via MNCC_REL_* */ |
| 56 | #define MNCC_CALL_CONF_IND 0x0107 |
| 57 | #define MNCC_CALL_PROC_REQ 0x0108 |
| 58 | #define MNCC_PROGRESS_REQ 0x0109 |
| 59 | #define MNCC_ALERT_REQ 0x010a |
| 60 | #define MNCC_ALERT_IND 0x010b |
| 61 | #define MNCC_NOTIFY_REQ 0x010c |
| 62 | #define MNCC_NOTIFY_IND 0x010d |
| 63 | #define MNCC_DISC_REQ 0x010e |
| 64 | #define MNCC_DISC_IND 0x010f |
| 65 | #define MNCC_REL_REQ 0x0110 |
| 66 | #define MNCC_REL_IND 0x0111 |
| 67 | #define MNCC_REL_CNF 0x0112 |
| 68 | #define MNCC_FACILITY_REQ 0x0113 |
| 69 | #define MNCC_FACILITY_IND 0x0114 |
| 70 | #define MNCC_START_DTMF_IND 0x0115 |
| 71 | #define MNCC_START_DTMF_RSP 0x0116 |
| 72 | #define MNCC_START_DTMF_REJ 0x0117 |
| 73 | #define MNCC_STOP_DTMF_IND 0x0118 |
| 74 | #define MNCC_STOP_DTMF_RSP 0x0119 |
| 75 | #define MNCC_MODIFY_REQ 0x011a |
| 76 | #define MNCC_MODIFY_IND 0x011b |
| 77 | #define MNCC_MODIFY_RSP 0x011c |
| 78 | #define MNCC_MODIFY_CNF 0x011d |
| 79 | #define MNCC_MODIFY_REJ 0x011e |
| 80 | #define MNCC_HOLD_IND 0x011f |
| 81 | #define MNCC_HOLD_CNF 0x0120 |
| 82 | #define MNCC_HOLD_REJ 0x0121 |
| 83 | #define MNCC_RETRIEVE_IND 0x0122 |
| 84 | #define MNCC_RETRIEVE_CNF 0x0123 |
| 85 | #define MNCC_RETRIEVE_REJ 0x0124 |
| 86 | #define MNCC_USERINFO_REQ 0x0125 |
| 87 | #define MNCC_USERINFO_IND 0x0126 |
| 88 | #define MNCC_REJ_REQ 0x0127 |
| 89 | #define MNCC_REJ_IND 0x0128 |
| 90 | |
| 91 | #define MNCC_BRIDGE 0x0200 |
| 92 | #define MNCC_FRAME_RECV 0x0201 |
| 93 | #define MNCC_FRAME_DROP 0x0202 |
| 94 | #define MNCC_LCHAN_MODIFY 0x0203 |
| 95 | |
Harald Welte | 3971ad5 | 2009-12-19 22:23:05 +0100 | [diff] [blame] | 96 | #define GSM_TCHF_FRAME 0x0300 |
Harald Welte | d3d68ad | 2009-12-19 23:06:41 +0100 | [diff] [blame] | 97 | #define GSM_TCHF_FRAME_EFR 0x0301 |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 98 | |
| 99 | #define GSM_MAX_FACILITY 128 |
| 100 | #define GSM_MAX_SSVERSION 128 |
| 101 | #define GSM_MAX_USERUSER 128 |
| 102 | |
| 103 | #define MNCC_F_BEARER_CAP 0x0001 |
| 104 | #define MNCC_F_CALLED 0x0002 |
| 105 | #define MNCC_F_CALLING 0x0004 |
| 106 | #define MNCC_F_REDIRECTING 0x0008 |
| 107 | #define MNCC_F_CONNECTED 0x0010 |
| 108 | #define MNCC_F_CAUSE 0x0020 |
| 109 | #define MNCC_F_USERUSER 0x0040 |
| 110 | #define MNCC_F_PROGRESS 0x0080 |
| 111 | #define MNCC_F_EMERGENCY 0x0100 |
| 112 | #define MNCC_F_FACILITY 0x0200 |
| 113 | #define MNCC_F_SSVERSION 0x0400 |
| 114 | #define MNCC_F_CCCAP 0x0800 |
| 115 | #define MNCC_F_KEYPAD 0x1000 |
| 116 | #define MNCC_F_SIGNAL 0x2000 |
| 117 | |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 118 | struct gsm_mncc { |
| 119 | /* context based information */ |
Holger Hans Peter Freyther | ddfda9e | 2011-01-06 14:42:15 +0100 | [diff] [blame^] | 120 | uint32_t msg_type; |
| 121 | uint32_t callref; |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 122 | |
| 123 | /* which fields are present */ |
Holger Hans Peter Freyther | ddfda9e | 2011-01-06 14:42:15 +0100 | [diff] [blame^] | 124 | uint32_t fields; |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 125 | |
| 126 | /* data derived informations (MNCC_F_ based) */ |
| 127 | struct gsm_mncc_bearer_cap bearer_cap; |
| 128 | struct gsm_mncc_number called; |
| 129 | struct gsm_mncc_number calling; |
| 130 | struct gsm_mncc_number redirecting; |
| 131 | struct gsm_mncc_number connected; |
| 132 | struct gsm_mncc_cause cause; |
| 133 | struct gsm_mncc_progress progress; |
| 134 | struct gsm_mncc_useruser useruser; |
| 135 | struct gsm_mncc_facility facility; |
| 136 | struct gsm_mncc_cccap cccap; |
| 137 | struct gsm_mncc_ssversion ssversion; |
| 138 | struct { |
| 139 | int sup; |
| 140 | int inv; |
| 141 | } clir; |
| 142 | int signal; |
| 143 | |
| 144 | /* data derived information, not MNCC_F based */ |
| 145 | int keypad; |
| 146 | int more; |
| 147 | int notify; /* 0..127 */ |
| 148 | int emergency; |
Andreas Eversberg | 9eaa5da | 2009-06-15 23:22:09 +0200 | [diff] [blame] | 149 | char imsi[16]; |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 150 | |
| 151 | unsigned char lchan_mode; |
| 152 | }; |
| 153 | |
Harald Welte | 3971ad5 | 2009-12-19 22:23:05 +0100 | [diff] [blame] | 154 | struct gsm_data_frame { |
Holger Hans Peter Freyther | ddfda9e | 2011-01-06 14:42:15 +0100 | [diff] [blame^] | 155 | uint32_t msg_type; |
| 156 | uint32_t callref; |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 157 | unsigned char data[0]; |
| 158 | }; |
| 159 | |
| 160 | char *get_mncc_name(int value); |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 161 | void mncc_set_cause(struct gsm_mncc *data, int loc, int val); |
Harald Welte | cef3b46 | 2010-12-23 00:13:47 +0100 | [diff] [blame] | 162 | void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg); |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 163 | |
Harald Welte | bd93eaf | 2010-12-23 01:26:29 +0100 | [diff] [blame] | 164 | /* input from CC code into mncc_builtin */ |
| 165 | int int_mncc_recv(struct gsm_network *net, struct msgb *msg); |
| 166 | |
| 167 | /* input from CC code into mncc_sock */ |
| 168 | void mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg); |
| 169 | |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 170 | #endif |