diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-11-05 13:52:53 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-04-16 09:17:21 +0200 |
commit | 77956aa034a7ac5ddfdf91c7341d3bf82cb07367 (patch) | |
tree | 65028be89f43a92f8dda44d24431edcc19d29d2e /openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c | |
parent | 6de9d0ba35f6fc9c483ef75426364580ad9fae01 (diff) |
nat: Move all methods sending a response to the callagent to a single place
For testing it can be nice to handle MGCP messages through the IPA
protocol. Prepare the code to send the messages through other means.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c')
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c index 80a34d313..1436ebd35 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c @@ -62,6 +62,14 @@ #include <errno.h> #include <unistd.h> +static void mgcp_queue_for_call_agent(struct bsc_nat *nat, struct msgb *output) +{ + if (osmo_wqueue_enqueue(&nat->mgcp_cfg->gw_fd, output) != 0) { + LOGP(DMGCP, LOGL_ERROR, "Failed to queue MGCP msg.\n"); + msgb_free(output); + } +} + int bsc_mgcp_nr_multiplexes(int max_endpoints) { int div = max_endpoints / 32; @@ -502,10 +510,7 @@ void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg) return; } - if (osmo_wqueue_enqueue(&bsc->nat->mgcp_cfg->gw_fd, output) != 0) { - LOGP(DMGCP, LOGL_ERROR, "Failed to queue MGCP msg.\n"); - msgb_free(output); - } + mgcp_queue_for_call_agent(bsc->nat, output); } int bsc_mgcp_parse_response(const char *str, int *code, char transaction[60]) @@ -680,12 +685,8 @@ static int mgcp_do_read(struct osmo_fd *fd) msgb_free(msg); /* we do have a direct answer... e.g. AUEP */ - if (resp) { - if (osmo_wqueue_enqueue(&nat->mgcp_cfg->gw_fd, resp) != 0) { - LOGP(DMGCP, LOGL_ERROR, "Failed to enqueue msg.\n"); - msgb_free(resp); - } - } + if (resp) + mgcp_queue_for_call_agent(nat, resp); return 0; } |