blob: 2d11ccabd3f73ad9a60e5028df2406a502c820ac [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>
Harald Welte6de46592018-02-09 00:53:17 +010025#include <osmocom/msc/vlr.h>
Neels Hofmeyr703638e2017-12-14 05:30:16 +010026#include <osmocom/gsm/protocol/gsm_08_08.h>
Philipp Maierfbf66102017-04-09 12:32:51 +020027
28/* A struct to keep a context information about the BSCs we are associated with */
29struct bsc_context {
30 struct llist_head list;
31
32 /* Holds a copy of the sccp address of the BSC,
33 * this address will become known as soon as
34 * a remote BSC tries to make a connection or
35 * sends a RESET request via UNIDATA */
36 struct osmo_sccp_addr bsc_addr;
37
38 /* Holds a copy of the our local MSC address,
39 * this will be the sccp-address that is associated
40 * with the A interface */
41 struct osmo_sccp_addr msc_addr;
42
43 /* A pointer to the reset handler FSM, the
44 * state machine is allocated when the BSC
45 * is registerd. */
Philipp Maierf913e5f2018-05-07 10:15:49 +020046 struct osmo_fsm_inst *reset_fsm;
Philipp Maierfbf66102017-04-09 12:32:51 +020047
48 /* A pointer to the sccp_user that is associated
49 * with the A interface. We need this information
50 * to send the resets and to send paging requests */
51 struct osmo_sccp_user *sccp_user;
52};
53
54/* Initalize A interface connection between to MSC and BSC */
55int a_init(struct osmo_sccp_instance *sccp, struct gsm_network *network);
56
Philipp Maier4502f5f2017-09-07 11:39:58 +020057/* Send DTAP message via A-interface, take ownership of msg */
Philipp Maierfbf66102017-04-09 12:32:51 +020058int a_iface_tx_dtap(struct msgb *msg);
59
60/* Send Cipher mode command via A-interface */
Neels Hofmeyrc036b792018-11-29 22:37:51 +010061int a_iface_tx_cipher_mode(const struct ran_conn *conn,
Neels Hofmeyr703638e2017-12-14 05:30:16 +010062 struct gsm0808_encrypt_info *ei, int include_imeisv);
Philipp Maierfbf66102017-04-09 12:32:51 +020063
64/* Page a subscriber via A-interface */
65int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac);
66
67/* Send assignment request via A-interface */
68int a_iface_tx_assignment(const struct gsm_trans *trans);
69
70/* Send clear command via A-interface */
Neels Hofmeyrc036b792018-11-29 22:37:51 +010071int a_iface_tx_clear_cmd(struct ran_conn *conn);
Philipp Maierfbf66102017-04-09 12:32:51 +020072
Neels Hofmeyrc036b792018-11-29 22:37:51 +010073int a_iface_tx_classmark_request(const struct ran_conn *conn);
Neels Hofmeyr3117b702018-09-13 03:23:07 +020074
Neels Hofmeyrc036b792018-11-29 22:37:51 +010075/* Clear all RAN connections on a specified BSC
Philipp Maierfbf66102017-04-09 12:32:51 +020076 * (Helper function for a_iface_bssap.c) */
77void a_clear_all(struct osmo_sccp_user *scu, const struct osmo_sccp_addr *bsc_addr);
78
Harald Welte54a10ef2018-02-09 00:09:16 +010079void a_start_reset(struct bsc_context *bsc_ctx, bool already_connected);
80
Philipp Maierfbf66102017-04-09 12:32:51 +020081/* Delete info of a closed connection from the active connection list
82 * (Helper function for a_iface_bssap.c) */
83void a_delete_bsc_con(uint32_t conn_id);