Commit f7d659086b06e44b85187160e4df7305236964bc

Authored by Perry Werneck
1 parent 3289390c

Adding "reset_callbacks" method.

Showing 2 changed files with 13 additions and 8 deletions   Show diff stats
src/include/lib3270.h
@@ -446,6 +446,7 @@ @@ -446,6 +446,7 @@
446 */ 446 */
447 LIB3270_EXPORT void lib3270_register_schange(H3270 *h,LIB3270_STATE tx, void (*func)(H3270 *, int, void *),void *data); 447 LIB3270_EXPORT void lib3270_register_schange(H3270 *h,LIB3270_STATE tx, void (*func)(H3270 *, int, void *),void *data);
448 448
  449 + LIB3270_EXPORT void lib3270_reset_callbacks(H3270 *hSession);
449 450
450 /** 451 /**
451 * @brief Set host id for the connect/reconnect operations. 452 * @brief Set host id for the connect/reconnect operations.
src/lib3270/session.c
@@ -254,15 +254,8 @@ static void set_peer_certificate)(const void *cert unused) @@ -254,15 +254,8 @@ static void set_peer_certificate)(const void *cert unused)
254 } 254 }
255 #endif // HAVE_LIBSSL 255 #endif // HAVE_LIBSSL
256 256
257 -static void lib3270_session_init(H3270 *hSession, const char *model, const char *charset) 257 +void lib3270_reset_callbacks(H3270 *hSession)
258 { 258 {
259 - int f;  
260 -  
261 - memset(hSession,0,sizeof(H3270));  
262 -// hSession->sz = sizeof(H3270);  
263 -  
264 - lib3270_set_host_charset(hSession,charset);  
265 -  
266 // Default calls 259 // Default calls
267 hSession->cbk.write = lib3270_sock_send; 260 hSession->cbk.write = lib3270_sock_send;
268 hSession->cbk.disconnect = lib3270_sock_disconnect; 261 hSession->cbk.disconnect = lib3270_sock_disconnect;
@@ -288,6 +281,17 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char @@ -288,6 +281,17 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char
288 hSession->cbk.set_timer = set_timer; 281 hSession->cbk.set_timer = set_timer;
289 hSession->cbk.print = print; 282 hSession->cbk.print = print;
290 hSession->cbk.set_peer_certificate = set_peer_certificate; 283 hSession->cbk.set_peer_certificate = set_peer_certificate;
  284 +}
  285 +
  286 +static void lib3270_session_init(H3270 *hSession, const char *model, const char *charset)
  287 +{
  288 + int f;
  289 +
  290 + memset(hSession,0,sizeof(H3270));
  291 +// hSession->sz = sizeof(H3270);
  292 +
  293 + lib3270_set_host_charset(hSession,charset);
  294 + lib3270_reset_callbacks(hSession);
291 295
292 // Trace management. 296 // Trace management.
293 hSession->trace.handler = def_trace; 297 hSession->trace.handler = def_trace;