Commit ff4a13ea430687f7ddd7871675c615ec11009317
1 parent
5506b564
Exists in
master
and in
2 other branches
Adding dummy send/receive methods.
Showing
5 changed files
with
61 additions
and
22 deletions
Show diff stats
.gitignore
src/core/ft/ft.c
@@ -701,3 +701,24 @@ LIB3270_EXPORT LIB3270_FT_STATE lib3270_get_ft_state(H3270 *session) | @@ -701,3 +701,24 @@ LIB3270_EXPORT LIB3270_FT_STATE lib3270_get_ft_state(H3270 *session) | ||
701 | 701 | ||
702 | return ((H3270FT *) session->ft)->state; | 702 | return ((H3270FT *) session->ft)->state; |
703 | } | 703 | } |
704 | + | ||
705 | +LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char *from, const char *to, const char **args) | ||
706 | +{ | ||
707 | + FAIL_IF_NOT_ONLINE(hSession); | ||
708 | + | ||
709 | + if(hSession->ft) | ||
710 | + return EBUSY; | ||
711 | + | ||
712 | + return hSession->cbk.send(hSession,from,to,args); | ||
713 | +} | ||
714 | + | ||
715 | +LIB3270_EXPORT int lib3270_receive(H3270 *hSession, const char *from, const char *to, const char **args) | ||
716 | +{ | ||
717 | + FAIL_IF_NOT_ONLINE(hSession); | ||
718 | + | ||
719 | + if(hSession->ft) | ||
720 | + return EBUSY; | ||
721 | + | ||
722 | + return hSession->cbk.receive(hSession,from,to,args); | ||
723 | +} | ||
724 | + |
src/core/session.c
@@ -217,28 +217,6 @@ static int load(H3270 *session, const char GNUC_UNUSED(*filename)) | @@ -217,28 +217,6 @@ static int load(H3270 *session, const char GNUC_UNUSED(*filename)) | ||
217 | return errno = ENOTSUP; | 217 | return errno = ENOTSUP; |
218 | } | 218 | } |
219 | 219 | ||
220 | -/* | ||
221 | -static void def_message(H3270 *session, LIB3270_NOTIFY GNUC_UNUSED(id), const char *title, const char *msg, const char *text) | ||
222 | -{ | ||
223 | -#ifdef ANDROID | ||
224 | - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",title); | ||
225 | - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",msg); | ||
226 | - __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s\n",text); | ||
227 | -#else | ||
228 | - lib3270_write_log(session,"lib3270","%s",title); | ||
229 | - lib3270_write_log(session,"lib3270","%s",msg); | ||
230 | - lib3270_write_log(session,"lib3270","%s",text); | ||
231 | -#endif // ANDROID | ||
232 | -} | ||
233 | -*/ | ||
234 | - | ||
235 | -/* | ||
236 | -static void def_popup(H3270 *hSession, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list args) | ||
237 | -{ | ||
238 | - lib3270_popup_va(hSession,type,title,msg,fmt,args); | ||
239 | -} | ||
240 | -*/ | ||
241 | - | ||
242 | static void def_trace(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *fmt, va_list args) | 220 | static void def_trace(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *fmt, va_list args) |
243 | { | 221 | { |
244 | vfprintf(stdout,fmt,args); | 222 | vfprintf(stdout,fmt,args); |
@@ -276,6 +254,10 @@ static int default_action(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(* | @@ -276,6 +254,10 @@ static int default_action(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(* | ||
276 | return ENOENT; | 254 | return ENOENT; |
277 | } | 255 | } |
278 | 256 | ||
257 | +static int default_ft(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(*from), const char GNUC_UNUSED(*to), const char GNUC_UNUSED(**args)) { | ||
258 | + return ENOTSUP; | ||
259 | +} | ||
260 | + | ||
279 | void lib3270_reset_callbacks(H3270 *hSession) | 261 | void lib3270_reset_callbacks(H3270 *hSession) |
280 | { | 262 | { |
281 | // Default calls | 263 | // Default calls |
@@ -306,6 +288,8 @@ void lib3270_reset_callbacks(H3270 *hSession) | @@ -306,6 +288,8 @@ void lib3270_reset_callbacks(H3270 *hSession) | ||
306 | hSession->cbk.update_url = default_update_url; | 288 | hSession->cbk.update_url = default_update_url; |
307 | hSession->cbk.action = default_action; | 289 | hSession->cbk.action = default_action; |
308 | hSession->cbk.reconnect = lib3270_reconnect; | 290 | hSession->cbk.reconnect = lib3270_reconnect; |
291 | + hSession->cbk.send = default_ft; | ||
292 | + hSession->cbk.receive = default_ft; | ||
309 | 293 | ||
310 | lib3270_set_popup_handler(hSession, NULL); | 294 | lib3270_set_popup_handler(hSession, NULL); |
311 | 295 |
src/include/lib3270/filetransfer.h
@@ -197,6 +197,34 @@ | @@ -197,6 +197,34 @@ | ||
197 | LIB3270_EXPORT struct lib3270_ft_callbacks * lib3270_get_ft_callbacks(H3270 *session, unsigned short sz); | 197 | LIB3270_EXPORT struct lib3270_ft_callbacks * lib3270_get_ft_callbacks(H3270 *session, unsigned short sz); |
198 | 198 | ||
199 | /** | 199 | /** |
200 | + * @brief Send file. | ||
201 | + * | ||
202 | + * @param from Origin filename | ||
203 | + * @param to Destination filename | ||
204 | + * @param args Null terminated file transfer options. | ||
205 | + * | ||
206 | + * @return 0 if ok, error code if not. | ||
207 | + * | ||
208 | + * @retval EBUSY File transfer is already active. | ||
209 | + * | ||
210 | + */ | ||
211 | + LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char *from, const char *to, const char **args); | ||
212 | + | ||
213 | + /** | ||
214 | + * @brief Receive file. | ||
215 | + * | ||
216 | + * @param from Origin filename | ||
217 | + * @param to Destination filename | ||
218 | + * @param args Null terminated file transfer options. | ||
219 | + * | ||
220 | + * @return 0 if ok, error code if not. | ||
221 | + * | ||
222 | + * @retval EBUSY File transfer is already active. | ||
223 | + * | ||
224 | + */ | ||
225 | + LIB3270_EXPORT int lib3270_receive(H3270 *hSession, const char *from, const char *to, const char **args); | ||
226 | + | ||
227 | + /** | ||
200 | * @brief Set all FT callbacks to default valides. | 228 | * @brief Set all FT callbacks to default valides. |
201 | * | 229 | * |
202 | * @param hSession TN3270 session to reset. | 230 | * @param hSession TN3270 session to reset. |
src/include/lib3270/session.h
@@ -80,6 +80,10 @@ | @@ -80,6 +80,10 @@ | ||
80 | int (*action)(H3270 *hSession, const char *name); | 80 | int (*action)(H3270 *hSession, const char *name); |
81 | 81 | ||
82 | int (*reconnect)(H3270 *hSession,int seconds); | 82 | int (*reconnect)(H3270 *hSession,int seconds); |
83 | + | ||
84 | + int (*send)(H3270 *hSession, const char *from, const char *to, const char **args); | ||
85 | + int (*receive)(H3270 *hSession, const char *from, const char *to, const char **args); | ||
86 | + | ||
83 | }; | 87 | }; |
84 | 88 | ||
85 | /** | 89 | /** |