Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Vadim Yanitskiy | ffc7f39 | 2020-01-18 18:39:41 +0700 | [diff] [blame] | 3 | #include <osmocom/core/tdef.h> |
| 4 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 5 | #include <osmocom/gsm/protocol/gsm_04_08.h> |
| 6 | #include <osmocom/gsm/gsm0808.h> |
| 7 | |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 8 | struct msgb; |
| 9 | struct gsm_network; |
| 10 | struct vlr_subscr; |
| 11 | |
Vadim Yanitskiy | ffc7f39 | 2020-01-18 18:39:41 +0700 | [diff] [blame] | 12 | extern struct osmo_tdef_group msc_tdef_group[]; |
Vadim Yanitskiy | baf71a7 | 2020-01-25 10:49:14 +0700 | [diff] [blame] | 13 | extern struct osmo_tdef msc_tdefs_vlr[]; |
Vadim Yanitskiy | ffc7f39 | 2020-01-18 18:39:41 +0700 | [diff] [blame] | 14 | |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 15 | #define MSC_HLR_REMOTE_IP_DEFAULT "127.0.0.1" |
| 16 | #define MSC_HLR_REMOTE_PORT_DEFAULT OSMO_GSUP_PORT |
| 17 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 18 | /* TS 48.008 DLCI containing DCCH/ACCH + SAPI */ |
| 19 | #define OMSC_LINKID_CB(__msgb) (__msgb)->cb[3] |
| 20 | |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 21 | enum nsap_addr_enc { |
| 22 | NSAP_ADDR_ENC_X213, |
| 23 | NSAP_ADDR_ENC_V4RAW, |
| 24 | }; |
| 25 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 26 | #define MAX_A5_KEY_LEN (128/8) |
| 27 | |
| 28 | struct geran_encr { |
| 29 | /*! alg_id is in encoded format: |
| 30 | * alg_id == 1 means A5/0 i.e. no encryption, alg_id == 4 means A5/3. |
| 31 | * alg_id == 0 means no such IE was present. */ |
| 32 | uint8_t alg_id; |
| 33 | uint8_t key_len; |
| 34 | uint8_t key[MAX_A5_KEY_LEN]; |
Neels Hofmeyr | 6ce2edc | 2021-06-09 22:26:11 +0200 | [diff] [blame] | 35 | bool kc128_present; |
| 36 | uint8_t kc128[MAX_A5_KEY_LEN]; |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | enum complete_layer3_type { |
| 40 | COMPLETE_LAYER3_NONE, |
| 41 | COMPLETE_LAYER3_LU, |
| 42 | COMPLETE_LAYER3_CM_SERVICE_REQ, |
| 43 | COMPLETE_LAYER3_PAGING_RESP, |
| 44 | }; |
| 45 | |
| 46 | extern const struct value_string complete_layer3_type_names[]; |
| 47 | static inline const char *complete_layer3_type_name(enum complete_layer3_type val) |
| 48 | { |
| 49 | return get_value_string(complete_layer3_type_names, val); |
| 50 | } |
| 51 | |
| 52 | struct cell_ids_entry { |
| 53 | struct llist_head entry; |
| 54 | struct gsm0808_cell_id_list2 cell_ids; |
| 55 | }; |
| 56 | |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 57 | typedef int (*mncc_recv_cb_t)(struct gsm_network *, struct msgb *); |
| 58 | |
| 59 | struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv); |
Neels Hofmeyr | 80447eb | 2018-12-05 01:11:28 +0100 | [diff] [blame] | 60 | void gsm_network_set_mncc_sock_path(struct gsm_network *net, const char *mncc_sock_path); |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 61 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 62 | extern const struct vlr_ops msc_vlr_ops; |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 63 | int msc_vlr_alloc(struct gsm_network *net); |
| 64 | int msc_vlr_start(struct gsm_network *net); |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 65 | int msc_gsup_client_start(struct gsm_network *net); |
Neels Hofmeyr | 7992122 | 2018-11-30 01:46:51 +0100 | [diff] [blame] | 66 | |
Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 67 | uint32_t msc_cc_next_outgoing_callref(); |