From af3fed9213666c8fa68ba3a153aa17577df97649 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 23 Jun 2011 20:42:19 +0200 Subject: ipa: add ipa_*_send() to transmit messages This patch adds ipa_*_send() functions to transmit messages using the new A-bis over IP infrastructure. This patch completes the transmission path support for the A-bis over IP infrastructure. --- include/osmocom/abis/ipa.h | 4 ++++ src/input/ipa.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h index 91afd01..f088ec0 100644 --- a/include/osmocom/abis/ipa.h +++ b/include/osmocom/abis/ipa.h @@ -31,6 +31,8 @@ struct ipa_server_peer { struct ipa_server_peer *ipa_server_peer_create(void *ctx, struct ipa_server_link *link, int fd, int (*cb)(struct ipa_server_peer *peer, struct msgb *msg), void *data); void ipa_server_peer_destroy(struct ipa_server_peer *peer); +void ipa_server_peer_send(struct ipa_server_peer *peer, struct msgb *msg); + enum ipa_client_link_state { IPA_CLIENT_LINK_STATE_NONE = 0, IPA_CLIENT_LINK_STATE_CONNECTING = 1, @@ -56,6 +58,8 @@ void ipa_client_link_destroy(struct ipa_client_link *link); int ipa_client_link_open(struct ipa_client_link *link); void ipa_client_link_close(struct ipa_client_link *link); +void ipa_client_link_send(struct ipa_client_link *link, struct msgb *msg); + int ipa_msg_recv(int fd, struct msgb **rmsg); #endif diff --git a/src/input/ipa.c b/src/input/ipa.c index 6a2022e..0cd2540 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -199,6 +199,7 @@ ipa_client_link_create(void *ctx, struct e1inp_line *line, ipa_link->cb = cb; ipa_link->line = line; ipa_link->data = data; + INIT_LLIST_HEAD(&ipa_link->tx_queue); return ipa_link; } @@ -242,6 +243,12 @@ static void ipa_link_timer_cb(void *data) } } +void ipa_client_link_send(struct ipa_client_link *link, struct msgb *msg) +{ + msgb_enqueue(&link->tx_queue, msg); + link->ofd.when |= BSC_FD_WRITE; +} + int ipa_server_fd_cb(struct osmo_fd *ofd, unsigned int what) { int ret; @@ -401,6 +408,8 @@ ipa_server_peer_create(void *ctx, struct ipa_server_link *link, int fd, peer->ofd.when = BSC_FD_READ; peer->cb = cb; peer->data = data; + INIT_LLIST_HEAD(&peer->tx_queue); + if (osmo_fd_register(&peer->ofd) < 0) { LOGP(DINP, LOGL_ERROR, "could not register FD\n"); talloc_free(peer); @@ -415,3 +424,9 @@ void ipa_server_peer_destroy(struct ipa_server_peer *peer) osmo_fd_unregister(&peer->ofd); talloc_free(peer); } + +void ipa_server_peer_send(struct ipa_server_peer *peer, struct msgb *msg) +{ + msgb_enqueue(&peer->tx_queue, msg); + peer->ofd.when |= BSC_FD_WRITE; +} -- cgit v1.2.3-55-g7522