nat: Make the write_queue write callback a public function
This commit is contained in:
parent
4d44fc56e7
commit
69cfa179ef
|
@ -298,6 +298,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);
|
||||
int bsc_write_cb(struct bsc_fd *bfd, struct msgb *msg);
|
||||
|
||||
/* IMSI allow/deny handling */
|
||||
void bsc_parse_reg(void *ctx, regex_t *reg, char **imsi, int argc, const char **argv);
|
||||
|
|
|
@ -984,17 +984,6 @@ static int ipaccess_bsc_read_cb(struct bsc_fd *bfd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ipaccess_bsc_write_cb(struct bsc_fd *bfd, struct msgb *msg)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = write(bfd->fd, msg->data, msg->len);
|
||||
if (rc != msg->len)
|
||||
LOGP(DNAT, LOGL_ERROR, "Failed to write message to the BSC.\n");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what)
|
||||
{
|
||||
struct bsc_connection *bsc;
|
||||
|
@ -1049,7 +1038,7 @@ static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what)
|
|||
bsc->write_queue.bfd.data = bsc;
|
||||
bsc->write_queue.bfd.fd = fd;
|
||||
bsc->write_queue.read_cb = ipaccess_bsc_read_cb;
|
||||
bsc->write_queue.write_cb = ipaccess_bsc_write_cb;
|
||||
bsc->write_queue.write_cb = bsc_write_cb;
|
||||
bsc->write_queue.bfd.when = BSC_FD_READ;
|
||||
if (bsc_register_fd(&bsc->write_queue.bfd) < 0) {
|
||||
LOGP(DNAT, LOGL_ERROR, "Failed to register BSC fd.\n");
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static const struct rate_ctr_desc bsc_cfg_ctr_description[] = {
|
||||
[BCFG_CTR_SCCP_CONN] = { "sccp.conn", "SCCP Connections "},
|
||||
|
@ -674,3 +675,15 @@ int bsc_conn_type_to_ctr(struct sccp_connections *conn)
|
|||
{
|
||||
return con_to_ctr[conn->con_type];
|
||||
}
|
||||
|
||||
int bsc_write_cb(struct bsc_fd *bfd, struct msgb *msg)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = write(bfd->fd, msg->data, msg->len);
|
||||
if (rc != msg->len)
|
||||
LOGP(DNAT, LOGL_ERROR, "Failed to write message to the BSC.\n");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue