aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-02-03 09:54:43 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-02-03 09:54:43 +0100
commit77f7afe08e2529ff7be301f6cf5298207370807f (patch)
treebb02bd4c9feebfd92da5e9f41a24cc1538280b13 /openbsc/src
parent2ada71de6465def08867c522dc955ff61907c116 (diff)
[mgcp] Prepare the in process MGCP handling by adding callbacks
* Call a callback when the endpoint was created, modified or deleted. This can be used by the BSC MUX to send a MGCP packet over TCP to the right the BSC to allocate the endpoint there with the right data, or it can be used in the BSC to send the right commands to the BTS.
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/mgcp/mgcp_protocol.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c
index 763dadbcc..d09615743 100644
--- a/openbsc/src/mgcp/mgcp_protocol.c
+++ b/openbsc/src/mgcp/mgcp_protocol.c
@@ -162,6 +162,9 @@ static int handle_create_con(int fd, struct msgb *msg, struct sockaddr_in *sourc
static int handle_delete_con(int fd, struct msgb *msg, struct sockaddr_in *source);
static int handle_modify_con(int fd, struct msgb *msg, struct sockaddr_in *source);
+static mgcp_change change_cb;
+static void *change_cb_data;
+
static int generate_call_id()
{
int i;
@@ -661,6 +664,9 @@ static int handle_create_con(int fd, struct msgb *msg, struct sockaddr_in *sourc
LOGP(DMGCP, LOGL_NOTICE, "Creating endpoint on: 0x%x CI: %u port: %u\n",
ENDPOINT_NUMBER(endp), endp->ci, endp->rtp_port);
+ if (change_cb)
+ change_cb(ENDPOINT_NUMBER(endp), MGCP_ENDP_CRCX, endp->rtp_port, change_cb_data);
+
return send_with_sdp(fd, endp, "CRCX", trans_id, source);
error:
LOGP(DMGCP, LOGL_ERROR, "Malformed line: %s on 0x%x with: line_start: %d %d\n",
@@ -752,6 +758,8 @@ static int handle_modify_con(int fd, struct msgb *msg, struct sockaddr_in *sourc
/* modify */
LOGP(DMGCP, LOGL_NOTICE, "Modified endpoint on: 0x%x Server: %s:%u\n",
ENDPOINT_NUMBER(endp), inet_ntoa(endp->remote), endp->net_rtp);
+ if (change_cb)
+ change_cb(ENDPOINT_NUMBER(endp), MGCP_ENDP_MDCX, endp->rtp_port, change_cb_data);
return send_with_sdp(fd, endp, "MDCX", trans_id, source);
error:
@@ -814,6 +822,8 @@ static int handle_delete_con(int fd, struct msgb *msg, struct sockaddr_in *sourc
}
endp->net_rtp = endp->net_rtcp = endp->bts_rtp = endp->bts_rtcp = 0;
+ if (change_cb)
+ change_cb(ENDPOINT_NUMBER(endp), MGCP_ENDP_DLCX, endp->rtp_port, change_cb_data);
return send_response(fd, 250, "DLCX", trans_id, source);
@@ -1117,3 +1127,9 @@ int mgcp_parse_config(const char *config_file, struct gsm_network *dummy_network
return !!forward_ip;
}
+
+void mgcp_set_change_cb(mgcp_change cb, void *data)
+{
+ change_cb = cb;
+ change_cb_data = data;
+}