Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1 | #ifndef _GSM_04_08_H |
| 2 | #define _GSM_04_08_H |
| 3 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 4 | #include <osmocom/gsm/gsm48.h> |
Harald Welte | b226864 | 2011-07-23 10:53:30 +0200 | [diff] [blame] | 5 | #include <osmocom/gsm/gsm_utils.h> |
| 6 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
| 7 | |
| 8 | #include <openbsc/meas_rep.h> |
Holger Hans Peter Freyther | 1494a76 | 2009-08-01 07:26:59 +0200 | [diff] [blame] | 9 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 10 | struct msgb; |
| 11 | struct gsm_bts; |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 12 | struct gsm_network; |
Harald Welte | 39e2ead | 2009-07-23 21:13:03 +0200 | [diff] [blame] | 13 | struct gsm_trans; |
Holger Hans Peter Freyther | f6fb3ef | 2010-06-15 13:16:52 +0800 | [diff] [blame] | 14 | struct gsm_subscriber_connection; |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 15 | struct amr_multirate_conf; |
Holger Hans Peter Freyther | 615ed46 | 2015-09-24 11:30:58 +0200 | [diff] [blame] | 16 | struct amr_mode; |
Neels Hofmeyr | 6d804b1 | 2017-02-18 22:20:46 +0100 | [diff] [blame] | 17 | struct bsc_subscr; |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 18 | |
Harald Welte | 985263e | 2010-12-23 23:00:21 +0100 | [diff] [blame] | 19 | #define GSM48_ALLOC_SIZE 2048 |
| 20 | #define GSM48_ALLOC_HEADROOM 256 |
Harald Welte | 3c69a4c | 2010-05-01 14:22:44 +0200 | [diff] [blame] | 21 | |
Holger Hans Peter Freyther | 8239e06 | 2016-01-25 22:03:25 +0100 | [diff] [blame] | 22 | static inline struct msgb *gsm48_msgb_alloc_name(const char *name) |
Harald Welte | 3c69a4c | 2010-05-01 14:22:44 +0200 | [diff] [blame] | 23 | { |
| 24 | return msgb_alloc_headroom(GSM48_ALLOC_SIZE, GSM48_ALLOC_HEADROOM, |
Holger Hans Peter Freyther | 8239e06 | 2016-01-25 22:03:25 +0100 | [diff] [blame] | 25 | name); |
Harald Welte | 3c69a4c | 2010-05-01 14:22:44 +0200 | [diff] [blame] | 26 | } |
| 27 | |
Harald Welte | 9066b74 | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 28 | void cm_service_request_concludes(struct gsm_subscriber_connection *conn, |
| 29 | struct msgb *msg); |
| 30 | |
Holger Freyther | e97f7fb | 2008-12-31 18:52:11 +0000 | [diff] [blame] | 31 | /* config options controlling the behaviour of the lower leves */ |
Holger Freyther | 89824fc | 2008-12-30 16:18:18 +0000 | [diff] [blame] | 32 | void gsm0408_allow_everyone(int allow); |
Harald Welte | 371efe5 | 2010-12-22 23:17:50 +0100 | [diff] [blame] | 33 | void gsm0408_clear_all_trans(struct gsm_network *net, int protocol); |
Holger Hans Peter Freyther | 9764331 | 2010-06-17 16:41:25 +0800 | [diff] [blame] | 34 | int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg); |
Holger Freyther | e97f7fb | 2008-12-31 18:52:11 +0000 | [diff] [blame] | 35 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 36 | int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 37 | enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, uint8_t ra); |
Harald Welte | b226864 | 2011-07-23 10:53:30 +0200 | [diff] [blame] | 38 | /* don't use "enum gsm_chreq_reason_t" to avoid circular dependency */ |
| 39 | int get_reason_by_chreq(uint8_t ra, int neci); |
Holger Hans Peter Freyther | 7889107 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 40 | void gsm_net_update_ctype(struct gsm_network *net); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 41 | |
Holger Hans Peter Freyther | 9140174 | 2010-06-15 14:16:02 +0800 | [diff] [blame] | 42 | int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn); |
Neels Hofmeyr | d675515 | 2017-01-27 00:25:47 +0100 | [diff] [blame] | 43 | int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, |
| 44 | uint8_t *autn, int key_seq); |
Holger Hans Peter Freyther | e9ed340 | 2010-06-16 12:30:50 +0800 | [diff] [blame] | 45 | int gsm48_tx_mm_auth_rej(struct gsm_subscriber_connection *conn); |
Jacob Erlbeck | 24d3b91 | 2013-10-31 15:36:41 +0100 | [diff] [blame] | 46 | int gsm48_tx_mm_serv_ack(struct gsm_subscriber_connection *conn); |
| 47 | int gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn, |
| 48 | enum gsm48_reject_value value); |
Holger Freyther | e64a7a3 | 2009-02-06 21:55:37 +0000 | [diff] [blame] | 49 | int gsm48_send_rr_release(struct gsm_lchan *lchan); |
Holger Hans Peter Freyther | ca6bc1d | 2009-10-05 14:00:14 +0200 | [diff] [blame] | 50 | int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 51 | int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, uint8_t apdu_id, |
| 52 | uint8_t apdu_len, const uint8_t *apdu); |
| 53 | int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_class); |
Harald Welte | 7a7a0d5 | 2009-12-17 00:25:18 +0100 | [diff] [blame] | 54 | int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 55 | uint8_t power_command, uint8_t ho_ref); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 56 | |
Harald Welte | 7655637 | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 57 | int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg); |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 58 | |
Harald Welte | 0932d1e | 2009-02-16 22:53:52 +0000 | [diff] [blame] | 59 | /* convert a ASCII phone number to call-control BCD */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 60 | int encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len, |
Harald Welte | 0c38930 | 2009-06-10 12:08:54 +0800 | [diff] [blame] | 61 | int h_len, const char *input); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 62 | int decode_bcd_number(char *output, int output_len, const uint8_t *bcd_lv, |
Harald Welte | 0c38930 | 2009-06-10 12:08:54 +0800 | [diff] [blame] | 63 | int h_len); |
Harald Welte | 0932d1e | 2009-02-16 22:53:52 +0000 | [diff] [blame] | 64 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 65 | int send_siemens_mrpci(struct gsm_lchan *lchan, uint8_t *classmark2_lv); |
Holger Hans Peter Freyther | b7b9c1d | 2010-05-16 01:07:20 +0800 | [diff] [blame] | 66 | int gsm48_extract_mi(uint8_t *classmark2, int length, char *mi_string, uint8_t *mi_type); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 67 | int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, uint8_t *mi_type); |
Holger Hans Peter Freyther | adc1478 | 2009-08-21 04:57:35 +0200 | [diff] [blame] | 68 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 69 | int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode); |
Holger Hans Peter Freyther | f520e64 | 2009-10-22 15:23:11 +0200 | [diff] [blame] | 70 | int gsm48_rx_rr_modif_ack(struct msgb *msg); |
Harald Welte | 3c7dc6e | 2009-11-29 19:07:28 +0100 | [diff] [blame] | 71 | int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg); |
| 72 | |
Holger Hans Peter Freyther | 2c0f166 | 2010-06-15 19:39:27 +0800 | [diff] [blame] | 73 | struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value); |
Holger Hans Peter Freyther | 230a4d8 | 2010-06-15 19:40:05 +0800 | [diff] [blame] | 74 | struct msgb *gsm48_create_loc_upd_rej(uint8_t cause); |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 75 | void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd, |
| 76 | const struct gsm_lchan *lchan); |
Holger Hans Peter Freyther | ff3f260 | 2009-10-22 15:13:00 +0200 | [diff] [blame] | 77 | |
Harald Welte | cf149ee | 2012-01-23 16:40:24 +0100 | [diff] [blame] | 78 | void release_security_operation(struct gsm_subscriber_connection *conn); |
| 79 | void allocate_security_operation(struct gsm_subscriber_connection *conn); |
| 80 | |
Harald Welte | 0de69a2 | 2017-05-27 13:18:50 +0200 | [diff] [blame] | 81 | int gsm48_multirate_config(uint8_t *lv, const struct amr_multirate_conf *mr, const struct amr_mode *modes); |
Andreas Eversberg | 7326652 | 2014-01-19 11:47:44 +0100 | [diff] [blame] | 82 | |
Philipp Maier | efe85d3 | 2017-04-09 12:32:51 +0200 | [diff] [blame] | 83 | int gsm48_tch_rtp_create(struct gsm_trans *trans); |
| 84 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 85 | #endif |