Commit 8927cb432f046fac5c64dfcf1a456584800ef084
1 parent
43f08d36
Exists in
master
and in
3 other branches
Reimplementando e modernizando processo de instalação.
Showing
2 changed files
with
1217 additions
and
0 deletions
Show diff stats
Makefile.in
... | ... | @@ -172,6 +172,7 @@ $(BINRLS)/@DLLPREFIX@$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_V |
172 | 172 | -shared -Wl,-soname,$(@F) \ |
173 | 173 | -o $@ \ |
174 | 174 | $(LDFLAGS) \ |
175 | + $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o) \ | |
175 | 176 | $(LIBS) |
176 | 177 | |
177 | 178 | #---[ Misc Targets ]--------------------------------------------------------------------- |
... | ... | @@ -199,6 +200,46 @@ locale: \ |
199 | 200 | |
200 | 201 | #---[ Install Targets ]------------------------------------------------------------------ |
201 | 202 | |
203 | +install: \ | |
204 | + install-lib \ | |
205 | + install-devel | |
206 | + | |
207 | +install-lib: \ | |
208 | + $(BINRLS)/@DLLPREFIX@$(LIBNAME)@DLLEXT@ | |
209 | + | |
210 | + @mkdir -p $(DESTDIR)$(libdir) | |
211 | + | |
212 | + @$(INSTALL_PROGRAM) \ | |
213 | + $(BINRLS)/@DLLPREFIX@$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ \ | |
214 | + $(DESTDIR)$(libdir) | |
215 | + | |
216 | + @$(LN_S) \ | |
217 | + @DLLPREFIX@$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ \ | |
218 | + $(DESTDIR)$(libdir)/@DLLPREFIX@$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ | |
219 | + | |
220 | + @$(LN_S) \ | |
221 | + @DLLPREFIX@$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@ \ | |
222 | + $(DESTDIR)$(libdir)/@DLLPREFIX@$(LIBNAME)@DLLEXT@ | |
223 | + | |
224 | +install-devel: | |
225 | + | |
226 | + @mkdir -p $(DESTDIR)$(includedir)/lib$(LIBNAME) | |
227 | + @mkdir -p $(DESTDIR)$(libdir)/pkgconfig | |
228 | + | |
229 | + # Install includes | |
230 | + @$(INSTALL_DATA) \ | |
231 | + src/include/lib3270/*.h \ | |
232 | + $(DESTDIR)$(includedir)/lib$(LIBNAME) | |
233 | + | |
234 | + @$(INSTALL_DATA) \ | |
235 | + src/include/lib3270.h \ | |
236 | + $(DESTDIR)$(includedir)/lib$(LIBNAME).h | |
237 | + | |
238 | + # Install PKG-CONFIG files | |
239 | + @$(INSTALL_DATA) \ | |
240 | + sdk/lib3270.pc \ | |
241 | + $(DESTDIR)$(libdir)/pkgconfig/lib$(LIBNAME).pc | |
242 | + | |
202 | 243 | |
203 | 244 | #---[ Debug Targets ]-------------------------------------------------------------------- |
204 | 245 | ... | ... |
... | ... | @@ -0,0 +1,1176 @@ |
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. | |
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 lib3270.h 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 | + * licinio@bb.com.br (Licínio Luis Branco) | |
28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
29 | + * | |
30 | + */ | |
31 | + | |
32 | +#ifndef LIB3270_H_INCLUDED | |
33 | + | |
34 | + #define LIB3270_H_INCLUDED 1 | |
35 | + #include <stdarg.h> | |
36 | + #include <errno.h> | |
37 | + | |
38 | + #ifndef ENOTCONN | |
39 | + #define ENOTCONN 126 | |
40 | + #endif // !ENOTCONN | |
41 | + | |
42 | + #if defined(__GNUC__) | |
43 | + #define LIB3270_GNUC_FORMAT(s,f) __attribute__ ((__format__ (__printf__, s, f))) | |
44 | + #else | |
45 | + #define LIB3270_GNUC_FORMAT(s, f) | |
46 | + #endif | |
47 | + | |
48 | + /** | |
49 | + * BIND definitions. | |
50 | + */ | |
51 | + #define LIB3270_BIND_RU 0x31 | |
52 | + #define LIB3270_BIND_OFF_PLU_NAME_LEN 26 | |
53 | + #define LIB3270_BIND_OFF_PLU_NAME 27 | |
54 | + #define LIB3270_BIND_PLU_NAME_MAX 8 | |
55 | + | |
56 | + /** | |
57 | + * Maximum size for LUNAME | |
58 | + * | |
59 | + */ | |
60 | + #define LIB3270_LUNAME_LENGTH 16 | |
61 | + | |
62 | + /** | |
63 | + * Character attributes | |
64 | + */ | |
65 | + typedef enum _lib3270_attr | |
66 | + { | |
67 | + LIB3270_ATTR_COLOR_BACKGROUND = 0x0000, | |
68 | + | |
69 | + LIB3270_ATTR_COLOR_BLUE = 0x0001, | |
70 | + LIB3270_ATTR_COLOR_RED = 0x0002, | |
71 | + LIB3270_ATTR_COLOR_PINK = 0x0003, | |
72 | + LIB3270_ATTR_COLOR_GREEN = 0x0004, | |
73 | + LIB3270_ATTR_COLOR_TURQUOISE = 0x0005, | |
74 | + LIB3270_ATTR_COLOR_YELLOW = 0x0006, | |
75 | + LIB3270_ATTR_COLOR_WHITE = 0x0007, | |
76 | + LIB3270_ATTR_COLOR_BLACK = 0x0008, | |
77 | + LIB3270_ATTR_COLOR_DARK_BLUE = 0x0009, | |
78 | + LIB3270_ATTR_COLOR_ORANGE = 0x000A, | |
79 | + LIB3270_ATTR_COLOR_PURPLE = 0x000B, | |
80 | + LIB3270_ATTR_COLOR_DARK_GREEN = 0x000C, | |
81 | + LIB3270_ATTR_COLOR_DARK_TURQUOISE = 0x000D, | |
82 | + LIB3270_ATTR_COLOR_MUSTARD = 0x000E, | |
83 | + LIB3270_ATTR_COLOR_GRAY = 0x000F, | |
84 | + | |
85 | + LIB3270_ATTR_COLOR = 0x00FF, | |
86 | + | |
87 | + LIB3270_ATTR_FIELD = 0x0100, | |
88 | + LIB3270_ATTR_BLINK = 0x0200, | |
89 | + LIB3270_ATTR_UNDERLINE = 0x0400, | |
90 | + LIB3270_ATTR_INTENSIFY = 0x0800, | |
91 | + | |
92 | + LIB3270_ATTR_CG = 0x1000, | |
93 | + LIB3270_ATTR_MARKER = 0x2000, | |
94 | + LIB3270_ATTR_BACKGROUND_INTENSITY = 0x4000, | |
95 | + LIB3270_ATTR_SELECTED = 0x8000 | |
96 | + | |
97 | + } LIB3270_ATTR; | |
98 | + | |
99 | + typedef enum _lib3270_toggle | |
100 | + { | |
101 | + LIB3270_TOGGLE_MONOCASE, | |
102 | + LIB3270_TOGGLE_CURSOR_BLINK, | |
103 | + LIB3270_TOGGLE_SHOW_TIMING, | |
104 | + LIB3270_TOGGLE_CURSOR_POS, | |
105 | + LIB3270_TOGGLE_DS_TRACE, | |
106 | + LIB3270_TOGGLE_LINE_WRAP, | |
107 | + LIB3270_TOGGLE_BLANK_FILL, | |
108 | + LIB3270_TOGGLE_SCREEN_TRACE, | |
109 | + LIB3270_TOGGLE_EVENT_TRACE, | |
110 | + LIB3270_TOGGLE_MARGINED_PASTE, | |
111 | + LIB3270_TOGGLE_RECTANGLE_SELECT, | |
112 | + LIB3270_TOGGLE_CROSSHAIR, | |
113 | + LIB3270_TOGGLE_FULL_SCREEN, | |
114 | + LIB3270_TOGGLE_RECONNECT, | |
115 | + LIB3270_TOGGLE_INSERT, | |
116 | + LIB3270_TOGGLE_SMART_PASTE, | |
117 | + LIB3270_TOGGLE_BOLD, | |
118 | + LIB3270_TOGGLE_KEEP_SELECTED, | |
119 | + LIB3270_TOGGLE_UNDERLINE, /**< Show underline ? */ | |
120 | + LIB3270_TOGGLE_CONNECT_ON_STARTUP, | |
121 | + LIB3270_TOGGLE_KP_ALTERNATIVE, /**< Keypad +/- move to next/previous field */ | |
122 | + LIB3270_TOGGLE_BEEP, /**< Beep on errors */ | |
123 | + LIB3270_TOGGLE_VIEW_FIELD, /**< View Field attribute */ | |
124 | + LIB3270_TOGGLE_ALTSCREEN, /**< auto resize on altscreen */ | |
125 | + LIB3270_TOGGLE_KEEP_ALIVE, /**< Enable network keep-alive with SO_KEEPALIVE */ | |
126 | + LIB3270_TOGGLE_NETWORK_TRACE, /**< Enable network in/out trace */ | |
127 | + | |
128 | + LIB3270_TOGGLE_COUNT | |
129 | + | |
130 | + } LIB3270_TOGGLE; | |
131 | + | |
132 | + typedef enum _lib3270_direction | |
133 | + { | |
134 | + LIB3270_DIR_UP, | |
135 | + LIB3270_DIR_DOWN, | |
136 | + LIB3270_DIR_LEFT, | |
137 | + LIB3270_DIR_RIGHT, | |
138 | + | |
139 | + LIB3270_DIR_END, | |
140 | + | |
141 | + } LIB3270_DIRECTION; | |
142 | + | |
143 | + /** | |
144 | + * Toggle types. | |
145 | + * | |
146 | + */ | |
147 | + typedef enum _LIB3270_TOGGLE_TYPE | |
148 | + { | |
149 | + LIB3270_TOGGLE_TYPE_INITIAL, | |
150 | + LIB3270_TOGGLE_TYPE_INTERACTIVE, | |
151 | + LIB3270_TOGGLE_TYPE_ACTION, | |
152 | + LIB3270_TOGGLE_TYPE_FINAL, | |
153 | + LIB3270_TOGGLE_TYPE_UPDATE, | |
154 | + | |
155 | + LIB3270_TOGGLE_TYPE_USER | |
156 | + | |
157 | + } LIB3270_TOGGLE_TYPE; | |
158 | + | |
159 | + | |
160 | + /** | |
161 | + * OIA Status indicators. | |
162 | + * | |
163 | + */ | |
164 | + typedef enum _lib3270_flag | |
165 | + { | |
166 | + LIB3270_FLAG_BOXSOLID, /**< System available */ | |
167 | + LIB3270_FLAG_UNDERA, /**< Control Unit STATUS */ | |
168 | + LIB3270_FLAG_TYPEAHEAD, | |
169 | + LIB3270_FLAG_PRINTER, /**< Printer session status */ | |
170 | + LIB3270_FLAG_REVERSE, | |
171 | + LIB3270_FLAG_SCRIPT, /**< Script status */ | |
172 | + | |
173 | + LIB3270_FLAG_COUNT | |
174 | + | |
175 | + } LIB3270_FLAG; | |
176 | + | |
177 | + | |
178 | + /** | |
179 | + * @brief 3270 program messages. | |
180 | + * | |
181 | + */ | |
182 | + typedef enum _LIB3270_MESSAGE | |
183 | + { | |
184 | + LIB3270_MESSAGE_NONE, ///< @brief No message | |
185 | + LIB3270_MESSAGE_SYSWAIT, ///< @brief -- | |
186 | + LIB3270_MESSAGE_TWAIT, ///< @brief -- | |
187 | + LIB3270_MESSAGE_CONNECTED, ///< @brief Connected | |
188 | + LIB3270_MESSAGE_DISCONNECTED, ///< @brief Disconnected from host | |
189 | + LIB3270_MESSAGE_AWAITING_FIRST, ///< @brief -- | |
190 | + LIB3270_MESSAGE_MINUS, ///< @brief -- | |
191 | + LIB3270_MESSAGE_PROTECTED, ///< @brief -- | |
192 | + LIB3270_MESSAGE_NUMERIC, ///< @brief -- | |
193 | + LIB3270_MESSAGE_OVERFLOW, ///< @brief -- | |
194 | + LIB3270_MESSAGE_INHIBIT, ///< @brief -- | |
195 | + LIB3270_MESSAGE_KYBDLOCK, ///< @brief Keyboard is locked | |
196 | + | |
197 | + LIB3270_MESSAGE_X, ///< @brief -- | |
198 | + LIB3270_MESSAGE_RESOLVING, ///< @brief Resolving hostname (running DNS query) | |
199 | + LIB3270_MESSAGE_CONNECTING, ///< @brief Connecting to host | |
200 | + | |
201 | + LIB3270_MESSAGE_USER | |
202 | + | |
203 | + } LIB3270_MESSAGE; | |
204 | + | |
205 | + | |
206 | + /** | |
207 | + * Pointer modes. | |
208 | + * | |
209 | + * Pointer modes set by library; an application can use it | |
210 | + * as a hint to change the mouse pointer based on connection status. | |
211 | + * | |
212 | + */ | |
213 | + typedef enum _LIB3270_POINTER | |
214 | + { | |
215 | + LIB3270_POINTER_UNLOCKED, /**< Ready for user actions */ | |
216 | + LIB3270_POINTER_WAITING, /**< Waiting for host */ | |
217 | + LIB3270_POINTER_LOCKED, /**< Locked, can't receive user actions */ | |
218 | + | |
219 | + LIB3270_POINTER_PROTECTED, | |
220 | + LIB3270_POINTER_MOVE_SELECTION, | |
221 | + LIB3270_POINTER_SELECTION_TOP_LEFT, | |
222 | + LIB3270_POINTER_SELECTION_TOP_RIGHT, | |
223 | + LIB3270_POINTER_SELECTION_TOP, | |
224 | + LIB3270_POINTER_SELECTION_BOTTOM_LEFT, | |
225 | + LIB3270_POINTER_SELECTION_BOTTOM_RIGHT, | |
226 | + LIB3270_POINTER_SELECTION_BOTTOM, | |
227 | + LIB3270_POINTER_SELECTION_LEFT, | |
228 | + LIB3270_POINTER_SELECTION_RIGHT, | |
229 | + LIB3270_POINTER_QUESTION, | |
230 | + | |
231 | + LIB3270_POINTER_COUNT | |
232 | + | |
233 | + } LIB3270_POINTER; | |
234 | + | |
235 | + | |
236 | + /** | |
237 | + * connection state | |
238 | + */ | |
239 | + typedef enum lib3270_cstate | |
240 | + { | |
241 | + LIB3270_NOT_CONNECTED, /**< no socket, disconnected */ | |
242 | + LIB3270_RESOLVING, /**< resolving hostname */ | |
243 | + LIB3270_PENDING, /**< connection pending */ | |
244 | + LIB3270_CONNECTED_INITIAL, /**< connected, no mode yet */ | |
245 | + LIB3270_CONNECTED_ANSI, /**< connected in NVT ANSI mode */ | |
246 | + LIB3270_CONNECTED_3270, /**< connected in old-style 3270 mode */ | |
247 | + LIB3270_CONNECTED_INITIAL_E, /**< connected in TN3270E mode, unnegotiated */ | |
248 | + LIB3270_CONNECTED_NVT, /**< connected in TN3270E mode, NVT mode */ | |
249 | + LIB3270_CONNECTED_SSCP, /**< connected in TN3270E mode, SSCP-LU mode */ | |
250 | + LIB3270_CONNECTED_TN3270E /**< connected in TN3270E mode, 3270 mode */ | |
251 | + } LIB3270_CSTATE; | |
252 | + | |
253 | + | |
254 | + /** | |
255 | + * Connect options | |
256 | + * | |
257 | + */ | |
258 | + typedef enum lib3270_option | |
259 | + { | |
260 | + /* Host types */ | |
261 | + LIB3270_OPTION_AS400 = 0x0001, /**< AS400 host - Prefix every PF with PA1 */ | |
262 | + LIB3270_OPTION_TSO = 0x0002, /**< Host is TSO? */ | |
263 | + LIB3270_OPTION_S390 = 0x0006, /**< Host is S390? (TSO included) */ | |
264 | + | |
265 | + /* Other options */ | |
266 | + LIB3270_OPTION_SSL = 0x0010, /**< Secure connection ? */ | |
267 | + | |
268 | + | |
269 | + LIB3270_OPTION_WAIT = 0x8000 /**< Wait for session ready on connect ? */ | |
270 | + } LIB3270_OPTION; | |
271 | + | |
272 | + #define LIB3270_OPTION_HOST_TYPE 0x0007 | |
273 | + #define LIB3270_OPTION_DEFAULTS LIB3270_OPTION_S390 | |
274 | + | |
275 | + typedef struct _lib3270_option_entry | |
276 | + { | |
277 | + LIB3270_OPTION option; | |
278 | + const char * name; | |
279 | + const char * description; | |
280 | + const char * tooltip; | |
281 | + } LIB3270_OPTION_ENTRY; | |
282 | + | |
283 | + /** | |
284 | + * SSL state | |
285 | + * | |
286 | + */ | |
287 | + typedef enum lib3270_ssl_state | |
288 | + { | |
289 | + LIB3270_SSL_UNSECURE, /**< No secure connection */ | |
290 | + LIB3270_SSL_SECURE, /**< Connection secure with CA check */ | |
291 | + LIB3270_SSL_NEGOTIATED, /**< Connection secure, no CA or self-signed */ | |
292 | + LIB3270_SSL_NEGOTIATING, /**< Negotiating SSL */ | |
293 | + LIB3270_SSL_UNDEFINED /**< Undefined */ | |
294 | + } LIB3270_SSL_STATE; | |
295 | + | |
296 | + #define LIB3270_SSL_FAILED LIB3270_SSL_UNSECURE | |
297 | + | |
298 | +#ifdef __cplusplus | |
299 | + extern "C" { | |
300 | +#endif | |
301 | + | |
302 | + #if defined( ANDROID ) | |
303 | + | |
304 | + #define LIB3270_INTERNAL extern __attribute__((visibility("hidden"))) | |
305 | + #define LIB3270_EXPORT extern __attribute__((visibility("hidden"))) | |
306 | + | |
307 | + #elif defined(_WIN32) | |
308 | + | |
309 | + #include <windows.h> | |
310 | + | |
311 | + #define LIB3270_INTERNAL extern | |
312 | + #define LIB3270_EXPORT extern __declspec (dllexport) | |
313 | + | |
314 | + #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) | |
315 | + | |
316 | + #define LIB3270_INTERNAL __hidden extern | |
317 | + #define LIB3270_EXPORT extern | |
318 | + | |
319 | + #else | |
320 | + | |
321 | + #define LIB3270_INTERNAL __attribute__((visibility("hidden"))) extern | |
322 | + #define LIB3270_EXPORT __attribute__((visibility("default"))) extern | |
323 | + | |
324 | + #endif | |
325 | + | |
326 | + /* State change IDs. */ | |
327 | + typedef enum _lib3270_state | |
328 | + { | |
329 | + LIB3270_STATE_RESOLVING, | |
330 | + LIB3270_STATE_HALF_CONNECT, | |
331 | + LIB3270_STATE_CONNECT, | |
332 | + LIB3270_STATE_3270_MODE, | |
333 | + LIB3270_STATE_LINE_MODE, | |
334 | + LIB3270_STATE_REMODEL, | |
335 | + LIB3270_STATE_PRINTER, | |
336 | + LIB3270_STATE_EXITING, | |
337 | + LIB3270_STATE_CHARSET, | |
338 | + | |
339 | + LIB3270_STATE_USER // Always the last one | |
340 | + } LIB3270_STATE; | |
341 | + | |
342 | + typedef struct _h3270 H3270; | |
343 | + typedef struct _h3270ft H3270FT; | |
344 | + | |
345 | + /** | |
346 | + * Get current screen size. | |
347 | + * | |
348 | + * Get the size of the terminal in rows/cols; this value can differ from | |
349 | + * the model if there's an active "altscreen" with diferent size. | |
350 | + * | |
351 | + * @param h Handle of the desired session. | |
352 | + * @param r Pointer to screen rows. | |
353 | + * @param c Pointer to screen columns. | |
354 | + * | |
355 | + */ | |
356 | + LIB3270_EXPORT void lib3270_get_screen_size(H3270 *h, int *r, int *c); | |
357 | + | |
358 | + | |
359 | + /** | |
360 | + * Get current screen width in columns. | |
361 | + * | |
362 | + * @param h Handle of the desired session. | |
363 | + * | |
364 | + * @return screen width. | |
365 | + * | |
366 | + */ | |
367 | + LIB3270_EXPORT int lib3270_get_width(H3270 *h); | |
368 | + | |
369 | + /** | |
370 | + * Get current screen width in rows. | |
371 | + * | |
372 | + * @param h Handle of the desired session. | |
373 | + * | |
374 | + * @return screen rows. | |
375 | + * | |
376 | + */ | |
377 | + LIB3270_EXPORT int lib3270_get_height(H3270 *h); | |
378 | + | |
379 | + LIB3270_EXPORT unsigned int lib3270_get_length(H3270 *h); | |
380 | + | |
381 | + /** | |
382 | + * Start a new session (INCOMPLETE). | |
383 | + * | |
384 | + * Initialize session structure, opens a new session. | |
385 | + * WARNING: Multi session ins't yet supported in lib3270, because of this | |
386 | + * this call always return the handle of the same session. | |
387 | + * | |
388 | + * @param model Terminal model. | |
389 | + * | |
390 | + * @return lib3270 internal session structure. | |
391 | + * | |
392 | + */ | |
393 | + LIB3270_EXPORT H3270 * lib3270_session_new(const char *model); | |
394 | + | |
395 | + /** | |
396 | + * Destroy session, release memory. | |
397 | + * | |
398 | + * @param h Session handle. | |
399 | + * | |
400 | + */ | |
401 | + LIB3270_EXPORT void lib3270_session_free(H3270 *h); | |
402 | + | |
403 | + /** | |
404 | + * Register a state change callback. | |
405 | + * | |
406 | + * @param h Session handle. | |
407 | + * @param tx State ID | |
408 | + * @param func Callback | |
409 | + * @param data Data | |
410 | + * | |
411 | + */ | |
412 | + LIB3270_EXPORT void lib3270_register_schange(H3270 *h,LIB3270_STATE tx, void (*func)(H3270 *, int, void *),void *data); | |
413 | + | |
414 | + | |
415 | + /** | |
416 | + * Set host id for the connect/reconnect operations. | |
417 | + * | |
418 | + * @param h Session handle. | |
419 | + * @param url URL of host to set in the format tn3270://hostname:service or tn3270s://hostname:service . | |
420 | + * | |
421 | + * @return Processed host url | |
422 | + * | |
423 | + */ | |
424 | + LIB3270_EXPORT const char * lib3270_set_url(H3270 *h, const char *url); | |
425 | + | |
426 | + /** | |
427 | + * Get hostname for the connect/reconnect operations. | |
428 | + * | |
429 | + * @param h Session handle. | |
430 | + * | |
431 | + * @return Pointer to host id set (internal data, do not change it) | |
432 | + * | |
433 | + */ | |
434 | + LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h); | |
435 | + | |
436 | + LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname); | |
437 | + | |
438 | + | |
439 | + /** | |
440 | + * Get service or port for the connect/reconnect operations. | |
441 | + * | |
442 | + * @param h Session handle. | |
443 | + * | |
444 | + * @return Pointer to service name (internal data, do not change it) | |
445 | + * | |
446 | + */ | |
447 | + LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h); | |
448 | + | |
449 | + LIB3270_EXPORT void lib3270_set_srvcname(H3270 *h, const char *srvc); | |
450 | + | |
451 | + LIB3270_EXPORT const char * lib3270_get_url(H3270 *h, char *buffer, int len); | |
452 | + | |
453 | + /** | |
454 | + * Get session options. | |
455 | + * | |
456 | + * @param h Session handle. | |
457 | + * | |
458 | + */ | |
459 | + LIB3270_EXPORT LIB3270_OPTION lib3270_get_options(H3270 *hSession); | |
460 | + | |
461 | + /** | |
462 | + * Get URL of the hostname for the connect/reconnect operations. | |
463 | + * | |
464 | + * @param h Session handle. | |
465 | + * | |
466 | + * @return Pointer to host URL set (internal data, do not change it) | |
467 | + * | |
468 | + */ | |
469 | + LIB3270_EXPORT const char * lib3270_get_host(H3270 *h); | |
470 | + | |
471 | + | |
472 | + /** | |
473 | + * Network connect operation, keep main loop running | |
474 | + * | |
475 | + * @param h Session handle. | |
476 | + * @param wait Non zero to wait for connection to be ok. | |
477 | + * | |
478 | + * @return 0 for success, EAGAIN if auto-reconnect is in progress, EBUSY if connected, ENOTCONN if connection has failed, -1 on unexpected failure. | |
479 | + * | |
480 | + */ | |
481 | + LIB3270_EXPORT int lib3270_connect(H3270 *h,int wait); | |
482 | + | |
483 | + /** | |
484 | + * Connect to defined host, keep main loop running. | |
485 | + * | |
486 | + * @param hSession Session handle. | |
487 | + * @param hostname Host name. | |
488 | + * @param srvc Service name (telnet if NULL). | |
489 | + * @param opt Session options. | |
490 | + * | |
491 | + * @return 0 for success, EAGAIN if auto-reconnect is in progress, EBUSY if connected, ENOTCONN if connection has failed, -1 on unexpected failure. | |
492 | + * | |
493 | + */ | |
494 | + LIB3270_EXPORT int lib3270_connect_host(H3270 *hSession, const char *hostname, const char *srvc, LIB3270_OPTION opt); | |
495 | + | |
496 | + /** | |
497 | + * @brief Connect by URL | |
498 | + * | |
499 | + * @param hSession Session handle. | |
500 | + * @param url Host URL | |
501 | + * @param wait Seconds to wait for connection. | |
502 | + * | |
503 | + * @see lib3270_wait | |
504 | + * | |
505 | + * @return 0 for success, EAGAIN if auto-reconnect is in progress, EBUSY if connected, ENOTCONN if connection has failed, -1 on unexpected failure. | |
506 | + */ | |
507 | + LIB3270_EXPORT int lib3270_connect_url(H3270 *hSession, const char *url, int wait); | |
508 | + | |
509 | + /** | |
510 | + * Disconnect from host. | |
511 | + * | |
512 | + * @param h Session handle. | |
513 | + * | |
514 | + */ | |
515 | + LIB3270_EXPORT int lib3270_disconnect(H3270 *h); | |
516 | + | |
517 | + /** | |
518 | + * Get connection state. | |
519 | + * | |
520 | + * @param h Session handle. | |
521 | + * | |
522 | + * @return Connection state. | |
523 | + * | |
524 | + */ | |
525 | + LIB3270_EXPORT LIB3270_CSTATE lib3270_get_connection_state(H3270 *h); | |
526 | + | |
527 | + /** | |
528 | + * Pretend that a sequence of keys was entered at the keyboard. | |
529 | + * | |
530 | + * "Pasting" means that the sequence came from the clipboard. Returns are | |
531 | + * ignored; newlines mean "move to beginning of next line"; tabs and formfeeds | |
532 | + * become spaces. Backslashes are not special, but ASCII ESC characters are | |
533 | + * used to signify 3270 Graphic Escapes. | |
534 | + * | |
535 | + * "Not pasting" means that the sequence is a login string specified in the | |
536 | + * hosts file, or a parameter to the String action. Returns are "move to | |
537 | + * beginning of next line"; newlines mean "Enter AID" and the termination of | |
538 | + * processing the string. Backslashes are processed as in C. | |
539 | + * | |
540 | + * @param s String to input. | |
541 | + * @param len Size of the string (or -1 to null terminated strings) | |
542 | + * @param pasting Non zero for pasting (See comments). | |
543 | + * | |
544 | + * @return The number of unprocessed characters or -1 if failed | |
545 | + */ | |
546 | + LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, const char *s, int len, int pasting); | |
547 | + | |
548 | + /** | |
549 | + * Set string at current cursor position. | |
550 | + * | |
551 | + * Returns are ignored; newlines mean "move to beginning of next line"; | |
552 | + * tabs and formfeeds become spaces. Backslashes are not special | |
553 | + * | |
554 | + * @param h Session handle. | |
555 | + * @param s String to input. | |
556 | + * | |
557 | + * @return Negative if error or number of processed characters. | |
558 | + * | |
559 | + */ | |
560 | + LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str); | |
561 | + | |
562 | + #define lib3270_set_text_at(h,r,c,t) lib3270_set_string_at(h,r,c,t) | |
563 | + LIB3270_EXPORT int lib3270_set_string_at(H3270 *h, int row, int col, const unsigned char *str); | |
564 | + LIB3270_EXPORT int lib3270_input_string(H3270 *hSession, const unsigned char *str); | |
565 | + | |
566 | + /** | |
567 | + * Set cursor address. | |
568 | + * | |
569 | + * @param h Session handle. | |
570 | + * @param baddr New cursor address. | |
571 | + * | |
572 | + * @return last cursor address. | |
573 | + * | |
574 | + */ | |
575 | + LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *h, int baddr); | |
576 | + | |
577 | + /** | |
578 | + * Set cursor position. | |
579 | + * | |
580 | + * @param h Session handle. | |
581 | + * @param row New cursor row. | |
582 | + * @param col New cursor col. | |
583 | + * | |
584 | + * @return last cursor address. | |
585 | + * | |
586 | + */ | |
587 | + LIB3270_EXPORT int lib3270_set_cursor_position(H3270 *h, int row, int col); | |
588 | + | |
589 | + /** | |
590 | + * get cursor address. | |
591 | + * | |
592 | + * @param h Session handle. | |
593 | + * | |
594 | + * @return Cursor address. | |
595 | + * | |
596 | + */ | |
597 | + LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h); | |
598 | + | |
599 | + | |
600 | + /** | |
601 | + * Move cursor | |
602 | + * | |
603 | + * @param h Session handle. | |
604 | + * @param dir Direction to move | |
605 | + * @param sel Non zero to move and selected to the current cursor position | |
606 | + * | |
607 | + * @return 0 if the movement can be done, non zero if failed. | |
608 | + */ | |
609 | + LIB3270_EXPORT int lib3270_move_cursor(H3270 *h, LIB3270_DIRECTION dir, unsigned char sel); | |
610 | + | |
611 | + /** | |
612 | + * Print page | |
613 | + * | |
614 | + * @param h Session Handle. | |
615 | + * | |
616 | + * @return 0 if ok, error code if not. | |
617 | + * | |
618 | + */ | |
619 | + LIB3270_EXPORT int lib3270_print(H3270 *h); | |
620 | + | |
621 | + /** | |
622 | + * Get buffer contents. | |
623 | + * | |
624 | + * @param h Session handle. | |
625 | + * @param first First element to get. | |
626 | + * @param last Last element to get. | |
627 | + * @param chr Pointer to buffer which will receive the read chars. | |
628 | + * @param attr Pointer to buffer which will receive the chars attributes. | |
629 | + * | |
630 | + */ | |
631 | + LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr); | |
632 | + | |
633 | + /** | |
634 | + * get toggle state. | |
635 | + * | |
636 | + * @param h Session handle. | |
637 | + * @param ix Toggle id. | |
638 | + * | |
639 | + * @return 0 if the toggle is disabled, non zero if enabled. | |
640 | + * | |
641 | + */ | |
642 | + LIB3270_EXPORT unsigned char lib3270_get_toggle(H3270 *h, LIB3270_TOGGLE ix); | |
643 | + | |
644 | + /** | |
645 | + * Set toggle state. | |
646 | + * | |
647 | + * @param h Session handle. | |
648 | + * @param ix Toggle id. | |
649 | + * @param value New toggle state (non zero for true). | |
650 | + * | |
651 | + * @returns 0 if the toggle is already at the state, 1 if the toggle was changed; < 0 on invalid toggle id | |
652 | + */ | |
653 | + LIB3270_EXPORT int lib3270_set_toggle(H3270 *h, LIB3270_TOGGLE ix, int value); | |
654 | + | |
655 | + /** | |
656 | + * Translate a string toggle name to the corresponding value. | |
657 | + * | |
658 | + * @param name Toggle name. | |
659 | + * | |
660 | + * @return Toggle ID or -1 if it's invalid. | |
661 | + * | |
662 | + */ | |
663 | + LIB3270_EXPORT LIB3270_TOGGLE lib3270_get_toggle_id(const char *name); | |
664 | + | |
665 | + /** | |
666 | + * Get the toggle name as string. | |
667 | + * | |
668 | + * @param id Toggle id | |
669 | + * | |
670 | + * @return Constant string with the toggle name or "" if invalid. | |
671 | + * | |
672 | + */ | |
673 | + LIB3270_EXPORT const char * lib3270_get_toggle_name(LIB3270_TOGGLE ix); | |
674 | + | |
675 | + /** | |
676 | + * Get a long description of the toggle. | |
677 | + * | |
678 | + * @return Constant string with the toggle description. | |
679 | + * | |
680 | + */ | |
681 | + LIB3270_EXPORT const char * lib3270_get_toggle_description(LIB3270_TOGGLE ix); | |
682 | + | |
683 | + /** | |
684 | + * Get a short description of the toggle (for menus). | |
685 | + * | |
686 | + * @return Constant string with the toggle label. | |
687 | + * | |
688 | + */ | |
689 | + LIB3270_EXPORT const char * lib3270_get_toggle_label(LIB3270_TOGGLE ix); | |
690 | + | |
691 | + /** | |
692 | + * Revert toggle status. | |
693 | + * | |
694 | + * @param h Session handle. | |
695 | + * @param ix Toggle id. | |
696 | + * | |
697 | + * @return Toggle status. | |
698 | + */ | |
699 | + LIB3270_EXPORT int lib3270_toggle(H3270 *h, LIB3270_TOGGLE ix); | |
700 | + | |
701 | + /** | |
702 | + * @brief IO flags. | |
703 | + * | |
704 | + */ | |
705 | + typedef enum _lib3270_io_event { | |
706 | + LIB3270_IO_FLAG_READ = 0x01, | |
707 | + LIB3270_IO_FLAG_EXCEPTION = 0x02, | |
708 | + LIB3270_IO_FLAG_WRITE = 0x04, | |
709 | + | |
710 | + LIB3270_IO_FLAG_MASK = 0x07 | |
711 | + } LIB3270_IO_FLAG; | |
712 | + | |
713 | + LIB3270_EXPORT void * lib3270_add_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*call)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); | |
714 | + LIB3270_EXPORT void lib3270_remove_poll(H3270 *session, void *id); | |
715 | + | |
716 | + LIB3270_EXPORT void lib3270_remove_poll_fd(H3270 *session, int fd); | |
717 | + LIB3270_EXPORT void lib3270_update_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag); | |
718 | + | |
719 | + /** Callback table | |
720 | + * | |
721 | + * Structure with GUI unblocking I/O calls, used to replace the lib3270´s internal ones. | |
722 | + * | |
723 | + */ | |
724 | + struct lib3270_callbacks | |
725 | + { | |
726 | + unsigned short sz; | |
727 | + | |
728 | + void * (*AddTimeOut)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)); | |
729 | + void (*RemoveTimeOut)(H3270 *session, void *timer); | |
730 | + | |
731 | + void * (*add_poll)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata); | |
732 | + void (*remove_poll)(H3270 *session, void *id); | |
733 | + | |
734 | + int (*Wait)(H3270 *hSession, int seconds); | |
735 | + int (*event_dispatcher)(H3270 *session, int wait); | |
736 | + void (*ring_bell)(H3270 *session); | |
737 | + | |
738 | + }; | |
739 | + | |
740 | + /** | |
741 | + * Register application Handlers. | |
742 | + * | |
743 | + * @param cbk Structure with the application I/O handles to set. | |
744 | + * | |
745 | + * @return 0 if ok, error code if not. | |
746 | + * | |
747 | + */ | |
748 | + int LIB3270_EXPORT lib3270_register_handlers(const struct lib3270_callbacks *cbk); | |
749 | + | |
750 | + /** | |
751 | + * Register time handlers. | |
752 | + * | |
753 | + * @param add Callback for adding a timeout | |
754 | + * @param rm Callback for removing a timeout | |
755 | + * | |
756 | + */ | |
757 | + void LIB3270_EXPORT lib3270_register_time_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer)); | |
758 | + | |
759 | + void LIB3270_EXPORT lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(H3270 *, void *id)); | |
760 | + | |
761 | + /** | |
762 | + * Get program message. | |
763 | + * | |
764 | + * @see LIB3270_MESSAGE | |
765 | + * | |
766 | + * @param h Session handle. | |
767 | + * | |
768 | + * @return Latest program message. | |
769 | + * | |
770 | + */ | |
771 | + LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_program_message(H3270 *h); | |
772 | + | |
773 | + /** | |
774 | + * Get connected LU name. | |
775 | + * | |
776 | + * Get the name of the connected LU; the value is internal to lib3270 and | |
777 | + * should not be changed ou freed. | |
778 | + * | |
779 | + * @param h Session handle. | |
780 | + * | |
781 | + * @return conected LU name or NULL if not connected. | |
782 | + * | |
783 | + */ | |
784 | + LIB3270_EXPORT const char * lib3270_get_luname(H3270 *h); | |
785 | + | |
786 | + LIB3270_EXPORT int lib3270_has_active_script(H3270 *h); | |
787 | + LIB3270_EXPORT int lib3270_get_typeahead(H3270 *h); | |
788 | + LIB3270_EXPORT int lib3270_get_undera(H3270 *h); | |
789 | + LIB3270_EXPORT int lib3270_get_oia_box_solid(H3270 *h); | |
790 | + LIB3270_EXPORT int lib3270_pconnected(H3270 *h); | |
791 | + LIB3270_EXPORT int lib3270_half_connected(H3270 *h); | |
792 | + LIB3270_EXPORT int lib3270_connected(H3270 *h); | |
793 | + LIB3270_EXPORT int lib3270_disconnected(H3270 *h); | |
794 | + LIB3270_EXPORT int lib3270_in_neither(H3270 *h); | |
795 | + LIB3270_EXPORT int lib3270_in_ansi(H3270 *h); | |
796 | + LIB3270_EXPORT int lib3270_in_3270(H3270 *h); | |
797 | + LIB3270_EXPORT int lib3270_in_sscp(H3270 *h); | |
798 | + LIB3270_EXPORT int lib3270_in_tn3270e(H3270 *h); | |
799 | + LIB3270_EXPORT int lib3270_in_e(H3270 *h); | |
800 | + | |
801 | + LIB3270_EXPORT int lib3270_is_ready(H3270 *h); | |
802 | + LIB3270_EXPORT int lib3270_is_connected(H3270 *h); | |
803 | + LIB3270_EXPORT int lib3270_is_secure(H3270 *h); | |
804 | + | |
805 | + LIB3270_EXPORT LIB3270_MESSAGE lib3270_lock_status(H3270 *h); | |
806 | + LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_secure(H3270 *session); | |
807 | + LIB3270_EXPORT long lib3270_get_SSL_verify_result(H3270 *session); | |
808 | + | |
809 | + | |
810 | + /** | |
811 | + * Call non gui function. | |
812 | + * | |
813 | + * Call informed function in a separate thread, keep gui main loop running until | |
814 | + * the function returns. | |
815 | + * | |
816 | + * @param callback Function to call. | |
817 | + * @param h Related session (for timer indicator) | |
818 | + * @param parm Parameter to be passed to the function. | |
819 | + * | |
820 | + */ | |
821 | +// LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm); | |
822 | + | |
823 | + | |
824 | + /** | |
825 | + * Run main iteration. | |
826 | + * | |
827 | + * Run lib3270 internal iterations, check for network inputs, process signals. | |
828 | + * | |
829 | + * @param h Related session. | |
830 | + * @param wait Wait for signal if not available. | |
831 | + * | |
832 | + */ | |
833 | + LIB3270_EXPORT void lib3270_main_iterate(H3270 *h, int wait); | |
834 | + | |
835 | + /** | |
836 | + * @brief Associate user data with 3270 session. | |
837 | + * | |
838 | + */ | |
839 | + LIB3270_EXPORT void lib3270_set_user_data(H3270 *h, void *ptr); | |
840 | + | |
841 | + /** | |
842 | + * @brief Get associated user data. | |
843 | + * | |
844 | + */ | |
845 | + LIB3270_EXPORT void * lib3270_get_user_data(H3270 *h); | |
846 | + | |
847 | + /** | |
848 | + * Wait for "N" seconds keeping main loop active. | |
849 | + * | |
850 | + * @param seconds Number of seconds to wait. | |
851 | + * | |
852 | + */ | |
853 | + LIB3270_EXPORT int lib3270_wait(H3270 *hSession, int seconds); | |
854 | + | |
855 | + /** | |
856 | + * Wait "N" seconds for "ready" state. | |
857 | + * | |
858 | + * @param seconds Number of seconds to wait. | |
859 | + * | |
860 | + * @return 0 if ok, errno code if not. | |
861 | + * | |
862 | + */ | |
863 | + LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds); | |
864 | + | |
865 | + /** | |
866 | + * "beep" to notify user. | |
867 | + * | |
868 | + * If available play a sound signal do alert user. | |
869 | + * | |
870 | + * @param h Session handle. | |
871 | + * | |
872 | + */ | |
873 | + LIB3270_EXPORT void lib3270_ring_bell(H3270 *session); | |
874 | + | |
875 | + | |
876 | + /** | |
877 | + * Get lib3270's charset. | |
878 | + * | |
879 | + * @param h Session handle. | |
880 | + * | |
881 | + * @return String with current encoding. | |
882 | + * | |
883 | + */ | |
884 | + LIB3270_EXPORT const char * lib3270_get_display_charset(H3270 *session); | |
885 | + | |
886 | + #define lib3270_get_charset(s) lib3270_get_display_charset(s) | |
887 | + | |
888 | + LIB3270_EXPORT const char * lib3270_get_default_charset(void); | |
889 | + | |
890 | + /** | |
891 | + * Get selected area. | |
892 | + * | |
893 | + * @param h Session Handle. | |
894 | + * | |
895 | + * @return selected text if available, or NULL. Release it with free() | |
896 | + * | |
897 | + */ | |
898 | + LIB3270_EXPORT char * lib3270_get_selected(H3270 *h); | |
899 | + | |
900 | + LIB3270_EXPORT char * lib3270_cut_selected(H3270 *hSession); | |
901 | + | |
902 | + LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession); | |
903 | + | |
904 | + /** | |
905 | + * Get all text inside the terminal. | |
906 | + * | |
907 | + * @param h Session Handle. | |
908 | + * @param offset Start position. | |
909 | + * @param len Text length or -1 to all text. | |
910 | + * @param lf Line break char (0 to disable line breaks). | |
911 | + * | |
912 | + * @return Contents at position if available, or NULL. Release it with lib3270_free() | |
913 | + * | |
914 | + */ | |
915 | + LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len, char lf); | |
916 | + | |
917 | + /** | |
918 | + * Get text at requested position | |
919 | + * | |
920 | + * @param h Session Handle. | |
921 | + * @param row Desired row. | |
922 | + * @param col Desired col. | |
923 | + * @param length Text length | |
924 | + * @param lf Line break char (0 to disable line breaks). | |
925 | + * | |
926 | + * @return Contents at position if available, or NULL. Release it with lib3270_free() | |
927 | + * | |
928 | + */ | |
929 | + LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len, char lf); | |
930 | + | |
931 | + /** | |
932 | + * Check for text at requested position | |
933 | + * | |
934 | + * @param h Session Handle. | |
935 | + * @param row Desired row. | |
936 | + * @param col Desired col. | |
937 | + * @param text Text to check. | |
938 | + * @param lf Line break char (0 to disable line breaks). | |
939 | + * | |
940 | + * @return Test result from strcmp | |
941 | + * | |
942 | + */ | |
943 | + LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text, char lf); | |
944 | + | |
945 | + | |
946 | + /** | |
947 | + * Get contents of the field at position. | |
948 | + * | |
949 | + * @param h Session Handle. | |
950 | + * @param baddr Reference position. | |
951 | + * | |
952 | + * @return Contents of the entire field, release it with lib3270_free() | |
953 | + * | |
954 | + */ | |
955 | + LIB3270_EXPORT char * lib3270_get_field_at(H3270 *h, int baddr); | |
956 | + | |
957 | + /** | |
958 | + * Find the next unprotected field. | |
959 | + * | |
960 | + * @param hSession Session handle. | |
961 | + * @param baddr0 Search start addr (-1 to use current cursor position). | |
962 | + * | |
963 | + * @return address following the unprotected attribute byte, or 0 if no nonzero-width unprotected field can be found. | |
964 | + * | |
965 | + */ | |
966 | + LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0); | |
967 | + | |
968 | + /** | |
969 | + * @brief Check if the screen position is protected. | |
970 | + * | |
971 | + */ | |
972 | + LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr0); | |
973 | + | |
974 | + /** | |
975 | + * Get Check if the screen position is protected. | |
976 | + * | |
977 | + * @param h Session Handle. | |
978 | + * @param row Desired row. | |
979 | + * @param col Desired col. | |
980 | + * | |
981 | + */ | |
982 | + LIB3270_EXPORT int lib3270_get_is_protected_at(H3270 *h, int row, int col); | |
983 | + | |
984 | + /** | |
985 | + * Get address of the first blank. | |
986 | + * | |
987 | + * Get address of the first blank after the last nonblank in the | |
988 | + * field, or if the field is full, to the last character in the field. | |
989 | + * | |
990 | + * @param hSession Session handle. | |
991 | + * @param baddr Field address. | |
992 | + * | |
993 | + * @return address of the first blank or -1 if invalid. | |
994 | + */ | |
995 | + LIB3270_EXPORT int lib3270_get_field_end(H3270 *hSession, int baddr); | |
996 | + | |
997 | + /** | |
998 | + * Find the buffer address of the field attribute for a given buffer address. | |
999 | + * | |
1000 | + * @param h Session handle. | |
1001 | + * @param addr Buffer address of the field. | |
1002 | + * | |
1003 | + * @return field address or -1 if the screen isn't formatted. | |
1004 | + * | |
1005 | + */ | |
1006 | + LIB3270_EXPORT int lib3270_field_addr(H3270 *h, int baddr); | |
1007 | + | |
1008 | + LIB3270_EXPORT int lib3270_field_attribute(H3270 *hSession, int baddr); | |
1009 | + | |
1010 | + /** | |
1011 | + * Get the length of the field at given buffer address. | |
1012 | + * | |
1013 | + * @param h Session handle. | |
1014 | + * @param addr Buffer address of the field. | |
1015 | + * | |
1016 | + * @return field length. | |
1017 | + * | |
1018 | + */ | |
1019 | + LIB3270_EXPORT int lib3270_field_length(H3270 *h, int baddr); | |
1020 | + | |
1021 | + | |
1022 | + /** | |
1023 | + * Get a terminal character and attribute. | |
1024 | + * | |
1025 | + * @param h Session Handle. | |
1026 | + * @param baddr Element address ((element_row*cols)+element_col) | |
1027 | + * @param c Pointer to character. | |
1028 | + * @param attr Pointer to attribute. | |
1029 | + * | |
1030 | + * @return 0 if ok or error code. | |
1031 | + * | |
1032 | + */ | |
1033 | + LIB3270_EXPORT int lib3270_get_element(H3270 *h, int baddr, unsigned char *c, unsigned short *attr); | |
1034 | + | |
1035 | + /** | |
1036 | + * Get field region | |
1037 | + * | |
1038 | + * @param h Session handle. | |
1039 | + * @param baddr Reference position to get the field start/stop offsets. | |
1040 | + * @param start return location for start of selection, as a character offset. | |
1041 | + * @param end return location for end of selection, as a character offset. | |
1042 | + * | |
1043 | + * @return Non 0 if invalid | |
1044 | + * | |
1045 | + */ | |
1046 | + LIB3270_EXPORT int lib3270_get_field_bounds(H3270 *hSession, int baddr, int *start, int *end); | |
1047 | + | |
1048 | + LIB3270_EXPORT int lib3270_get_field_start(H3270 *hSession, int baddr); | |
1049 | + LIB3270_EXPORT int lib3270_get_field_len(H3270 *hSession, int baddr); | |
1050 | + | |
1051 | + LIB3270_EXPORT int lib3270_get_word_bounds(H3270 *hSession, int baddr, int *start, int *end); | |
1052 | + | |
1053 | + LIB3270_EXPORT int lib3270_set_model(H3270 *hSession, const char *name); | |
1054 | + | |
1055 | + LIB3270_EXPORT const char * lib3270_get_model(H3270 *session); | |
1056 | + LIB3270_EXPORT int lib3270_get_model_number(H3270 *hSession); | |
1057 | + | |
1058 | + LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr); | |
1059 | + LIB3270_EXPORT int lib3270_is_protected_at(H3270 *h, unsigned int row, unsigned int col); | |
1060 | + | |
1061 | + LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name); | |
1062 | + | |
1063 | + /** | |
1064 | + * | |
1065 | + * Overrides the default value for the unlock delay (the delay between the host unlocking the | |
1066 | + * keyboard and lib3270 actually performing the unlock). | |
1067 | + * The value is in milliseconds; use 0 to turn off the delay completely. | |
1068 | + * | |
1069 | + * @param session lib3270 session. | |
1070 | + * @param Delay in milliseconds. | |
1071 | + * | |
1072 | + */ | |
1073 | + LIB3270_EXPORT void lib3270_set_unlock_delay(H3270 *session, unsigned short delay); | |
1074 | + | |
1075 | + | |
1076 | + /** | |
1077 | + * Alloc/Realloc memory buffer. | |
1078 | + * | |
1079 | + * Allocate/reallocate an array. | |
1080 | + * | |
1081 | + * @param elsize Element size. | |
1082 | + * @param nelem Number of elements in the array. | |
1083 | + * @param ptr Pointer to the actual array. | |
1084 | + * | |
1085 | + * @return Clean buffer with size for the number of elements. | |
1086 | + * | |
1087 | + */ | |
1088 | + LIB3270_EXPORT void * lib3270_calloc(int elsize, int nelem, void *ptr); | |
1089 | + | |
1090 | + LIB3270_EXPORT void * lib3270_malloc(int len); | |
1091 | + LIB3270_EXPORT void * lib3270_realloc(void *p, int len); | |
1092 | + LIB3270_EXPORT void * lib3270_replace(void **p, void *ptr); | |
1093 | + LIB3270_EXPORT void * lib3270_strdup(const char *str); | |
1094 | + | |
1095 | + /** | |
1096 | + * Release allocated memory. | |
1097 | + * | |
1098 | + * @param p Memory block to release (can be NULL) | |
1099 | + * | |
1100 | + * @return NULL | |
1101 | + */ | |
1102 | + LIB3270_EXPORT void * lib3270_free(void *p); | |
1103 | + | |
1104 | + | |
1105 | + /** | |
1106 | + * Get default session handle. | |
1107 | + * | |
1108 | + * @return Internal's lib3270 session handle. | |
1109 | + * | |
1110 | + */ | |
1111 | + LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void); | |
1112 | + | |
1113 | + /** | |
1114 | + * Get resource string. | |
1115 | + * | |
1116 | + * @param first_element First element of resource path | |
1117 | + * @param ... Resource path (ends with NULL) | |
1118 | + * | |
1119 | + * @return Resource string (Release with lib3270_free()) | |
1120 | + * | |
1121 | + */ | |
1122 | + LIB3270_EXPORT char * lib3270_get_resource_string(H3270 *hSession, const char *first_element, ...); | |
1123 | + | |
1124 | + /** | |
1125 | + * Get library version. | |
1126 | + * | |
1127 | + * @return Version of active library as string. | |
1128 | + * | |
1129 | + */ | |
1130 | + LIB3270_EXPORT const char * lib3270_get_version(void); | |
1131 | + | |
1132 | + /** | |
1133 | + * Get source code revision. | |
1134 | + * | |
1135 | + * @return SVN revision of the current source code. | |
1136 | + * | |
1137 | + */ | |
1138 | + LIB3270_EXPORT const char * lib3270_get_revision(void); | |
1139 | + | |
1140 | + LIB3270_EXPORT char * lib3270_vsprintf(const char *fmt, va_list args); | |
1141 | + LIB3270_EXPORT char * lib3270_strdup_printf(const char *fmt, ...); | |
1142 | + | |
1143 | + LIB3270_EXPORT int lib3270_clear_operator_error(H3270 *hSession); | |
1144 | + | |
1145 | + LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt); | |
1146 | + | |
1147 | + LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype); | |
1148 | + LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession); | |
1149 | + | |
1150 | + LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name); | |
1151 | + LIB3270_EXPORT LIB3270_OPTION lib3270_parse_host_type(const char *name); | |
1152 | + | |
1153 | + LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void); | |
1154 | + | |
1155 | + LIB3270_EXPORT LIB3270_POINTER lib3270_get_pointer(H3270 *hSession, int baddr); | |
1156 | + | |
1157 | + /** | |
1158 | + * The host is TSO? | |
1159 | + * | |
1160 | + * @param hSession Session Handle | |
1161 | + * | |
1162 | + * @return Non zero if the host is TSO. | |
1163 | + * | |
1164 | + */ | |
1165 | + LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession); | |
1166 | + | |
1167 | +#ifdef WIN32 | |
1168 | + LIB3270_EXPORT const char * lib3270_win32_strerror(int e); | |
1169 | + LIB3270_EXPORT const char * lib3270_win32_local_charset(void); | |
1170 | +#endif // WIn32 | |
1171 | + | |
1172 | +#ifdef __cplusplus | |
1173 | + } | |
1174 | +#endif | |
1175 | + | |
1176 | +#endif // LIB3270_H_INCLUDED | ... | ... |