blob: 8a43e69a3fef82ae752519bb206423d3e4894809 [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[];
Vadim Yanitskiybaf71a72020-01-25 10:49:14 +070013extern struct osmo_tdef msc_tdefs_vlr[];
Vadim Yanitskiyffc7f392020-01-18 18:39:41 +070014
Neels Hofmeyr79921222018-11-30 01:46:51 +010015#define MSC_HLR_REMOTE_IP_DEFAULT "127.0.0.1"
16#define MSC_HLR_REMOTE_PORT_DEFAULT OSMO_GSUP_PORT
17
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010018/* TS 48.008 DLCI containing DCCH/ACCH + SAPI */
19#define OMSC_LINKID_CB(__msgb) (__msgb)->cb[3]
20
Neels Hofmeyr79921222018-11-30 01:46:51 +010021enum nsap_addr_enc {
22 NSAP_ADDR_ENC_X213,
23 NSAP_ADDR_ENC_V4RAW,
24};
25
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010026#define MAX_A5_KEY_LEN (128/8)
27
28struct 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];
35};
36
37enum complete_layer3_type {
38 COMPLETE_LAYER3_NONE,
39 COMPLETE_LAYER3_LU,
40 COMPLETE_LAYER3_CM_SERVICE_REQ,
41 COMPLETE_LAYER3_PAGING_RESP,
42};
43
44extern const struct value_string complete_layer3_type_names[];
45static inline const char *complete_layer3_type_name(enum complete_layer3_type val)
46{
47 return get_value_string(complete_layer3_type_names, val);
48}
49
50struct cell_ids_entry {
51 struct llist_head entry;
52 struct gsm0808_cell_id_list2 cell_ids;
53};
54
Neels Hofmeyr79921222018-11-30 01:46:51 +010055typedef int (*mncc_recv_cb_t)(struct gsm_network *, struct msgb *);
56
57struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv);
Neels Hofmeyr80447eb2018-12-05 01:11:28 +010058void gsm_network_set_mncc_sock_path(struct gsm_network *net, const char *mncc_sock_path);
Neels Hofmeyr79921222018-11-30 01:46:51 +010059
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010060extern const struct vlr_ops msc_vlr_ops;
Neels Hofmeyr79921222018-11-30 01:46:51 +010061int msc_vlr_alloc(struct gsm_network *net);
62int msc_vlr_start(struct gsm_network *net);
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010063int msc_gsup_client_start(struct gsm_network *net);
Neels Hofmeyr79921222018-11-30 01:46:51 +010064
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010065uint32_t msc_cc_next_outgoing_callref();