From 869e38eced83a73ce95f415d2013f6b648aa16a6 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 6 Aug 2010 17:54:27 +0800 Subject: mgcp: Add a callback to inform the client that an endpoint got reallocated --- openbsc/include/openbsc/mgcp.h | 2 ++ openbsc/src/mgcp/mgcp_protocol.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index 7f77868a4..38fe50482 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -76,6 +76,7 @@ struct mgcp_config; #define MGCP_POLICY_REJECT 5 #define MGCP_POLICY_DEFER 6 +typedef int (*mgcp_realloc)(struct mgcp_config *cfg, int endpoint); typedef int (*mgcp_change)(struct mgcp_config *cfg, int endpoint, int state); typedef int (*mgcp_policy)(struct mgcp_config *cfg, int endpoint, int state, const char *transactio_id); typedef int (*mgcp_reset)(struct mgcp_config *cfg); @@ -121,6 +122,7 @@ struct mgcp_config { mgcp_change change_cb; mgcp_policy policy_cb; mgcp_reset reset_cb; + mgcp_realloc realloc_cb; void *data; struct mgcp_endpoint *endpoints; diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c index e5f9a145d..828c33b98 100644 --- a/openbsc/src/mgcp/mgcp_protocol.c +++ b/openbsc/src/mgcp/mgcp_protocol.c @@ -435,6 +435,8 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg) LOGP(DMGCP, LOGL_NOTICE, "Endpoint 0x%x already allocated. Forcing realloc.\n", ENDPOINT_NUMBER(endp)); mgcp_free_endp(endp); + if (cfg->realloc_cb) + cfg->realloc_cb(cfg, ENDPOINT_NUMBER(endp)); } else { LOGP(DMGCP, LOGL_ERROR, "Endpoint is already used. 0x%x\n", ENDPOINT_NUMBER(endp)); -- cgit v1.2.3