Commit 770f6a8e3e5fa339feea7cf0a3d21786c803d3f0

Authored by perry.werneck@gmail.com
1 parent c8301151

Mais ajustes para multi-sessão

src/include/lib3270/session.h
@@ -253,6 +253,9 @@ @@ -253,6 +253,9 @@
253 LIB3270_TA * ta_head; 253 LIB3270_TA * ta_head;
254 LIB3270_TA * ta_tail; 254 LIB3270_TA * ta_tail;
255 255
  256 + // ft_dft.c
  257 + int dft_buffersize; /**< Buffer size (LIMIN, LIMOUT) */
  258 +
256 // Widget info 259 // Widget info
257 void * widget; 260 void * widget;
258 261
src/lib3270/ctlr.c
@@ -581,7 +581,7 @@ void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all) @@ -581,7 +581,7 @@ void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all)
581 #if defined(X3270_FT) /*[*/ 581 #if defined(X3270_FT) /*[*/
582 if (aid_byte == AID_SF) 582 if (aid_byte == AID_SF)
583 { 583 {
584 - dft_read_modified(); 584 + dft_read_modified(hSession);
585 return; 585 return;
586 } 586 }
587 #endif /*]*/ 587 #endif /*]*/
@@ -765,8 +765,9 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) @@ -765,8 +765,9 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte)
765 unsigned char current_cs = 0x00; 765 unsigned char current_cs = 0x00;
766 766
767 #if defined(X3270_FT) /*[*/ 767 #if defined(X3270_FT) /*[*/
768 - if (aid_byte == AID_SF) {  
769 - dft_read_modified(); 768 + if (aid_byte == AID_SF)
  769 + {
  770 + dft_read_modified(hSession);
770 return; 771 return;
771 } 772 }
772 #endif /*]*/ 773 #endif /*]*/
src/lib3270/ft.c
@@ -239,8 +239,8 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); @@ -239,8 +239,8 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
239 } 239 }
240 240
241 // Set options 241 // Set options
242 - dft_buffersize = dft;  
243 - set_dft_buffersize(); 242 + session->dft_buffersize = dft;
  243 + set_dft_buffersize(session);
244 244
245 // Initialize ft control structure. 245 // Initialize ft control structure.
246 ft_last_cr = False; 246 ft_last_cr = False;
src/lib3270/ft_dft.c
@@ -77,7 +77,7 @@ struct data_buffer { @@ -77,7 +77,7 @@ struct data_buffer {
77 }; 77 };
78 78
79 /* Globals. */ 79 /* Globals. */
80 -int dft_buffersize = 0; /* Buffer size (LIMIN, LIMOUT) */ 80 +// int dft_buffersize = 0; /* Buffer size (LIMIN, LIMOUT) */
81 81
82 /* Statics. */ 82 /* Statics. */
83 static Boolean message_flag = False; /* Open Request for msg received */ 83 static Boolean message_flag = False; /* Open Request for msg received */
@@ -98,9 +98,11 @@ static void dft_open_request(unsigned short len, unsigned char *cp); @@ -98,9 +98,11 @@ static void dft_open_request(unsigned short len, unsigned char *cp);
98 static void dft_set_cur_req(void); 98 static void dft_set_cur_req(void);
99 static int filter_len(char *s, register int len); 99 static int filter_len(char *s, register int len);
100 100
101 -/* Process a Transfer Data structured field from the host. */  
102 -void  
103 -ft_dft_data(unsigned char *data, int length unused) 101 +/**
  102 + * Process a Transfer Data structured field from the host.
  103 + *
  104 + */
  105 +void ft_dft_data(H3270 *hSession, unsigned char *data, int length unused)
104 { 106 {
105 struct data_buffer *data_bufr = (struct data_buffer *)data; 107 struct data_buffer *data_bufr = (struct data_buffer *)data;
106 unsigned short data_length, data_type; 108 unsigned short data_length, data_type;
@@ -353,9 +355,9 @@ dft_get_request(void) @@ -353,9 +355,9 @@ dft_get_request(void)
353 } 355 }
354 356
355 /* Read a buffer's worth. */ 357 /* Read a buffer's worth. */
356 - set_dft_buffersize();  
357 - space3270out(&h3270,dft_buffersize);  
358 - numbytes = dft_buffersize - 27; /* always read 5 bytes less than we're allowed */ 358 + set_dft_buffersize(&h3270);
  359 + space3270out(&h3270,h3270.dft_buffersize);
  360 + numbytes = h3270.dft_buffersize - 27; /* always read 5 bytes less than we're allowed */
