blob: 8821251fc86a0e927faa96c93c00f9a0fd8b1316 [file] [log] [blame]
Neels Hofmeyr7b656882017-07-09 22:09:18 +02001#pragma once
2
Neels Hofmeyrb5ce49f2018-07-24 17:42:14 +02003#include <stdint.h>
Neels Hofmeyr5cda1d02020-05-15 01:41:35 +02004#include <osmocom/core/msgb.h>
Neels Hofmeyrb5ce49f2018-07-24 17:42:14 +02005
6struct amr_mode;
7struct amr_multirate_conf;
8struct bsc_subscr;
9struct gsm48_chan_desc;
10struct gsm48_pag_resp;
11struct gsm_lchan;
12struct gsm_meas_rep;
13struct gsm_network;
14struct gsm_subscriber_connection;
Neels Hofmeyrb5ce49f2018-07-24 17:42:14 +020015
Neels Hofmeyr7b656882017-07-09 22:09:18 +020016void gsm_net_update_ctype(struct gsm_network *network);
17enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *network, uint8_t ra);
18int get_reason_by_chreq(uint8_t ra, int neci);
19int gsm48_send_rr_release(struct gsm_lchan *lchan);
20int send_siemens_mrpci(struct gsm_lchan *lchan,
21 uint8_t *classmark2_lv);
22int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn,
23 struct msgb *msg, struct bsc_subscr *bsub);
Neels Hofmeyre2209c22018-09-13 05:19:32 +020024int gsm48_send_rr_classmark_enquiry(struct gsm_lchan *lchan);
Neels Hofmeyr7b656882017-07-09 22:09:18 +020025int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv);
Philipp Maier3b9dcb32018-10-22 14:21:57 +020026int 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 Hofmeyr31f525e2018-05-14 18:14:15 +020028struct msgb *gsm48_make_ho_cmd(struct gsm_lchan *new_lchan, uint8_t power_command, uint8_t ho_ref);
Neels Hofmeyr7b656882017-07-09 22:09:18 +020029int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan,
30 uint8_t power_command, uint8_t ho_ref);
31int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_command);
Harald Weltebbd0bff2019-09-02 14:13:51 +020032int 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 Hofmeyr7b656882017-07-09 22:09:18 +020034int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t mode);
35int gsm48_rx_rr_modif_ack(struct msgb *msg);
36int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg);
37int gsm48_tx_mm_serv_ack(struct gsm_subscriber_connection *conn);
38int gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
39 enum gsm48_reject_value value);
40
Neels Hofmeyrb5400772018-02-13 23:48:24 +010041struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value);
Neels Hofmeyrb5400772018-02-13 23:48:24 +010042struct msgb *gsm48_create_loc_upd_rej(uint8_t cause);
43
Harald Weltef94cbf62018-03-17 21:40:32 +010044struct msgb *gsm48_create_rr_status(uint8_t cause);
45int gsm48_tx_rr_status(struct gsm_subscriber_connection *conn, uint8_t cause);
46
Neels Hofmeyr7b656882017-07-09 22:09:18 +020047#define GSM48_ALLOC_SIZE 2048
48#define GSM48_ALLOC_HEADROOM 256
49
50static inline struct msgb *gsm48_msgb_alloc_name(const char *name)
51{
52 return msgb_alloc_headroom(GSM48_ALLOC_SIZE, GSM48_ALLOC_HEADROOM,
53 name);
54}
Neels Hofmeyrd0d204a2018-06-08 18:46:04 +020055
56uint64_t str_to_imsi(const char *imsi_str);
Neels Hofmeyr68455f32018-07-24 16:12:45 +020057
Neels Hofmeyr31f525e2018-05-14 18:14:15 +020058int gsm48_sendmsg(struct msgb *msg);
Neels Hofmeyr68455f32018-07-24 16:12:45 +020059int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id);