Commit b8383bb61d0ad5e2ad93b56826a614ea9156396e
1 parent
64b52c6e
Exists in
master
and in
3 other branches
Adding method to get active trace handler.
Showing
3 changed files
with
22 additions
and
4 deletions
Show diff stats
src/include/lib3270/trace.h
@@ -44,9 +44,8 @@ | @@ -44,9 +44,8 @@ | ||
44 | 44 | ||
45 | typedef void (*LIB3270_TRACE_HANDLER)(H3270 *, void *, const char *, va_list); | 45 | typedef void (*LIB3270_TRACE_HANDLER)(H3270 *, void *, const char *, va_list); |
46 | 46 | ||
47 | - | ||
48 | /** | 47 | /** |
49 | - * Set trace handle callback. | 48 | + * @brief Set trace handle callback. |
50 | * | 49 | * |
51 | * @param hSession TN3270 Session handle. | 50 | * @param hSession TN3270 Session handle. |
52 | * @param handler Callback to write in trace file or show trace window (NULL send all trace to stdout/syslog). | 51 | * @param handler Callback to write in trace file or show trace window (NULL send all trace to stdout/syslog). |
@@ -56,6 +55,16 @@ | @@ -56,6 +55,16 @@ | ||
56 | LIB3270_EXPORT void lib3270_set_trace_handler(H3270 *hSession, LIB3270_TRACE_HANDLER handler, void *userdata); | 55 | LIB3270_EXPORT void lib3270_set_trace_handler(H3270 *hSession, LIB3270_TRACE_HANDLER handler, void *userdata); |
57 | 56 | ||
58 | /** | 57 | /** |
58 | + * @brief Get trace handle callback. | ||
59 | + * | ||
60 | + * @param hSession TN3270 Session handle. | ||
61 | + * @param handler Callback to write in trace file or show trace window (NULL send all trace to stdout/syslog). | ||
62 | + * @param userdata User data to pass to the trace handler. | ||
63 | + * | ||
64 | + */ | ||
65 | + LIB3270_EXPORT void lib3270_get_trace_handler(H3270 *hSession, LIB3270_TRACE_HANDLER *handler, void **userdata); | ||
66 | + | ||
67 | + /** | ||
59 | * Write on trace file. | 68 | * Write on trace file. |
60 | * | 69 | * |
61 | * Write text on trace file, if DStrace is enabled. | 70 | * Write text on trace file, if DStrace is enabled. |
src/lib3270/session.c
@@ -327,10 +327,19 @@ LIB3270_EXPORT void lib3270_set_trace_handler(H3270 *hSession, LIB3270_TRACE_HAN | @@ -327,10 +327,19 @@ LIB3270_EXPORT void lib3270_set_trace_handler(H3270 *hSession, LIB3270_TRACE_HAN | ||
327 | { | 327 | { |
328 | CHECK_SESSION_HANDLE(hSession); | 328 | CHECK_SESSION_HANDLE(hSession); |
329 | 329 | ||
330 | - hSession->trace.handler = handler ? handler : def_trace; | 330 | + hSession->trace.handler = handler ? handler : def_trace; |
331 | hSession->trace.userdata = userdata; | 331 | hSession->trace.userdata = userdata; |
332 | } | 332 | } |
333 | 333 | ||
334 | +LIB3270_EXPORT void lib3270_get_trace_handler(H3270 *hSession, LIB3270_TRACE_HANDLER *handler, void **userdata) | ||
335 | +{ | ||
336 | + CHECK_SESSION_HANDLE(hSession); | ||
337 | + | ||
338 | + *handler = hSession->trace.handler; | ||
339 | + *userdata = hSession->trace.userdata; | ||
340 | + | ||
341 | +} | ||
342 | + | ||
334 | LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *session, void (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)) { | 343 | LIB3270_EXPORT void lib3270_set_popup_handler(H3270 *session, void (*handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)) { |
335 | session->cbk.popup = handler ? handler : def_popup; | 344 | session->cbk.popup = handler ? handler : def_popup; |
336 | } | 345 | } |
src/lib3270/testprogram/testprogram.c
@@ -17,7 +17,7 @@ int main(int numpar, char *param[]) | @@ -17,7 +17,7 @@ int main(int numpar, char *param[]) | ||
17 | h = lib3270_session_new(""); | 17 | h = lib3270_session_new(""); |
18 | printf("3270 session %p created\n]",h); | 18 | printf("3270 session %p created\n]",h); |
19 | 19 | ||
20 | -// lib3270_set_toggle(session,LIB3270_TOGGLE_DS_TRACE,1); | 20 | + lib3270_set_toggle(h,LIB3270_TOGGLE_DS_TRACE,1); |
21 | 21 | ||
22 | lib3270_set_url(h,url ? url : "tn3270://fandezhi.efglobe.com"); | 22 | lib3270_set_url(h,url ? url : "tn3270://fandezhi.efglobe.com"); |
23 | rc = lib3270_connect(h,120); | 23 | rc = lib3270_connect(h,120); |