blob: 15039f7473928c9fb8ce7fce2c11c7a72d731c22 [file] [log] [blame]
Philipp Maier39c609b2017-09-27 15:51:34 +02001/* (C) 2017 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
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
Philipp Maierfa85d182017-11-22 13:26:03 +010023#include <osmocom/mgcp_client/mgcp_common.h>
Philipp Maier75f2c8d2017-12-04 11:42:32 +010024#include <osmocom/mgcp_client/mgcp_client.h>
Philipp Maierfa85d182017-11-22 13:26:03 +010025
Philipp Maier66d2ef82017-12-13 11:01:06 +010026/* MGCP state handler context. This context information stores all information
27 * to handle the direction of the RTP streams via MGCP. There is one instance
28 * of this context struct per subscriber connection.
29 * (see also struct osmo_bsc_sccp_con) */
Philipp Maier39c609b2017-09-27 15:51:34 +020030struct mgcp_ctx {
31 /* FSM instance, which handles the connection switching procedure */
32 struct osmo_fsm_inst *fsm;
33
Philipp Maier66d2ef82017-12-13 11:01:06 +010034 /* RTP endpoint number. This number number identifies the endpoint
35 * on the MGW on which the BTS and NET connection is created. This
36 * endpoint number is assigned and released automatically. */
Philipp Maier39c609b2017-09-27 15:51:34 +020037 uint16_t rtp_endpoint;
38
Philipp Maierfa85d182017-11-22 13:26:03 +010039 /* RTP connection identifiers */
40 char conn_id_bts[MGCP_CONN_ID_LENGTH];
41 char conn_id_net[MGCP_CONN_ID_LENGTH];
42
Philipp Maier39c609b2017-09-27 15:51:34 +020043 /* Copy of the pointer and the data with context information
44 * needed to process the AoIP and MGCP requests (system data) */
45 struct mgcp_client *mgcp;
Harald Welte519c7e12018-01-28 02:45:46 +010046 struct gsm_subscriber_connection *conn;
Philipp Maier39c609b2017-09-27 15:51:34 +020047 enum gsm48_chan_mode chan_mode;
48 bool full_rate;
49 struct gsm_lchan *lchan;
50 struct gsm_lchan *ho_lchan;
51 struct msgb *resp;
Philipp Maier75f2c8d2017-12-04 11:42:32 +010052 mgcp_trans_id_t mgw_pending_trans;
Philipp Maier39c609b2017-09-27 15:51:34 +020053};
54
Neels Hofmeyr9af36d72018-01-19 01:21:39 +010055void mgcp_init(struct gsm_network *net);
56
Harald Welte519c7e12018-01-28 02:45:46 +010057struct mgcp_ctx *mgcp_assignm_req(void *ctx, struct mgcp_client *mgcp,
58 struct gsm_subscriber_connection *conn,
Philipp Maier39c609b2017-09-27 15:51:34 +020059 enum gsm48_chan_mode chan_mode, bool full_rate);
60void mgcp_clear_complete(struct mgcp_ctx *mgcp_ctx, struct msgb *resp);
61void mgcp_ass_complete(struct mgcp_ctx *mgcp_ctx, struct gsm_lchan *lchan);
Philipp Maier39c609b2017-09-27 15:51:34 +020062void mgcp_free_ctx(struct mgcp_ctx *mgcp_ctx);