aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_protocol.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-22 15:00:52 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-22 15:00:52 +0200
commitcb6ad70994dc7686f1c89d803fcca1081b5ef32b (patch)
tree2cca0df46b85af353b579cf8335d586fb03e9147 /openbsc/src/libmgcp/mgcp_protocol.c
parent34a1976d5d3791501ee57404629a849dce181b0b (diff)
mgcp: Change API to remove memory management from the name
Jacob pointed out that "free_endp" refers to the memory of the endpoint being freed. What we want is actually a way to release an endpoint (and the resource it allocated) or in the case of the testcase/testapp initialize the data structure correctly. Introduce two names for that.
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_protocol.c')
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index f25c1faa9..1198c24a6 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -940,7 +940,7 @@ mgcp_header_done:
if (tcfg->force_realloc) {
LOGP(DMGCP, LOGL_NOTICE, "Endpoint 0x%x already allocated. Forcing realloc.\n",
ENDPOINT_NUMBER(endp));
- mgcp_free_endp(endp);
+ mgcp_release_endp(endp);
if (p->cfg->realloc_cb)
p->cfg->realloc_cb(tcfg, ENDPOINT_NUMBER(endp));
} else {
@@ -1006,7 +1006,7 @@ mgcp_header_done:
case MGCP_POLICY_REJECT:
LOGP(DMGCP, LOGL_NOTICE, "CRCX rejected by policy on 0x%x\n",
ENDPOINT_NUMBER(endp));
- mgcp_free_endp(endp);
+ mgcp_release_endp(endp);
return create_err_response(endp, 400, "CRCX", p->trans);
break;
case MGCP_POLICY_DEFER:
@@ -1033,7 +1033,7 @@ mgcp_header_done:
create_transcoder(endp);
return create_response_with_sdp(endp, "CRCX", p->trans);
error2:
- mgcp_free_endp(endp);
+ mgcp_release_endp(endp);
LOGP(DMGCP, LOGL_NOTICE, "Resource error on 0x%x\n", ENDPOINT_NUMBER(endp));
return create_err_response(endp, error_code, "CRCX", p->trans);
}
@@ -1248,7 +1248,7 @@ static struct msgb *handle_delete_con(struct mgcp_parse_data *p)
mgcp_format_stats(endp, stats, sizeof(stats));
delete_transcoder(endp);
- mgcp_free_endp(endp);
+ mgcp_release_endp(endp);
if (p->cfg->change_cb)
p->cfg->change_cb(endp->tcfg, ENDPOINT_NUMBER(endp), MGCP_ENDP_DLCX);
@@ -1488,9 +1488,9 @@ int mgcp_endpoints_allocate(struct mgcp_trunk_config *tcfg)
return 0;
}
-void mgcp_free_endp(struct mgcp_endpoint *endp)
+void mgcp_release_endp(struct mgcp_endpoint *endp)
{
- LOGP(DMGCP, LOGL_DEBUG, "Deleting endpoint on: 0x%x\n", ENDPOINT_NUMBER(endp));
+ LOGP(DMGCP, LOGL_DEBUG, "Releasing endpoint on: 0x%x\n", ENDPOINT_NUMBER(endp));
endp->ci = CI_UNUSED;
endp->allocated = 0;
@@ -1516,6 +1516,11 @@ void mgcp_free_endp(struct mgcp_endpoint *endp)
memset(&endp->taps, 0, sizeof(endp->taps));
}
+void mgcp_initialize_endp(struct mgcp_endpoint *endp)
+{
+ return mgcp_release_endp(endp);
+}
+
static int send_trans(struct mgcp_config *cfg, const char *buf, int len)
{
struct sockaddr_in addr;