From ff4a13ea430687f7ddd7871675c615ec11009317 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 28 Jan 2021 17:56:35 -0300 Subject: [PATCH] Adding dummy send/receive methods. --- .gitignore | 2 ++ src/core/ft/ft.c | 21 +++++++++++++++++++++ src/core/session.c | 28 ++++++---------------------- src/include/lib3270/filetransfer.h | 28 ++++++++++++++++++++++++++++ src/include/lib3270/session.h | 4 ++++ 5 files changed, 61 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index ff19fd7..6c61ffb 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,8 @@ doxygen/doxyfile win32-configure* ValgrindOut.xml certs +libtool +m4 *.mak confdefs.h conftest.* diff --git a/src/core/ft/ft.c b/src/core/ft/ft.c index 825a259..8539200 100644 --- a/src/core/ft/ft.c +++ b/src/core/ft/ft.c @@ -701,3 +701,24 @@ LIB3270_EXPORT LIB3270_FT_STATE lib3270_get_ft_state(H3270 *session) return ((H3270FT *) session->ft)->state; } + +LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char *from, const char *to, const char **args) +{ + FAIL_IF_NOT_ONLINE(hSession); + + if(hSession->ft) + return EBUSY; + + return hSession->cbk.send(hSession,from,to,args); +} + +LIB3270_EXPORT int lib3270_receive(H3270 *hSession, const char *from, const char *to, const char **args) +{ + FAIL_IF_NOT_ONLINE(hSession); + + if(hSession->ft) + return EBUSY; + + return hSession->cbk.receive(hSession,from,to,args); +} + diff --git a/src/core/session.c b/src/core/session.c index 6bed1ea..359e94c 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -217,28 +217,6 @@ static int load(H3270 *session, const char GNUC_UNUSED(*filename)) return errno = ENOTSUP; } -/* -static void def_message(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(id), const char *title, const char *msg, const char *text) -{ -#ifdef ANDROID - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",title); - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",msg); - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",text); -#else - lib3270_write_log(session,"lib3270","%s",title); - lib3270_write_log(session,"lib3270","%s",msg); - lib3270_write_log(session,"lib3270","%s",text); -#endif // ANDROID -} -*/ - -/* -static void def_popup(H3270 *hSession, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) -{ - lib3270_popup_va(hSession,type,title,msg,fmt,args); -} -*/ - static void def_trace(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *fmt, va_list args) { vfprintf(stdout,fmt,args); @@ -276,6 +254,10 @@ static int default_action(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(* return ENOENT; } +static int default_ft(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(*from), const char GNUC_UNUSED(*to), const char GNUC_UNUSED(**args)) { + return ENOTSUP; +} + void lib3270_reset_callbacks(H3270 *hSession) { // Default calls @@ -306,6 +288,8 @@ void lib3270_reset_callbacks(H3270 *hSession) hSession->cbk.update_url = default_update_url; hSession->cbk.action = default_action; hSession->cbk.reconnect = lib3270_reconnect; + hSession->cbk.send = default_ft; + hSession->cbk.receive = default_ft; lib3270_set_popup_handler(hSession, NULL); diff --git a/src/include/lib3270/filetransfer.h b/src/include/lib3270/filetransfer.h index 7c427b4..c58c53f 100644 --- a/src/include/lib3270/filetransfer.h +++ b/src/include/lib3270/filetransfer.h @@ -197,6 +197,34 @@ LIB3270_EXPORT struct lib3270_ft_callbacks * lib3270_get_ft_callbacks(H3270 *session, unsigned short sz); /** + * @brief Send file. + * + * @param from Origin filename + * @param to Destination filename + * @param args Null terminated file transfer options. + * + * @return 0 if ok, error code if not. + * + * @retval EBUSY File transfer is already active. + * + */ + LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char *from, const char *to, const char **args); + + /** + * @brief Receive file. + * + * @param from Origin filename + * @param to Destination filename + * @param args Null terminated file transfer options. + * + * @return 0 if ok, error code if not. + * + * @retval EBUSY File transfer is already active. + * + */ + LIB3270_EXPORT int lib3270_receive(H3270 *hSession, const char *from, const char *to, const char **args); + + /** * @brief Set all FT callbacks to default valides. * * @param hSession TN3270 session to reset. diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h index 20a4c29..25f4251 100644 --- a/src/include/lib3270/session.h +++ b/src/include/lib3270/session.h @@ -80,6 +80,10 @@ int (*action)(H3270 *hSession, const char *name); int (*reconnect)(H3270 *hSession,int seconds); + + int (*send)(H3270 *hSession, const char *from, const char *to, const char **args); + int (*receive)(H3270 *hSession, const char *from, const char *to, const char **args); + }; /** -- libgit2 0.21.2