Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 1 | #ifndef _GSM_04_08_H |
| 2 | #define _GSM_04_08_H |
| 3 | |
Pablo Neira Ayuso | dd5fff4 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 4 | #include <osmocom/gsm/gsm48.h> |
Harald Welte | 5d977a8 | 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 | 3689710 | 2009-08-01 07:26:59 +0200 | [diff] [blame] | 9 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 10 | struct msgb; |
| 11 | struct gsm_bts; |
| 12 | struct gsm_subscriber; |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 13 | struct gsm_network; |
Harald Welte | 36fe2e8 | 2009-07-23 21:13:03 +0200 | [diff] [blame] | 14 | struct gsm_trans; |
Holger Hans Peter Freyther | ed4e3bd | 2010-06-15 13:16:52 +0800 | [diff] [blame] | 15 | struct gsm_subscriber_connection; |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 16 | |
Harald Welte | 532dcca | 2010-12-23 23:00:21 +0100 | [diff] [blame] | 17 | #define GSM48_ALLOC_SIZE 2048 |
| 18 | #define GSM48_ALLOC_HEADROOM 256 |
Harald Welte | d828519 | 2010-05-01 14:22:44 +0200 | [diff] [blame] | 19 | |
| 20 | static inline struct msgb *gsm48_msgb_alloc(void) |
| 21 | { |
| 22 | return msgb_alloc_headroom(GSM48_ALLOC_SIZE, GSM48_ALLOC_HEADROOM, |
| 23 | "GSM 04.08"); |
| 24 | } |
| 25 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 26 | /* config options controlling the behaviour of the lower leves */ |
| 27 | void gsm0408_allow_everyone(int allow); |
Holger Hans Peter Freyther | ed4e3bd | 2010-06-15 13:16:52 +0800 | [diff] [blame] | 28 | void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause); |
Harald Welte | e8d1617 | 2010-12-22 23:17:50 +0100 | [diff] [blame] | 29 | void gsm0408_clear_all_trans(struct gsm_network *net, int protocol); |
Holger Hans Peter Freyther | b979579 | 2010-06-17 16:41:25 +0800 | [diff] [blame] | 30 | int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 31 | |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 32 | int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id); |
Holger Hans Peter Freyther | 425cfc4 | 2010-07-05 15:34:16 +0800 | [diff] [blame] | 33 | int gsm0408_new_conn(struct gsm_subscriber_connection *conn); |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 34 | enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, uint8_t ra); |
Harald Welte | 5d977a8 | 2011-07-23 10:53:30 +0200 | [diff] [blame] | 35 | /* don't use "enum gsm_chreq_reason_t" to avoid circular dependency */ |
| 36 | int get_reason_by_chreq(uint8_t ra, int neci); |
Holger Hans Peter Freyther | f0f37f1 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 37 | void gsm_net_update_ctype(struct gsm_network *net); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 38 | |
Holger Hans Peter Freyther | 3d31527 | 2010-06-15 14:16:02 +0800 | [diff] [blame] | 39 | int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn); |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 40 | int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, int key_seq); |
Holger Hans Peter Freyther | 5a38f92 | 2010-06-16 12:30:50 +0800 | [diff] [blame] | 41 | int gsm48_tx_mm_auth_rej(struct gsm_subscriber_connection *conn); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 42 | int gsm48_send_rr_release(struct gsm_lchan *lchan); |
Holger Hans Peter Freyther | b94719d | 2009-10-05 14:00:14 +0200 | [diff] [blame] | 43 | int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 44 | int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, uint8_t apdu_id, |
| 45 | uint8_t apdu_len, const uint8_t *apdu); |
| 46 | int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_class); |
Harald Welte | d0841fa | 2009-12-17 00:25:18 +0100 | [diff] [blame] | 47 | int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 48 | uint8_t power_command, uint8_t ho_ref); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 49 | |
Harald Welte | f4e4b8a | 2010-12-22 23:57:45 +0100 | [diff] [blame] | 50 | int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg); |
Harald Welte | 0374084 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 51 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 52 | /* convert a ASCII phone number to call-control BCD */ |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 53 | int encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len, |
Harald Welte | b8a18b5 | 2009-06-10 12:08:54 +0800 | [diff] [blame] | 54 | int h_len, const char *input); |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 55 | int decode_bcd_number(char *output, int output_len, const uint8_t *bcd_lv, |
Harald Welte | b8a18b5 | 2009-06-10 12:08:54 +0800 | [diff] [blame] | 56 | int h_len); |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 57 | |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 58 | int send_siemens_mrpci(struct gsm_lchan *lchan, uint8_t *classmark2_lv); |
Holger Hans Peter Freyther | 088ca3a | 2010-05-16 01:07:20 +0800 | [diff] [blame] | 59 | int gsm48_extract_mi(uint8_t *classmark2, int length, char *mi_string, uint8_t *mi_type); |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 60 | int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, uint8_t *mi_type); |
Holger Hans Peter Freyther | 0b83e54 | 2010-06-21 10:46:44 +0800 | [diff] [blame] | 61 | int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, struct msgb *msg, struct gsm_subscriber *subscr); |
Holger Hans Peter Freyther | a269ece | 2009-08-21 04:57:35 +0200 | [diff] [blame] | 62 | |
Holger Hans Peter Freyther | 7eb8a9a | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 63 | int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode); |
Holger Hans Peter Freyther | 9e6d6ce | 2009-10-22 15:23:11 +0200 | [diff] [blame] | 64 | int gsm48_rx_rr_modif_ack(struct msgb *msg); |
Harald Welte | c20bd1d | 2009-11-29 19:07:28 +0100 | [diff] [blame] | 65 | int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg); |
| 66 | |
Holger Hans Peter Freyther | a44eea5 | 2010-06-15 19:39:27 +0800 | [diff] [blame] | 67 | struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value); |
Holger Hans Peter Freyther | 8073cbd | 2010-06-15 19:40:05 +0800 | [diff] [blame] | 68 | struct msgb *gsm48_create_loc_upd_rej(uint8_t cause); |
Harald Welte | a42a93f | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 69 | void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd, |
| 70 | const struct gsm_lchan *lchan); |
Holger Hans Peter Freyther | cf0f336 | 2009-10-22 15:13:00 +0200 | [diff] [blame] | 71 | |
Harald Welte | 59b0468 | 2009-06-10 05:40:52 +0800 | [diff] [blame] | 72 | #endif |