aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-09-07 13:39:07 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-11-12 16:05:35 +0100
commita9370b6b65e3610d78cbf2b805220df923bc2cd5 (patch)
tree146aa320e459054f64b3260b51f808058e0fdfb3 /openbsc/include/openbsc
parentb50af47d4291abd656a28e31a704d19b3e4413eb (diff)
libmgcp: add mgcpgw client API
Add an API to send MGCP messages to an MGCP GW, from the perspective of an MSC instructing the GW to setup RTP streams. Rationale: the mgcp_protocol.h is mostly for the MGCP GW itself, other implementations forward incoming MGCP messages. So a simpler approach for an MGCP GW client is useful. Add general VTY commands that can be used to configure mgcpgw_client. osmo-cscn is going to use this to route RTP streams (for 3G at first). Change-Id: I6fe365c4c89207f2172943cc456b508a207b1135
Diffstat (limited to 'openbsc/include/openbsc')
-rw-r--r--openbsc/include/openbsc/Makefile.am1
-rw-r--r--openbsc/include/openbsc/mgcpgw_client.h47
2 files changed, 48 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index 3f6ba412a..ac3a2d081 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -48,6 +48,7 @@ noinst_HEADERS = \
mgcp.h \
mgcp_internal.h \
mgcp_transcode.h \
+ mgcpgw_client.h \
misdn.h \
mncc.h \
mncc_int.h \
diff --git a/openbsc/include/openbsc/mgcpgw_client.h b/openbsc/include/openbsc/mgcpgw_client.h
new file mode 100644
index 000000000..c21011898
--- /dev/null
+++ b/openbsc/include/openbsc/mgcpgw_client.h
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <stdint.h>
+enum mgcp_connection_mode;
+
+struct msgb;
+struct mgcpgw_client;
+
+#define MGCPGW_CLIENT_LOCAL_ADDR_DEFAULT "0.0.0.0"
+#define MGCPGW_CLIENT_LOCAL_PORT_DEFAULT 0
+#define MGCPGW_CLIENT_REMOTE_ADDR_DEFAULT "127.0.0.1"
+#define MGCPGW_CLIENT_REMOTE_PORT_DEFAULT 2427
+
+typedef void (* mgcp_rx_cb_t )(struct msgb *msg, void *priv);
+
+struct mgcpgw_client_conf {
+ const char *local_addr;
+ int local_port;
+ const char *remote_addr;
+ int remote_port;
+};
+
+void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf);
+
+struct mgcpgw_client *mgcpgw_client_init(void *ctx,
+ struct mgcpgw_client_conf *conf,
+ mgcp_rx_cb_t rx_cb, void *rx_cb_priv);
+
+const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp);
+uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp);
+uint32_t mgcpgw_client_remote_addr_n(struct mgcpgw_client *mgcp);
+
+unsigned int mgcpgw_client_next_endpoint(struct mgcpgw_client *client);
+
+int mgcpgw_client_tx_crcx(struct mgcpgw_client *client,
+ uint16_t rtp_endpoint, unsigned int call_id,
+ enum mgcp_connection_mode mode);
+int mgcpgw_client_tx_mdcx(struct mgcpgw_client *client, uint16_t rtp_endpoint,
+ const char *rtp_conn_addr, uint16_t rtp_port,
+ enum mgcp_connection_mode mode);
+
+int mgcpgw_client_tx_str(struct mgcpgw_client *mgcp, const char *fmt, ...);
+int mgcpgw_client_tx_buf(struct mgcpgw_client *mgcp, const char *buf, int len);
+int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg);
+
+void mgcpgw_client_vty_init(int node, struct mgcpgw_client_conf *conf);
+int mgcpgw_client_config_write(struct vty *vty, const char *indent);