aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-13 17:56:22 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-13 23:55:52 +0200
commit4d44fc56e782dd0598ddfb8fc963c46c3b1b5a20 (patch)
treefd5f75db93f10f7b8c98d2f74813e221f65d0c94
parent19c530c5e7be14c518c8c0e65855c658b78d0146 (diff)
nat: Make the queue routine work on any write_queue
-rw-r--r--openbsc/include/openbsc/bsc_nat.h1
-rw-r--r--openbsc/src/nat/bsc_nat_utils.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 7ac175dfc..682447a4b 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -297,6 +297,7 @@ uint32_t bsc_mgcp_extract_ci(const char *resp);
int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id);
+int bsc_do_write(struct write_queue *queue, struct msgb *msg, int id);
/* IMSI allow/deny handling */
void bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv);
diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c
index 4fda517c2..9c155ccaf 100644
--- a/openbsc/src/nat/bsc_nat_utils.c
+++ b/openbsc/src/nat/bsc_nat_utils.c
@@ -265,10 +265,15 @@ int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int
int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int proto)
{
+ return bsc_do_write(&bsc->write_queue, msg, proto);
+}
+
+int bsc_do_write(struct write_queue *queue, struct msgb *msg, int proto)
+{
/* prepend the header */
ipaccess_prepend_header(msg, proto);
- if (write_queue_enqueue(&bsc->write_queue, msg) != 0) {
+ if (write_queue_enqueue(queue, msg) != 0) {
LOGP(DINP, LOGL_ERROR, "Failed to enqueue the write.\n");
msgb_free(msg);
return -1;