mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
Leave the old osmo-bsc_mgcp and libosmo-legacy-mgcp as it is; on a copy thereof (added by a previous commit), apply changes to initially implement the new osmo-mgw. Adjust build system and debian packaging to accomodate the new libosmo-mgcp and osmo-mgw. The main differences: *) use a list to manage rtp connections. Aggregate all rtp related information inside a single struct. Use a linked list to manage the both connections (net and bts). The idea behind using a list is that we might support conference calls at some later point. Store the linked list in struct mgcp_endpoint, have a private linked list for each endpoint. The list contains connection items which are implemented in struct mgcp_conn. A connection is allocated and freed using the functions in mgcp_conn.c. A connection is allocated on the reception of a CRCX command and freed with the reception of a DLCX command. *) remove external transcoder feature Fortunatelly the external transcoder feature is not needed anymore. This patch removes the related code. *) vty: get rid of CONN_BTS and CONN_NET Since the new connection model does not make a difference between BTS and NET connections the VTY should not use the fixed CONN_BTS and CONN_NET constants. - Handle the conns list inside the endpoint directly - introduce function to dump basic rtp connection info - introduce human readable names for connections Parts of the code adjusted to use generalized connections instead of explicit BTS/NET ones: - teach mgcp_send_dummy() to send dummy packets to any RTP connection - network: generalize mgcp_bind_net/bts_rtp_port() - network: generalize mgcp_send() - tap: generalize call tapping feature - stat: generalize statistics - Replace rtp_data_net() and rtp_data_bts() with generalized rtp_data_rx() *) mgcp_protocol.c fixes: - check ci string before it is converted: In case of missing ci, a nullpointer is delivered to strtoul(). Add a function that takes ci, checks it and converts it to an uint32_t. Use the return code to react on missing ci. - output error message on missing CI. - when parsing the mode, print log message when mode is missing. - use mode_orig when mode is missing. - fix ptime formatstring to use %u rather than %d. - cosmetic: log when connection is deleted on DLCX. - change loglevels of CRCX, MDCX, DLCX events from DEBUG to NOTICE. *) mgcp_test - apply rename of strline_r() to mgcp_strline(). - MGCP command macros: - Add 'I: 1' parameters. - Use proper port numbers: from m=audio 0 RTP/AVP 126 to m=audio 16002 RTP/AVP 128 - Change ptime to 'a=ptime:40' because this is what the MGW currently returns. CRCX generally feed a ptime:40 and this is expected to be returned. - struct mgcp_test: Use only one ptype, there are no explicit BTS and NET endpoints anymore. Hence remove one column from tests[]. - test_messages(): - Enable: remove '#if 0' - Remove concept of BTS and NET endpoints: test only one conn, as they are now interchangeable anyway. - remove endpoint init, now done internally. - add false asserts in error cases. - test_retransmission(): - remove endpoint init, now done internally. - add false asserts in error cases. - test_packet_error_detection(): - Remove concept of BTS and NET endpoints: test only one conn, as they are now interchangeable anyway. Use arbitrary conn ids (e.g. 4711). - remove endpoint init, now done internally. - add false assert in error case. - Assert that a conn really vanishes on DLCX, previously the conn would remain and just be unused, now it is actually discarded. - test_no_cycle() - Remove concept of BTS and NET endpoints: test only one conn, as they are now interchangeable anyway. Use arbitrary conn ids (e.g. 4711). - test_no_name() - Enable: remove '#if 0'. - remove endpoint init, now done internally. - add false assert in error case. - mgcp_test.ok: adjust expected results to status quo: - We now see two dummy packets instead of one, now sent to both sides because we don't know of BTS or NET side. (maybe drop dummy packets later...) - packet duration, conn mode: now sane defaults show instead of unset. - various whitespace and formatting changes from lindent. Change-Id: Ie008599136c7ed8a0dfbb0cf803188975a499fc5
39 lines
940 B
C
39 lines
940 B
C
#pragma once
|
|
|
|
|
|
#include <osmocom/netif/osmux.h>
|
|
struct mgcp_conn_rtp;
|
|
|
|
#define OSMUX_PORT 1984
|
|
|
|
enum {
|
|
OSMUX_ROLE_BSC = 0,
|
|
OSMUX_ROLE_BSC_NAT,
|
|
};
|
|
|
|
int osmux_init(int role, struct mgcp_config *cfg);
|
|
int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn,
|
|
struct in_addr *addr, uint16_t port);
|
|
void osmux_disable_conn(struct mgcp_conn_rtp *conn);
|
|
void osmux_allocate_cid(struct mgcp_conn_rtp *conn);
|
|
void osmux_release_cid(struct mgcp_conn_rtp *conn);
|
|
int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn);
|
|
int osmux_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn);
|
|
int osmux_get_cid(void);
|
|
void osmux_put_cid(uint8_t osmux_cid);
|
|
int osmux_used_cid(void);
|
|
|
|
enum osmux_state {
|
|
OSMUX_STATE_DISABLED = 0,
|
|
OSMUX_STATE_NEGOTIATING,
|
|
OSMUX_STATE_ACTIVATING,
|
|
OSMUX_STATE_ENABLED,
|
|
};
|
|
|
|
enum osmux_usage {
|
|
OSMUX_USAGE_OFF = 0,
|
|
OSMUX_USAGE_ON = 1,
|
|
OSMUX_USAGE_ONLY = 2,
|
|
};
|
|
|