blob: 74172984d8c3327c39747981bc349a76f880272d [file] [log] [blame]
Philipp Maierfbf66102017-04-09 12:32:51 +02001/* (C) 2017 by Sysmocom s.f.m.c. GmbH
2 * All Rights Reserved
3 *
4 * Author: Philipp Maier
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22
Neels Hofmeyr90843962017-09-04 15:04:35 +020023#include <osmocom/msc/a_reset.h>
Max43b01b02017-09-15 11:22:30 +020024#include <osmocom/msc/transaction.h>
Neels Hofmeyr703638e2017-12-14 05:30:16 +010025#include <osmocom/gsm/protocol/gsm_08_08.h>
Philipp Maierfbf66102017-04-09 12:32:51 +020026
27/* A struct to keep a context information about the BSCs we are associated with */
28struct bsc_context {
29 struct llist_head list;
30
31 /* Holds a copy of the sccp address of the BSC,
32 * this address will become known as soon as
33 * a remote BSC tries to make a connection or
34 * sends a RESET request via UNIDATA */
35 struct osmo_sccp_addr bsc_addr;
36
37 /* Holds a copy of the our local MSC address,
38 * this will be the sccp-address that is associated
39 * with the A interface */
40 struct osmo_sccp_addr msc_addr;
41
42 /* A pointer to the reset handler FSM, the
43 * state machine is allocated when the BSC
44 * is registerd. */
45 struct a_reset_ctx *reset;
46
47 /* A pointer to the sccp_user that is associated
48 * with the A interface. We need this information
49 * to send the resets and to send paging requests */
50 struct osmo_sccp_user *sccp_user;
51};
52
53/* Initalize A interface connection between to MSC and BSC */
54int a_init(struct osmo_sccp_instance *sccp, struct gsm_network *network);
55
Philipp Maier4502f5f2017-09-07 11:39:58 +020056/* Send DTAP message via A-interface, take ownership of msg */
Philipp Maierfbf66102017-04-09 12:32:51 +020057int a_iface_tx_dtap(struct msgb *msg);
58
59/* Send Cipher mode command via A-interface */
60int a_iface_tx_cipher_mode(const struct gsm_subscriber_connection *conn,
Neels Hofmeyr703638e2017-12-14 05:30:16 +010061 struct gsm0808_encrypt_info *ei, int include_imeisv);
Philipp Maierfbf66102017-04-09 12:32:51 +020062
63/* Page a subscriber via A-interface */
64int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac);
65
66/* Send assignment request via A-interface */
67int a_iface_tx_assignment(const struct gsm_trans *trans);
68
69/* Send clear command via A-interface */
70int a_iface_tx_clear_cmd(struct gsm_subscriber_connection *conn);
71
72/* Clear all subscriber connections on a specified BSC
73 * (Helper function for a_iface_bssap.c) */
74void a_clear_all(struct osmo_sccp_user *scu, const struct osmo_sccp_addr *bsc_addr);
75
76/* Delete info of a closed connection from the active connection list
77 * (Helper function for a_iface_bssap.c) */
78void a_delete_bsc_con(uint32_t conn_id);