From cec20ff712bc18d95ce4c8e080d4efade082e4e7 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Wed, 19 Nov 2014 20:12:14 +0000 Subject: [PATCH] Remodelando poll de sockets --- connect.c | 2 +- iocalls.c | 8 ++++++++ telnet.c | 4 ++-- telnetc.h | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/connect.c b/connect.c index a78413e..933d000 100644 --- a/connect.c +++ b/connect.c @@ -77,7 +77,7 @@ //static void net_connected(H3270 *hSession) -static void net_connected(H3270 *hSession, LIB3270_IO_FLAG flag, void *dunno) +static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno) { int err; socklen_t len = sizeof(err); diff --git a/iocalls.c b/iocalls.c index 60100b2..528d8df 100644 --- a/iocalls.c +++ b/iocalls.c @@ -281,6 +281,14 @@ static void internal_remove_poll(void *id) inputs_changed = True; } +LIB3270_EXPORT void lib3270_remove_poll(void *id) { + remove_poll(id); +} + +LIB3270_EXPORT void * lib3270_add_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*call)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ) { + return add_poll(session,fd,flag,call,userdata); +} + /* Event dispatcher. */ static int internal_event_dispatcher(H3270 *hSession, int block) { diff --git a/telnet.c b/telnet.c index fe118b2..785febb 100644 --- a/telnet.c +++ b/telnet.c @@ -988,7 +988,7 @@ LIB3270_EXPORT void lib3270_data_recv(H3270 *hSession, size_t nr, const unsigned * @param hSession Session handle * */ -void net_input(H3270 *hSession, LIB3270_IO_FLAG flag, void *dunno) +void net_input(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno) { // register unsigned char * cp; int nr; @@ -1950,7 +1950,7 @@ process_eor(H3270 *hSession) * net_exception * Called when there is an exceptional condition on the socket. */ -void net_exception(H3270 *session, LIB3270_IO_FLAG flag, void *dunno) +void net_exception(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno) { CHECK_SESSION_HANDLE(session); diff --git a/telnetc.h b/telnetc.h index e7fa430..6c800eb 100644 --- a/telnetc.h +++ b/telnetc.h @@ -34,8 +34,8 @@ LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); LIB3270_INTERNAL void net_break(H3270 *hSession); LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); LIB3270_INTERNAL void net_disconnect(H3270 *session); -LIB3270_INTERNAL void net_exception(H3270 *session, LIB3270_IO_FLAG flag, void *dunno); -LIB3270_INTERNAL void net_input(H3270 *session, LIB3270_IO_FLAG flag, void *dunno); +LIB3270_INTERNAL void net_exception(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno); +LIB3270_INTERNAL void net_input(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno); LIB3270_INTERNAL void net_interrupt(H3270 *hSession); LIB3270_INTERNAL void net_output(H3270 *hSession); LIB3270_INTERNAL void net_sendc(H3270 *hSession, char c); -- libgit2 0.21.2