Commit f02f07cd7885d72a40e40f80ec5609e0db36eda1
1 parent
5787185d
Exists in
master
and in
3 other branches
Ajustes para multi-sessão
Showing
5 changed files
with
80 additions
and
93 deletions
Show diff stats
| @@ -75,9 +75,7 @@ static void ft_in3270(H3270 *session, int ignored unused, void *unused); | @@ -75,9 +75,7 @@ static void ft_in3270(H3270 *session, int ignored unused, void *unused); | ||
| 75 | #define BN (Boolean *)NULL | 75 | #define BN (Boolean *)NULL |
| 76 | 76 | ||
| 77 | // Globals. | 77 | // Globals. |
| 78 | -static H3270FT *ftsession = NULL; | ||
| 79 | - | ||
| 80 | -#define CHECK_FT_HANDLE(x) if(!x) x = ftsession; | 78 | +H3270FT *ftsession = NULL; |
| 81 | 79 | ||
| 82 | // enum ft_state ft_state = FT_NONE; // File transfer state | 80 | // enum ft_state ft_state = FT_NONE; // File transfer state |
| 83 | // char *ft_local_filename; // Local file to transfer to/from | 81 | // char *ft_local_filename; // Local file to transfer to/from |
| @@ -20,25 +20,24 @@ | @@ -20,25 +20,24 @@ | ||
| 20 | 20 | ||
| 21 | #if defined(X3270_FT) /*[*/ | 21 | #if defined(X3270_FT) /*[*/ |
| 22 | 22 | ||
| 23 | -#include <lib3270/filetransfer.h> | 23 | + #include <lib3270/filetransfer.h> |
| 24 | 24 | ||
| 25 | -LIB3270_INTERNAL Boolean ascii_flag; | ||
| 26 | -LIB3270_INTERNAL Boolean cr_flag; | ||
| 27 | -LIB3270_INTERNAL unsigned long ft_length; | 25 | + #define CHECK_FT_HANDLE(x) if(!x) x = ftsession; |
| 28 | 26 | ||
| 29 | -// LIB3270_INTERNAL H3270FT * ftsession; | 27 | + LIB3270_INTERNAL Boolean ascii_flag; |
| 28 | + LIB3270_INTERNAL Boolean cr_flag; | ||
| 29 | + LIB3270_INTERNAL unsigned long ft_length; | ||
| 30 | 30 | ||
| 31 | -// LIB3270_INTERNAL FILE *ft_local_file; | ||
| 32 | -// extern char *ft_local_filename; | 31 | + LIB3270_INTERNAL H3270FT * ftsession; |
| 33 | 32 | ||
| 34 | -LIB3270_INTERNAL Boolean ft_last_cr; | ||
| 35 | -LIB3270_INTERNAL Boolean remap_flag; | 33 | + LIB3270_INTERNAL Boolean ft_last_cr; |
| 34 | + LIB3270_INTERNAL Boolean remap_flag; | ||
| 36 | 35 | ||
| 37 | -LIB3270_INTERNAL void ft_init(H3270 *session); | 36 | + LIB3270_INTERNAL void ft_init(H3270 *session); |
| 38 | 37 | ||
| 39 | -LIB3270_INTERNAL void ft_aborting(H3270FT *h); | ||
| 40 | -LIB3270_INTERNAL void ft_complete(H3270FT *h, const char *errmsg); | ||
| 41 | -LIB3270_INTERNAL void ft_running(H3270FT *h, Boolean is_cut); | ||
| 42 | -LIB3270_INTERNAL void ft_update_length(H3270FT *h); | 38 | + LIB3270_INTERNAL void ft_aborting(H3270FT *h); |
| 39 | + LIB3270_INTERNAL void ft_complete(H3270FT *h, const char *errmsg); | ||
| 40 | + LIB3270_INTERNAL void ft_running(H3270FT *h, Boolean is_cut); | ||
| 41 | + LIB3270_INTERNAL void ft_update_length(H3270FT *h); | ||
| 43 | 42 | ||
| 44 | #endif /*]*/ | 43 | #endif /*]*/ |
kybd.c
| @@ -394,11 +394,11 @@ kybd_inhibit(Boolean inhibit) | @@ -394,11 +394,11 @@ kybd_inhibit(Boolean inhibit) | ||
| 394 | if (inhibit) { | 394 | if (inhibit) { |
| 395 | kybdlock_set(KL_ENTER_INHIBIT, "kybd_inhibit"); | 395 | kybdlock_set(KL_ENTER_INHIBIT, "kybd_inhibit"); |
| 396 | if (kybdlock == KL_ENTER_INHIBIT) | 396 | if (kybdlock == KL_ENTER_INHIBIT) |
| 397 | - status_reset(NULL); | 397 | + status_reset(&h3270); |
| 398 | } else { | 398 | } else { |
| 399 | kybdlock_clr(KL_ENTER_INHIBIT, "kybd_inhibit"); | 399 | kybdlock_clr(KL_ENTER_INHIBIT, "kybd_inhibit"); |
| 400 | if (!kybdlock) | 400 | if (!kybdlock) |
| 401 | - status_reset(NULL); | 401 | + status_reset(&h3270); |
| 402 | } | 402 | } |
| 403 | } | 403 | } |
| 404 | 404 | ||
| @@ -1406,7 +1406,7 @@ LIB3270_KEY_ACTION( backtab ) | @@ -1406,7 +1406,7 @@ LIB3270_KEY_ACTION( backtab ) | ||
| 1406 | if (kybdlock) { | 1406 | if (kybdlock) { |
| 1407 | if (KYBDLOCK_IS_OERR) { | 1407 | if (KYBDLOCK_IS_OERR) { |
| 1408 | kybdlock_clr(KL_OERR_MASK, "BackTab"); | 1408 | kybdlock_clr(KL_OERR_MASK, "BackTab"); |
| 1409 | - status_reset(NULL); | 1409 | + status_reset(&h3270); |
| 1410 | } else { | 1410 | } else { |
| 1411 | ENQUEUE_ACTION(lib3270_backtab); | 1411 | ENQUEUE_ACTION(lib3270_backtab); |
| 1412 | return 0; | 1412 | return 0; |
| @@ -1515,7 +1515,7 @@ do_reset(Boolean explicit) | @@ -1515,7 +1515,7 @@ do_reset(Boolean explicit) | ||
| 1515 | } | 1515 | } |
| 1516 | 1516 | ||
| 1517 | /* Clean up other modes. */ | 1517 | /* Clean up other modes. */ |
| 1518 | - status_reset(NULL); | 1518 | + status_reset(&h3270); |
| 1519 | mcursor_normal(&h3270); | 1519 | mcursor_normal(&h3270); |
| 1520 | 1520 | ||
| 1521 | } | 1521 | } |
| @@ -1586,7 +1586,7 @@ LIB3270_CURSOR_ACTION( left ) | @@ -1586,7 +1586,7 @@ LIB3270_CURSOR_ACTION( left ) | ||
| 1586 | if (KYBDLOCK_IS_OERR) | 1586 | if (KYBDLOCK_IS_OERR) |
| 1587 | { | 1587 | { |
| 1588 | kybdlock_clr(KL_OERR_MASK, "Left"); | 1588 | kybdlock_clr(KL_OERR_MASK, "Left"); |
| 1589 | - status_reset(NULL); | 1589 | + status_reset(&h3270); |
| 1590 | } | 1590 | } |
| 1591 | else | 1591 | else |
| 1592 | { | 1592 | { |
| @@ -1848,7 +1848,7 @@ LIB3270_CURSOR_ACTION( right ) | @@ -1848,7 +1848,7 @@ LIB3270_CURSOR_ACTION( right ) | ||
| 1848 | if (KYBDLOCK_IS_OERR) | 1848 | if (KYBDLOCK_IS_OERR) |
| 1849 | { | 1849 | { |
| 1850 | kybdlock_clr(KL_OERR_MASK, "Right"); | 1850 | kybdlock_clr(KL_OERR_MASK, "Right"); |
| 1851 | - status_reset(NULL); | 1851 | + status_reset(&h3270); |
| 1852 | } | 1852 | } |
| 1853 | else | 1853 | else |
| 1854 | { | 1854 | { |
| @@ -1893,7 +1893,7 @@ Left2_action(Widget w unused, XEvent *event, String *params, | @@ -1893,7 +1893,7 @@ Left2_action(Widget w unused, XEvent *event, String *params, | ||
| 1893 | if (kybdlock) { | 1893 | if (kybdlock) { |
| 1894 | if (KYBDLOCK_IS_OERR) { | 1894 | if (KYBDLOCK_IS_OERR) { |
| 1895 | kybdlock_clr(KL_OERR_MASK, "Left2"); | 1895 | kybdlock_clr(KL_OERR_MASK, "Left2"); |
| 1896 | - status_reset(); | 1896 | + status_reset(&h3270); |
| 1897 | } else { | 1897 | } else { |
| 1898 | enq_ta(Left2_action, CN, CN); | 1898 | enq_ta(Left2_action, CN, CN); |
| 1899 | return; | 1899 | return; |
| @@ -1998,7 +1998,7 @@ Right2_action(Widget w unused, XEvent *event, String *params, | @@ -1998,7 +1998,7 @@ Right2_action(Widget w unused, XEvent *event, String *params, | ||
| 1998 | if (kybdlock) { | 1998 | if (kybdlock) { |
| 1999 | if (KYBDLOCK_IS_OERR) { | 1999 | if (KYBDLOCK_IS_OERR) { |
| 2000 | kybdlock_clr(KL_OERR_MASK, "Right2"); | 2000 | kybdlock_clr(KL_OERR_MASK, "Right2"); |
| 2001 | - status_reset(); | 2001 | + status_reset(&h3270); |
| 2002 | } else { | 2002 | } else { |
| 2003 | enq_ta(Right2_action, CN, CN); | 2003 | enq_ta(Right2_action, CN, CN); |
| 2004 | return; | 2004 | return; |
| @@ -2151,7 +2151,7 @@ LIB3270_CURSOR_ACTION( up ) | @@ -2151,7 +2151,7 @@ LIB3270_CURSOR_ACTION( up ) | ||
| 2151 | if (KYBDLOCK_IS_OERR) | 2151 | if (KYBDLOCK_IS_OERR) |
| 2152 | { | 2152 | { |
| 2153 | kybdlock_clr(KL_OERR_MASK, "Up"); | 2153 | kybdlock_clr(KL_OERR_MASK, "Up"); |
| 2154 | - status_reset(NULL); | 2154 | + status_reset(&h3270); |
| 2155 | } | 2155 | } |
| 2156 | else | 2156 | else |
| 2157 | { | 2157 | { |
| @@ -2189,7 +2189,7 @@ LIB3270_CURSOR_ACTION( down ) | @@ -2189,7 +2189,7 @@ LIB3270_CURSOR_ACTION( down ) | ||
| 2189 | if (KYBDLOCK_IS_OERR) | 2189 | if (KYBDLOCK_IS_OERR) |
| 2190 | { | 2190 | { |
| 2191 | kybdlock_clr(KL_OERR_MASK, "Down"); | 2191 | kybdlock_clr(KL_OERR_MASK, "Down"); |
| 2192 | - status_reset(NULL); | 2192 | + status_reset(&h3270); |
| 2193 | } else | 2193 | } else |
| 2194 | { | 2194 | { |
| 2195 | ENQUEUE_ACTION(lib3270_cursor_down); | 2195 | ENQUEUE_ACTION(lib3270_cursor_down); |
| @@ -50,9 +50,11 @@ | @@ -50,9 +50,11 @@ | ||
| 50 | 50 | ||
| 51 | #include "charsetc.h" | 51 | #include "charsetc.h" |
| 52 | #include "ctlrc.h" | 52 | #include "ctlrc.h" |
| 53 | -#if defined(X3270_FT) /*[*/ | ||
| 54 | -#include "ft_dftc.h" | ||
| 55 | -#endif /*]*/ | 53 | + |
| 54 | +#if defined(X3270_FT) | ||
| 55 | + #include "ft_dftc.h" | ||
| 56 | +#endif | ||
| 57 | + | ||
| 56 | #include "kybdc.h" | 58 | #include "kybdc.h" |
| 57 | #include "screenc.h" | 59 | #include "screenc.h" |
| 58 | #include "seec.h" | 60 | #include "seec.h" |
telnet.c
| @@ -203,9 +203,9 @@ static char *proxy_host = CN; | @@ -203,9 +203,9 @@ static char *proxy_host = CN; | ||
| 203 | static char *proxy_portname = CN; | 203 | static char *proxy_portname = CN; |
| 204 | static unsigned short proxy_port = 0; | 204 | static unsigned short proxy_port = 0; |
| 205 | 205 | ||
| 206 | -static int telnet_fsm(unsigned char c); | 206 | +static int telnet_fsm(H3270 *session, unsigned char c); |
| 207 | static void net_rawout(unsigned const char *buf, int len); | 207 | static void net_rawout(unsigned const char *buf, int len); |
| 208 | -static void check_in3270(void); | 208 | +static void check_in3270(H3270 *session); |
| 209 | static void store3270in(unsigned char c); | 209 | static void store3270in(unsigned char c); |
| 210 | static void check_linemode(Boolean init); | 210 | static void check_linemode(Boolean init); |
| 211 | static int non_blocking(H3270 *session, Boolean on); | 211 | static int non_blocking(H3270 *session, Boolean on); |
| @@ -609,14 +609,14 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -609,14 +609,14 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 609 | haddr.sin.sin_port = passthru_port; | 609 | haddr.sin.sin_port = passthru_port; |
| 610 | ha_len = sizeof(struct sockaddr_in); | 610 | ha_len = sizeof(struct sockaddr_in); |
| 611 | } else if (proxy_type > 0) { | 611 | } else if (proxy_type > 0) { |
| 612 | - if (resolve_host_and_port(&h3270,proxy_host, proxy_portname, | 612 | + if (resolve_host_and_port(session,proxy_host, proxy_portname, |
| 613 | &proxy_port, &haddr.sa, &ha_len, errmsg, | 613 | &proxy_port, &haddr.sa, &ha_len, errmsg, |
| 614 | sizeof(errmsg)) < 0) { | 614 | sizeof(errmsg)) < 0) { |
| 615 | popup_an_error(session,errmsg); | 615 | popup_an_error(session,errmsg); |
| 616 | return -1; | 616 | return -1; |
| 617 | } | 617 | } |
| 618 | } else { | 618 | } else { |
| 619 | - if (resolve_host_and_port(&h3270,host, portname, | 619 | + if (resolve_host_and_port(session,host, portname, |
| 620 | &session->current_port, &haddr.sa, &ha_len, | 620 | &session->current_port, &haddr.sa, &ha_len, |
| 621 | errmsg, sizeof(errmsg)) < 0) { | 621 | errmsg, sizeof(errmsg)) < 0) { |
| 622 | popup_an_error(session,errmsg); | 622 | popup_an_error(session,errmsg); |
| @@ -818,7 +818,7 @@ static void net_connected(H3270 *session) | @@ -818,7 +818,7 @@ static void net_connected(H3270 *session) | ||
| 818 | if (SSL_set_fd(session->ssl_con, session->sock) != 1) | 818 | if (SSL_set_fd(session->ssl_con, session->sock) != 1) |
| 819 | { | 819 | { |
| 820 | trace_dsn("Can't set fd!\n"); | 820 | trace_dsn("Can't set fd!\n"); |
| 821 | - popup_system_error(&h3270,_( "Connection failed" ), _( "Can't set SSL socket file descriptor" ), "%s", SSL_state_string_long(session->ssl_con)); | 821 | + popup_system_error(session,_( "Connection failed" ), _( "Can't set SSL socket file descriptor" ), "%s", SSL_state_string_long(session->ssl_con)); |
| 822 | set_ssl_state(session,LIB3270_SSL_UNSECURE); | 822 | set_ssl_state(session,LIB3270_SSL_UNSECURE); |
| 823 | } | 823 | } |
| 824 | else | 824 | else |
| @@ -836,11 +836,7 @@ static void net_connected(H3270 *session) | @@ -836,11 +836,7 @@ static void net_connected(H3270 *session) | ||
| 836 | 836 | ||
| 837 | if(e != session->last_ssl_error) | 837 | if(e != session->last_ssl_error) |
| 838 | { | 838 | { |
| 839 | - session->message( &h3270, | ||
| 840 | - LIB3270_NOTIFY_ERROR, | ||
| 841 | - _( "Connection failed" ), | ||
| 842 | - _( "SSL negotiation failed" ), | ||
| 843 | - state); | 839 | + session->message(session,LIB3270_NOTIFY_ERROR,_( "Connection failed" ),_( "SSL negotiation failed" ),state); |
| 844 | session->last_ssl_error = e; | 840 | session->last_ssl_error = e; |
| 845 | } | 841 | } |
| 846 | return; | 842 | return; |
| @@ -907,15 +903,15 @@ static void net_connected(H3270 *session) | @@ -907,15 +903,15 @@ static void net_connected(H3270 *session) | ||
| 907 | * appeared ready but recv() returned EWOULDBLOCK). Complete the | 903 | * appeared ready but recv() returned EWOULDBLOCK). Complete the |
| 908 | * connection-completion processing. | 904 | * connection-completion processing. |
| 909 | */ | 905 | */ |
| 910 | -static void connection_complete(void) | 906 | +static void connection_complete(H3270 *session) |
| 911 | { | 907 | { |
| 912 | - if (non_blocking(&h3270,False) < 0) | 908 | + if (non_blocking(session,False) < 0) |
| 913 | { | 909 | { |
| 914 | - host_disconnect(&h3270,True); | 910 | + host_disconnect(session,True); |
| 915 | return; | 911 | return; |
| 916 | } | 912 | } |
| 917 | - host_connected(&h3270); | ||
| 918 | - net_connected(&h3270); | 913 | + host_connected(session); |
| 914 | + net_connected(session); | ||
| 919 | } | 915 | } |
| 920 | 916 | ||
| 921 | /* | 917 | /* |
| @@ -950,7 +946,7 @@ void net_disconnect(H3270 *session) | @@ -950,7 +946,7 @@ void net_disconnect(H3270 *session) | ||
| 950 | 946 | ||
| 951 | /* We're not connected to an LU any more. */ | 947 | /* We're not connected to an LU any more. */ |
| 952 | session->connected_lu = CN; | 948 | session->connected_lu = CN; |
| 953 | - status_lu(&h3270,CN); | 949 | + status_lu(session,CN); |
| 954 | 950 | ||
| 955 | } | 951 | } |
| 956 | 952 | ||
| @@ -984,7 +980,7 @@ void net_input(H3270 *session) | @@ -984,7 +980,7 @@ void net_input(H3270 *session) | ||
| 984 | 980 | ||
| 985 | switch (err) { | 981 | switch (err) { |
| 986 | case WSAEISCONN: | 982 | case WSAEISCONN: |
| 987 | - connection_complete(); | 983 | + connection_complete(session); |
| 988 | // and go get data...? | 984 | // and go get data...? |
| 989 | break; | 985 | break; |
| 990 | case WSAEALREADY: | 986 | case WSAEALREADY: |
| @@ -992,11 +988,7 @@ void net_input(H3270 *session) | @@ -992,11 +988,7 @@ void net_input(H3270 *session) | ||
| 992 | case WSAEINVAL: | 988 | case WSAEINVAL: |
| 993 | return; | 989 | return; |
| 994 | default: | 990 | default: |
| 995 | - lib3270_popup_dialog( &h3270, | ||
| 996 | - LIB3270_NOTIFY_CRITICAL, | ||
| 997 | - N_( "Network startup error" ), | ||
| 998 | - N_( "Second connect() failed" ), | ||
| 999 | - "%s", win32_strerror(GetLastError()) ); | 991 | + lib3270_popup_dialog(session,LIB3270_NOTIFY_CRITICAL,N_( "Network startup error" ),N_( "Second connect() failed" ),"%s", win32_strerror(GetLastError()) ); |
| 1000 | _exit(1); | 992 | _exit(1); |
| 1001 | } | 993 | } |
| 1002 | } | 994 | } |
| @@ -1040,11 +1032,7 @@ void net_input(H3270 *session) | @@ -1040,11 +1032,7 @@ void net_input(H3270 *session) | ||
| 1040 | 1032 | ||
| 1041 | trace_dsn("RCVD SSL_read error %ld (%s)\n", e,err_buf); | 1033 | trace_dsn("RCVD SSL_read error %ld (%s)\n", e,err_buf); |
| 1042 | 1034 | ||
| 1043 | - h3270.message( &h3270, | ||
| 1044 | - LIB3270_NOTIFY_ERROR, | ||
| 1045 | - _( "SSL Error" ), | ||
| 1046 | - _( "SSL Read error" ), | ||
| 1047 | - err_buf ); | 1035 | + session->message( session,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); |
| 1048 | 1036 | ||
| 1049 | host_disconnect(session,True); | 1037 | host_disconnect(session,True); |
| 1050 | return; | 1038 | return; |
| @@ -1053,7 +1041,7 @@ void net_input(H3270 *session) | @@ -1053,7 +1041,7 @@ void net_input(H3270 *session) | ||
| 1053 | 1041 | ||
| 1054 | if (HALF_CONNECTED && socket_errno() == SE_EAGAIN) | 1042 | if (HALF_CONNECTED && socket_errno() == SE_EAGAIN) |
| 1055 | { | 1043 | { |
| 1056 | - connection_complete(); | 1044 | + connection_complete(session); |
| 1057 | return; | 1045 | return; |
| 1058 | } | 1046 | } |
| 1059 | 1047 | ||
| @@ -1095,7 +1083,7 @@ void net_input(H3270 *session) | @@ -1095,7 +1083,7 @@ void net_input(H3270 *session) | ||
| 1095 | ns_brcvd += nr; | 1083 | ns_brcvd += nr; |
| 1096 | for (cp = netrbuf; cp < (netrbuf + nr); cp++) | 1084 | for (cp = netrbuf; cp < (netrbuf + nr); cp++) |
| 1097 | { | 1085 | { |
| 1098 | - if (telnet_fsm(*cp)) | 1086 | + if (telnet_fsm(session,*cp)) |
| 1099 | { | 1087 | { |
| 1100 | (void) ctlr_dbcs_postprocess(); | 1088 | (void) ctlr_dbcs_postprocess(); |
| 1101 | host_disconnect(session,True); | 1089 | host_disconnect(session,True); |
| @@ -1177,8 +1165,7 @@ next_lu(void) | @@ -1177,8 +1165,7 @@ next_lu(void) | ||
| 1177 | * Telnet finite-state machine. | 1165 | * Telnet finite-state machine. |
| 1178 | * Returns 0 for okay, -1 for errors. | 1166 | * Returns 0 for okay, -1 for errors. |
| 1179 | */ | 1167 | */ |
| 1180 | -static int | ||
| 1181 | -telnet_fsm(unsigned char c) | 1168 | +static int telnet_fsm(H3270 *session, unsigned char c) |
| 1182 | { | 1169 | { |
| 1183 | #if defined(X3270_ANSI) /*[*/ | 1170 | #if defined(X3270_ANSI) /*[*/ |
| 1184 | char *see_chr; | 1171 | char *see_chr; |
| @@ -1202,9 +1189,9 @@ telnet_fsm(unsigned char c) | @@ -1202,9 +1189,9 @@ telnet_fsm(unsigned char c) | ||
| 1202 | if (linemode) | 1189 | if (linemode) |
| 1203 | cooked_init(); | 1190 | cooked_init(); |
| 1204 | #endif /*]*/ | 1191 | #endif /*]*/ |
| 1205 | - host_in3270(&h3270,CONNECTED_ANSI); | 1192 | + host_in3270(session,CONNECTED_ANSI); |
| 1206 | kybdlock_clr(KL_AWAITING_FIRST, "telnet_fsm"); | 1193 | kybdlock_clr(KL_AWAITING_FIRST, "telnet_fsm"); |
| 1207 | - status_reset(NULL); | 1194 | + status_reset(session); |
| 1208 | ps_process(); | 1195 | ps_process(); |
| 1209 | } | 1196 | } |
| 1210 | if (IN_ANSI && !IN_E) { | 1197 | if (IN_ANSI && !IN_E) { |
| @@ -1220,9 +1207,9 @@ telnet_fsm(unsigned char c) | @@ -1220,9 +1207,9 @@ telnet_fsm(unsigned char c) | ||
| 1220 | ansi_data = 4 + sl; | 1207 | ansi_data = 4 + sl; |
| 1221 | } | 1208 | } |
| 1222 | trace_dsn("%s",see_chr); | 1209 | trace_dsn("%s",see_chr); |
| 1223 | - if (!h3270.syncing) | 1210 | + if (!session->syncing) |
| 1224 | { | 1211 | { |
| 1225 | - if (linemode && h3270.onlcr && c == '\n') | 1212 | + if (linemode && session->onlcr && c == '\n') |
| 1226 | ansi_process((unsigned int) '\r'); | 1213 | ansi_process((unsigned int) '\r'); |
| 1227 | ansi_process((unsigned int) c); | 1214 | ansi_process((unsigned int) c); |
| 1228 | // sms_store(c); | 1215 | // sms_store(c); |
| @@ -1289,10 +1276,10 @@ telnet_fsm(unsigned char c) | @@ -1289,10 +1276,10 @@ telnet_fsm(unsigned char c) | ||
| 1289 | break; | 1276 | break; |
| 1290 | case DM: | 1277 | case DM: |
| 1291 | trace_dsn("\n"); | 1278 | trace_dsn("\n"); |
| 1292 | - if (h3270.syncing) | 1279 | + if (session->syncing) |
| 1293 | { | 1280 | { |
| 1294 | - h3270.syncing = 0; | ||
| 1295 | - x_except_on(&h3270); | 1281 | + session->syncing = 0; |
| 1282 | + x_except_on(session); | ||
| 1296 | } | 1283 | } |
| 1297 | telnet_state = TNS_DATA; | 1284 | telnet_state = TNS_DATA; |
| 1298 | break; | 1285 | break; |
| @@ -1339,7 +1326,7 @@ telnet_fsm(unsigned char c) | @@ -1339,7 +1326,7 @@ telnet_fsm(unsigned char c) | ||
| 1339 | cmd(WILL), opt(c)); | 1326 | cmd(WILL), opt(c)); |
| 1340 | } | 1327 | } |
| 1341 | 1328 | ||
| 1342 | - check_in3270(); | 1329 | + check_in3270(&h3270); |
| 1343 | check_linemode(False); | 1330 | check_linemode(False); |
| 1344 | } | 1331 | } |
| 1345 | break; | 1332 | break; |
| @@ -1359,7 +1346,7 @@ telnet_fsm(unsigned char c) | @@ -1359,7 +1346,7 @@ telnet_fsm(unsigned char c) | ||
| 1359 | dont_opt[2] = c; | 1346 | dont_opt[2] = c; |
| 1360 | net_rawout(dont_opt, sizeof(dont_opt)); | 1347 | net_rawout(dont_opt, sizeof(dont_opt)); |
| 1361 | trace_dsn("SENT %s %s\n", cmd(DONT), opt(c)); | 1348 | trace_dsn("SENT %s %s\n", cmd(DONT), opt(c)); |
| 1362 | - check_in3270(); | 1349 | + check_in3270(&h3270); |
| 1363 | check_linemode(False); | 1350 | check_linemode(False); |
| 1364 | } | 1351 | } |
| 1365 | telnet_state = TNS_DATA; | 1352 | telnet_state = TNS_DATA; |
| @@ -1379,9 +1366,9 @@ telnet_fsm(unsigned char c) | @@ -1379,9 +1366,9 @@ telnet_fsm(unsigned char c) | ||
| 1379 | #if defined(HAVE_LIBSSL) /*[*/ | 1366 | #if defined(HAVE_LIBSSL) /*[*/ |
| 1380 | case TELOPT_STARTTLS: | 1367 | case TELOPT_STARTTLS: |
| 1381 | #endif /*]*/ | 1368 | #endif /*]*/ |
| 1382 | - if (c == TELOPT_TN3270E && h3270.non_tn3270e_host) | 1369 | + if (c == TELOPT_TN3270E && session->non_tn3270e_host) |
| 1383 | goto wont; | 1370 | goto wont; |
| 1384 | - if (c == TELOPT_TM && !h3270.bsd_tm) | 1371 | + if (c == TELOPT_TM && !session->bsd_tm) |
| 1385 | goto wont; | 1372 | goto wont; |
| 1386 | 1373 | ||
| 1387 | if (!myopts[c]) { | 1374 | if (!myopts[c]) { |
| @@ -1390,7 +1377,7 @@ telnet_fsm(unsigned char c) | @@ -1390,7 +1377,7 @@ telnet_fsm(unsigned char c) | ||
| 1390 | will_opt[2] = c; | 1377 | will_opt[2] = c; |
| 1391 | net_rawout(will_opt, sizeof(will_opt)); | 1378 | net_rawout(will_opt, sizeof(will_opt)); |
| 1392 | trace_dsn("SENT %s %s\n", cmd(WILL), opt(c)); | 1379 | trace_dsn("SENT %s %s\n", cmd(WILL), opt(c)); |
| 1393 | - check_in3270(); | 1380 | + check_in3270(&h3270); |
| 1394 | check_linemode(False); | 1381 | check_linemode(False); |
| 1395 | } | 1382 | } |
| 1396 | if (c == TELOPT_NAWS) | 1383 | if (c == TELOPT_NAWS) |
| @@ -1432,7 +1419,7 @@ telnet_fsm(unsigned char c) | @@ -1432,7 +1419,7 @@ telnet_fsm(unsigned char c) | ||
| 1432 | wont_opt[2] = c; | 1419 | wont_opt[2] = c; |
| 1433 | net_rawout(wont_opt, sizeof(wont_opt)); | 1420 | net_rawout(wont_opt, sizeof(wont_opt)); |
| 1434 | trace_dsn("SENT %s %s\n", cmd(WONT), opt(c)); | 1421 | trace_dsn("SENT %s %s\n", cmd(WONT), opt(c)); |
| 1435 | - check_in3270(); | 1422 | + check_in3270(&h3270); |
| 1436 | check_linemode(False); | 1423 | check_linemode(False); |
| 1437 | } | 1424 | } |
| 1438 | telnet_state = TNS_DATA; | 1425 | telnet_state = TNS_DATA; |
| @@ -1460,19 +1447,19 @@ telnet_fsm(unsigned char c) | @@ -1460,19 +1447,19 @@ telnet_fsm(unsigned char c) | ||
| 1460 | return -1; | 1447 | return -1; |
| 1461 | } | 1448 | } |
| 1462 | 1449 | ||
| 1463 | - tt_len = strlen(h3270.termtype); | 1450 | + tt_len = strlen(session->termtype); |
| 1464 | if (try_lu != CN && *try_lu) { | 1451 | if (try_lu != CN && *try_lu) { |
| 1465 | tt_len += strlen(try_lu) + 1; | 1452 | tt_len += strlen(try_lu) + 1; |
| 1466 | - h3270.connected_lu = try_lu; | 1453 | + session->connected_lu = try_lu; |
| 1467 | } else | 1454 | } else |
| 1468 | - h3270.connected_lu = CN; | ||
| 1469 | - status_lu(&h3270,h3270.connected_lu); | 1455 | + session->connected_lu = CN; |
| 1456 | + status_lu(session,session->connected_lu); | ||
| 1470 | 1457 | ||
| 1471 | tb_len = 4 + tt_len + 2; | 1458 | tb_len = 4 + tt_len + 2; |
| 1472 | tt_out = lib3270_malloc(tb_len + 1); | 1459 | tt_out = lib3270_malloc(tb_len + 1); |
| 1473 | (void) sprintf(tt_out, "%c%c%c%c%s%s%s%c%c", | 1460 | (void) sprintf(tt_out, "%c%c%c%c%s%s%s%c%c", |
| 1474 | IAC, SB, TELOPT_TTYPE, TELQUAL_IS, | 1461 | IAC, SB, TELOPT_TTYPE, TELQUAL_IS, |
| 1475 | - h3270.termtype, | 1462 | + session->termtype, |
| 1476 | (try_lu != CN && *try_lu) ? "@" : "", | 1463 | (try_lu != CN && *try_lu) ? "@" : "", |
| 1477 | (try_lu != CN && *try_lu) ? try_lu : "", | 1464 | (try_lu != CN && *try_lu) ? try_lu : "", |
| 1478 | IAC, SE); | 1465 | IAC, SE); |
| @@ -1569,7 +1556,7 @@ backoff_tn3270e(const char *why) | @@ -1569,7 +1556,7 @@ backoff_tn3270e(const char *why) | ||
| 1569 | 1556 | ||
| 1570 | /* Reset our internal state. */ | 1557 | /* Reset our internal state. */ |
| 1571 | myopts[TELOPT_TN3270E] = 0; | 1558 | myopts[TELOPT_TN3270E] = 0; |
| 1572 | - check_in3270(); | 1559 | + check_in3270(&h3270); |
| 1573 | } | 1560 | } |
| 1574 | 1561 | ||
| 1575 | /* | 1562 | /* |
| @@ -1706,7 +1693,7 @@ tn3270e_negotiate(void) | @@ -1706,7 +1693,7 @@ tn3270e_negotiate(void) | ||
| 1706 | tn3270e_subneg_send(TN3270E_OP_IS, e_funcs); | 1693 | tn3270e_subneg_send(TN3270E_OP_IS, e_funcs); |
| 1707 | tn3270e_negotiated = 1; | 1694 | tn3270e_negotiated = 1; |
| 1708 | trace_dsn("TN3270E option negotiation complete.\n"); | 1695 | trace_dsn("TN3270E option negotiation complete.\n"); |
| 1709 | - check_in3270(); | 1696 | + check_in3270(&h3270); |
| 1710 | } else { | 1697 | } else { |
| 1711 | /* | 1698 | /* |
| 1712 | * They want us to do something we can't. | 1699 | * They want us to do something we can't. |
| @@ -1743,7 +1730,7 @@ tn3270e_negotiate(void) | @@ -1743,7 +1730,7 @@ tn3270e_negotiate(void) | ||
| 1743 | } | 1730 | } |
| 1744 | tn3270e_negotiated = 1; | 1731 | tn3270e_negotiated = 1; |
| 1745 | trace_dsn("TN3270E option negotiation complete.\n"); | 1732 | trace_dsn("TN3270E option negotiation complete.\n"); |
| 1746 | - check_in3270(); | 1733 | + check_in3270(&h3270); |
| 1747 | break; | 1734 | break; |
| 1748 | 1735 | ||
| 1749 | default: | 1736 | default: |
| @@ -1894,7 +1881,7 @@ process_eor(void) | @@ -1894,7 +1881,7 @@ process_eor(void) | ||
| 1894 | !tn3270e_bound) | 1881 | !tn3270e_bound) |
| 1895 | return 0; | 1882 | return 0; |
| 1896 | tn3270e_submode = E_3270; | 1883 | tn3270e_submode = E_3270; |
| 1897 | - check_in3270(); | 1884 | + check_in3270(&h3270); |
| 1898 | response_required = h->response_flag; | 1885 | response_required = h->response_flag; |
| 1899 | rv = process_ds(ibuf + EH_SIZE, | 1886 | rv = process_ds(ibuf + EH_SIZE, |
| 1900 | (ibptr - ibuf) - EH_SIZE); | 1887 | (ibptr - ibuf) - EH_SIZE); |
| @@ -1912,7 +1899,7 @@ process_eor(void) | @@ -1912,7 +1899,7 @@ process_eor(void) | ||
| 1912 | process_bind(ibuf + EH_SIZE, (ibptr - ibuf) - EH_SIZE); | 1899 | process_bind(ibuf + EH_SIZE, (ibptr - ibuf) - EH_SIZE); |
| 1913 | trace_dsn("< BIND PLU-name '%s'\n", plu_name); | 1900 | trace_dsn("< BIND PLU-name '%s'\n", plu_name); |
| 1914 | tn3270e_bound = 1; | 1901 | tn3270e_bound = 1; |
| 1915 | - check_in3270(); | 1902 | + check_in3270(&h3270); |
| 1916 | return 0; | 1903 | return 0; |
| 1917 | case TN3270E_DT_UNBIND: | 1904 | case TN3270E_DT_UNBIND: |
| 1918 | if (!(e_funcs & E_OPT(TN3270E_FUNC_BIND_IMAGE))) | 1905 | if (!(e_funcs & E_OPT(TN3270E_FUNC_BIND_IMAGE))) |
| @@ -1920,12 +1907,12 @@ process_eor(void) | @@ -1920,12 +1907,12 @@ process_eor(void) | ||
| 1920 | tn3270e_bound = 0; | 1907 | tn3270e_bound = 0; |
| 1921 | if (tn3270e_submode == E_3270) | 1908 | if (tn3270e_submode == E_3270) |
| 1922 | tn3270e_submode = E_NONE; | 1909 | tn3270e_submode = E_NONE; |
| 1923 | - check_in3270(); | 1910 | + check_in3270(&h3270); |
| 1924 | return 0; | 1911 | return 0; |
| 1925 | case TN3270E_DT_NVT_DATA: | 1912 | case TN3270E_DT_NVT_DATA: |
| 1926 | /* In tn3270e NVT mode */ | 1913 | /* In tn3270e NVT mode */ |
| 1927 | tn3270e_submode = E_NVT; | 1914 | tn3270e_submode = E_NVT; |
| 1928 | - check_in3270(); | 1915 | + check_in3270(&h3270); |
| 1929 | for (s = ibuf; s < ibptr; s++) { | 1916 | for (s = ibuf; s < ibptr; s++) { |
| 1930 | ansi_process(*s++); | 1917 | ansi_process(*s++); |
| 1931 | } | 1918 | } |
| @@ -1934,7 +1921,7 @@ process_eor(void) | @@ -1934,7 +1921,7 @@ process_eor(void) | ||
| 1934 | if (!(e_funcs & E_OPT(TN3270E_FUNC_BIND_IMAGE))) | 1921 | if (!(e_funcs & E_OPT(TN3270E_FUNC_BIND_IMAGE))) |
| 1935 | return 0; | 1922 | return 0; |
| 1936 | tn3270e_submode = E_SSCP; | 1923 | tn3270e_submode = E_SSCP; |
| 1937 | - check_in3270(); | 1924 | + check_in3270(&h3270); |
| 1938 | ctlr_write_sscp_lu(ibuf + EH_SIZE, | 1925 | ctlr_write_sscp_lu(ibuf + EH_SIZE, |
| 1939 | (ibptr - ibuf) - EH_SIZE); | 1926 | (ibptr - ibuf) - EH_SIZE); |
| 1940 | return 0; | 1927 | return 0; |
| @@ -2407,9 +2394,10 @@ do_lnext(char c) | @@ -2407,9 +2394,10 @@ do_lnext(char c) | ||
| 2407 | * Check for switches between NVT, SSCP-LU and 3270 modes. | 2394 | * Check for switches between NVT, SSCP-LU and 3270 modes. |
| 2408 | */ | 2395 | */ |
| 2409 | static void | 2396 | static void |
| 2410 | -check_in3270(void) | 2397 | +check_in3270(H3270 *session) |
| 2411 | { | 2398 | { |
| 2412 | LIB3270_CSTATE new_cstate = NOT_CONNECTED; | 2399 | LIB3270_CSTATE new_cstate = NOT_CONNECTED; |
| 2400 | + | ||
| 2413 | #if defined(X3270_TRACE) /*[*/ | 2401 | #if defined(X3270_TRACE) /*[*/ |
| 2414 | static const char *state_name[] = { | 2402 | static const char *state_name[] = { |
| 2415 | "unconnected", | 2403 | "unconnected", |
| @@ -2451,14 +2439,14 @@ check_in3270(void) | @@ -2451,14 +2439,14 @@ check_in3270(void) | ||
| 2451 | hisopts[TELOPT_BINARY] && | 2439 | hisopts[TELOPT_BINARY] && |
| 2452 | hisopts[TELOPT_EOR]) { | 2440 | hisopts[TELOPT_EOR]) { |
| 2453 | new_cstate = CONNECTED_3270; | 2441 | new_cstate = CONNECTED_3270; |
| 2454 | - } else if (h3270.cstate == CONNECTED_INITIAL) { | 2442 | + } else if (session->cstate == CONNECTED_INITIAL) { |
| 2455 | /* Nothing has happened, yet. */ | 2443 | /* Nothing has happened, yet. */ |
| 2456 | return; | 2444 | return; |
| 2457 | } else { | 2445 | } else { |
| 2458 | new_cstate = CONNECTED_ANSI; | 2446 | new_cstate = CONNECTED_ANSI; |
| 2459 | } | 2447 | } |
| 2460 | 2448 | ||
| 2461 | - if (new_cstate != h3270.cstate) { | 2449 | + if (new_cstate != session->cstate) { |
| 2462 | #if defined(X3270_TN3270E) /*[*/ | 2450 | #if defined(X3270_TN3270E) /*[*/ |
| 2463 | int was_in_e = IN_E; | 2451 | int was_in_e = IN_E; |
| 2464 | #endif /*]*/ | 2452 | #endif /*]*/ |
| @@ -2498,7 +2486,7 @@ check_in3270(void) | @@ -2498,7 +2486,7 @@ check_in3270(void) | ||
| 2498 | } | 2486 | } |
| 2499 | #endif /*]*/ | 2487 | #endif /*]*/ |
| 2500 | trace_dsn("Now operating in %s mode.\n",state_name[new_cstate]); | 2488 | trace_dsn("Now operating in %s mode.\n",state_name[new_cstate]); |
| 2501 | - host_in3270(&h3270,new_cstate); | 2489 | + host_in3270(session,new_cstate); |
| 2502 | } | 2490 | } |
| 2503 | } | 2491 | } |
| 2504 | 2492 | ||
| @@ -3017,14 +3005,14 @@ net_abort(void) | @@ -3017,14 +3005,14 @@ net_abort(void) | ||
| 3017 | if (tn3270e_bound || | 3005 | if (tn3270e_bound || |
| 3018 | !(e_funcs & E_OPT(TN3270E_FUNC_BIND_IMAGE))) { | 3006 | !(e_funcs & E_OPT(TN3270E_FUNC_BIND_IMAGE))) { |
| 3019 | tn3270e_submode = E_3270; | 3007 | tn3270e_submode = E_3270; |
| 3020 | - check_in3270(); | 3008 | + check_in3270(&h3270); |
| 3021 | } | 3009 | } |
| 3022 | break; | 3010 | break; |
| 3023 | case E_3270: | 3011 | case E_3270: |
| 3024 | net_rawout(buf, sizeof(buf)); | 3012 | net_rawout(buf, sizeof(buf)); |
| 3025 | trace_dsn("SENT AO\n"); | 3013 | trace_dsn("SENT AO\n"); |
| 3026 | tn3270e_submode = E_SSCP; | 3014 | tn3270e_submode = E_SSCP; |
| 3027 | - check_in3270(); | 3015 | + check_in3270(&h3270); |
| 3028 | break; | 3016 | break; |
| 3029 | } | 3017 | } |
| 3030 | } | 3018 | } |