From 2c9168cf34d370b4ea2b21177402d01a7cfffea8 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 10 Oct 2013 20:21:33 +0200 Subject: vty: Make vty_event dispatch signals and use it in the testcase The testcase didn't work on Ubuntu 12.04 because vty_create will directly call vty_event (e.g. not through the plt). This means that the approach to override vty_event in the testcase failed. Use the signal interface of libosmocore and make the testcase use it. The signals can be generally useful as well. --- src/vty/telnet_interface.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/vty') diff --git a/src/vty/telnet_interface.c b/src/vty/telnet_interface.c index 1abf141d..32ab6bee 100644 --- a/src/vty/telnet_interface.c +++ b/src/vty/telnet_interface.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -166,12 +167,23 @@ static int telnet_new_connection(struct osmo_fd *fd, unsigned int what) /*! \brief callback from core VTY code about VTY related events */ void vty_event(enum event event, int sock, struct vty *vty) { + struct vty_signal_data sig_data = { 0, }; struct telnet_connection *connection = vty->priv; - struct osmo_fd *bfd = &connection->fd; + struct osmo_fd *bfd; if (vty->type != VTY_TERM) return; + sig_data.event = event; + sig_data.sock = sock; + sig_data.vty = vty; + osmo_signal_dispatch(SS_L_VTY, S_VTY_EVENT, &sig_data); + + if (!connection) + return; + + bfd = &connection->fd; + switch (event) { case VTY_READ: bfd->when |= BSC_FD_READ; -- cgit v1.2.3