blob: 78337f7640b17c783fe18129bf9c8b04819871b8 [file] [log] [blame]
Neels Hofmeyr79921222018-11-30 01:46:51 +01001#pragma once
2
Neels Hofmeyrc4628a32018-12-07 14:47:34 +01003#include <osmocom/gsm/protocol/gsm_04_08.h>
4#include <osmocom/gsm/gsm0808.h>
5
Neels Hofmeyr79921222018-11-30 01:46:51 +01006struct msgb;
7struct gsm_network;
8struct vlr_subscr;
9
10#define MSC_HLR_REMOTE_IP_DEFAULT "127.0.0.1"
11#define MSC_HLR_REMOTE_PORT_DEFAULT OSMO_GSUP_PORT
12
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010013/* TS 48.008 DLCI containing DCCH/ACCH + SAPI */
14#define OMSC_LINKID_CB(__msgb) (__msgb)->cb[3]
15
Neels Hofmeyr79921222018-11-30 01:46:51 +010016enum nsap_addr_enc {
17 NSAP_ADDR_ENC_X213,
18 NSAP_ADDR_ENC_V4RAW,
19};
20
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010021#define MAX_A5_KEY_LEN (128/8)
22
23struct geran_encr {
24 /*! alg_id is in encoded format:
25 * alg_id == 1 means A5/0 i.e. no encryption, alg_id == 4 means A5/3.
26 * alg_id == 0 means no such IE was present. */
27 uint8_t alg_id;
28 uint8_t key_len;
29 uint8_t key[MAX_A5_KEY_LEN];
30};
31
32enum complete_layer3_type {
33 COMPLETE_LAYER3_NONE,
34 COMPLETE_LAYER3_LU,
35 COMPLETE_LAYER3_CM_SERVICE_REQ,
36 COMPLETE_LAYER3_PAGING_RESP,
37};
38
39extern const struct value_string complete_layer3_type_names[];
40static inline const char *complete_layer3_type_name(enum complete_layer3_type val)
41{
42 return get_value_string(complete_layer3_type_names, val);
43}
44
45struct cell_ids_entry {
46 struct llist_head entry;
47 struct gsm0808_cell_id_list2 cell_ids;
48};
49
Neels Hofmeyr79921222018-11-30 01:46:51 +010050typedef int (*mncc_recv_cb_t)(struct gsm_network *, struct msgb *);
51
52struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv);
Neels Hofmeyr80447eb2018-12-05 01:11:28 +010053void gsm_network_set_mncc_sock_path(struct gsm_network *net, const char *mncc_sock_path);
Neels Hofmeyr79921222018-11-30 01:46:51 +010054
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010055extern const struct vlr_ops msc_vlr_ops;
Neels Hofmeyr79921222018-11-30 01:46:51 +010056int msc_vlr_alloc(struct gsm_network *net);
57int msc_vlr_start(struct gsm_network *net);
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010058int msc_gsup_client_start(struct gsm_network *net);
Neels Hofmeyr79921222018-11-30 01:46:51 +010059
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010060uint32_t msc_cc_next_outgoing_callref();