blob: e4b038cd9d6d02cbfb0c889c4add4678b182dc07 [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>
24
Philipp Maier66d2ef82017-12-13 11:01:06 +010025/* MGCP state handler context. This context information stores all information
26 * to handle the direction of the RTP streams via MGCP. There is one instance
27 * of this context struct per subscriber connection.
28 * (see also struct osmo_bsc_sccp_con) */
Philipp Maier39c609b2017-09-27 15:51:34 +020029struct mgcp_ctx {
30 /* FSM instance, which handles the connection switching procedure */
31 struct osmo_fsm_inst *fsm;
32
Philipp Maier66d2ef82017-12-13 11:01:06 +010033 /* RTP endpoint number. This number number identifies the endpoint
34 * on the MGW on which the BTS and NET connection is created. This
35 * endpoint number is assigned and released automatically. */
Philipp Maier39c609b2017-09-27 15:51:34 +020036 uint16_t rtp_endpoint;
37
Philipp Maierfa85d182017-11-22 13:26:03 +010038 /* RTP connection identifiers */
39 char conn_id_bts[MGCP_CONN_ID_LENGTH];
40 char conn_id_net[MGCP_CONN_ID_LENGTH];
41
Philipp Maier39c609b2017-09-27 15:51:34 +020042 /* Copy of the pointer and the data with context information
43 * needed to process the AoIP and MGCP requests (system data) */
44 struct mgcp_client *mgcp;
Philipp Maier39c609b2017-09-27 15:51:34 +020045 struct osmo_bsc_sccp_con *conn;
46 enum gsm48_chan_mode chan_mode;
47 bool full_rate;
48 struct gsm_lchan *lchan;
49 struct gsm_lchan *ho_lchan;
50 struct msgb *resp;
51};
52
53struct mgcp_ctx *mgcp_assignm_req(void *ctx, struct mgcp_client *mgcp, struct osmo_bsc_sccp_con *conn,
54 enum gsm48_chan_mode chan_mode, bool full_rate);
55void mgcp_clear_complete(struct mgcp_ctx *mgcp_ctx, struct msgb *resp);
56void mgcp_ass_complete(struct mgcp_ctx *mgcp_ctx, struct gsm_lchan *lchan);
57void mgcp_handover(struct mgcp_ctx *mgcp_ctx, struct gsm_lchan *ho_lchan);
58void mgcp_free_ctx(struct mgcp_ctx *mgcp_ctx);