diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-03-26 07:20:59 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-03-26 07:20:59 +0100 |
commit | 3177580cc17fa5752b5939e5647064172ec7d0b3 (patch) | |
tree | 223795106d33f5093a52c5f038180b33698877e2 /openbsc/src/nat/bsc_nat.c | |
parent | cbe77e165785977a664e0ee8c1c5e229f8bbe402 (diff) |
nat: Move BSC msg sending to a new method.
Move all writes into one place so we can switch to the
write queue more easily in the future.
Diffstat (limited to 'openbsc/src/nat/bsc_nat.c')
-rw-r--r-- | openbsc/src/nat/bsc_nat.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/openbsc/src/nat/bsc_nat.c b/openbsc/src/nat/bsc_nat.c index 0972208fa..4694788e4 100644 --- a/openbsc/src/nat/bsc_nat.c +++ b/openbsc/src/nat/bsc_nat.c @@ -269,6 +269,11 @@ static void initialize_msc_if_needed() /* do we need to send a GSM 08.08 message here? */ } +static int bsc_write(struct bsc_connection *bsc, u_int8_t *data, unsigned int length) +{ + return write(bsc->write_queue.bfd.fd, data, length); +} + static int forward_sccp_to_bts(struct msgb *msg) { struct bsc_connection *bsc = NULL; @@ -314,7 +319,7 @@ static int forward_sccp_to_bts(struct msgb *msg) return -1; } - return write(bsc->write_queue.bfd.fd, msg->data, msg->len); + return bsc_write(bsc, msg->data, msg->len); send_to_all: /* @@ -348,7 +353,7 @@ send_to_all: if (!bsc->authenticated || _lac != bsc->lac) continue; - rc = write(bsc->write_queue.bfd.fd, msg->data, msg->len); + rc = bsc_write(bsc, msg->data, msg->len); if (rc < msg->len) LOGP(DNAT, LOGL_ERROR, "Failed to write message to BTS: %d\n", rc); @@ -362,7 +367,7 @@ send_to_all: if (!bsc->authenticated) continue; - rc = write(bsc->write_queue.bfd.fd, msg->data, msg->len); + rc = bsc_write(bsc, msg->data, msg->len); /* try the next one */ if (rc < msg->len) |