Commit 031f3088b32bf66de3529a5ea3fc98f77d649f7c

Authored by perry.werneck@gmail.com
1 parent 79f8d70b

Remodelando poll de sockets

src/include/lib3270.h
@@ -667,7 +667,7 @@ @@ -667,7 +667,7 @@
667 LIB3270_IO_FLAG_MASK = 0x07 667 LIB3270_IO_FLAG_MASK = 0x07
668 } LIB3270_IO_FLAG; 668 } LIB3270_IO_FLAG;
669 669
670 - LIB3270_EXPORT void * lib3270_add_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*call)(H3270 *, LIB3270_IO_FLAG, void *), void *userdata ); 670 + 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 );
671 LIB3270_EXPORT void lib3270_remove_poll(void *id); 671 LIB3270_EXPORT void lib3270_remove_poll(void *id);
672 672
673 // LIB3270_EXPORT void lib3270_remove_poll_fd(int fd); 673 // LIB3270_EXPORT void lib3270_remove_poll_fd(int fd);
src/lib3270/connect.c
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 77
78 78
79 //static void net_connected(H3270 *hSession) 79 //static void net_connected(H3270 *hSession)
80 -static void net_connected(H3270 *hSession, LIB3270_IO_FLAG flag, void *dunno) 80 +static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno)
81 { 81 {
82 int err; 82 int err;
83 socklen_t len = sizeof(err); 83 socklen_t len = sizeof(err);
src/lib3270/iocalls.c
@@ -281,6 +281,14 @@ static void internal_remove_poll(void *id) @@ -281,6 +281,14 @@ static void internal_remove_poll(void *id)
281 inputs_changed = True; 281 inputs_changed = True;
282 } 282 }
283 283
  284 +LIB3270_EXPORT void lib3270_remove_poll(void *id) {
  285 + remove_poll(id);
  286 +}
  287 +
  288 +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 ) {
  289 + return add_poll(session,fd,flag,call,userdata);
  290 +}
  291 +
284 /* Event dispatcher. */ 292 /* Event dispatcher. */
285 static int internal_event_dispatcher(H3270 *hSession, int block) 293 static int internal_event_dispatcher(H3270 *hSession, int block)
286 { 294 {
src/lib3270/telnet.c
@@ -988,7 +988,7 @@ LIB3270_EXPORT void lib3270_data_recv(H3270 *hSession, size_t nr, const unsigned @@ -988,7 +988,7 @@ LIB3270_EXPORT void lib3270_data_recv(H3270 *hSession, size_t nr, const unsigned
988 * @param hSession Session handle 988 * @param hSession Session handle
989 * 989 *
990 */ 990 */
991 -void net_input(H3270 *hSession, LIB3270_IO_FLAG flag, void *dunno) 991 +void net_input(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno)
992 { 992 {
993 // register unsigned char * cp; 993 // register unsigned char * cp;
994 int nr; 994 int nr;
@@ -1950,7 +1950,7 @@ process_eor(H3270 *hSession) @@ -1950,7 +1950,7 @@ process_eor(H3270 *hSession)
1950 * net_exception 1950 * net_exception
1951 * Called when there is an exceptional condition on the socket. 1951 * Called when there is an exceptional condition on the socket.
1952 */ 1952 */
1953 -void net_exception(H3270 *session, LIB3270_IO_FLAG flag, void *dunno) 1953 +void net_exception(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno)
1954 { 1954 {
1955 CHECK_SESSION_HANDLE(session); 1955 CHECK_SESSION_HANDLE(session);
1956 1956
src/lib3270/telnetc.h
@@ -34,8 +34,8 @@ LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); @@ -34,8 +34,8 @@ LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len);
34 LIB3270_INTERNAL void net_break(H3270 *hSession); 34 LIB3270_INTERNAL void net_break(H3270 *hSession);
35 LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); 35 LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *);
36 LIB3270_INTERNAL void net_disconnect(H3270 *session); 36 LIB3270_INTERNAL void net_disconnect(H3270 *session);
37 -LIB3270_INTERNAL void net_exception(H3270 *session, LIB3270_IO_FLAG flag, void *dunno);  
38 -LIB3270_INTERNAL void net_input(H3270 *session, LIB3270_IO_FLAG flag, void *dunno); 37 +LIB3270_INTERNAL void net_exception(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno);
  38 +LIB3270_INTERNAL void net_input(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno);
39 LIB3270_INTERNAL void net_interrupt(H3270 *hSession); 39 LIB3270_INTERNAL void net_interrupt(H3270 *hSession);
40 LIB3270_INTERNAL void net_output(H3270 *hSession); 40 LIB3270_INTERNAL void net_output(H3270 *hSession);
41 LIB3270_INTERNAL void net_sendc(H3270 *hSession, char c); 41 LIB3270_INTERNAL void net_sendc(H3270 *hSession, char c);