Commit c14c147742d51bcf8d96bbdfbbeeec8e57a24bd3

Authored by Perry Werneck
1 parent ff4a13ea
Exists in master and in 2 other branches develop, macos

Adjustments on file-transfer object.

src/core/ft/ft.c
@@ -290,8 +290,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -290,8 +290,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
290 } 290 }
291 291
292 // Set options 292 // Set options
293 - session->dft_buffersize = dft;  
294 - set_dft_buffersize(session); 293 + lib3270_set_dft_buffersize(session, dft);
295 294
296 // Create & Initialize ft control structure. 295 // Create & Initialize ft control structure.
297 ftHandle = lib3270_malloc(sizeof(H3270FT)+strlen(local)+strlen(remote)+3); 296 ftHandle = lib3270_malloc(sizeof(H3270FT)+strlen(local)+strlen(remote)+3);
@@ -339,6 +338,61 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -339,6 +338,61 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
339 return ftHandle; 338 return ftHandle;
340 } 339 }
341 340
  341 + LIB3270_EXPORT int lib3270_ft_set_lrecl(H3270 *hSession, int lrecl)
  342 + {
  343 + CHECK_SESSION_HANDLE(hSession);
  344 +
  345 + if(!hSession->ft)
  346 + return errno = EINVAL;
  347 +
  348 +
  349 + return 0;
  350 + }
  351 +
  352 + LIB3270_EXPORT int lib3270_ft_set_blksize(H3270 *hSession, int blksize)
  353 + {
  354 + CHECK_SESSION_HANDLE(hSession);
  355 +
  356 + if(!hSession->ft)
  357 + return errno = EINVAL;
  358 +
  359 +
  360 + return 0;
  361 + }
  362 +
  363 + LIB3270_EXPORT int lib3270_ft_set_primspace(H3270 *hSession, int primspace)
  364 + {
  365 + CHECK_SESSION_HANDLE(hSession);
  366 +
  367 + if(!hSession->ft)
  368 + return errno = EINVAL;
  369 +
  370 +
  371 + return 0;
  372 + }
  373 +
  374 + LIB3270_EXPORT int lib3270_ft_set_secspace(H3270 *hSession, int secspace)
  375 + {
  376 + CHECK_SESSION_HANDLE(hSession);
  377 +
  378 + if(!hSession->ft)
  379 + return errno = EINVAL;
  380 +
  381 +
  382 + return 0;
  383 + }
  384 +
  385 + LIB3270_EXPORT int lib3270_ft_set_option(H3270 *hSession, LIB3270_FT_OPTION option)
  386 + {
  387 + CHECK_SESSION_HANDLE(hSession);
  388 +
  389 + if(!hSession->ft)
  390 + return errno = EINVAL;
  391 +
  392 +
  393 + return 0;
  394 + }
  395 +
342 LIB3270_EXPORT int lib3270_reset_ft_callbacks(H3270 *hSession) 396 LIB3270_EXPORT int lib3270_reset_ft_callbacks(H3270 *hSession)
343 { 397 {
344 CHECK_SESSION_HANDLE(hSession); 398 CHECK_SESSION_HANDLE(hSession);
src/core/ft/ft_dft.c
@@ -42,6 +42,7 @@ @@ -42,6 +42,7 @@
42 #endif // WIN32 42 #endif // WIN32
43 43
44 #include <lib3270.h> 44 #include <lib3270.h>
  45 +#include <lib3270/filetransfer.h>
45 #include <internals.h> 46 #include <internals.h>
46 47
47 #if defined(X3270_FT) /*[*/ 48 #if defined(X3270_FT) /*[*/
@@ -375,7 +376,7 @@ static void dft_get_request(H3270 *hSession) @@ -375,7 +376,7 @@ static void dft_get_request(H3270 *hSession)
375 } 376 }
376 377
377 /* Read a buffer's worth. */ 378 /* Read a buffer's worth. */
378 - set_dft_buffersize(hSession); 379 + lib3270_set_dft_buffersize(hSession,hSession->dft_buffersize);
379 space3270out(hSession,hSession->dft_buffersize); 380 space3270out(hSession,hSession->dft_buffersize);
380 numbytes = hSession->dft_buffersize - 27; /* always read 5 bytes less than we're allowed */ 381 numbytes = hSession->dft_buffersize - 27; /* always read 5 bytes less than we're allowed */
381 bufptr = hSession->output.buf + 17; 382 bufptr = hSession->output.buf + 17;
@@ -589,9 +590,7 @@ void dft_read_modified(H3270 *hSession) @@ -589,9 +590,7 @@ void dft_read_modified(H3270 *hSession)
589 } 590 }
590 } 591 }
591 592
592 -/**  
593 - * Update the buffersize for generating a Query Reply.  
594 - */ 593 +/*
595 void set_dft_buffersize(H3270 *hSession) 594 void set_dft_buffersize(H3270 *hSession)
596 { 595 {
597 if (hSession->dft_buffersize == 0) 596 if (hSession->dft_buffersize == 0)
@@ -603,6 +602,25 @@ void set_dft_buffersize(H3270 *hSession) @@ -603,6 +602,25 @@ void set_dft_buffersize(H3270 *hSession)
603 if (hSession->dft_buffersize < DFT_MIN_BUF) 602 if (hSession->dft_buffersize < DFT_MIN_BUF)
604 hSession->dft_buffersize = DFT_MIN_BUF; 603 hSession->dft_buffersize = DFT_MIN_BUF;
605 } 604 }
606 - 605 +*/
607 606
608 #endif /*]*/ 607 #endif /*]*/
  608 +
  609 + LIB3270_EXPORT int lib3270_set_dft_buffersize(H3270 *hSession, int dft_buffersize)
  610 + {
  611 + CHECK_SESSION_HANDLE(hSession);
  612 +
  613 + hSession->dft_buffersize = dft_buffersize;
  614 +
  615 + if (hSession->dft_buffersize == 0)
  616 + hSession->dft_buffersize = DFT_BUF;
  617 +
  618 + if (hSession->dft_buffersize > DFT_MAX_BUF)
  619 + hSession->dft_buffersize = DFT_MAX_BUF;
  620 +
  621 + if (hSession->dft_buffersize < DFT_MIN_BUF)
  622 + hSession->dft_buffersize = DFT_MIN_BUF;
  623 +
  624 + return 0;
  625 + }
  626 +
