nat: Make the queue routine work on any write_queue

This commit is contained in:
Holger Hans Peter Freyther 2010-10-13 17:56:22 +02:00
parent 19c530c5e7
commit 4d44fc56e7
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -264,11 +264,16 @@ 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;