Commit b500a0c9ec560a2865cd2642b5e4fcb8fe487312
1 parent
088fbe3c
Exists in
master
and in
3 other branches
Splitting property set/get methods.
Showing
8 changed files
with
830 additions
and
597 deletions
Show diff stats
Makefile.in
@@ -36,6 +36,7 @@ SOURCES= \ | @@ -36,6 +36,7 @@ SOURCES= \ | ||
36 | $(wildcard src/core/ft/*.c) \ | 36 | $(wildcard src/core/ft/*.c) \ |
37 | $(wildcard src/core/@OSNAME@/*.rc) \ | 37 | $(wildcard src/core/@OSNAME@/*.rc) \ |
38 | $(wildcard src/core/@OSNAME@/*.c) \ | 38 | $(wildcard src/core/@OSNAME@/*.c) \ |
39 | + $(wildcard src/core/properties/*.c) \ | ||
39 | $(wildcard src/selection/*.c) \ | 40 | $(wildcard src/selection/*.c) \ |
40 | $(wildcard src/ssl/*.c) \ | 41 | $(wildcard src/ssl/*.c) \ |
41 | $(wildcard src/ssl/@OSNAME@/*.c) \ | 42 | $(wildcard src/ssl/@OSNAME@/*.c) \ |
lib3270.cbp
@@ -122,7 +122,19 @@ | @@ -122,7 +122,19 @@ | ||
122 | <Unit filename="src/core/printer.c"> | 122 | <Unit filename="src/core/printer.c"> |
123 | <Option compilerVar="CC" /> | 123 | <Option compilerVar="CC" /> |
124 | </Unit> | 124 | </Unit> |
125 | - <Unit filename="src/core/properties.c"> | 125 | + <Unit filename="src/core/properties/boolean.c"> |
126 | + <Option compilerVar="CC" /> | ||
127 | + </Unit> | ||
128 | + <Unit filename="src/core/properties/properties.c"> | ||
129 | + <Option compilerVar="CC" /> | ||
130 | + </Unit> | ||
131 | + <Unit filename="src/core/properties/signed.c"> | ||
132 | + <Option compilerVar="CC" /> | ||
133 | + </Unit> | ||
134 | + <Unit filename="src/core/properties/string.c"> | ||
135 | + <Option compilerVar="CC" /> | ||
136 | + </Unit> | ||
137 | + <Unit filename="src/core/properties/unsigned.c"> | ||
126 | <Option compilerVar="CC" /> | 138 | <Option compilerVar="CC" /> |
127 | </Unit> | 139 | </Unit> |
128 | <Unit filename="src/core/resources.c"> | 140 | <Unit filename="src/core/resources.c"> |
src/core/properties.c
@@ -1,596 +0,0 @@ | @@ -1,596 +0,0 @@ | ||
1 | -/* | ||
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | - * | ||
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | - * | ||
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | - * Free Software Foundation. | ||
11 | - * | ||
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | - * obter mais detalhes. | ||
16 | - * | ||
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | - * | ||
21 | - * Este programa está nomeado como - e possui - linhas de código. | ||
22 | - * | ||
23 | - * Contatos: | ||
24 | - * | ||
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | - * | ||
28 | - */ | ||
29 | - | ||
30 | -/** | ||
31 | - * @brief This module handles the properties get/set methods. | ||
32 | - */ | ||
33 | - | ||
34 | - #include <config.h> | ||
35 | - #include <lib3270-internals.h> | ||
36 | - #include <string.h> | ||
37 | - #include <lib3270.h> | ||
38 | - #include <lib3270/properties.h> | ||
39 | - #include <lib3270/keyboard.h> | ||
40 | - | ||
41 | - static int lib3270_get_connection_state_as_int(H3270 *hSession) | ||
42 | - { | ||
43 | - return (int) lib3270_get_connection_state(hSession); | ||
44 | - } | ||
45 | - | ||
46 | - static int lib3270_get_program_message_as_int(H3270 *hSession) | ||
47 | - { | ||
48 | - return (int) lib3270_get_program_message(hSession); | ||
49 | - } | ||
50 | - | ||
51 | - int lib3270_is_starting(H3270 *hSession) | ||
52 | - { | ||
53 | - return hSession->starting != 0; | ||
54 | - } | ||
55 | - | ||
56 | - unsigned int lib3270_get_kybdlock_as_int(H3270 *hSession) | ||
57 | - { | ||
58 | - return (unsigned int) lib3270_get_keyboard_lock_state(hSession); | ||
59 | - } | ||
60 | - | ||
61 | - const LIB3270_INT_PROPERTY * lib3270_get_boolean_properties_list(void) | ||
62 | - { | ||
63 | - | ||
64 | - static const LIB3270_INT_PROPERTY properties[] = { | ||
65 | - { | ||
66 | - "ready", // Property name. | ||
67 | - N_( "Is terminal ready" ), // Property description. | ||
68 | - lib3270_is_ready, // Get value. | ||
69 | - NULL // Set value. | ||
70 | - }, | ||
71 | - | ||
72 | - { | ||
73 | - "connected", // Property name. | ||
74 | - N_( "Is terminal connected" ), // Property description. | ||
75 | - lib3270_is_connected, // Get value. | ||
76 | - NULL // Set value. | ||
77 | - }, | ||
78 | - | ||
79 | - { | ||
80 | - "secure", // Property name. | ||
81 | - N_( "Is connection secure" ), // Property description. | ||
82 | - lib3270_is_secure, // Get value. | ||
83 | - NULL // Set value. | ||
84 | - }, | ||
85 | - | ||
86 | - { | ||
87 | - "tso", // Property name. | ||
88 | - N_( "Non zero if the host is TSO." ), // Property description. | ||
89 | - lib3270_is_tso, // Get value. | ||
90 | - lib3270_set_tso // Set value. | ||
91 | - }, | ||
92 | - | ||
93 | - { | ||
94 | - "as400", // Property name. | ||
95 | - N_( "Non zero if the host is AS400." ), // Property description. | ||
96 | - lib3270_is_as400, // Get value. | ||
97 | - lib3270_set_as400 // Set value. | ||
98 | - }, | ||
99 | - | ||
100 | - { | ||
101 | - "pconnected", // Property name. | ||
102 | - "", // Property description. | ||
103 | - lib3270_pconnected, // Get value. | ||
104 | - NULL // Set value. | ||
105 | - }, | ||
106 | - | ||
107 | - { | ||
108 | - "half_connected", // Property name. | ||
109 | - "", // Property description. | ||
110 | - lib3270_half_connected, // Get value. | ||
111 | - NULL // Set value. | ||
112 | - }, | ||
113 | - | ||
114 | - { | ||
115 | - "neither", // Property name. | ||
116 | - "", // Property description. | ||
117 | - lib3270_in_neither, // Get value. | ||
118 | - NULL // Set value. | ||
119 | - }, | ||
120 | - | ||
121 | - { | ||
122 | - "ansi", // Property name. | ||
123 | - "", // Property description. | ||
124 | - lib3270_in_ansi, // Get value. | ||
125 | - NULL // Set value. | ||
126 | - }, | ||
127 | - | ||
128 | - { | ||
129 | - "tn3270", // Property name. | ||
130 | - N_( "State is 3270, TN3270e or SSCP" ), // Property description. | ||
131 | - lib3270_in_3270, // Get value. | ||
132 | - NULL // Set value. | ||
133 | - }, | ||
134 | - | ||
135 | - { | ||
136 | - "sscp", // Property name. | ||
137 | - "", // Property description. | ||
138 | - lib3270_in_sscp, // Get value. | ||
139 | - NULL // Set value. | ||
140 | - }, | ||
141 | - | ||
142 | - { | ||
143 | - "tn3270e", // Property name. | ||
144 | - "", // Property description. | ||
145 | - lib3270_in_tn3270e, // Get value. | ||
146 | - NULL // Set value. | ||
147 | - }, | ||
148 | - | ||
149 | - { | ||
150 | - "e", // Property name. | ||
151 | - N_( "Is terminal in the INITIAL_E state?" ), // Property description. | ||
152 | - lib3270_in_e, // Get value. | ||
153 | - NULL // Set value. | ||
154 | - }, | ||
155 | - | ||
156 | - { | ||
157 | - "has_selection", // Property name. | ||
158 | - N_( "Has selected area" ), // Property description. | ||
159 | - lib3270_has_selection, // Get value. | ||
160 | - NULL // Set value. | ||
161 | - }, | ||
162 | - | ||
163 | - { | ||
164 | - "starting", // Property name. | ||
165 | - N_( "Is starting (no first screen)?" ), // Property description. | ||
166 | - lib3270_is_starting, // Get value. | ||
167 | - NULL // Set value. | ||
168 | - }, | ||
169 | - | ||
170 | - { | ||
171 | - "formatted", // Property name. | ||
172 | - N_( "Formatted screen" ), // Property description. | ||
173 | - lib3270_get_is_formatted, // Get value. | ||
174 | - NULL // Set value. | ||
175 | - }, | ||
176 | - | ||
177 | - { | ||
178 | - "oerrlock", // Property name. | ||
179 | - N_( "Lock keyboard on operator error" ), // Property description. | ||
180 | - lib3270_get_lock_on_operator_error, // Get value. | ||
181 | - lib3270_set_lock_on_operator_error // Set value. | ||
182 | - }, | ||
183 | - | ||
184 | - /* | ||
185 | - { | ||
186 | - "", // Property name. | ||
187 | - "", // Property description. | ||
188 | - NULL, // Get value. | ||
189 | - NULL // Set value. | ||
190 | - }, | ||
191 | - */ | ||
192 | - | ||
193 | - { | ||
194 | - NULL, | ||
195 | - NULL, | ||
196 | - NULL, | ||
197 | - NULL | ||
198 | - } | ||
199 | - | ||
200 | - }; | ||
201 | - | ||
202 | - return properties; | ||
203 | - | ||
204 | - } | ||
205 | - | ||
206 | - const LIB3270_UINT_PROPERTY * lib3270_get_unsigned_properties_list(void) | ||
207 | - { | ||
208 | - | ||
209 | - static const LIB3270_UINT_PROPERTY properties[] = { | ||
210 | - | ||
211 | - { | ||
212 | - "cursor_address", // Property name. | ||
213 | - N_( "Cursor address" ), // Property description. | ||
214 | - lib3270_get_cursor_address, // Get value. | ||
215 | - lib3270_set_cursor_address // Set value. | ||
216 | - }, | ||
217 | - | ||
218 | - { | ||
219 | - "width", // Property name. | ||
220 | - N_( "Current screen width in columns" ), // Property description. | ||
221 | - lib3270_get_width, // Get value. | ||
222 | - NULL // Set value. | ||
223 | - }, | ||
224 | - | ||
225 | - { | ||
226 | - "height", // Property name. | ||
227 | - N_( "Current screen height in rows" ), // Property description. | ||
228 | - lib3270_get_height, // Get value. | ||
229 | - NULL // Set value. | ||
230 | - }, | ||
231 | - | ||
232 | - { | ||
233 | - "length", // Property name. | ||
234 | - N_( "Screen buffer length in bytes" ), // Property description. | ||
235 | - lib3270_get_length, // Get value. | ||
236 | - NULL // Set value. | ||
237 | - }, | ||
238 | - | ||
239 | - { | ||
240 | - "unlock_delay", // Property name. | ||
241 | - N_( "The delay between the host unlocking the keyboard and the actual unlock" ), // Property description. | ||
242 | - lib3270_get_unlock_delay, // Get value. | ||
243 | - lib3270_set_unlock_delay // Set value. | ||
244 | - }, | ||
245 | - | ||
246 | - { | ||
247 | - "kybdlock", // Property name. | ||
248 | - N_( "Keyboard lock status" ), // Property description. | ||
249 | - lib3270_get_kybdlock_as_int, // Get value. | ||
250 | - NULL // Set value. | ||
251 | - }, | ||
252 | - | ||
253 | - /* | ||
254 | - { | ||
255 | - "", // Property name. | ||
256 | - "", // Property description. | ||
257 | - NULL, // Get value. | ||
258 | - NULL // Set value. | ||
259 | - }, | ||
260 | - */ | ||
261 | - | ||
262 | - { | ||
263 | - NULL, | ||
264 | - NULL, | ||
265 | - NULL, | ||
266 | - NULL | ||
267 | - } | ||
268 | - }; | ||
269 | - | ||
270 | - return properties; | ||
271 | - } | ||
272 | - | ||
273 | - static int lib3270_get_ssl_state_as_int(H3270 * hSession) | ||
274 | - { | ||
275 | - return (int) lib3270_get_ssl_state(hSession); | ||
276 | - } | ||
277 | - | ||
278 | - const LIB3270_INT_PROPERTY * lib3270_get_int_properties_list(void) | ||
279 | - { | ||
280 | - | ||
281 | - static const LIB3270_INT_PROPERTY properties[] = { | ||
282 | - | ||
283 | - { | ||
284 | - "model_number", // Property name. | ||
285 | - N_( "The model number" ), // Property description. | ||
286 | - lib3270_get_model_number, // Get value. | ||
287 | - NULL // Set value. | ||
288 | - }, | ||
289 | - | ||
290 | - { | ||
291 | - "color_type", // Property name. | ||
292 | - N_( "The color type" ), // Property description. | ||
293 | - lib3270_get_color_type, // Get value. | ||
294 | - lib3270_set_color_type // Set value. | ||
295 | - }, | ||
296 | - | ||
297 | - { | ||
298 | - "cstate", // Property name. | ||
299 | - N_( "Connection state" ), // Property description. | ||
300 | - lib3270_get_connection_state_as_int, // Get value. | ||
301 | - NULL // Set value. | ||
302 | - }, | ||
303 | - | ||
304 | - { | ||
305 | - "program_message", // Property name. | ||
306 | - N_( "Latest program message" ), // Property description. | ||
307 | - lib3270_get_program_message_as_int, // Get value. | ||
308 | - NULL // Set value. | ||
309 | - }, | ||
310 | - | ||
311 | - { | ||
312 | - "ssl_state", // Property name. | ||
313 | - N_( "ID of the session security state" ), // Property description. | ||
314 | - lib3270_get_ssl_state_as_int, // Get value. | ||
315 | - NULL // Set value. | ||
316 | - }, | ||
317 | - | ||
318 | - /* | ||
319 | - { | ||
320 | - "", // Property name. | ||
321 | - "", // Property description. | ||
322 | - NULL, // Get value. | ||
323 | - NULL // Set value. | ||
324 | - }, | ||
325 | - */ | ||
326 | - | ||
327 | - { | ||
328 | - NULL, | ||
329 | - NULL, | ||
330 | - NULL, | ||
331 | - NULL | ||
332 | - } | ||
333 | - }; | ||
334 | - | ||
335 | - return properties; | ||
336 | - } | ||
337 | - | ||
338 | - static const char * get_version(H3270 GNUC_UNUSED(*hSession)) | ||
339 | - { | ||
340 | - return lib3270_get_version(); | ||
341 | - } | ||
342 | - | ||
343 | - static const char * get_revision(H3270 GNUC_UNUSED(*hSession)) | ||
344 | - { | ||
345 | - return lib3270_get_revision(); | ||
346 | - } | ||
347 | - | ||
348 | - LIB3270_EXPORT const LIB3270_STRING_PROPERTY * lib3270_get_string_properties_list(void) | ||
349 | - { | ||
350 | - static const LIB3270_STRING_PROPERTY properties[] = { | ||
351 | - | ||
352 | - { | ||
353 | - "luname", // Property name. | ||
354 | - N_( "The name of the active LU" ), // Property description. | ||
355 | - lib3270_get_luname, // Get value. | ||
356 | - lib3270_set_luname // Set value. | ||
357 | - }, | ||
358 | - | ||
359 | - { | ||
360 | - "url", // Property name. | ||
361 | - N_( "URL of the current host" ), // Property description. | ||
362 | - lib3270_get_url, // Get value. | ||
363 | - lib3270_set_url // Set value. | ||
364 | - }, | ||
365 | - | ||
366 | - { | ||
367 | - "model", // Property name. | ||
368 | - N_( "Model name" ), // Property description. | ||
369 | - lib3270_get_model, // Get value. | ||
370 | - lib3270_set_model // Set value. | ||
371 | - }, | ||
372 | - | ||
373 | - { | ||
374 | - "host_type", // Property name. | ||
375 | - N_( "Host type name" ), // Property description. | ||
376 | - lib3270_get_host_type_name, // Get value. | ||
377 | - lib3270_set_host_type_by_name // Set value. | ||
378 | - }, | ||
379 | - | ||
380 | - { | ||
381 | - "host_charset", // Property name. | ||
382 | - N_( "Host charset" ), // Property description. | ||
383 | - lib3270_get_host_charset, // Get value. | ||
384 | - lib3270_set_host_charset // Set value. | ||
385 | - }, | ||
386 | - | ||
387 | - { | ||
388 | - "display_charset", // Property name. | ||
389 | - N_( "Display charset" ), // Property description. | ||
390 | - lib3270_get_display_charset, // Get value. | ||
391 | - NULL // Set value. | ||
392 | - }, | ||
393 | - | ||
394 | - { | ||
395 | - "version", // Property name. | ||
396 | - N_( "lib3270 version" ), // Property description. | ||
397 | - get_version, // Get value. | ||
398 | - NULL // Set value. | ||
399 | - }, | ||
400 | - | ||
401 | - { | ||
402 | - "revision", // Property name. | ||
403 | - N_( "lib3270 revision" ), // Property description. | ||
404 | - get_revision, // Get value. | ||
405 | - NULL // Set value. | ||
406 | - }, | ||
407 | - | ||
408 | - { | ||
409 | - "crlpath", // Property name. | ||
410 | - N_( "URL for the certificate revocation list" ), // Property description. | ||
411 | - lib3270_get_crl_url, // Get value. | ||
412 | - lib3270_set_crl_url, // Set value. | ||
413 | - }, | ||
414 | - | ||
415 | - { | ||
416 | - "default_host", // Property name. | ||
417 | - N_( "Default host URL" ), // Property description. | ||
418 | - lib3270_get_default_host, // Get value. | ||
419 | - NULL // Set value. | ||
420 | - }, | ||
421 | - | ||
422 | - { | ||
423 | - "sslmessage", // Property name. | ||
424 | - N_( "The security state" ), // Property description. | ||
425 | - lib3270_get_ssl_state_message, // Get value. | ||
426 | - NULL // Set value. | ||
427 | - }, | ||
428 | - | ||
429 | - { | ||
430 | - "ssldescription", // Property name. | ||
431 | - N_( "Description of the current security state" ), // Property description. | ||
432 | - lib3270_get_ssl_state_description, // Get value. | ||
433 | - NULL // Set value. | ||
434 | - }, | ||
435 | - | ||
436 | - /* | ||
437 | - { | ||
438 | - "", // Property name. | ||
439 | - "", // Property description. | ||
440 | - , // Get value. | ||
441 | - NULL // Set value. | ||
442 | - }, | ||
443 | - */ | ||
444 | - | ||
445 | - { | ||
446 | - NULL, | ||
447 | - NULL, | ||
448 | - NULL, | ||
449 | - NULL | ||
450 | - } | ||
451 | - | ||
452 | - }; | ||
453 | - | ||
454 | - return properties; | ||
455 | - | ||
456 | - } | ||
457 | - | ||
458 | -int lib3270_get_int_property(H3270 *hSession, const char *name, int seconds) | ||
459 | -{ | ||
460 | - size_t ix; | ||
461 | - const LIB3270_INT_PROPERTY * properties; | ||
462 | - | ||
463 | - if(seconds) | ||
464 | - { | ||
465 | - lib3270_wait_for_ready(hSession, seconds); | ||
466 | - } | ||
467 | - | ||
468 | - // Check for boolean properties | ||
469 | - properties = lib3270_get_boolean_properties_list(); | ||
470 | - for(ix = 0; properties[ix].name; ix++) | ||
471 | - { | ||
472 | - if(!strcasecmp(name,properties[ix].name)) | ||
473 | - { | ||
474 | - if(properties[ix].get) | ||
475 | - { | ||
476 | - return properties[ix].get(hSession); | ||
477 | - } | ||
478 | - else | ||
479 | - { | ||
480 | - errno = EPERM; | ||
481 | - return -1; | ||
482 | - } | ||
483 | - } | ||
484 | - | ||
485 | - | ||
486 | - } | ||
487 | - | ||
488 | - // Check for int properties | ||
489 | - properties = lib3270_get_int_properties_list(); | ||
490 | - for(ix = 0; properties[ix].name; ix++) | ||
491 | - { | ||
492 | - if(!strcasecmp(name,properties[ix].name)) | ||
493 | - { | ||
494 | - if(properties[ix].get) | ||
495 | - { | ||
496 | - return properties[ix].get(hSession); | ||
497 | - } | ||
498 | - else | ||
499 | - { | ||
500 | - errno = EPERM; | ||
501 | - return -1; | ||
502 | - } | ||
503 | - } | ||
504 | - | ||
505 | - | ||
506 | - } | ||
507 | - | ||
508 | - errno = ENOENT; | ||
509 | - return -1; | ||
510 | -} | ||
511 | - | ||
512 | -int lib3270_set_int_property(H3270 *hSession, const char *name, int value, int seconds) | ||
513 | -{ | ||
514 | - size_t ix; | ||
515 | - const LIB3270_INT_PROPERTY * properties; | ||
516 | - | ||
517 | - if(seconds) | ||
518 | - { | ||
519 | - lib3270_wait_for_ready(hSession, seconds); | ||
520 | - } | ||
521 | - | ||
522 | - // Check for boolean properties | ||
523 | - properties = lib3270_get_boolean_properties_list(); | ||
524 | - for(ix = 0; properties[ix].name; ix++) | ||
525 | - { | ||
526 | - if(!strcasecmp(name,properties[ix].name)) | ||
527 | - { | ||
528 | - if(properties[ix].set) | ||
529 | - { | ||
530 | - return properties[ix].set(hSession, value); | ||
531 | - } | ||
532 | - else | ||
533 | - { | ||
534 | - errno = EPERM; | ||
535 | - return -1; | ||
536 | - } | ||
537 | - } | ||
538 | - | ||
539 | - } | ||
540 | - | ||
541 | - // Check for INT Properties | ||
542 | - properties = lib3270_get_int_properties_list(); | ||
543 | - for(ix = 0; properties[ix].name; ix++) | ||
544 | - { | ||
545 | - if(!strcasecmp(name,properties[ix].name)) | ||
546 | - { | ||
547 | - if(properties[ix].set) | ||
548 | - { | ||
549 | - return properties[ix].set(hSession, value); | ||
550 | - } | ||
551 | - else | ||
552 | - { | ||
553 | - errno = EPERM; | ||
554 | - return -1; | ||
555 | - } | ||
556 | - } | ||
557 | - | ||
558 | - } | ||
559 | - | ||
560 | - errno = ENOENT; | ||
561 | - return -1; | ||
562 | - | ||
563 | -} | ||
564 | - | ||
565 | -int lib3270_set_string_property(H3270 *hSession, const char *name, const char * value, int seconds) | ||
566 | -{ | ||
567 | - size_t ix; | ||
568 | - | ||
569 | - if(seconds) | ||
570 | - { | ||
571 | - lib3270_wait_for_ready(hSession, seconds); | ||
572 | - } | ||
573 | - | ||
574 | - const LIB3270_STRING_PROPERTY * properties = lib3270_get_string_properties_list(); | ||
575 | - for(ix = 0; properties[ix].name; ix++) | ||
576 | - { | ||
577 | - if(!strcasecmp(name,properties[ix].name)) | ||
578 | - { | ||
579 | - if(properties[ix].set) | ||
580 | - { | ||
581 | - return properties[ix].set(hSession, value); | ||
582 | - } | ||
583 | - else | ||
584 | - { | ||
585 | - errno = EPERM; | ||
586 | - return -1; | ||
587 | - } | ||
588 | - } | ||
589 | - | ||
590 | - } | ||
591 | - | ||
592 | - errno = ENOENT; | ||
593 | - return -1; | ||
594 | - | ||
595 | -} | ||
596 | - |
@@ -0,0 +1,186 @@ | @@ -0,0 +1,186 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como - e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | + #include <config.h> | ||
31 | + #include <lib3270-internals.h> | ||
32 | + #include <string.h> | ||
33 | + #include <lib3270.h> | ||
34 | + #include <lib3270/properties.h> | ||
35 | + #include <lib3270/keyboard.h> | ||
36 | + | ||
37 | + int lib3270_is_starting(H3270 *hSession) | ||
38 | + { | ||
39 | + return hSession->starting != 0; | ||
40 | + } | ||
41 | + | ||
42 | + const LIB3270_INT_PROPERTY * lib3270_get_boolean_properties_list(void) | ||
43 | + { | ||
44 | + | ||
45 | + static const LIB3270_INT_PROPERTY properties[] = { | ||
46 | + { | ||
47 | + "ready", // Property name. | ||
48 | + N_( "Is terminal ready" ), // Property description. | ||
49 | + lib3270_is_ready, // Get value. | ||
50 | + NULL // Set value. | ||
51 | + }, | ||
52 | + | ||
53 | + { | ||
54 | + "connected", // Property name. | ||
55 | + N_( "Is terminal connected" ), // Property description. | ||
56 | + lib3270_is_connected, // Get value. | ||
57 | + NULL // Set value. | ||
58 | + }, | ||
59 | + | ||
60 | + { | ||
61 | + "secure", // Property name. | ||
62 | + N_( "Is connection secure" ), // Property description. | ||
63 | + lib3270_is_secure, // Get value. | ||
64 | + NULL // Set value. | ||
65 | + }, | ||
66 | + | ||
67 | + { | ||
68 | + "tso", // Property name. | ||
69 | + N_( "Non zero if the host is TSO." ), // Property description. | ||
70 | + lib3270_is_tso, // Get value. | ||
71 | + lib3270_set_tso // Set value. | ||
72 | + }, | ||
73 | + | ||
74 | + { | ||
75 | + "as400", // Property name. | ||
76 | + N_( "Non zero if the host is AS400." ), // Property description. | ||
77 | + lib3270_is_as400, // Get value. | ||
78 | + lib3270_set_as400 // Set value. | ||
79 | + }, | ||
80 | + | ||
81 | + { | ||
82 | + "pconnected", // Property name. | ||
83 | + "", // Property description. | ||
84 | + lib3270_pconnected, // Get value. | ||
85 | + NULL // Set value. | ||
86 | + }, | ||
87 | + | ||
88 | + { | ||
89 | + "half_connected", // Property name. | ||
90 | + "", // Property description. | ||
91 | + lib3270_half_connected, // Get value. | ||
92 | + NULL // Set value. | ||
93 | + }, | ||
94 | + | ||
95 | + { | ||
96 | + "neither", // Property name. | ||
97 | + "", // Property description. | ||
98 | + lib3270_in_neither, // Get value. | ||
99 | + NULL // Set value. | ||
100 | + }, | ||
101 | + | ||
102 | + { | ||
103 | + "ansi", // Property name. | ||
104 | + "", // Property description. | ||
105 | + lib3270_in_ansi, // Get value. | ||
106 | + NULL // Set value. | ||
107 | + }, | ||
108 | + | ||
109 | + { | ||
110 | + "tn3270", // Property name. | ||
111 | + N_( "State is 3270, TN3270e or SSCP" ), // Property description. | ||
112 | + lib3270_in_3270, // Get value. | ||
113 | + NULL // Set value. | ||
114 | + }, | ||
115 | + | ||
116 | + { | ||
117 | + "sscp", // Property name. | ||
118 | + "", // Property description. | ||
119 | + lib3270_in_sscp, // Get value. | ||
120 | + NULL // Set value. | ||
121 | + }, | ||
122 | + | ||
123 | + { | ||
124 | + "tn3270e", // Property name. | ||
125 | + "", // Property description. | ||
126 | + lib3270_in_tn3270e, // Get value. | ||
127 | + NULL // Set value. | ||
128 | + }, | ||
129 | + | ||
130 | + { | ||
131 | + "e", // Property name. | ||
132 | + N_( "Is terminal in the INITIAL_E state?" ), // Property description. | ||
133 | + lib3270_in_e, // Get value. | ||
134 | + NULL // Set value. | ||
135 | + }, | ||
136 | + | ||
137 | + { | ||
138 | + "has_selection", // Property name. | ||
139 | + N_( "Has selected area" ), // Property description. | ||
140 | + lib3270_has_selection, // Get value. | ||
141 | + NULL // Set value. | ||
142 | + }, | ||
143 | + | ||
144 | + { | ||
145 | + "starting", // Property name. | ||
146 | + N_( "Is starting (no first screen)?" ), // Property description. | ||
147 | + lib3270_is_starting, // Get value. | ||
148 | + NULL // Set value. | ||
149 | + }, | ||
150 | + | ||
151 | + { | ||
152 | + "formatted", // Property name. | ||
153 | + N_( "Formatted screen" ), // Property description. | ||
154 | + lib3270_get_is_formatted, // Get value. | ||
155 | + NULL // Set value. | ||
156 | + }, | ||
157 | + | ||
158 | + { | ||
159 | + "oerrlock", // Property name. | ||
160 | + N_( "Lock keyboard on operator error" ), // Property description. | ||
161 | + lib3270_get_lock_on_operator_error, // Get value. | ||
162 | + lib3270_set_lock_on_operator_error // Set value. | ||
163 | + }, | ||
164 | + | ||
165 | + /* | ||
166 | + { | ||
167 | + "", // Property name. | ||
168 | + "", // Property description. | ||
169 | + NULL, // Get value. | ||
170 | + NULL // Set value. | ||
171 | + }, | ||
172 | + */ | ||
173 | + | ||
174 | + { | ||
175 | + NULL, | ||
176 | + NULL, | ||
177 | + NULL, | ||
178 | + NULL | ||
179 | + } | ||
180 | + | ||
181 | + }; | ||
182 | + | ||
183 | + return properties; | ||
184 | + | ||
185 | + } | ||
186 | + |
@@ -0,0 +1,40 @@ | @@ -0,0 +1,40 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como - e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | +/** | ||
31 | + * @brief This module handles the properties get/set methods. | ||
32 | + */ | ||
33 | + | ||
34 | + #include <config.h> | ||
35 | + #include <lib3270-internals.h> | ||
36 | + #include <string.h> | ||
37 | + #include <lib3270.h> | ||
38 | + #include <lib3270/properties.h> | ||
39 | + #include <lib3270/keyboard.h> | ||
40 | + |
@@ -0,0 +1,219 @@ | @@ -0,0 +1,219 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como - e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | + #include <config.h> | ||
31 | + #include <lib3270-internals.h> | ||
32 | + #include <string.h> | ||
33 | + #include <lib3270.h> | ||
34 | + #include <lib3270/properties.h> | ||
35 | + #include <lib3270/keyboard.h> | ||
36 | + | ||
37 | + static int lib3270_get_connection_state_as_int(H3270 *hSession) | ||
38 | + { | ||
39 | + return (int) lib3270_get_connection_state(hSession); | ||
40 | + } | ||
41 | + | ||
42 | + static int lib3270_get_program_message_as_int(H3270 *hSession) | ||
43 | + { | ||
44 | + return (int) lib3270_get_program_message(hSession); | ||
45 | + } | ||
46 | + | ||
47 | + static int lib3270_get_ssl_state_as_int(H3270 * hSession) | ||
48 | + { | ||
49 | + return (int) lib3270_get_ssl_state(hSession); | ||
50 | + } | ||
51 | + | ||
52 | + const LIB3270_INT_PROPERTY * lib3270_get_int_properties_list(void) | ||
53 | + { | ||
54 | + | ||
55 | + static const LIB3270_INT_PROPERTY properties[] = { | ||
56 | + | ||
57 | + { | ||
58 | + "model_number", // Property name. | ||
59 | + N_( "The model number" ), // Property description. | ||
60 | + lib3270_get_model_number, // Get value. | ||
61 | + NULL // Set value. | ||
62 | + }, | ||
63 | + | ||
64 | + { | ||
65 | + "color_type", // Property name. | ||
66 | + N_( "The color type" ), // Property description. | ||
67 | + lib3270_get_color_type, // Get value. | ||
68 | + lib3270_set_color_type // Set value. | ||
69 | + }, | ||
70 | + | ||
71 | + { | ||
72 | + "cstate", // Property name. | ||
73 | + N_( "Connection state" ), // Property description. | ||
74 | + lib3270_get_connection_state_as_int, // Get value. | ||
75 | + NULL // Set value. | ||
76 | + }, | ||
77 | + | ||
78 | + { | ||
79 | + "program_message", // Property name. | ||
80 | + N_( "Latest program message" ), // Property description. | ||
81 | + lib3270_get_program_message_as_int, // Get value. | ||
82 | + NULL // Set value. | ||
83 | + }, | ||
84 | + | ||
85 | + { | ||
86 | + "ssl_state", // Property name. | ||
87 | + N_( "ID of the session security state" ), // Property description. | ||
88 | + lib3270_get_ssl_state_as_int, // Get value. | ||
89 | + NULL // Set value. | ||
90 | + }, | ||
91 | + | ||
92 | + /* | ||
93 | + { | ||
94 | + "", // Property name. | ||
95 | + "", // Property description. | ||
96 | + NULL, // Get value. | ||
97 | + NULL // Set value. | ||
98 | + }, | ||
99 | + */ | ||
100 | + | ||
101 | + { | ||
102 | + NULL, | ||
103 | + NULL, | ||
104 | + NULL, | ||
105 | + NULL | ||
106 | + } | ||
107 | + }; | ||
108 | + | ||
109 | + return properties; | ||
110 | + } | ||
111 | + | ||
112 | + | ||
113 | +int lib3270_get_int_property(H3270 *hSession, const char *name, int seconds) | ||
114 | +{ | ||
115 | + size_t ix; | ||
116 | + const LIB3270_INT_PROPERTY * properties; | ||
117 | + | ||
118 | + if(seconds) | ||
119 | + { | ||
120 | + lib3270_wait_for_ready(hSession, seconds); | ||
121 | + } | ||
122 | + | ||
123 | + // Check for boolean properties | ||
124 | + properties = lib3270_get_boolean_properties_list(); | ||
125 | + for(ix = 0; properties[ix].name; ix++) | ||
126 | + { | ||
127 | + if(!strcasecmp(name,properties[ix].name)) | ||
128 | + { | ||
129 | + if(properties[ix].get) | ||
130 | + { | ||
131 | + return properties[ix].get(hSession); | ||
132 | + } | ||
133 | + else | ||
134 | + { | ||
135 | + errno = EPERM; | ||
136 | + return -1; | ||
137 | + } | ||
138 | + } | ||
139 | + | ||
140 | + | ||
141 | + } | ||
142 | + | ||
143 | + // Check for int properties | ||
144 | + properties = lib3270_get_int_properties_list(); | ||
145 | + for(ix = 0; properties[ix].name; ix++) | ||
146 | + { | ||
147 | + if(!strcasecmp(name,properties[ix].name)) | ||
148 | + { | ||
149 | + if(properties[ix].get) | ||
150 | + { | ||
151 | + return properties[ix].get(hSession); | ||
152 | + } | ||
153 | + else | ||
154 | + { | ||
155 | + errno = EPERM; | ||
156 | + return -1; | ||
157 | + } | ||
158 | + } | ||
159 | + | ||
160 | + | ||
161 | + } | ||
162 | + | ||
163 | + errno = ENOENT; | ||
164 | + return -1; | ||
165 | +} | ||
166 | + | ||
167 | +int lib3270_set_int_property(H3270 *hSession, const char *name, int value, int seconds) | ||
168 | +{ | ||
169 | + size_t ix; | ||
170 | + const LIB3270_INT_PROPERTY * properties; | ||
171 | + | ||
172 | + if(seconds) | ||
173 | + { | ||
174 | + lib3270_wait_for_ready(hSession, seconds); | ||
175 | + } | ||
176 | + | ||
177 | + // Check for boolean properties | ||
178 | + properties = lib3270_get_boolean_properties_list(); | ||
179 | + for(ix = 0; properties[ix].name; ix++) | ||
180 | + { | ||
181 | + if(!strcasecmp(name,properties[ix].name)) | ||
182 | + { | ||
183 | + if(properties[ix].set) | ||
184 | + { | ||
185 | + return properties[ix].set(hSession, value); | ||
186 | + } | ||
187 | + else | ||
188 | + { | ||
189 | + errno = EPERM; | ||
190 | + return -1; | ||
191 | + } | ||
192 | + } | ||
193 | + | ||
194 | + } | ||
195 | + | ||
196 | + // Check for INT Properties | ||
197 | + properties = lib3270_get_int_properties_list(); | ||
198 | + for(ix = 0; properties[ix].name; ix++) | ||
199 | + { | ||
200 | + if(!strcasecmp(name,properties[ix].name)) | ||
201 | + { | ||
202 | + if(properties[ix].set) | ||
203 | + { | ||
204 | + return properties[ix].set(hSession, value); | ||
205 | + } | ||
206 | + else | ||
207 | + { | ||
208 | + errno = EPERM; | ||
209 | + return -1; | ||
210 | + } | ||
211 | + } | ||
212 | + | ||
213 | + } | ||
214 | + | ||
215 | + errno = ENOENT; | ||
216 | + return -1; | ||
217 | + | ||
218 | +} | ||
219 | + |
@@ -0,0 +1,262 @@ | @@ -0,0 +1,262 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como - e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | + #include <config.h> | ||
31 | + #include <lib3270-internals.h> | ||
32 | + #include <string.h> | ||
33 | + #include <lib3270.h> | ||
34 | + #include <lib3270/properties.h> | ||
35 | + #include <lib3270/keyboard.h> | ||
36 | + | ||
37 | + static const char * get_version(H3270 GNUC_UNUSED(*hSession)) | ||
38 | + { | ||
39 | + return lib3270_get_version(); | ||
40 | + } | ||
41 | + | ||
42 | + static const char * get_revision(H3270 GNUC_UNUSED(*hSession)) | ||
43 | + { | ||
44 | + return lib3270_get_revision(); | ||
45 | + } | ||
46 | + | ||
47 | + LIB3270_EXPORT const LIB3270_STRING_PROPERTY * lib3270_get_string_properties_list(void) | ||
48 | + { | ||
49 | + static const LIB3270_STRING_PROPERTY properties[] = { | ||
50 | + | ||
51 | + { | ||
52 | + "luname", // Property name. | ||
53 | + N_( "The name of the active LU" ), // Property description. | ||
54 | + lib3270_get_luname, // Get value. | ||
55 | + lib3270_set_luname // Set value. | ||
56 | + }, | ||
57 | + | ||
58 | + { | ||
59 | + "url", // Property name. | ||
60 | + N_( "URL of the current host" ), // Property description. | ||
61 | + lib3270_get_url, // Get value. | ||
62 | + lib3270_set_url // Set value. | ||
63 | + }, | ||
64 | + | ||
65 | + { | ||
66 | + "model", // Property name. | ||
67 | + N_( "Model name" ), // Property description. | ||
68 | + lib3270_get_model, // Get value. | ||
69 | + lib3270_set_model // Set value. | ||
70 | + }, | ||
71 | + | ||
72 | + { | ||
73 | + "host_type", // Property name. | ||
74 | + N_( "Host type name" ), // Property description. | ||
75 | + lib3270_get_host_type_name, // Get value. | ||
76 | + lib3270_set_host_type_by_name // Set value. | ||
77 | + }, | ||
78 | + | ||
79 | + { | ||
80 | + "host_charset", // Property name. | ||
81 | + N_( "Host charset" ), // Property description. | ||
82 | + lib3270_get_host_charset, // Get value. | ||
83 | + lib3270_set_host_charset // Set value. | ||
84 | + }, | ||
85 | + | ||
86 | + { | ||
87 | + "display_charset", // Property name. | ||
88 | + N_( "Display charset" ), // Property description. | ||
89 | + lib3270_get_display_charset, // Get value. | ||
90 | + NULL // Set value. | ||
91 | + }, | ||
92 | + | ||
93 | + { | ||
94 | + "version", // Property name. | ||
95 | + N_( "lib3270 version" ), // Property description. | ||
96 | + get_version, // Get value. | ||
97 | + NULL // Set value. | ||
98 | + }, | ||
99 | + | ||
100 | + { | ||
101 | + "revision", // Property name. | ||
102 | + N_( "lib3270 revision" ), // Property description. | ||
103 | + get_revision, // Get value. | ||
104 | + NULL // Set value. | ||
105 | + }, | ||
106 | + | ||
107 | + { | ||
108 | + "crlpath", // Property name. | ||
109 | + N_( "URL for the certificate revocation list" ), // Property description. | ||
110 | + lib3270_get_crl_url, // Get value. | ||
111 | + lib3270_set_crl_url, // Set value. | ||
112 | + }, | ||
113 | + | ||
114 | + { | ||
115 | + "default_host", // Property name. | ||
116 | + N_( "Default host URL" ), // Property description. | ||
117 | + lib3270_get_default_host, // Get value. | ||
118 | + NULL // Set value. | ||
119 | + }, | ||
120 | + | ||
121 | + { | ||
122 | + "sslmessage", // Property name. | ||
123 | + N_( "The security state" ), // Property description. | ||
124 | + lib3270_get_ssl_state_message, // Get value. | ||
125 | + NULL // Set value. | ||
126 | + }, | ||
127 | + | ||
128 | + { | ||
129 | + "ssldescription", // Property name. | ||
130 | + N_( "Description of the current security state" ), // Property description. | ||
131 | + lib3270_get_ssl_state_description, // Get value. | ||
132 | + NULL // Set value. | ||
133 | + }, | ||
134 | + | ||
135 | + /* | ||
136 | + { | ||
137 | + "", // Property name. | ||
138 | + "", // Property description. | ||
139 | + , // Get value. | ||
140 | + NULL // Set value. | ||
141 | + }, | ||
142 | + */ | ||
143 | + | ||
144 | + { | ||
145 | + NULL, | ||
146 | + NULL, | ||
147 | + NULL, | ||
148 | + NULL | ||
149 | + } | ||
150 | + | ||
151 | + }; | ||
152 | + | ||
153 | + return properties; | ||
154 | + | ||
155 | + } | ||
156 | + | ||
157 | +int lib3270_set_string_property(H3270 *hSession, const char *name, const char * value, int seconds) | ||
158 | +{ | ||
159 | + size_t ix; | ||
160 | + | ||
161 | + if(seconds) | ||
162 | + { | ||
163 | + lib3270_wait_for_ready(hSession, seconds); | ||
164 | + } | ||
165 | + | ||
166 | + // | ||
167 | + // Check for string property | ||
168 | + // | ||
169 | + { | ||
170 | + const LIB3270_STRING_PROPERTY * properties = lib3270_get_string_properties_list(); | ||
171 | + for(ix = 0; properties[ix].name; ix++) | ||
172 | + { | ||
173 | + if(!strcasecmp(name,properties[ix].name)) | ||
174 | + { | ||
175 | + if(properties[ix].set) | ||
176 | + { | ||
177 | + return properties[ix].set(hSession, value); | ||
178 | + } | ||
179 | + else | ||
180 | + { | ||
181 | + errno = EPERM; | ||
182 | + return -1; | ||
183 | + } | ||
184 | + } | ||
185 | + | ||
186 | + } | ||
187 | + } | ||
188 | + | ||
189 | + // | ||
190 | + // Check for signed int property | ||
191 | + // | ||
192 | + { | ||
193 | + const LIB3270_INT_PROPERTY * properties = lib3270_get_int_properties_list(); | ||
194 | + for(ix = 0; properties[ix].name; ix++) | ||
195 | + { | ||
196 | + if(!strcasecmp(name,properties[ix].name)) | ||
197 | + { | ||
198 | + if(properties[ix].set) | ||
199 | + { | ||
200 | + return properties[ix].set(hSession, atoi(value)); | ||
201 | + } | ||
202 | + else | ||
203 | + { | ||
204 | + errno = EPERM; | ||
205 | + return -1; | ||
206 | + } | ||
207 | + } | ||
208 | + | ||
209 | + } | ||
210 | + } | ||
211 | + | ||
212 | + // | ||
213 | + // Check for unsigned int property | ||
214 | + // | ||
215 | + { | ||
216 | + const LIB3270_UINT_PROPERTY * properties = lib3270_get_unsigned_properties_list(); | ||
217 | + for(ix = 0; properties[ix].name; ix++) | ||
218 | + { | ||
219 | + if(!strcasecmp(name,properties[ix].name)) | ||
220 | + { | ||
221 | + if(properties[ix].set) | ||
222 | + { | ||
223 | + return properties[ix].set(hSession, strtoul(value,NULL,0)); | ||
224 | + } | ||
225 | + else | ||
226 | + { | ||
227 | + errno = EPERM; | ||
228 | + return -1; | ||
229 | + } | ||
230 | + } | ||
231 | + | ||
232 | + } | ||
233 | + } | ||
234 | + | ||
235 | + // | ||
236 | + // Check for boolean property | ||
237 | + // | ||
238 | + { | ||
239 | + const LIB3270_INT_PROPERTY * properties = lib3270_get_int_properties_list(); | ||
240 | + for(ix = 0; properties[ix].name; ix++) | ||
241 | + { | ||
242 | + if(!strcasecmp(name,properties[ix].name)) | ||
243 | + { | ||
244 | + if(properties[ix].set) | ||
245 | + { | ||
246 | + return properties[ix].set(hSession, atoi(value)); | ||
247 | + } | ||
248 | + else | ||
249 | + { | ||
250 | + errno = EPERM; | ||
251 | + return -1; | ||
252 | + } | ||
253 | + } | ||
254 | + | ||
255 | + } | ||
256 | + } | ||
257 | + | ||
258 | + errno = ENOENT; | ||
259 | + return -1; | ||
260 | + | ||
261 | +} | ||
262 | + |
@@ -0,0 +1,109 @@ | @@ -0,0 +1,109 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como - e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | + #include <config.h> | ||
31 | + #include <lib3270-internals.h> | ||
32 | + #include <string.h> | ||
33 | + #include <lib3270.h> | ||
34 | + #include <lib3270/properties.h> | ||
35 | + #include <lib3270/keyboard.h> | ||
36 | + | ||
37 | + unsigned int lib3270_get_kybdlock_as_int(H3270 *hSession) | ||
38 | + { | ||
39 | + return (unsigned int) lib3270_get_keyboard_lock_state(hSession); | ||
40 | + } | ||
41 | + | ||
42 | + const LIB3270_UINT_PROPERTY * lib3270_get_unsigned_properties_list(void) | ||
43 | + { | ||
44 | + | ||
45 | + static const LIB3270_UINT_PROPERTY properties[] = { | ||
46 | + | ||
47 | + { | ||
48 | + "cursor_address", // Property name. | ||
49 | + N_( "Cursor address" ), // Property description. | ||
50 | + lib3270_get_cursor_address, // Get value. | ||
51 | + lib3270_set_cursor_address // Set value. | ||
52 | + }, | ||
53 | + | ||
54 | + { | ||
55 | + "width", // Property name. | ||
56 | + N_( "Current screen width in columns" ), // Property description. | ||
57 | + lib3270_get_width, // Get value. | ||
58 | + NULL // Set value. | ||
59 | + }, | ||
60 | + | ||
61 | + { | ||
62 | + "height", // Property name. | ||
63 | + N_( "Current screen height in rows" ), // Property description. | ||
64 | + lib3270_get_height, // Get value. | ||
65 | + NULL // Set value. | ||
66 | + }, | ||
67 | + | ||
68 | + { | ||
69 | + "length", // Property name. | ||
70 | + N_( "Screen buffer length in bytes" ), // Property description. | ||
71 | + lib3270_get_length, // Get value. | ||
72 | + NULL // Set value. | ||
73 | + }, | ||
74 | + | ||
75 | + { | ||
76 | + "unlock_delay", // Property name. | ||
77 | + N_( "The delay between the host unlocking the keyboard and the actual unlock" ), // Property description. | ||
78 | + lib3270_get_unlock_delay, // Get value. | ||
79 | + lib3270_set_unlock_delay // Set value. | ||
80 | + }, | ||
81 | + | ||
82 | + { | ||
83 | + "kybdlock", // Property name. | ||
84 | + N_( "Keyboard lock status" ), // Property description. | ||
85 | + lib3270_get_kybdlock_as_int, // Get value. | ||
86 | + NULL // Set value. | ||
87 | + }, | ||
88 | + | ||
89 | + /* | ||
90 | + { | ||
91 | + "", // Property name. | ||
92 | + "", // Property description. | ||
93 | + NULL, // Get value. | ||
94 | + NULL // Set value. | ||
95 | + }, | ||
96 | + */ | ||
97 | + | ||
98 | + { | ||
99 | + NULL, | ||
100 | + NULL, | ||
101 | + NULL, | ||
102 | + NULL | ||
103 | + } | ||
104 | + }; | ||
105 | + | ||
106 | + return properties; | ||
107 | + } | ||
108 | + | ||
109 | + |