blob: 40ad9c8d115fb1461881e26428a836442197ed3e [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>
Philipp Maierfbf66102017-04-09 12:32:51 +020025
26/* A struct to keep a context information about the BSCs we are associated with */
27struct bsc_context {
28 struct llist_head list;
29
30 /* Holds a copy of the sccp address of the BSC,
31 * this address will become known as soon as
32 * a remote BSC tries to make a connection or
33 * sends a RESET request via UNIDATA */
34 struct osmo_sccp_addr bsc_addr;
35
36 /* Holds a copy of the our local MSC address,
37 * this will be the sccp-address that is associated
38 * with the A interface */
39 struct osmo_sccp_addr msc_addr;
40
41 /* A pointer to the reset handler FSM, the
42 * state machine is allocated when the BSC
43 * is registerd. */
44 struct a_reset_ctx *reset;
45
46 /* A pointer to the sccp_user that is associated
47 * with the A interface. We need this information
48 * to send the resets and to send paging requests */
49 struct osmo_sccp_user *sccp_user;
50};
51
52/* Initalize A interface connection between to MSC and BSC */
53int a_init(struct osmo_sccp_instance *sccp, struct gsm_network *network);
54
Philipp Maier4502f5f2017-09-07 11:39:58 +020055/* Send DTAP message via A-interface, take ownership of msg */
Philipp Maierfbf66102017-04-09 12:32:51 +020056int a_iface_tx_dtap(struct msgb *msg);
57
58/* Send Cipher mode command via A-interface */
59int a_iface_tx_cipher_mode(const struct gsm_subscriber_connection *conn,
60 int cipher, const const uint8_t *key, int len, int include_imeisv);
61
62/* Page a subscriber via A-interface */
63int a_iface_tx_paging(const char *imsi, uint32_t tmsi, uint16_t lac);
64
65/* Send assignment request via A-interface */
66int a_iface_tx_assignment(const struct gsm_trans *trans);
67
68/* Send clear command via A-interface */
69int a_iface_tx_clear_cmd(struct gsm_subscriber_connection *conn);
70
71/* Clear all subscriber connections on a specified BSC
72 * (Helper function for a_iface_bssap.c) */
73void a_clear_all(struct osmo_sccp_user *scu, const struct osmo_sccp_addr *bsc_addr);
74
75/* Delete info of a closed connection from the active connection list
76 * (Helper function for a_iface_bssap.c) */
77void a_delete_bsc_con(uint32_t conn_id);