Holger Hans Peter Freyther | ec32b58 | 2010-03-23 07:40:46 +0100 | [diff] [blame] | 1 | /* GSM 08.08 like API for OpenBSC */ |
| 2 | |
Holger Hans Peter Freyther | 05a379b | 2010-06-14 15:50:35 +0800 | [diff] [blame] | 3 | #ifndef OPENBSC_BSC_API_H |
| 4 | #define OPENBSC_BSC_API_H |
| 5 | |
Holger Hans Peter Freyther | ec32b58 | 2010-03-23 07:40:46 +0100 | [diff] [blame] | 6 | #include "gsm_data.h" |
| 7 | |
Holger Hans Peter Freyther | 9764331 | 2010-06-17 16:41:25 +0800 | [diff] [blame] | 8 | #define BSC_API_CONN_POL_ACCEPT 0 |
| 9 | #define BSC_API_CONN_POL_REJECT 1 |
| 10 | |
Holger Hans Peter Freyther | 05a379b | 2010-06-14 15:50:35 +0800 | [diff] [blame] | 11 | struct bsc_api { |
Harald Welte | ca86dd5 | 2011-09-13 00:09:20 +0100 | [diff] [blame] | 12 | /*! \brief BTS->MSC: tell MSC a SAPI was not established */ |
Holger Hans Peter Freyther | 05a379b | 2010-06-14 15:50:35 +0800 | [diff] [blame] | 13 | void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci); |
Harald Welte | ca86dd5 | 2011-09-13 00:09:20 +0100 | [diff] [blame] | 14 | /*! \brief MS->MSC: Tell MSC that ciphering has been enabled */ |
Holger Hans Peter Freyther | 05a379b | 2010-06-14 15:50:35 +0800 | [diff] [blame] | 15 | void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn, |
Holger Hans Peter Freyther | c702b75 | 2010-07-23 17:10:44 +0800 | [diff] [blame] | 16 | struct msgb *msg, uint8_t chosen_encr); |
Harald Welte | ca86dd5 | 2011-09-13 00:09:20 +0100 | [diff] [blame] | 17 | /*! \brief MS->MSC: New MM context with L3 payload */ |
Holger Hans Peter Freyther | 9764331 | 2010-06-17 16:41:25 +0800 | [diff] [blame] | 18 | int (*compl_l3)(struct gsm_subscriber_connection *conn, |
| 19 | struct msgb *msg, uint16_t chosen_channel); |
Harald Welte | ca86dd5 | 2011-09-13 00:09:20 +0100 | [diff] [blame] | 20 | /*! \brief MS->BSC/MSC: Um L3 message */ |
Holger Hans Peter Freyther | 46caa30 | 2010-11-04 12:18:00 +0100 | [diff] [blame] | 21 | void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id, |
| 22 | struct msgb *msg); |
Harald Welte | ca86dd5 | 2011-09-13 00:09:20 +0100 | [diff] [blame] | 23 | /*! \brief BSC->MSC: Assignment of lchan successful */ |
Holger Hans Peter Freyther | c354de8 | 2010-07-23 16:49:38 +0800 | [diff] [blame] | 24 | void (*assign_compl)(struct gsm_subscriber_connection *conn, |
Holger Hans Peter Freyther | b094171 | 2010-11-04 12:06:57 +0100 | [diff] [blame] | 25 | uint8_t rr_cause, uint8_t chosen_channel, |
| 26 | uint8_t encr_alg_id, uint8_t speech_mode); |
Harald Welte | ca86dd5 | 2011-09-13 00:09:20 +0100 | [diff] [blame] | 27 | /*! \brief BSC->MSC: Assignment of lchan failed */ |
Holger Hans Peter Freyther | c354de8 | 2010-07-23 16:49:38 +0800 | [diff] [blame] | 28 | void (*assign_fail)(struct gsm_subscriber_connection *conn, |
Holger Hans Peter Freyther | 45b575f | 2010-11-05 10:37:17 +0100 | [diff] [blame] | 29 | uint8_t cause, uint8_t *rr_cause); |
Harald Welte | ca86dd5 | 2011-09-13 00:09:20 +0100 | [diff] [blame] | 30 | /*! \brief BSC->MSC: RR conn has been cleared */ |
Holger Hans Peter Freyther | 05c6884 | 2010-11-03 19:01:58 +0100 | [diff] [blame] | 31 | int (*clear_request)(struct gsm_subscriber_connection *conn, |
Holger Hans Peter Freyther | 05a379b | 2010-06-14 15:50:35 +0800 | [diff] [blame] | 32 | uint32_t cause); |
Harald Welte | 95e862c | 2012-01-23 10:28:35 +0100 | [diff] [blame] | 33 | /*! \brief BSC->MSC: Classmark Update */ |
| 34 | void (*classmark_chg)(struct gsm_subscriber_connection *conn, |
| 35 | const uint8_t *cm2, uint8_t cm2_len, |
| 36 | const uint8_t *cm3, uint8_t cm3_len); |
Holger Hans Peter Freyther | 25aa749 | 2011-08-06 07:00:52 +0200 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Configure the multirate setting on this channel. If it is |
| 40 | * not implemented AMR5.9 will be used. |
| 41 | */ |
| 42 | void (*mr_config)(struct gsm_subscriber_connection *conn, |
Holger Hans Peter Freyther | 7a77d01 | 2015-09-24 16:26:01 +0200 | [diff] [blame] | 43 | struct gsm_lchan *lchan, int full_rate); |
Harald Welte | 9066b74 | 2016-06-19 18:06:02 +0200 | [diff] [blame^] | 44 | |
| 45 | /** Callback for additional actions during conn cleanup */ |
| 46 | void (*conn_cleanup)(struct gsm_subscriber_connection *conn); |
Holger Hans Peter Freyther | 05a379b | 2010-06-14 15:50:35 +0800 | [diff] [blame] | 47 | }; |
Holger Hans Peter Freyther | ec32b58 | 2010-03-23 07:40:46 +0100 | [diff] [blame] | 48 | |
Holger Hans Peter Freyther | abcddf1 | 2010-06-14 18:20:15 +0800 | [diff] [blame] | 49 | int bsc_api_init(struct gsm_network *network, struct bsc_api *api); |
Holger Hans Peter Freyther | afa0ad1 | 2012-04-18 18:58:36 +0200 | [diff] [blame] | 50 | int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, int link_id, int allow_sacch); |
Holger Hans Peter Freyther | 2603c1f | 2010-11-10 10:01:20 +0100 | [diff] [blame] | 51 | int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate); |
Holger Hans Peter Freyther | dbc62db | 2010-07-23 16:55:24 +0800 | [diff] [blame] | 52 | int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher, |
Holger Hans Peter Freyther | 2f169d6 | 2010-11-10 09:42:50 +0100 | [diff] [blame] | 53 | const uint8_t *key, int len, int include_imeisv); |
Holger Hans Peter Freyther | 7700846 | 2010-06-16 14:10:45 +0800 | [diff] [blame] | 54 | int gsm0808_page(struct gsm_bts *bts, unsigned int page_group, |
| 55 | unsigned int mi_len, uint8_t *mi, int chan_type); |
Holger Hans Peter Freyther | 4049455 | 2010-06-28 17:09:29 +0800 | [diff] [blame] | 56 | int gsm0808_clear(struct gsm_subscriber_connection *conn); |
Holger Hans Peter Freyther | 05a379b | 2010-06-14 15:50:35 +0800 | [diff] [blame] | 57 | |
| 58 | #endif |