blob: bd85722cd8434667721ae39e04daa404a13028be [file] [log] [blame]
Neels Hofmeyr79921222018-11-30 01:46:51 +01001#pragma once
2
Vadim Yanitskiyffc7f392020-01-18 18:39:41 +07003#include <osmocom/core/tdef.h>
4
Neels Hofmeyrc4628a32018-12-07 14:47:34 +01005#include <osmocom/gsm/protocol/gsm_04_08.h>
6#include <osmocom/gsm/gsm0808.h>
7
Neels Hofmeyr79921222018-11-30 01:46:51 +01008struct msgb;
9struct gsm_network;
10struct vlr_subscr;
11
Vadim Yanitskiyffc7f392020-01-18 18:39:41 +070012extern struct osmo_tdef_group msc_tdef_group[];
13
Neels Hofmeyr79921222018-11-30 01:46:51 +010014#define MSC_HLR_REMOTE_IP_DEFAULT "127.0.0.1"
15#define MSC_HLR_REMOTE_PORT_DEFAULT OSMO_GSUP_PORT
16
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010017/* TS 48.008 DLCI containing DCCH/ACCH + SAPI */
18#define OMSC_LINKID_CB(__msgb) (__msgb)->cb[3]
19
Neels Hofmeyr79921222018-11-30 01:46:51 +010020enum nsap_addr_enc {
21 NSAP_ADDR_ENC_X213,
22 NSAP_ADDR_ENC_V4RAW,
23};
24
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010025#define MAX_A5_KEY_LEN (128/8)
26
27struct geran_encr {
28 /*! alg_id is in encoded format:
29 * alg_id == 1 means A5/0 i.e. no encryption, alg_id == 4 means A5/3.
30 * alg_id == 0 means no such IE was present. */
31 uint8_t alg_id;
32 uint8_t key_len;
33 uint8_t key[MAX_A5_KEY_LEN];
34};
35
36enum complete_layer3_type {
37 COMPLETE_LAYER3_NONE,
38 COMPLETE_LAYER3_LU,
39 COMPLETE_LAYER3_CM_SERVICE_REQ,
40 COMPLETE_LAYER3_PAGING_RESP,
41};
42
43extern const struct value_string complete_layer3_type_names[];
44static inline const char *complete_layer3_type_name(enum complete_layer3_type val)
45{
46 return get_value_string(complete_layer3_type_names, val);
47}
48
49struct cell_ids_entry {
50 struct llist_head entry;
51 struct gsm0808_cell_id_list2 cell_ids;
52};
53
Neels Hofmeyr79921222018-11-30 01:46:51 +010054typedef int (*mncc_recv_cb_t)(struct gsm_network *, struct msgb *);
55
56struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv);
Neels Hofmeyr80447eb2018-12-05 01:11:28 +010057void gsm_network_set_mncc_sock_path(struct gsm_network *net, const char *mncc_sock_path);
Neels Hofmeyr79921222018-11-30 01:46:51 +010058
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010059extern const struct vlr_ops msc_vlr_ops;
Neels Hofmeyr79921222018-11-30 01:46:51 +010060int msc_vlr_alloc(struct gsm_network *net);
61int msc_vlr_start(struct gsm_network *net);
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010062int msc_gsup_client_start(struct gsm_network *net);
Neels Hofmeyr79921222018-11-30 01:46:51 +010063
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010064uint32_t msc_cc_next_outgoing_callref();