summaryrefslogtreecommitdiff
path: root/include/osmocom/mgcp/mgcp_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/osmocom/mgcp/mgcp_internal.h')
-rw-r--r--include/osmocom/mgcp/mgcp_internal.h89
1 files changed, 49 insertions, 40 deletions
diff --git a/include/osmocom/mgcp/mgcp_internal.h b/include/osmocom/mgcp/mgcp_internal.h
index b9c1731..0da2c56 100644
--- a/include/osmocom/mgcp/mgcp_internal.h
+++ b/include/osmocom/mgcp/mgcp_internal.h
@@ -27,11 +27,14 @@
#include <osmocom/core/select.h>
#include <osmocom/mgcp/mgcp.h>
#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/counter.h>
#define CI_UNUSED 0
-#define CONN_ID_BTS 0
-#define CONN_ID_NET 1
+/* FIXME: This this is only needed to compile the currently
+ * broken OSMUX support. Remove when fixed */
+#define CONN_ID_BTS "0"
+#define CONN_ID_NET "1"
enum mgcp_trunk_type {
MGCP_TRUNK_VIRTUAL,
@@ -48,27 +51,37 @@ struct mgcp_rtp_stream_state {
};
struct mgcp_rtp_state {
+ /* has this state structure been initialized? */
int initialized;
- int patch_ssrc;
- uint32_t orig_ssrc;
-
- int seq_offset;
-
- int32_t timestamp_offset;
+ struct {
+ /* are we patching the SSRC value? */
+ int patch_ssrc;
+ /* original SSRC (to which we shall patch any different SSRC) */
+ uint32_t orig_ssrc;
+ /* offset to apply on the sequence number */
+ int seq_offset;
+ /* offset to apply on the timestamp number */
+ int32_t timestamp_offset;
+ } patch;
+
+ /* duration of a packet (FIXME: in which unit?) */
uint32_t packet_duration;
struct mgcp_rtp_stream_state in_stream;
struct mgcp_rtp_stream_state out_stream;
/* jitter and packet loss calculation */
- int stats_initialized;
- uint16_t stats_base_seq;
- uint16_t stats_max_seq;
- uint32_t stats_ssrc;
- uint32_t stats_jitter;
- int32_t stats_transit;
- int stats_cycles;
+ struct {
+ int initialized;
+ uint16_t base_seq;
+ uint16_t max_seq;
+ uint32_t ssrc;
+ uint32_t jitter;
+ int32_t transit;
+ int cycles;
+ } stats;
+
bool patched_first_rtp_payload; /* FIXME: drop this, see OS#2459 */
};
@@ -83,13 +96,18 @@ struct mgcp_rtp_codec {
char *subtype_name;
};
+/* 'mgcp_rtp_end': basically a wrapper around the RTP+RTCP ports */
struct mgcp_rtp_end {
/* statistics */
- unsigned int packets_rx;
- unsigned int octets_rx;
- unsigned int packets_tx;
- unsigned int octets_tx;
- unsigned int dropped_packets;
+ struct {
+ unsigned int packets_rx;
+ unsigned int octets_rx;
+ unsigned int packets_tx;
+ unsigned int octets_tx;
+ unsigned int dropped_packets;
+ } stats;
+
+ /* local IP address of the RTP socket */
struct in_addr addr;
/* in network byte order */
@@ -103,23 +121,30 @@ struct mgcp_rtp_end {
int frames_per_packet;
uint32_t packet_duration_ms;
char *fmtp_extra;
+ /* are we transmitting packets (1) or dropping (0) outbound packets */
int output_enabled;
+ /* FIXME: This parameter can be set + printed, but is nowhere used! */
int force_output_ptime;
/* RTP patching */
int force_constant_ssrc; /* -1: always, 0: don't, 1: once */
+ /* should we perform align_rtp_timestamp_offset() (1) or not (0) */
int force_aligned_timing;
+ /* FIXME: not used anymore, used to be [external] transcoding related */
void *rtp_process_data;
/* Each end has a separate socket for RTP and RTCP */
struct osmo_fd rtp;
struct osmo_fd rtcp;
+ /* local UDP port number of the RTP socket; RTCP is +1 */
int local_port;
};
struct mgcp_rtp_tap {
+ /* is this tap active (1) or not (0) */
int enabled;
+ /* IP/port to which we're forwarding the tapped data */
struct sockaddr_in forward;
};
@@ -155,7 +180,7 @@ struct mgcp_conn_rtp {
/* Sequence bits */
struct mgcp_rtp_state state;
- /* taps for the rtp connection */
+ /* taps for the rtp connection; one per direction */
struct mgcp_rtp_tap tap_in;
struct mgcp_rtp_tap tap_out;
@@ -202,8 +227,8 @@ struct mgcp_conn {
/*!< copy of the mode to restore the original setting (VTY) */
enum mgcp_connection_mode mode_orig;
- /*!< connection id to identify the conntion */
- uint32_t id;
+ /*!< connection id to identify the connection */
+ char id[MGCP_CONN_ID_LENGTH];
/*!< human readable name (vty, logging) */
char name[256];
@@ -221,25 +246,9 @@ struct mgcp_conn {
struct mgcp_endpoint_type;
-struct mgcp_endpoint {
- char *callid;
- struct mgcp_lco local_options;
- struct llist_head conns;
-
- /* backpointer */
- struct mgcp_config *cfg;
- struct mgcp_trunk_config *tcfg;
-
- const struct mgcp_endpoint_type *type;
-
- /* fields for re-transmission */
- char *last_trans;
- char *last_response;
-};
-#define ENDPOINT_NUMBER(endp) abs((int)(endp - endp->tcfg->endpoints))
/**
* Internal structure while parsing a request
@@ -249,7 +258,6 @@ struct mgcp_parse_data {
struct mgcp_endpoint *endp;
char *trans;
char *save;
- int found;
};
int mgcp_send(struct mgcp_endpoint *endp, int is_rtp, struct sockaddr_in *addr,
@@ -258,6 +266,7 @@ int mgcp_send(struct mgcp_endpoint *endp, int is_rtp, struct sockaddr_in *addr,
int mgcp_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn);
int mgcp_dispatch_rtp_bridge_cb(int proto, struct sockaddr_in *addr, char *buf,
unsigned int buf_size, struct mgcp_conn *conn);
+void mgcp_cleanup_rtp_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn *conn);
int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port,
struct mgcp_conn_rtp *conn);
void mgcp_free_rtp_port(struct mgcp_rtp_end *end);