diff --git a/pw3270.cbp b/pw3270.cbp index 95a3403..f2dcd25 100644 --- a/pw3270.cbp +++ b/pw3270.cbp @@ -58,6 +58,7 @@ + diff --git a/src/include/lib3270/internals.h b/src/include/lib3270/internals.h index ee2f116..0b98c8f 100644 --- a/src/include/lib3270/internals.h +++ b/src/include/lib3270/internals.h @@ -35,6 +35,8 @@ #endif LIB3270_EXPORT void lib3270_data_recv(H3270 *hSession, size_t nr, const unsigned char *netrbuf); + LIB3270_EXPORT void lib3270_set_disconnected(H3270 *hSession); + LIB3270_EXPORT void lib3270_set_connected(H3270 *hSession); #ifdef __cplusplus } diff --git a/src/lib3270/host.c b/src/lib3270/host.c index 63ef189..539d11e 100644 --- a/src/lib3270/host.c +++ b/src/lib3270/host.c @@ -52,6 +52,7 @@ #include "xioc.h" #include +#include #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */ #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */ @@ -550,7 +551,7 @@ static int do_connect(H3270 *hSession, const char *n) if(net_connect(hSession, chost, port, 0, &resolving,&pending) != 0 && !resolving) { /* Redundantly signal a disconnect. */ - host_disconnected(hSession); + lib3270_set_disconnected(hSession); return -1; } @@ -588,7 +589,7 @@ static int do_connect(H3270 *hSession, const char *n) } else { - host_connected(hSession); + lib3270_set_connected(hSession); } return 0; @@ -687,7 +688,7 @@ void host_disconnect(H3270 *h, int failed) trace_ansi_disc(); #endif /*]*/ - host_disconnected(h); + lib3270_set_disconnected(h); } } @@ -703,22 +704,24 @@ void host_in3270(H3270 *session, LIB3270_CSTATE new_cstate) lib3270_st_changed(session, LIB3270_STATE_3270_MODE, now3270); } -void host_connected(H3270 *session) +void lib3270_set_connected(H3270 *hSession) { - session->cstate = CONNECTED_INITIAL; - lib3270_st_changed(session, LIB3270_STATE_CONNECT, True); - if(session->update_connect) - session->update_connect(session,1); + hSession->cstate = CONNECTED_INITIAL; + lib3270_st_changed(hSession, LIB3270_STATE_CONNECT, True); + if(hSession->update_connect) + hSession->update_connect(hSession,1); } -void host_disconnected(H3270 *session) +void lib3270_set_disconnected(H3270 *hSession) { - session->cstate = NOT_CONNECTED; - set_status(session,OIA_FLAG_UNDERA,False); - lib3270_st_changed(session,LIB3270_STATE_CONNECT, False); - status_changed(session,LIB3270_MESSAGE_DISCONNECTED); - if(session->update_connect) - session->update_connect(session,0); + CHECK_SESSION_HANDLE(hSession); + + hSession->cstate = NOT_CONNECTED; + set_status(hSession,OIA_FLAG_UNDERA,False); + lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False); + status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); + if(hSession->update_connect) + hSession->update_connect(hSession,0); } /* Register a function interested in a state change. */ diff --git a/src/lib3270/hostc.h b/src/lib3270/hostc.h index a918ac2..6ce0ced 100644 --- a/src/lib3270/hostc.h +++ b/src/lib3270/hostc.h @@ -39,8 +39,6 @@ // #define st_changed(tx,mode) lib3270_st_changed(NULL,tx,mode) LIB3270_INTERNAL void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode); - LIB3270_INTERNAL void host_connected(H3270 *session); - LIB3270_INTERNAL void host_disconnected(H3270 *session); LIB3270_INTERNAL void host_in3270(H3270 *session, LIB3270_CSTATE); LIB3270_INTERNAL void host_disconnect(H3270 *h, int disable); diff --git a/src/lib3270/telnet.c b/src/lib3270/telnet.c index b821f95..22e2914 100644 --- a/src/lib3270/telnet.c +++ b/src/lib3270/telnet.c @@ -867,7 +867,7 @@ static void net_connected(H3270 *session) // trace_dsn("TLS/SSL tunneled connection complete. Connection is now secure.\n"); /* Tell everyone else again. */ - host_connected(session); + lib3270_set_connected(session); } #endif /*]*/ @@ -927,7 +927,7 @@ static void connection_complete(H3270 *session) host_disconnect(session,True); return; } - host_connected(session); + lib3270_set_connected(session); net_connected(session); } @@ -1098,7 +1098,7 @@ void net_input(H3270 *session) host_disconnect(session,True); return; } - host_connected(session); + lib3270_set_connected(session); net_connected(session); } @@ -3396,7 +3396,7 @@ static void continue_tls(unsigned char *sbbuf, int len) // trace_dsn("TLS/SSL negotiated connection complete. Connection is now secure.\n"); /* Tell the world that we are (still) connected, now in secure mode. */ - host_connected(&h3270); + lib3270_set_connected(&h3270); } #endif /*]*/ -- libgit2 0.21.2