359 bufptr = h3270.obuf + 17; 361 bufptr = h3270.obuf + 17;
360 while (!dft_eof && numbytes) { 362 while (!dft_eof && numbytes) {
361 if (ascii_flag && cr_flag) { 363 if (ascii_flag && cr_flag) {
@@ -528,35 +530,35 @@ filter_len(char *s, register int len) @@ -528,35 +530,35 @@ filter_len(char *s, register int len)
528 return t - s; 530 return t - s;
529 } 531 }
530 532
531 -/* Processes a Read Modified command when there is upload data pending. */  
532 -void  
533 -dft_read_modified(void) 533 +/**
  534 + * Processes a Read Modified command when there is upload data pending.
  535 + */
  536 +void dft_read_modified(H3270 *hSession)
534 { 537 {
535 if (dft_savebuf_len) 538 if (dft_savebuf_len)
536 { 539 {
537 - trace_ds(&h3270,"> WriteStructuredField FileTransferData\n");  
538 - h3270.obptr = h3270.obuf;  
539 - space3270out(&h3270,dft_savebuf_len);  
540 - memcpy(h3270.obptr, dft_savebuf, dft_savebuf_len);  
541 - h3270.obptr += dft_savebuf_len;  
542 - net_output(&h3270); 540 + trace_ds(hSession,"> WriteStructuredField FileTransferData\n");
  541 + hSession->obptr = hSession->obuf;
  542 + space3270out(hSession,dft_savebuf_len);
  543 + memcpy(hSession->obptr, dft_savebuf, dft_savebuf_len);
  544 + hSession->obptr += dft_savebuf_len;
  545 + net_output(hSession);
543 } 546 }
544 } 547 }
545 548
546 -/* Update the buffersize for generating a Query Reply. */  
547 -void  
548 -set_dft_buffersize(void) 549 +/**
  550 + * Update the buffersize for generating a Query Reply.
  551 + */
  552 +void set_dft_buffersize(H3270 *hSession)
549 { 553 {
550 - if (dft_buffersize == 0)  
551 - {  
552 -// dft_buffersize = appres.dft_buffer_size;  
553 -// if (dft_buffersize == 0)  
554 - dft_buffersize = DFT_BUF;  
555 - }  
556 - if (dft_buffersize > DFT_MAX_BUF)  
557 - dft_buffersize = DFT_MAX_BUF;  
558 - if (dft_buffersize < DFT_MIN_BUF)  
559 - dft_buffersize = DFT_MIN_BUF; 554 + if (hSession->dft_buffersize == 0)
  555 + hSession->dft_buffersize = DFT_BUF;
  556 +
  557 + if (hSession->dft_buffersize > DFT_MAX_BUF)
  558 + hSession->dft_buffersize = DFT_MAX_BUF;
  559 +
  560 + if (hSession->dft_buffersize < DFT_MIN_BUF)
  561 + hSession->dft_buffersize = DFT_MIN_BUF;
560 } 562 }
561 563
562 564
src/lib3270/ft_dftc.h
@@ -14,6 +14,6 @@ @@ -14,6 +14,6 @@
14 * for more details. 14 * for more details.
15 */ 15 */
16 16
17 -LIB3270_INTERNAL void ft_dft_data(unsigned char *data, int length);  
18 -LIB3270_INTERNAL void dft_read_modified(void);  
19 -LIB3270_INTERNAL void set_dft_buffersize(void); 17 +LIB3270_INTERNAL void ft_dft_data(H3270 *hSession, unsigned char *data, int length);
  18 +LIB3270_INTERNAL void dft_read_modified(H3270 *hSession);
  19 +LIB3270_INTERNAL void set_dft_buffersize(H3270 *hSession);
src/lib3270/globals.h
@@ -144,11 +144,12 @@ enum iaction { @@ -144,11 +144,12 @@ enum iaction {
144 144
145 LIB3270_INTERNAL H3270 h3270; 145 LIB3270_INTERNAL H3270 h3270;
146 146
147 -#if defined(X3270_DISPLAY) /*[*/ 147 +/*
  148 +#if defined(X3270_DISPLAY)
148 LIB3270_INTERNAL Atom a_3270, a_registry, a_encoding; 149 LIB3270_INTERNAL Atom a_3270, a_registry, a_encoding;
149 LIB3270_INTERNAL XtAppContext appcontext; 150 LIB3270_INTERNAL XtAppContext appcontext;
150 -#endif /*]*/  
151 - 151 +#endif
  152 +*/
152 153
153 // Version strings 154 // Version strings
154 LIB3270_INTERNAL const char * build; 155 LIB3270_INTERNAL const char * build;
@@ -164,12 +165,12 @@ LIB3270_INTERNAL const char * build_rpq_revision; @@ -164,12 +165,12 @@ LIB3270_INTERNAL const char * build_rpq_revision;
164 LIB3270_INTERNAL Boolean dbcs; 165 LIB3270_INTERNAL Boolean dbcs;
165 #endif /*]*/ 166 #endif /*]*/
166 167
167 -#if defined(X3270_FT) /*[*/  
168 - LIB3270_INTERNAL int dft_buffersize;  
169 -#endif /*]*/ 168 +// #if defined(X3270_FT) /*[*/
  169 +// LIB3270_INTERNAL int dft_buffersize;
  170 +// #endif /*]*/
170 171
171 // LIB3270_INTERNAL char *efontname; 172 // LIB3270_INTERNAL char *efontname;
172 -LIB3270_INTERNAL Boolean ever_3270; 173 +// LIB3270_INTERNAL Boolean ever_3270;
173 // LIB3270_INTERNAL Boolean exiting; 174 // LIB3270_INTERNAL Boolean exiting;
174 175
175 /* 176 /*
@@ -218,13 +219,13 @@ LIB3270_INTERNAL Boolean ever_3270; @@ -218,13 +219,13 @@ LIB3270_INTERNAL Boolean ever_3270;
218 // LIB3270_INTERNAL char *qualified_host; 219 // LIB3270_INTERNAL char *qualified_host;
219 // LIB3270_INTERNAL char *reconnect_host; 220 // LIB3270_INTERNAL char *reconnect_host;
220 // LIB3270_INTERNAL int screen_depth; 221 // LIB3270_INTERNAL int screen_depth;
221 -LIB3270_INTERNAL Boolean scroll_initted; 222 +// LIB3270_INTERNAL Boolean scroll_initted;
222 223
223 //#if defined(HAVE_LIBSSL) /*[*/ 224 //#if defined(HAVE_LIBSSL) /*[*/
224 // LIB3270_INTERNAL Boolean secure_connection; 225 // LIB3270_INTERNAL Boolean secure_connection;
225 //#endif /*]*/ 226 //#endif /*]*/
226 227
227 -LIB3270_INTERNAL Boolean shifted; 228 +// LIB3270_INTERNAL Boolean shifted;
228 // LIB3270_INTERNAL Boolean ssl_host; 229 // LIB3270_INTERNAL Boolean ssl_host;
229 LIB3270_INTERNAL Boolean *standard_font; 230 LIB3270_INTERNAL Boolean *standard_font;
230 // LIB3270_INTERNAL Boolean std_ds_host; 231 // LIB3270_INTERNAL Boolean std_ds_host;
src/lib3270/sf.c
@@ -214,7 +214,7 @@ write_structured_field(unsigned char buf[], int buflen) @@ -214,7 +214,7 @@ write_structured_field(unsigned char buf[], int buflen)
214 #if defined(X3270_FT) /*[*/ 214 #if defined(X3270_FT) /*[*/
215 case SF_TRANSFER_DATA: /* File transfer data */ 215 case SF_TRANSFER_DATA: /* File transfer data */
216 trace_ds(&h3270,"FileTransferData"); 216 trace_ds(&h3270,"FileTransferData");
217 - ft_dft_data(cp, (int)fieldlen); 217 + ft_dft_data(&h3270,cp, (int)fieldlen);
218 break; 218 break;
219 #endif /*]*/ 219 #endif /*]*/
220 default: 220 default:
@@ -951,14 +951,14 @@ do_qr_charsets(void) @@ -951,14 +951,14 @@ do_qr_charsets(void)
951 static void 951 static void
952 do_qr_ddm(void) 952 do_qr_ddm(void)
953 { 953 {
954 - set_dft_buffersize(); 954 + set_dft_buffersize(&h3270);
955 955
956 trace_ds(&h3270,"> QueryReply(DistributedDataManagement)\n"); 956 trace_ds(&h3270,"> QueryReply(DistributedDataManagement)\n");
957 space3270out(&h3270,8); 957 space3270out(&h3270,8);
958 - SET16(h3270.obptr,0); /* set reserved field to 0 */  
959 - SET16(h3270.obptr, dft_buffersize); /* set inbound length limit INLIM */  
960 - SET16(h3270.obptr, dft_buffersize); /* set outbound length limit OUTLIM */  
961 - SET16(h3270.obptr, 0x0101); /* NSS=01, DDMSS=01 */ 958 + SET16(h3270.obptr,0); /* set reserved field to 0 */
  959 + SET16(h3270.obptr, h3270.dft_buffersize); /* set inbound length limit INLIM */
  960 + SET16(h3270.obptr, h3270.dft_buffersize); /* set outbound length limit OUTLIM */
  961 + SET16(h3270.obptr, 0x0101); /* NSS=01, DDMSS=01 */
962 } 962 }
963 #endif /*]*/ 963 #endif /*]*/
964 964