Commit e162af43e15e0287376c3ee8302a41b744759729
1 parent
84078687
Exists in
master
and in
3 other branches
Modificando funcionamento para compartilhar com websockets
Showing
4 changed files
with
91 additions
and
122 deletions
Show diff stats
connect.c
@@ -76,13 +76,14 @@ | @@ -76,13 +76,14 @@ | ||
76 | /*---[ Implement ]-------------------------------------------------------------------------------*/ | 76 | /*---[ Implement ]-------------------------------------------------------------------------------*/ |
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 | { | 81 | { |
81 | int err; | 82 | int err; |
82 | socklen_t len = sizeof(err); | 83 | socklen_t len = sizeof(err); |
83 | 84 | ||
84 | trace("%s",__FUNCTION__); | 85 | trace("%s",__FUNCTION__); |
85 | - RemoveSource(hSession->ns_write_id); | 86 | + lib3270_remove_poll(hSession->ns_write_id); |
86 | hSession->ns_write_id = NULL; | 87 | hSession->ns_write_id = NULL; |
87 | 88 | ||
88 | if(getsockopt(hSession->sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) < 0) | 89 | if(getsockopt(hSession->sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) < 0) |
@@ -120,8 +121,12 @@ static void net_connected(H3270 *hSession) | @@ -120,8 +121,12 @@ static void net_connected(H3270 *hSession) | ||
120 | return; | 121 | return; |
121 | } | 122 | } |
122 | 123 | ||
123 | - hSession->ns_exception_id = AddExcept(hSession->sock, hSession, net_exception); | ||
124 | - hSession->ns_read_id = AddInput(hSession->sock, hSession, net_input); | 124 | +// hSession->ns_exception_id = AddExcept(hSession->sock, hSession, net_exception); |
125 | +// hSession->ns_read_id = AddInput(hSession->sock, hSession, net_input); | ||
126 | + | ||
127 | + hSession->ns_exception_id = lib3270_add_poll_fd(hSession,hSession->sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0); | ||
128 | + hSession->ns_read_id = lib3270_add_poll_fd(hSession,hSession->sock,LIB3270_IO_FLAG_READ,net_input,0); | ||
129 | + | ||
125 | hSession->excepting = 1; | 130 | hSession->excepting = 1; |
126 | hSession->reading = 1; | 131 | hSession->reading = 1; |
127 | 132 | ||
@@ -498,7 +503,8 @@ static void net_connected(H3270 *hSession) | @@ -498,7 +503,8 @@ static void net_connected(H3270 *hSession) | ||
498 | hSession->cstate = LIB3270_PENDING; | 503 | hSession->cstate = LIB3270_PENDING; |
499 | lib3270_st_changed(hSession, LIB3270_STATE_HALF_CONNECT, True); | 504 | lib3270_st_changed(hSession, LIB3270_STATE_HALF_CONNECT, True); |
500 | 505 | ||
501 | - hSession->ns_write_id = AddOutput(hSession->sock, hSession, net_connected); | 506 | + hSession->ns_write_id = lib3270_add_poll_fd(hSession,hSession->sock,LIB3270_IO_FLAG_WRITE,net_connected,0); |
507 | + // hSession->ns_write_id = AddOutput(hSession->sock, hSession, net_connected); | ||
502 | 508 | ||
503 | trace("%s: Connection in progress",__FUNCTION__); | 509 | trace("%s: Connection in progress",__FUNCTION__); |
504 | 510 |
iocalls.c
@@ -37,9 +37,6 @@ | @@ -37,9 +37,6 @@ | ||
37 | #include "utilc.h" | 37 | #include "utilc.h" |
38 | 38 | ||
39 | #define MILLION 1000000L | 39 | #define MILLION 1000000L |
40 | -#define InputReadMask 0x1 | ||
41 | -#define InputExceptMask 0x2 | ||
42 | -#define InputWriteMask 0x4 | ||
43 | 40 | ||
44 | #if defined(_WIN32) | 41 | #if defined(_WIN32) |
45 | #define MAX_HA 256 | 42 | #define MAX_HA 256 |
@@ -47,18 +44,25 @@ | @@ -47,18 +44,25 @@ | ||
47 | 44 | ||
48 | /*---[ Standard calls ]-------------------------------------------------------------------------------------*/ | 45 | /*---[ Standard calls ]-------------------------------------------------------------------------------------*/ |
49 | 46 | ||
50 | -static void internal_remove_timeout(void *timer); | ||
51 | -static void internal_remove_source(void *id); | ||
52 | -static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | 47 | +// Timeout calls |
48 | +static void internal_remove_timeout(void *timer); | ||
49 | +static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | ||
53 | 50 | ||
51 | +static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); | ||
52 | +static void internal_remove_poll(void *id); | ||
53 | + | ||
54 | + | ||
55 | +/* | ||
56 | +// fdcalls | ||
57 | +static void internal_remove_source(void *id); | ||
54 | static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session)); | 58 | static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session)); |
55 | static void * internal_add_output(int source, H3270 *session, void (*fn)(H3270 *session)); | 59 | static void * internal_add_output(int source, H3270 *session, void (*fn)(H3270 *session)); |
56 | static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)); | 60 | static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)); |
61 | +*/ | ||
57 | 62 | ||
58 | -// static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm); | ||
59 | -static int internal_wait(H3270 *hSession, int seconds); | 63 | +static int internal_wait(H3270 *hSession, int seconds); |
60 | 64 | ||
61 | -static int internal_event_dispatcher(H3270 *hSession, int block); | 65 | +static int internal_event_dispatcher(H3270 *hSession, int block); |
62 | static void internal_ring_bell(H3270 *); | 66 | static void internal_ring_bell(H3270 *); |
63 | 67 | ||
64 | /*---[ Active callbacks ]-----------------------------------------------------------------------------------*/ | 68 | /*---[ Active callbacks ]-----------------------------------------------------------------------------------*/ |
@@ -69,19 +73,13 @@ static void internal_ring_bell(H3270 *); | @@ -69,19 +73,13 @@ static void internal_ring_bell(H3270 *); | ||
69 | static void (*remove_timeout)(void *timer) | 73 | static void (*remove_timeout)(void *timer) |
70 | = internal_remove_timeout; | 74 | = internal_remove_timeout; |
71 | 75 | ||
72 | - static void (*remove_source)(void *id) | ||
73 | - = internal_remove_source; | ||
74 | - | ||
75 | - static void * (*add_input)(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
76 | - = internal_add_input; | 76 | + static void * (*add_poll)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata) |
77 | + = internal_add_poll; | ||
77 | 78 | ||
78 | - static void * (*add_output)(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
79 | - = internal_add_output; | 79 | + static void (*remove_poll)(void *id) |
80 | + = internal_remove_poll; | ||
80 | 81 | ||
81 | - static void * (*add_except)(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
82 | - = internal_add_except; | ||
83 | - | ||
84 | - static int (*wait)(H3270 *hSession, int seconds) | 82 | + static int (*wait)(H3270 *hSession, int seconds) |
85 | = internal_wait; | 83 | = internal_wait; |
86 | 84 | ||
87 | static int (*event_dispatcher)(H3270 *hSession,int wait) | 85 | static int (*event_dispatcher)(H3270 *hSession,int wait) |
@@ -107,23 +105,25 @@ static void internal_ring_bell(H3270 *); | @@ -107,23 +105,25 @@ static void internal_ring_bell(H3270 *); | ||
107 | 105 | ||
108 | #define TN (timeout_t *)NULL | 106 | #define TN (timeout_t *)NULL |
109 | 107 | ||
110 | - /* Input events. */ | 108 | +/* I/O events. */ |
111 | typedef struct input | 109 | typedef struct input |
112 | { | 110 | { |
113 | - struct input *next; | ||
114 | - int source; | ||
115 | - int condition; | ||
116 | - void (*proc)(H3270 *session); | ||
117 | - H3270 *session; | ||
118 | -} input_t; | 111 | + struct input * next; |
112 | + H3270 * session; | ||
113 | + int fd; | ||
114 | + LIB3270_IO_FLAG flag; | ||
115 | + void * userdata; | ||
119 | 116 | ||
117 | + void (*call)(H3270 *, int, LIB3270_IO_FLAG, void *); | ||
118 | + | ||
119 | +} input_t; | ||
120 | 120 | ||
121 | 121 | ||
122 | /*---[ Statics ]--------------------------------------------------------------------------------------------*/ | 122 | /*---[ Statics ]--------------------------------------------------------------------------------------------*/ |
123 | 123 | ||
124 | static timeout_t * timeouts = NULL; | 124 | static timeout_t * timeouts = NULL; |
125 | static input_t * inputs = NULL; | 125 | static input_t * inputs = NULL; |
126 | - static Boolean inputs_changed = False; | 126 | + static Boolean inputs_changed = False; |
127 | 127 | ||
128 | /*---[ Implement ]------------------------------------------------------------------------------------------*/ | 128 | /*---[ Implement ]------------------------------------------------------------------------------------------*/ |
129 | 129 | ||
@@ -235,56 +235,25 @@ static void internal_remove_timeout(void * timer) | @@ -235,56 +235,25 @@ static void internal_remove_timeout(void * timer) | ||
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | -/* Input events. */ | 238 | +/* I/O events. */ |
239 | 239 | ||
240 | -static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session)) | 240 | +static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*call)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ) |
241 | { | 241 | { |
242 | input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t)); | 242 | input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t)); |
243 | 243 | ||
244 | - ip->source = source; | ||
245 | - ip->condition = InputReadMask; | ||
246 | - ip->proc = fn; | ||
247 | - ip->session = session; | ||
248 | - ip->next = inputs; | ||
249 | - inputs = ip; | ||
250 | - inputs_changed = True; | ||
251 | - | ||
252 | - return ip; | ||
253 | -} | ||
254 | - | ||
255 | -static void * internal_add_output(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
256 | -{ | ||
257 | - input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t)); | 244 | + ip->session = session; |
245 | + ip->fd = fd; | ||
246 | + ip->flag = flag; | ||
247 | + ip->userdata = userdata; | ||
248 | + ip->call = call; | ||
258 | 249 | ||
259 | - ip->source = source; | ||
260 | - ip->condition = InputWriteMask; | ||
261 | - ip->proc = fn; | ||
262 | - ip->session = session; | ||
263 | - ip->next = inputs; | ||
264 | inputs = ip; | 250 | inputs = ip; |
265 | inputs_changed = True; | 251 | inputs_changed = True; |
266 | 252 | ||
267 | return ip; | 253 | return ip; |
268 | } | 254 | } |
269 | 255 | ||
270 | -static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
271 | -{ | ||
272 | - input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t)); | ||
273 | - | ||
274 | - ip->source = source; | ||
275 | - ip->condition = InputExceptMask; | ||
276 | - ip->proc = fn; | ||
277 | - ip->session = session; | ||
278 | - ip->next = inputs; | ||
279 | - inputs = ip; | ||
280 | - inputs_changed = True; | ||
281 | - | ||
282 | - trace("%s session=%p proc=%p handle=%p",__FUNCTION__,ip->session,ip->proc,ip); | ||
283 | - | ||
284 | - return ip; | ||
285 | -} | ||
286 | - | ||
287 | -static void internal_remove_source(void *id) | 256 | +static void internal_remove_poll(void *id) |
288 | { | 257 | { |
289 | input_t *ip; | 258 | input_t *ip; |
290 | input_t *prev = (input_t *)NULL; | 259 | input_t *prev = (input_t *)NULL; |
@@ -349,22 +318,22 @@ retry: | @@ -349,22 +318,22 @@ retry: | ||
349 | 318 | ||
350 | for (ip = inputs; ip != (input_t *)NULL; ip = ip->next) | 319 | for (ip = inputs; ip != (input_t *)NULL; ip = ip->next) |
351 | { | 320 | { |
352 | - if ((unsigned long)ip->condition & InputReadMask) | 321 | + if(ip->flag & LIB3270_IO_FLAG_READ) |
353 | { | 322 | { |
354 | - FD_SET(ip->source, &rfds); | ||
355 | - maxSock = max(ip->source,maxSock); | 323 | + FD_SET(ip->fd, &rfds); |
324 | + maxSock = max(ip->fd,maxSock); | ||
356 | } | 325 | } |
357 | 326 | ||
358 | - if ((unsigned long)ip->condition & InputWriteMask) | 327 | + if(ip->flag & LIB3270_IO_FLAG_WRITE) |
359 | { | 328 | { |
360 | - FD_SET(ip->source, &wfds); | ||
361 | - maxSock = max(ip->source,maxSock); | 329 | + FD_SET(ip->fd, &wfds); |
330 | + maxSock = max(ip->fd,maxSock); | ||
362 | } | 331 | } |
363 | 332 | ||
364 | - if ((unsigned long)ip->condition & InputExceptMask) | 333 | + if(ip->flag & LIB3270_IO_FLAG_EXCEPTION) |
365 | { | 334 | { |
366 | - FD_SET(ip->source, &xfds); | ||
367 | - maxSock = max(ip->source,maxSock); | 335 | + FD_SET(ip->fd, &xfds); |
336 | + maxSock = max(ip->fd,maxSock); | ||
368 | } | 337 | } |
369 | } | 338 | } |
370 | 339 | ||
@@ -410,7 +379,7 @@ retry: | @@ -410,7 +379,7 @@ retry: | ||
410 | { | 379 | { |
411 | for (ip = inputs; ip != (input_t *) NULL; ip = ip->next) | 380 | for (ip = inputs; ip != (input_t *) NULL; ip = ip->next) |
412 | { | 381 | { |
413 | - if (((unsigned long)ip->condition & InputReadMask) && FD_ISSET(ip->source, &rfds)) | 382 | + if((ip->flag & LIB3270_IO_FLAG_READ) && FD_ISSET(ip->fd, &rfds)) |
414 | { | 383 | { |
415 | (*ip->proc)(ip->session); | 384 | (*ip->proc)(ip->session); |
416 | processed_any = True; | 385 | processed_any = True; |
@@ -418,7 +387,7 @@ retry: | @@ -418,7 +387,7 @@ retry: | ||
418 | goto retry; | 387 | goto retry; |
419 | } | 388 | } |
420 | 389 | ||
421 | - if (((unsigned long)ip->condition & InputWriteMask) && FD_ISSET(ip->source, &wfds)) | 390 | + if ((ip->flag & LIB3270_IO_FLAG_WRITE) && FD_ISSET(ip->fd, &wfds)) |
422 | { | 391 | { |
423 | (*ip->proc)(ip->session); | 392 | (*ip->proc)(ip->session); |
424 | processed_any = True; | 393 | processed_any = True; |
@@ -426,7 +395,7 @@ retry: | @@ -426,7 +395,7 @@ retry: | ||
426 | goto retry; | 395 | goto retry; |
427 | } | 396 | } |
428 | 397 | ||
429 | - if (((unsigned long)ip->condition & InputExceptMask) && FD_ISSET(ip->source, &xfds)) | 398 | + if ((ip->flag & LIB3270_IO_FLAG_EXCEPTION) && FD_ISSET(ip->fd, &xfds)) |
430 | { | 399 | { |
431 | (*ip->proc)(ip->session); | 400 | (*ip->proc)(ip->session); |
432 | processed_any = True; | 401 | processed_any = True; |
@@ -452,21 +421,21 @@ retry: | @@ -452,21 +421,21 @@ retry: | ||
452 | 421 | ||
453 | for (ip = inputs; ip != (input_t *)NULL; ip = ip->next) | 422 | for (ip = inputs; ip != (input_t *)NULL; ip = ip->next) |
454 | { | 423 | { |
455 | - if ((unsigned long)ip->condition & InputReadMask) | 424 | + if(ip->flag & LIB3270_IO_FLAG_READ) |
456 | { | 425 | { |
457 | - FD_SET(ip->source, &rfds); | 426 | + FD_SET(ip->fd, &rfds); |
458 | events++; | 427 | events++; |
459 | } | 428 | } |
460 | 429 | ||
461 | - if ((unsigned long)ip->condition & InputWriteMask) | 430 | + if(ip->flag & LIB3270_IO_FLAG_WRITE) |
462 | { | 431 | { |
463 | - FD_SET(ip->source, &wfds); | 432 | + FD_SET(ip->fd, &wfds); |
464 | events++; | 433 | events++; |
465 | } | 434 | } |
466 | 435 | ||
467 | - if ((unsigned long)ip->condition & InputExceptMask) | 436 | + if(ip->flag & LIB3270_IO_FLAG_EXCEPTION) |
468 | { | 437 | { |
469 | - FD_SET(ip->source, &xfds); | 438 | + FD_SET(ip->fd, &xfds); |
470 | events++; | 439 | events++; |
471 | } | 440 | } |
472 | } | 441 | } |
@@ -518,25 +487,25 @@ retry: | @@ -518,25 +487,25 @@ retry: | ||
518 | { | 487 | { |
519 | for (ip = inputs; ip != (input_t *) NULL; ip = ip->next) | 488 | for (ip = inputs; ip != (input_t *) NULL; ip = ip->next) |
520 | { | 489 | { |
521 | - if (((unsigned long)ip->condition & InputReadMask) && FD_ISSET(ip->source, &rfds)) | 490 | + if((ip->flag & LIB3270_IO_FLAG_READ) && FD_ISSET(ip->fd, &rfds)) |
522 | { | 491 | { |
523 | - (*ip->proc)(ip->session); | 492 | + (*ip->call)(ip->session,ip->fd,LIB3270_IO_FLAG_READ,ip->userdata); |
524 | processed_any = True; | 493 | processed_any = True; |
525 | if (inputs_changed) | 494 | if (inputs_changed) |
526 | goto retry; | 495 | goto retry; |
527 | } | 496 | } |
528 | 497 | ||
529 | - if (((unsigned long)ip->condition & InputWriteMask) && FD_ISSET(ip->source, &wfds)) | 498 | + if((ip->flag & LIB3270_IO_FLAG_WRITE) && FD_ISSET(ip->fd, &wfds)) |
530 | { | 499 | { |
531 | - (*ip->proc)(ip->session); | 500 | + (*ip->call)(ip->session,ip->fd,LIB3270_IO_FLAG_WRITE,ip->userdata); |
532 | processed_any = True; | 501 | processed_any = True; |
533 | if (inputs_changed) | 502 | if (inputs_changed) |
534 | goto retry; | 503 | goto retry; |
535 | } | 504 | } |
536 | 505 | ||
537 | - if (((unsigned long)ip->condition & InputExceptMask) && FD_ISSET(ip->source, &xfds)) | 506 | + if((ip->flag & LIB3270_IO_FLAG_EXCEPTION) && FD_ISSET(ip->fd, &xfds)) |
538 | { | 507 | { |
539 | - (*ip->proc)(ip->session); | 508 | + (*ip->call)(ip->session,ip->fd,LIB3270_IO_FLAG_EXCEPTION,ip->userdata); |
540 | processed_any = True; | 509 | processed_any = True; |
541 | if (inputs_changed) | 510 | if (inputs_changed) |
542 | goto retry; | 511 | goto retry; |
@@ -619,6 +588,7 @@ void RemoveTimeOut(void * timer) | @@ -619,6 +588,7 @@ void RemoveTimeOut(void * timer) | ||
619 | return remove_timeout(timer); | 588 | return remove_timeout(timer); |
620 | } | 589 | } |
621 | 590 | ||
591 | +/* | ||
622 | void * AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) | 592 | void * AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) |
623 | { | 593 | { |
624 | CHECK_SESSION_HANDLE(session); | 594 | CHECK_SESSION_HANDLE(session); |
@@ -641,6 +611,7 @@ void RemoveSource(void * id) | @@ -641,6 +611,7 @@ void RemoveSource(void * id) | ||
641 | { | 611 | { |
642 | remove_source(id); | 612 | remove_source(id); |
643 | } | 613 | } |
614 | +*/ | ||
644 | 615 | ||
645 | void x_except_on(H3270 *h) | 616 | void x_except_on(H3270 *h) |
646 | { | 617 | { |
@@ -648,32 +619,36 @@ void x_except_on(H3270 *h) | @@ -648,32 +619,36 @@ void x_except_on(H3270 *h) | ||
648 | return; | 619 | return; |
649 | 620 | ||
650 | if(h->reading) | 621 | if(h->reading) |
651 | - RemoveSource(h->ns_read_id); | 622 | + lib3270_remove_poll(h->ns_read_id); |
623 | + | ||
624 | + h->ns_exception_id = lib3270_add_poll_fd(h,h->sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0); | ||
625 | +// h->ns_exception_id = AddExcept(h->sock, h, net_exception); | ||
652 | 626 | ||
653 | - h->ns_exception_id = AddExcept(h->sock, h, net_exception); | ||
654 | h->excepting = 1; | 627 | h->excepting = 1; |
655 | 628 | ||
656 | if(h->reading) | 629 | if(h->reading) |
657 | - h->ns_read_id = AddInput(h->sock, h, net_input); | 630 | + h->ns_read_id = lib3270_add_poll_fd(h,h->sock,LIB3270_IO_FLAG_READ,net_input,0); |
631 | + | ||
632 | +// h->ns_read_id = AddInput(h->sock, h, net_input); | ||
658 | } | 633 | } |
659 | 634 | ||
660 | void remove_input_calls(H3270 *session) | 635 | void remove_input_calls(H3270 *session) |
661 | { | 636 | { |
662 | if(session->ns_read_id) | 637 | if(session->ns_read_id) |
663 | { | 638 | { |
664 | - RemoveSource(session->ns_read_id); | 639 | + lib3270_remove_poll(session->ns_read_id); |
665 | session->ns_read_id = NULL; | 640 | session->ns_read_id = NULL; |
666 | session->reading = 0; | 641 | session->reading = 0; |
667 | } | 642 | } |
668 | if(session->ns_exception_id) | 643 | if(session->ns_exception_id) |
669 | { | 644 | { |
670 | - RemoveSource(session->ns_exception_id); | 645 | + lib3270_remove_poll(session->ns_exception_id); |
671 | session->ns_exception_id = NULL; | 646 | session->ns_exception_id = NULL; |
672 | session->excepting = 0; | 647 | session->excepting = 0; |
673 | } | 648 | } |
674 | if(session->ns_write_id) | 649 | if(session->ns_write_id) |
675 | { | 650 | { |
676 | - RemoveSource(session->ns_write_id); | 651 | + lib3270_remove_poll(session->ns_write_id); |
677 | session->ns_write_id = NULL; | 652 | session->ns_write_id = NULL; |
678 | session->writing = 0; | 653 | session->writing = 0; |
679 | } | 654 | } |
@@ -689,6 +664,7 @@ LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(unsigned long i | @@ -689,6 +664,7 @@ LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(unsigned long i | ||
689 | 664 | ||
690 | } | 665 | } |
691 | 666 | ||
667 | +/* | ||
692 | LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk) | 668 | LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk) |
693 | { | 669 | { |
694 | if(!cbk) | 670 | if(!cbk) |
@@ -723,6 +699,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk | @@ -723,6 +699,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk | ||
723 | return 0; | 699 | return 0; |
724 | 700 | ||
725 | } | 701 | } |
702 | +*/ | ||
726 | 703 | ||
727 | LIB3270_EXPORT void lib3270_iterate(int block) { | 704 | LIB3270_EXPORT void lib3270_iterate(int block) { |
728 | event_dispatcher(NULL,block); | 705 | event_dispatcher(NULL,block); |
telnet.c
@@ -909,7 +909,7 @@ LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession) | @@ -909,7 +909,7 @@ LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession) | ||
909 | 909 | ||
910 | if(hSession->ns_write_id) | 910 | if(hSession->ns_write_id) |
911 | { | 911 | { |
912 | - RemoveSource(hSession->ns_write_id); | 912 | + lib3270_remove_poll(hSession->ns_write_id); |
913 | hSession->ns_write_id = 0; | 913 | hSession->ns_write_id = 0; |
914 | } | 914 | } |
915 | 915 | ||
@@ -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) | 991 | +void net_input(H3270 *hSession, 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) | 1953 | +void net_exception(H3270 *session, LIB3270_IO_FLAG flag, void *dunno) |
1954 | { | 1954 | { |
1955 | CHECK_SESSION_HANDLE(session); | 1955 | CHECK_SESSION_HANDLE(session); |
1956 | 1956 | ||
@@ -1961,7 +1961,7 @@ void net_exception(H3270 *session) | @@ -1961,7 +1961,7 @@ void net_exception(H3270 *session) | ||
1961 | 1961 | ||
1962 | if(session->excepting) | 1962 | if(session->excepting) |
1963 | { | 1963 | { |
1964 | - RemoveSource(session->ns_exception_id); | 1964 | + lib3270_remove_poll(session->ns_exception_id); |
1965 | session->ns_exception_id = NULL; | 1965 | session->ns_exception_id = NULL; |
1966 | session->excepting = 0; | 1966 | session->excepting = 0; |
1967 | } | 1967 | } |
telnetc.h
@@ -30,34 +30,20 @@ struct ctl_char { | @@ -30,34 +30,20 @@ struct ctl_char { | ||
30 | }; | 30 | }; |
31 | 31 | ||
32 | LIB3270_INTERNAL void net_abort(H3270 *hSession); | 32 | LIB3270_INTERNAL void net_abort(H3270 *hSession); |
33 | -// LIB3270_INTERNAL Boolean net_add_dummy_tn3270e(H3270 *hSession); | ||
34 | LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); | 33 | LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); |
35 | LIB3270_INTERNAL void net_break(H3270 *hSession); | 34 | LIB3270_INTERNAL void net_break(H3270 *hSession); |
36 | -// LIB3270_INTERNAL void net_charmode(H3270 *hSession); | ||
37 | 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 *); |
38 | LIB3270_INTERNAL void net_disconnect(H3270 *session); | 36 | LIB3270_INTERNAL void net_disconnect(H3270 *session); |
39 | -LIB3270_INTERNAL void net_exception(H3270 *session); | ||
40 | -// LIB3270_INTERNAL void net_hexansi_out(unsigned char *buf, int len); | ||
41 | -LIB3270_INTERNAL void net_input(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); | ||
42 | LIB3270_INTERNAL void net_interrupt(H3270 *hSession); | 39 | LIB3270_INTERNAL void net_interrupt(H3270 *hSession); |
43 | -// LIB3270_INTERNAL void net_linemode(void); | ||
44 | -// LIB3270_INTERNAL struct ctl_char *net_linemode_chars(void); | ||
45 | LIB3270_INTERNAL void net_output(H3270 *hSession); | 40 | LIB3270_INTERNAL void net_output(H3270 *hSession); |
46 | -//LIB3270_INTERNAL const char *net_query_bind_plu_name(void); | ||
47 | -//LIB3270_INTERNAL const char *net_query_connection_state(void); | ||
48 | -//LIB3270_INTERNAL const char *net_query_host(void); | ||
49 | -//LIB3270_INTERNAL const char *net_query_lu_name(void); | ||
50 | LIB3270_INTERNAL void net_sendc(H3270 *hSession, char c); | 41 | LIB3270_INTERNAL void net_sendc(H3270 *hSession, char c); |
51 | LIB3270_INTERNAL void net_sends(H3270 *hSession, const char *s); | 42 | LIB3270_INTERNAL void net_sends(H3270 *hSession, const char *s); |
52 | LIB3270_INTERNAL void net_send_erase(H3270 *hSession); | 43 | LIB3270_INTERNAL void net_send_erase(H3270 *hSession); |
53 | LIB3270_INTERNAL void net_send_kill(H3270 *hSession); | 44 | LIB3270_INTERNAL void net_send_kill(H3270 *hSession); |
54 | LIB3270_INTERNAL void net_send_werase(H3270 *hSession); | 45 | LIB3270_INTERNAL void net_send_werase(H3270 *hSession); |
55 | -// LIB3270_INTERNAL Boolean net_snap_options(void); | ||
56 | LIB3270_INTERNAL void space3270out(H3270 *hSession, int n); | 46 | LIB3270_INTERNAL void space3270out(H3270 *hSession, int n); |
57 | -// LIB3270_INTERNAL const char *tn3270e_current_opts(void); | ||
58 | -// LIB3270_INTERNAL char *net_proxy_type(void); | ||
59 | -//LIB3270_INTERNAL char *net_proxy_host(void); | ||
60 | -// LIB3270_INTERNAL char *net_proxy_port(void); | ||
61 | 47 | ||
62 | #if defined(X3270_TRACE) | 48 | #if defined(X3270_TRACE) |
63 | LIB3270_INTERNAL void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, int len); | 49 | LIB3270_INTERNAL void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, int len); |