@@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
37 */ 37 */
38 38
39 #include <internals.h> 39 #include <internals.h>
  40 +#include <lib3270/filetransfer.h>
40 #include <lib3270/trace.h> 41 #include <lib3270/trace.h>
41 42
42 #include <errno.h> 43 #include <errno.h>
@@ -997,7 +998,7 @@ static void do_qr_charsets(H3270 *hSession) @@ -997,7 +998,7 @@ static void do_qr_charsets(H3270 *hSession)
997 #if defined(X3270_FT) /*[*/ 998 #if defined(X3270_FT) /*[*/
998 static void do_qr_ddm(H3270 *hSession) 999 static void do_qr_ddm(H3270 *hSession)
999 { 1000 {
1000 - set_dft_buffersize(hSession); 1001 + lib3270_set_dft_buffersize(hSession,hSession->dft_buffersize);
1001 1002
1002 trace_ds(hSession,"> QueryReply(DistributedDataManagement)\n"); 1003 trace_ds(hSession,"> QueryReply(DistributedDataManagement)\n");
1003 space3270out(hSession,8); 1004 space3270out(hSession,8);
src/include/ft_dftc.h
@@ -16,4 +16,4 @@ @@ -16,4 +16,4 @@
16 16
17 LIB3270_INTERNAL void ft_dft_data(H3270 *hSession, unsigned char *data, int length); 17 LIB3270_INTERNAL void ft_dft_data(H3270 *hSession, unsigned char *data, int length);
18 LIB3270_INTERNAL void dft_read_modified(H3270 *hSession); 18 LIB3270_INTERNAL void dft_read_modified(H3270 *hSession);
19 -LIB3270_INTERNAL void set_dft_buffersize(H3270 *hSession); 19 +//LIB3270_INTERNAL void set_dft_buffersize(H3270 *hSession);
src/include/lib3270/filetransfer.h
@@ -196,6 +196,19 @@ @@ -196,6 +196,19 @@
196 196
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 + LIB3270_EXPORT int lib3270_ft_set_lrecl(H3270 *hSession, int lrecl);
  200 + LIB3270_EXPORT int lib3270_ft_set_blksize(H3270 *hSession, int blksize);
  201 + LIB3270_EXPORT int lib3270_ft_set_primspace(H3270 *hSession, int primspace);
  202 + LIB3270_EXPORT int lib3270_ft_set_secspace(H3270 *hSession, int secspace);
  203 +
  204 + /**
  205 + * @brief Update the buffersize for generating a Query Reply.
  206 + */
  207 + LIB3270_EXPORT int lib3270_set_dft_buffersize(H3270 *hSession, int dft_buffersize);
  208 +
  209 +
  210 + LIB3270_EXPORT int lib3270_ft_set_option(H3270 *hSession, LIB3270_FT_OPTION option);
  211 +
199 /** 212 /**
200 * @brief Send file. 213 * @brief Send file.
201 * 214 *