summaryrefslogtreecommitdiffstats
path: root/openbsc/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-18 18:38:59 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-16 15:32:33 +0100
commit601002ad4c0b366966173f0576ba54d118e9bb0f (patch)
tree324d319e7b653623a818a7e21cabee6e51b6a9bd /openbsc/include
parent7c8a62a9406ab33feecd890b044f001aee7fadd9 (diff)
mgcp parsing, mgcp test
Diffstat (limited to 'openbsc/include')
-rw-r--r--openbsc/include/openbsc/mgcpgw_client.h49
-rw-r--r--openbsc/include/openbsc/transaction.h13
2 files changed, 39 insertions, 23 deletions
diff --git a/openbsc/include/openbsc/mgcpgw_client.h b/openbsc/include/openbsc/mgcpgw_client.h
index 60e648d9b..b353db0a4 100644
--- a/openbsc/include/openbsc/mgcpgw_client.h
+++ b/openbsc/include/openbsc/mgcpgw_client.h
@@ -8,12 +8,17 @@ enum mgcp_connection_mode;
struct msgb;
struct mgcpgw_client;
+struct vty;
#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
+#define MSGB_CB_MGCP_TRANS_ID 0
+
+typedef unsigned int mgcp_trans_id_t;
+
struct mgcpgw_client_conf {
const char *local_addr;
int local_port;
@@ -23,12 +28,12 @@ struct mgcpgw_client_conf {
struct mgcp_response_head {
int response_code;
- unsigned int trans_id;
+ mgcp_trans_id_t trans_id;
const char *comment;
};
struct mgcp_response {
- char *data;
+ char *body;
struct mgcp_response_head head;
uint16_t audio_port;
};
@@ -40,7 +45,7 @@ typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void *priv)
struct mgcp_response_pending {
struct llist_head entry;
- unsigned int trans_id;
+ mgcp_trans_id_t trans_id;
mgcp_response_cb_t response_cb;
void *priv;
};
@@ -50,6 +55,7 @@ void mgcpgw_client_conf_init(struct mgcpgw_client_conf *conf);
struct mgcpgw_client *mgcpgw_client_init(void *ctx,
struct mgcpgw_client_conf *conf);
+int mgcpgw_client_connect(struct mgcpgw_client *mgcp);
const char *mgcpgw_client_remote_addr_str(struct mgcpgw_client *mgcp);
uint16_t mgcpgw_client_remote_port(struct mgcpgw_client *mgcp);
@@ -59,26 +65,23 @@ unsigned int mgcpgw_client_next_endpoint(struct mgcpgw_client *client);
int mgcp_response_parse_params(struct mgcp_response *r);
-int mgcpgw_client_tx_crcx(struct mgcpgw_client *mgcp,
- mgcp_response_cb_t response_cb, void *priv,
- uint16_t rtp_endpoint, unsigned int call_id,
- enum mgcp_connection_mode mode);
-int mgcpgw_client_tx_mdcx(struct mgcpgw_client *mgcp,
- mgcp_response_cb_t response_cb, void *priv,
- 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,
- mgcp_response_cb_t response_cb, void *priv,
- unsigned int trans_id,
- const char *fmt, ...);
-int mgcpgw_client_tx_buf(struct mgcpgw_client *mgcp,
- mgcp_response_cb_t response_cb, void *priv,
- const char *buf, int len,
- unsigned int trans_id);
-int mgcpgw_client_tx(struct mgcpgw_client *mgcp,
- mgcp_response_cb_t response_cb, void *priv,
- struct msgb *msg, unsigned int trans_id);
+int mgcpgw_client_tx(struct mgcpgw_client *mgcp, struct msgb *msg,
+ mgcp_response_cb_t response_cb, void *priv);
+
+struct msgb *mgcp_msg_crcx(struct mgcpgw_client *mgcp,
+ uint16_t rtp_endpoint, unsigned int call_id,
+ enum mgcp_connection_mode mode);
+
+struct msgb *mgcp_msg_mdcx(struct mgcpgw_client *mgcp,
+ uint16_t rtp_endpoint, const char *rtp_conn_addr,
+ uint16_t rtp_port, enum mgcp_connection_mode mode);
void mgcpgw_client_vty_init(int node, struct mgcpgw_client_conf *conf);
int mgcpgw_client_config_write(struct vty *vty, const char *indent);
+
+struct mgcp_response_pending * mgcpgw_client_pending_add(
+ struct mgcpgw_client *mgcp,
+ mgcp_trans_id_t trans_id,
+ mgcp_response_cb_t response_cb,
+ void *priv);
+int mgcpgw_client_rx(struct mgcpgw_client *mgcp, struct msgb *msg);
diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h
index 07ab7a7da..a8df20baa 100644
--- a/openbsc/include/openbsc/transaction.h
+++ b/openbsc/include/openbsc/transaction.h
@@ -9,6 +9,14 @@
#include <osmocom/gsm/gsm0411_smc.h>
#include <osmocom/gsm/gsm0411_smr.h>
+enum bridge_state {
+ BRIDGE_STATE_NONE,
+ BRIDGE_STATE_LOOPBACK_PENDING,
+ BRIDGE_STATE_LOOPBACK_ESTABLISHED,
+ BRIDGE_STATE_BRIDGE_PENDING,
+ BRIDGE_STATE_BRIDGE_ESTABLISHED,
+};
+
/* One transaction */
struct gsm_trans {
/* Entry in list of all transactions */
@@ -57,6 +65,11 @@ struct gsm_trans {
struct gsm_sms *sms;
} sms;
};
+
+ struct {
+ struct gsm_trans *peer;
+ enum bridge_state state;
+ } bridge;
};