aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_protocol.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-20 21:59:55 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-18 17:49:00 +0200
commit61692adb2b0cd090c8fb8c81376a28bca099d079 (patch)
treebee3b3fde06ec8dc2a4cb9208ceae3465cea25a5 /openbsc/src/libmgcp/mgcp_protocol.c
parent58774cba12ec4675e32fa524cfa631bdc690a9da (diff)
Implement IuCS (large refactoring and addition)
osmo-nitb becomes osmo-msc add DIUCS debug log constant add iucs.[hc] add msc vty, remove nitb vty add libiudummy, to avoid linking Iu deps in tests Use new msc_tx_dtap() instead of gsm0808_submit_dtap() libmgcp: add mgcpgw client API bridge calls via mgcpgw mgcp: hack RAB success from nano3G: patch first RTP payload The ip.access nano3G needs the first RTP payload's first two bytes to read hex 'e400', or it will reject the RAB assignment. Add flag patched_first_rtp_payload to mgcp_rtp_state to detect the first RTP payload on a stream, and overwrite its first bytes with e400. This should probably be configurable, but seems to not harm other femto cells (as long as we patch only the first RTP payload in each stream). Only do this when sending to the BTS side. Change-Id: Ie13ff348117e892d41b8355ab6c24915301eaeaf
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_protocol.c')
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index 4fcadd949..78e41f193 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -318,26 +318,14 @@ struct msgb *mgcp_handle_message(struct mgcp_config *cfg, struct msgb *msg)
int i, code, handled = 0;
struct msgb *resp = NULL;
char *data;
- unsigned char *tail = msg->l2h + msgb_l2len(msg); /* char after l2 data */
if (msgb_l2len(msg) < 4) {
LOGP(DMGCP, LOGL_ERROR, "msg too short: %d\n", msg->len);
return NULL;
}
- /* Ensure that the msg->l2h is NUL terminated. */
- if (tail[-1] == '\0')
- /* nothing to do */;
- else if (msgb_tailroom(msg) > 0)
- tail[0] = '\0';
- else if (tail[-1] == '\r' || tail[-1] == '\n')
- tail[-1] = '\0';
- else {
- LOGP(DMGCP, LOGL_ERROR, "Cannot NUL terminate MGCP message: "
- "Length: %d, Buffer size: %d\n",
- msgb_l2len(msg), msg->data_len);
+ if (mgcp_msg_terminate_nul(msg))
return NULL;
- }
/* attempt to treat it as a response */
if (sscanf((const char *)&msg->l2h[0], "%3d %*s", &code) == 1) {
@@ -547,6 +535,11 @@ static int parse_conn_mode(const char *msg, struct mgcp_endpoint *endp)
endp->bts_end.output_enabled =
endp->conn_mode & MGCP_CONN_RECV_ONLY ? 1 : 0;
+ LOGP(DMGCP, LOGL_DEBUG, "endpoint %x connection mode '%s' %d output_enabled net %d bts %d\n",
+ ENDPOINT_NUMBER(endp),
+ msg, endp->conn_mode, endp->net_end.output_enabled,
+ endp->bts_end.output_enabled);
+
return ret;
}
@@ -972,6 +965,8 @@ static struct msgb *handle_modify_con(struct mgcp_parse_data *p)
break;
case MGCP_POLICY_DEFER:
/* stop processing */
+ LOGP(DMGCP, LOGL_DEBUG, "endp %x MDCX defer\n",
+ ENDPOINT_NUMBER(endp));
return NULL;
break;
case MGCP_POLICY_CONT:
@@ -1003,6 +998,8 @@ error3:
out_silent:
+ LOGP(DMGCP, LOGL_DEBUG, "endp %x Modify endpoint: silent exit\n",
+ ENDPOINT_NUMBER(endp));
return NULL;
}