blob: e170a255fa0b67251d15038c7f9469cd3d48ebce [file] [log] [blame]
Philipp Maier8bda7a72018-01-17 14:32:23 +01001#pragma once
2
3#include <osmocom/mgcp_client/mgcp_common.h>
4#include <osmocom/mgcp_client/mgcp_client.h>
5#include <osmocom/gsm/protocol/gsm_04_08.h>
6
7/*! This struct organizes the connection infromation one connection side
8 * (either remote or local). It is used to pass parameters (local) to the FSM
9 * and get responses (remote) from the FSM as pointer attached to the FSM
10 * event.
11 *
12 * When modifiying a connection, the endpoint and call_id members may be left
13 * unpopulated. The call_id field is ignored in this case. If an endpoint
14 * identifier is supplied it is checked against the internal state to make
15 * sure it is correct. */
16struct mgcp_conn_peer {
Neels Hofmeyr8838c622018-06-26 00:05:53 +020017 /*! RTP connection IP-Address (optional, string e.g. "127.0.0.1") */
Philipp Maier8bda7a72018-01-17 14:32:23 +010018 char addr[INET_ADDRSTRLEN];
19
Neels Hofmeyr8838c622018-06-26 00:05:53 +020020 /*! RTP connection IP-Port (optional) */
Philipp Maier8bda7a72018-01-17 14:32:23 +010021 uint16_t port;
22
Neels Hofmeyr8838c622018-06-26 00:05:53 +020023 /*! RTP endpoint */
Philipp Maier8bda7a72018-01-17 14:32:23 +010024 char endpoint[MGCP_ENDPOINT_MAXLEN];
25
Neels Hofmeyr8838c622018-06-26 00:05:53 +020026 /*! CALL ID (unique per connection) */
Philipp Maier8bda7a72018-01-17 14:32:23 +010027 unsigned int call_id;
Philipp Maier704c4f02018-06-07 18:51:31 +020028
Neels Hofmeyr8838c622018-06-26 00:05:53 +020029 /*! RTP packetization interval (optional) */
Philipp Maier704c4f02018-06-07 18:51:31 +020030 unsigned int ptime;
31
Neels Hofmeyr8838c622018-06-26 00:05:53 +020032 /*! RTP codec list (optional) */
Philipp Maier704c4f02018-06-07 18:51:31 +020033 enum mgcp_codecs codecs[MGCP_MAX_CODECS];
34
Neels Hofmeyr8838c622018-06-26 00:05:53 +020035 /*! Number of codecs in RTP codec list (optional) */
Philipp Maier704c4f02018-06-07 18:51:31 +020036 unsigned int codecs_len;
Philipp Maier544448a2018-07-26 11:37:44 +020037
38 /*! RTP payload type map (optional, only needed when payload types are
39 * used that differ from what IANA/3GPP defines) */
40 struct ptmap ptmap[MGCP_MAX_CODECS];
41
42 /*! RTP payload type map length (optional, only needed when payload
43 * types are used that differ from what IANA/3GPP defines) */
44 unsigned int ptmap_len;
Neels Hofmeyre6d8e912018-08-23 16:36:48 +020045
46 /*! If nonzero, send 'X-Osmo-IGN:' header. This is useful e.g. for SCCPlite MSCs where the MSC is
47 * known to issue incoherent or unknown CallIDs / to issue CRCX commands with a different domain
48 * name than the BSC. An OsmoMGW will then ignore these and not fail on mismatches. */
49 uint32_t x_osmo_ign;
Neels Hofmeyrcb760bd2019-03-04 21:07:54 +010050
51 /*! If left MGCP_CONN_NONE, use MGCP_CONN_RECV_ONLY or MGCP_CONN_RECV_SEND, depending on whether an audio RTP
52 * address is set. If != MGCP_CONN_NONE, force this conn mode. */
53 enum mgcp_connection_mode conn_mode;
Philipp Maier228e5912019-03-05 13:56:59 +010054
55 /*! If the codec requires additional format parameters (fmtp), those cann be set here, see also
56 * mgcp_common.h */
57 bool param_present;
58 struct mgcp_codec_param param;
Philipp Maier8bda7a72018-01-17 14:32:23 +010059};
60
61struct osmo_fsm_inst *mgcp_conn_create(struct mgcp_client *mgcp, struct osmo_fsm_inst *parent_fi, uint32_t parent_term_evt,
62 uint32_t parent_evt, struct mgcp_conn_peer *conn_peer);
63int mgcp_conn_modify(struct osmo_fsm_inst *fi, uint32_t parent_evt, struct mgcp_conn_peer *conn_peer);
64void mgcp_conn_delete(struct osmo_fsm_inst *fi);
Neels Hofmeyr04da5e52018-06-12 21:51:23 +020065
66const char *mgcp_conn_get_ci(struct osmo_fsm_inst *fi);
Neels Hofmeyr538d2c52019-01-28 03:51:35 +010067
68const char *osmo_mgcpc_conn_peer_name(const struct mgcp_conn_peer *info);