Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Neels Hofmeyr | b5ce49f | 2018-07-24 17:42:14 +0200 | [diff] [blame] | 3 | #include <stdint.h> |
Neels Hofmeyr | 5cda1d0 | 2020-05-15 01:41:35 +0200 | [diff] [blame] | 4 | #include <osmocom/core/msgb.h> |
Neels Hofmeyr | b5ce49f | 2018-07-24 17:42:14 +0200 | [diff] [blame] | 5 | |
| 6 | struct amr_mode; |
| 7 | struct amr_multirate_conf; |
| 8 | struct bsc_subscr; |
| 9 | struct gsm48_chan_desc; |
| 10 | struct gsm48_pag_resp; |
| 11 | struct gsm_lchan; |
| 12 | struct gsm_meas_rep; |
| 13 | struct gsm_network; |
| 14 | struct gsm_subscriber_connection; |
Neels Hofmeyr | b5ce49f | 2018-07-24 17:42:14 +0200 | [diff] [blame] | 15 | |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 16 | void gsm_net_update_ctype(struct gsm_network *network); |
| 17 | enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *network, uint8_t ra); |
| 18 | int get_reason_by_chreq(uint8_t ra, int neci); |
| 19 | int gsm48_send_rr_release(struct gsm_lchan *lchan); |
| 20 | int send_siemens_mrpci(struct gsm_lchan *lchan, |
| 21 | uint8_t *classmark2_lv); |
| 22 | int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, |
| 23 | struct msgb *msg, struct bsc_subscr *bsub); |
Neels Hofmeyr | e2209c2 | 2018-09-13 05:19:32 +0200 | [diff] [blame] | 24 | int gsm48_send_rr_classmark_enquiry(struct gsm_lchan *lchan); |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 25 | int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); |
Philipp Maier | 3b9dcb3 | 2018-10-22 14:21:57 +0200 | [diff] [blame] | 26 | int gsm48_multirate_config(uint8_t *lv, const struct gsm48_multi_rate_conf *mr_conf, |
| 27 | const struct amr_mode *modes, unsigned int num_modes); |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 28 | struct msgb *gsm48_make_ho_cmd(struct gsm_lchan *new_lchan, uint8_t power_command, uint8_t ho_ref); |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 29 | int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, |
| 30 | uint8_t power_command, uint8_t ho_ref); |
| 31 | int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_command); |
Harald Welte | bbd0bff | 2019-09-02 14:13:51 +0200 | [diff] [blame] | 32 | int gsm48_send_rr_app_info(struct gsm_lchan *lchan, uint8_t apdu_id, uint8_t apdu_flags, |
| 33 | const uint8_t *apdu_data, ssize_t apdu_data_len); |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 34 | int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t mode); |
| 35 | int gsm48_rx_rr_modif_ack(struct msgb *msg); |
| 36 | int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg); |
| 37 | int gsm48_tx_mm_serv_ack(struct gsm_subscriber_connection *conn); |
| 38 | int gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn, |
| 39 | enum gsm48_reject_value value); |
| 40 | |
Neels Hofmeyr | b540077 | 2018-02-13 23:48:24 +0100 | [diff] [blame] | 41 | struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value); |
| 42 | int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, uint8_t *mi_type); |
| 43 | int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length, |
| 44 | char *mi_string, uint8_t *mi_type); |
| 45 | struct msgb *gsm48_create_loc_upd_rej(uint8_t cause); |
| 46 | |
Harald Welte | f94cbf6 | 2018-03-17 21:40:32 +0100 | [diff] [blame] | 47 | struct msgb *gsm48_create_rr_status(uint8_t cause); |
| 48 | int gsm48_tx_rr_status(struct gsm_subscriber_connection *conn, uint8_t cause); |
| 49 | |
Neels Hofmeyr | 7b65688 | 2017-07-09 22:09:18 +0200 | [diff] [blame] | 50 | #define GSM48_ALLOC_SIZE 2048 |
| 51 | #define GSM48_ALLOC_HEADROOM 256 |
| 52 | |
| 53 | static inline struct msgb *gsm48_msgb_alloc_name(const char *name) |
| 54 | { |
| 55 | return msgb_alloc_headroom(GSM48_ALLOC_SIZE, GSM48_ALLOC_HEADROOM, |
| 56 | name); |
| 57 | } |
Neels Hofmeyr | d0d204a | 2018-06-08 18:46:04 +0200 | [diff] [blame] | 58 | |
| 59 | uint64_t str_to_imsi(const char *imsi_str); |
Neels Hofmeyr | 68455f3 | 2018-07-24 16:12:45 +0200 | [diff] [blame] | 60 | |
Neels Hofmeyr | 31f525e | 2018-05-14 18:14:15 +0200 | [diff] [blame] | 61 | int gsm48_sendmsg(struct msgb *msg); |
Neels Hofmeyr | 68455f3 | 2018-07-24 16:12:45 +0200 | [diff] [blame] | 62 | int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id); |