aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/bsc/osmo_bsc.h
blob: 485c83648a9097358e796e422991242323940e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* OpenBSC BSC code */

#ifndef OSMO_BSC_H
#define OSMO_BSC_H

#include "bsc_api.h"
#include "bsc_msg_filter.h"

#define BSS_SEND_USSD 1

enum bsc_con {
	BSC_CON_SUCCESS,
	BSC_CON_REJECT_NO_LINK,
	BSC_CON_REJECT_RF_GRACE,
	BSC_CON_NO_MEM,
};

struct bsc_msc_data;
struct bsc_msc_connection;

struct osmo_bsc_sccp_con {
	/* list_head anchoring us to gsm_network.subscr_conns */
	struct llist_head entry;

	/* flag to prevent multiple simultaneous ciphering commands */
	int ciphering_handled;

	/* for audio handling */
	struct {
		uint16_t cic;
		uint32_t rtp_ip;
		int rtp_port;
		/* RTP address of the remote end (assigned by MSC through assignment request) */
		struct sockaddr_storage aoip_rtp_addr_remote;

		/* Local RTP address (reported back to the MSC by us with the
		 * assignment complete message) */
		struct sockaddr_storage aoip_rtp_addr_local;

		/* storage to keep states of the MGCP connection handler, the
		* handler is created when an assignment request is received
		* and is terminated when the assignment complete message is
		* sent */
		struct mgcp_ctx *mgcp_ctx;
	} user_plane;

	/* for advanced ping/pong */
	int send_ping;

	/* SCCP connection realted */
	struct bsc_msc_data *msc;

	/* back-pointer to subscriber connection */
	struct gsm_subscriber_connection *conn;
	/* state related to welcome USSD */
	uint8_t new_subscriber;

	/* state related to osmo_bsc_filter.c */
	struct bsc_filter_state filter_state;

	/* Sigtran connection ID */
	int conn_id;
};

struct bsc_api *osmo_bsc_api();

int bsc_queue_for_msc(struct osmo_bsc_sccp_con *conn, struct msgb *msg);
int bsc_open_connection(struct osmo_bsc_sccp_con *sccp, struct msgb *msg);
enum bsc_con bsc_create_new_connection(struct gsm_subscriber_connection *conn,
				       struct bsc_msc_data *msc, int send_ping);
int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp);

struct bsc_msc_data *bsc_find_msc(struct gsm_subscriber_connection *conn, struct msgb *);
int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg);
int bsc_send_welcome_ussd(struct gsm_subscriber_connection *conn);

int bsc_handle_udt(struct bsc_msc_data *msc, struct msgb *msg, unsigned int length);
int bsc_handle_dt(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned int len);

int bsc_ctrl_cmds_install();

void bsc_gen_location_state_trap(struct gsm_bts *bts);

struct llist_head *bsc_access_lists(void);

int bssmap_send_aoip_ass_compl(struct gsm_lchan *lchan);

#endif