Commit 8b9c149d8d0905d91ac5e566420b45806dd073a3
1 parent
803eba3b
Exists in
master
and in
3 other branches
Adding oversize setting
Updating API.
Showing
14 changed files
with
146 additions
and
225 deletions
Show diff stats
src/core/charset.c
| @@ -274,15 +274,13 @@ LIB3270_EXPORT const char * lib3270_get_default_charset(void) | @@ -274,15 +274,13 @@ LIB3270_EXPORT const char * lib3270_get_default_charset(void) | ||
| 274 | return "ISO-8859-1"; | 274 | return "ISO-8859-1"; |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | -LIB3270_EXPORT const char * lib3270_get_display_charset(H3270 *hSession) | 277 | +LIB3270_EXPORT const char * lib3270_get_display_charset(const H3270 *hSession) |
| 278 | { | 278 | { |
| 279 | - CHECK_SESSION_HANDLE(hSession); | ||
| 280 | return hSession->charset.display ? hSession->charset.display : "ISO-8859-1"; | 279 | return hSession->charset.display ? hSession->charset.display : "ISO-8859-1"; |
| 281 | } | 280 | } |
| 282 | 281 | ||
| 283 | -LIB3270_EXPORT const char * lib3270_get_host_charset(H3270 *hSession) | 282 | +LIB3270_EXPORT const char * lib3270_get_host_charset(const H3270 *hSession) |
| 284 | { | 283 | { |
| 285 | - CHECK_SESSION_HANDLE(hSession); | ||
| 286 | return hSession->charset.host; | 284 | return hSession->charset.host; |
| 287 | } | 285 | } |
| 288 | 286 |
src/core/host.c
| @@ -315,10 +315,8 @@ LIB3270_EXPORT int lib3270_set_luname(H3270 *hSession, const char *luname) | @@ -315,10 +315,8 @@ LIB3270_EXPORT int lib3270_set_luname(H3270 *hSession, const char *luname) | ||
| 315 | return 0; | 315 | return 0; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | -LIB3270_EXPORT const char * lib3270_get_url(H3270 *hSession) | 318 | +LIB3270_EXPORT const char * lib3270_get_url(const H3270 *hSession) |
| 319 | { | 319 | { |
| 320 | - CHECK_SESSION_HANDLE(hSession); | ||
| 321 | - | ||
| 322 | if(hSession->host.full) | 320 | if(hSession->host.full) |
| 323 | return hSession->host.full; | 321 | return hSession->host.full; |
| 324 | 322 | ||
| @@ -330,7 +328,7 @@ LIB3270_EXPORT const char * lib3270_get_url(H3270 *hSession) | @@ -330,7 +328,7 @@ LIB3270_EXPORT const char * lib3270_get_url(H3270 *hSession) | ||
| 330 | 328 | ||
| 331 | } | 329 | } |
| 332 | 330 | ||
| 333 | -LIB3270_EXPORT const char * lib3270_get_default_host(H3270 GNUC_UNUSED(*hSession)) | 331 | +LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 GNUC_UNUSED(*hSession)) |
| 334 | { | 332 | { |
| 335 | #ifdef LIB3270_DEFAULT_HOST | 333 | #ifdef LIB3270_DEFAULT_HOST |
| 336 | return LIB3270_DEFAULT_HOST; | 334 | return LIB3270_DEFAULT_HOST; |
| @@ -461,14 +459,8 @@ LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *n) | @@ -461,14 +459,8 @@ LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *n) | ||
| 461 | return 0; | 459 | return 0; |
| 462 | } | 460 | } |
| 463 | 461 | ||
| 464 | -LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h) | 462 | +LIB3270_EXPORT const char * lib3270_get_hostname(const H3270 *h) |
| 465 | { | 463 | { |
| 466 | - CHECK_SESSION_HANDLE(h); | ||
| 467 | - | ||
| 468 | - // TODO: Find a better way! | ||
| 469 | - if(!h->host.current) | ||
| 470 | - lib3270_set_url(h,NULL); | ||
| 471 | - | ||
| 472 | if(h->host.current) | 464 | if(h->host.current) |
| 473 | return h->host.current; | 465 | return h->host.current; |
| 474 | 466 | ||
| @@ -482,14 +474,8 @@ LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname) | @@ -482,14 +474,8 @@ LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname) | ||
| 482 | update_host(h); | 474 | update_host(h); |
| 483 | } | 475 | } |
| 484 | 476 | ||
| 485 | -LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h) | 477 | +LIB3270_EXPORT const char * lib3270_get_srvcname(const H3270 *h) |
| 486 | { | 478 | { |
| 487 | - CHECK_SESSION_HANDLE(h); | ||
| 488 | - | ||
| 489 | - // TODO: Find a better way! | ||
| 490 | - if(!h->host.srvc) | ||
| 491 | - lib3270_set_url(h,NULL); | ||
| 492 | - | ||
| 493 | if(h->host.srvc) | 479 | if(h->host.srvc) |
| 494 | return h->host.srvc; | 480 | return h->host.srvc; |
| 495 | return "telnet"; | 481 | return "telnet"; |
| @@ -502,38 +488,32 @@ LIB3270_EXPORT void lib3270_set_srvcname(H3270 *h, const char *srvc) | @@ -502,38 +488,32 @@ LIB3270_EXPORT void lib3270_set_srvcname(H3270 *h, const char *srvc) | ||
| 502 | update_host(h); | 488 | update_host(h); |
| 503 | } | 489 | } |
| 504 | 490 | ||
| 505 | -LIB3270_EXPORT const char * lib3270_get_host(H3270 *h) | 491 | +LIB3270_EXPORT const char * lib3270_get_host(const H3270 *h) |
| 506 | { | 492 | { |
| 507 | - CHECK_SESSION_HANDLE(h); | ||
| 508 | return h->host.full; | 493 | return h->host.full; |
| 509 | } | 494 | } |
| 510 | 495 | ||
| 511 | -LIB3270_EXPORT const char * lib3270_get_luname(H3270 *h) | 496 | +LIB3270_EXPORT const char * lib3270_get_luname(const H3270 *h) |
| 512 | { | 497 | { |
| 513 | - CHECK_SESSION_HANDLE(h); | ||
| 514 | return h->connected_lu; | 498 | return h->connected_lu; |
| 515 | } | 499 | } |
| 516 | 500 | ||
| 517 | -LIB3270_EXPORT int lib3270_has_active_script(H3270 *h) | 501 | +LIB3270_EXPORT int lib3270_has_active_script(const H3270 *h) |
| 518 | { | 502 | { |
| 519 | - CHECK_SESSION_HANDLE(h); | ||
| 520 | return (h->oia.flag[LIB3270_FLAG_SCRIPT] != 0); | 503 | return (h->oia.flag[LIB3270_FLAG_SCRIPT] != 0); |
| 521 | } | 504 | } |
| 522 | 505 | ||
| 523 | -LIB3270_EXPORT int lib3270_get_typeahead(H3270 *h) | 506 | +LIB3270_EXPORT int lib3270_get_typeahead(const H3270 *h) |
| 524 | { | 507 | { |
| 525 | - CHECK_SESSION_HANDLE(h); | ||
| 526 | return (h->oia.flag[LIB3270_FLAG_TYPEAHEAD] != 0); | 508 | return (h->oia.flag[LIB3270_FLAG_TYPEAHEAD] != 0); |
| 527 | } | 509 | } |
| 528 | 510 | ||
| 529 | -LIB3270_EXPORT int lib3270_get_undera(H3270 *h) | 511 | +LIB3270_EXPORT int lib3270_get_undera(const H3270 *h) |
| 530 | { | 512 | { |
| 531 | - CHECK_SESSION_HANDLE(h); | ||
| 532 | return (h->oia.flag[LIB3270_FLAG_UNDERA] != 0); | 513 | return (h->oia.flag[LIB3270_FLAG_UNDERA] != 0); |
| 533 | } | 514 | } |
| 534 | 515 | ||
| 535 | -LIB3270_EXPORT int lib3270_get_oia_box_solid(H3270 *h) | 516 | +LIB3270_EXPORT int lib3270_get_oia_box_solid(const H3270 *h) |
| 536 | { | 517 | { |
| 537 | - CHECK_SESSION_HANDLE(h); | ||
| 538 | return (h->oia.flag[LIB3270_FLAG_BOXSOLID] != 0); | 518 | return (h->oia.flag[LIB3270_FLAG_BOXSOLID] != 0); |
| 539 | } | 519 | } |
src/core/model.c
| @@ -34,12 +34,12 @@ | @@ -34,12 +34,12 @@ | ||
| 34 | #include <lib3270/trace.h> | 34 | #include <lib3270/trace.h> |
| 35 | #include <lib3270/log.h> | 35 | #include <lib3270/log.h> |
| 36 | 36 | ||
| 37 | - const char * lib3270_get_oversize(H3270 *hSession) | 37 | + const char * lib3270_get_oversize(const H3270 *hSession) |
| 38 | { | 38 | { |
| 39 | return hSession->oversize.str; | 39 | return hSession->oversize.str; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | - int lib3270_set_oversize(H3270 *hSession, const char GNUC_UNUSED(*value)) | 42 | + int lib3270_set_oversize(H3270 *hSession, const char *value) |
| 43 | { | 43 | { |
| 44 | if(hSession->cstate != LIB3270_NOT_CONNECTED) | 44 | if(hSession->cstate != LIB3270_NOT_CONNECTED) |
| 45 | return errno = EISCONN; | 45 | return errno = EISCONN; |
| @@ -47,10 +47,34 @@ | @@ -47,10 +47,34 @@ | ||
| 47 | if(!hSession->extended) | 47 | if(!hSession->extended) |
| 48 | return errno = ENOTSUP; | 48 | return errno = ENOTSUP; |
| 49 | 49 | ||
| 50 | - // TODO: Implement it! | ||
| 51 | - // Replace(hSession->oversize.str,value); | 50 | + if(hSession->oversize.str) |
| 51 | + { | ||
| 52 | + // Do nothing if it's the same value! | ||
| 53 | + if(value && !strcasecmp(hSession->oversize.str,value)) | ||
| 54 | + return 0; | ||
| 55 | + | ||
| 56 | + lib3270_free(hSession->oversize.str); | ||
| 57 | + hSession->oversize.str = NULL; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + int ovc = 0, ovr = 0; | ||
| 61 | + | ||
| 62 | + if(value) | ||
| 63 | + { | ||
| 64 | + char junk; | ||
| 65 | + | ||
| 66 | + if(sscanf(value, "%dx%d%c", &ovc, &ovr, &junk) != 2) | ||
| 67 | + return errno = EINVAL; | ||
| 52 | 68 | ||
| 53 | - return errno = ENOTSUP; | 69 | + hSession->oversize.str = lib3270_strdup(value); |
| 70 | + | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + ctlr_set_rows_cols(hSession, hSession->model_num, ovc, ovr); | ||
| 74 | + ctlr_reinit(hSession,MODEL_CHANGE); | ||
| 75 | + screen_update(hSession,0,hSession->view.rows*hSession->view.cols); | ||
| 76 | + | ||
| 77 | + return 0; | ||
| 54 | 78 | ||
| 55 | } | 79 | } |
| 56 | 80 | ||
| @@ -62,13 +86,11 @@ | @@ -62,13 +86,11 @@ | ||
| 62 | */ | 86 | */ |
| 63 | int lib3270_get_model_number(H3270 *hSession) | 87 | int lib3270_get_model_number(H3270 *hSession) |
| 64 | { | 88 | { |
| 65 | - CHECK_SESSION_HANDLE(hSession); | ||
| 66 | return hSession->model_num; | 89 | return hSession->model_num; |
| 67 | } | 90 | } |
| 68 | 91 | ||
| 69 | -const char * lib3270_get_model(H3270 *hSession) | 92 | +const char * lib3270_get_model(const H3270 *hSession) |
| 70 | { | 93 | { |
| 71 | - CHECK_SESSION_HANDLE(hSession); | ||
| 72 | return hSession->model_name; | 94 | return hSession->model_name; |
| 73 | } | 95 | } |
| 74 | 96 | ||
| @@ -152,9 +174,7 @@ static int parse_model_number(H3270 *session, const char *m) | @@ -152,9 +174,7 @@ static int parse_model_number(H3270 *session, const char *m) | ||
| 152 | 174 | ||
| 153 | int lib3270_set_model(H3270 *hSession, const char *model) | 175 | int lib3270_set_model(H3270 *hSession, const char *model) |
| 154 | { | 176 | { |
| 155 | - int ovc, ovr; | ||
| 156 | - char junk; | ||
| 157 | - int model_number; | 177 | + int model_number; |
| 158 | 178 | ||
| 159 | if(hSession->cstate != LIB3270_NOT_CONNECTED) | 179 | if(hSession->cstate != LIB3270_NOT_CONNECTED) |
| 160 | return errno = EISCONN; | 180 | return errno = EISCONN; |
| @@ -200,13 +220,6 @@ int lib3270_set_model(H3270 *hSession, const char *model) | @@ -200,13 +220,6 @@ int lib3270_set_model(H3270 *hSession, const char *model) | ||
| 200 | 220 | ||
| 201 | trace("Model_number: %d",model_number); | 221 | trace("Model_number: %d",model_number); |
| 202 | 222 | ||
| 203 | - if (!hSession->extended || hSession->oversize.str == CN || sscanf(hSession->oversize.str, "%dx%d%c", &ovc, &ovr, &junk) != 2) | ||
| 204 | - { | ||
| 205 | - ovc = 0; | ||
| 206 | - ovr = 0; | ||
| 207 | - } | ||
| 208 | - ctlr_set_rows_cols(hSession, model_number, ovc, ovr); | ||
| 209 | - | ||
| 210 | if (hSession->termname != CN) | 223 | if (hSession->termname != CN) |
| 211 | hSession->termtype = hSession->termname; | 224 | hSession->termtype = hSession->termname; |
| 212 | else | 225 | else |
| @@ -214,6 +227,18 @@ int lib3270_set_model(H3270 *hSession, const char *model) | @@ -214,6 +227,18 @@ int lib3270_set_model(H3270 *hSession, const char *model) | ||
| 214 | 227 | ||
| 215 | trace("Termtype: %s",hSession->termtype); | 228 | trace("Termtype: %s",hSession->termtype); |
| 216 | 229 | ||
| 230 | + | ||
| 231 | + // Check for oversize | ||
| 232 | + char junk; | ||
| 233 | + int ovc, ovr; | ||
| 234 | + | ||
| 235 | + if (!hSession->extended || hSession->oversize.str == CN || sscanf(hSession->oversize.str, "%dx%d%c", &ovc, &ovr, &junk) != 2) | ||
| 236 | + { | ||
| 237 | + ovc = 0; | ||
| 238 | + ovr = 0; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + ctlr_set_rows_cols(hSession, model_number, ovc, ovr); | ||
| 217 | ctlr_reinit(hSession,MODEL_CHANGE); | 242 | ctlr_reinit(hSession,MODEL_CHANGE); |
| 218 | screen_update(hSession,0,hSession->view.rows*hSession->view.cols); | 243 | screen_update(hSession,0,hSession->view.rows*hSession->view.cols); |
| 219 | 244 |
src/core/options.c
| @@ -73,9 +73,8 @@ | @@ -73,9 +73,8 @@ | ||
| 73 | 73 | ||
| 74 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ | 74 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ |
| 75 | 75 | ||
| 76 | -LIB3270_EXPORT LIB3270_HOST_TYPE lib3270_get_host_type(H3270 *hSession) | 76 | +LIB3270_EXPORT LIB3270_HOST_TYPE lib3270_get_host_type(const H3270 *hSession) |
| 77 | { | 77 | { |
| 78 | - CHECK_SESSION_HANDLE(hSession); | ||
| 79 | return hSession->host_type; | 78 | return hSession->host_type; |
| 80 | } | 79 | } |
| 81 | 80 | ||
| @@ -86,9 +85,8 @@ LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, LIB3270_HOST_TYPE opt) | @@ -86,9 +85,8 @@ LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, LIB3270_HOST_TYPE opt) | ||
| 86 | return 0; | 85 | return 0; |
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | -LIB3270_EXPORT int lib3270_get_color_type(H3270 *hSession) | 88 | +LIB3270_EXPORT int lib3270_get_color_type(const H3270 *hSession) |
| 90 | { | 89 | { |
| 91 | - CHECK_SESSION_HANDLE(hSession); | ||
| 92 | return (int) (hSession->mono ? 2 : hSession->colors); | 90 | return (int) (hSession->mono ? 2 : hSession->colors); |
| 93 | } | 91 | } |
| 94 | 92 | ||
| @@ -134,9 +132,8 @@ LIB3270_EXPORT const LIB3270_HOST_TYPE_ENTRY * lib3270_get_option_list(void) | @@ -134,9 +132,8 @@ LIB3270_EXPORT const LIB3270_HOST_TYPE_ENTRY * lib3270_get_option_list(void) | ||
| 134 | return host_type; | 132 | return host_type; |
| 135 | } | 133 | } |
| 136 | 134 | ||
| 137 | -LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession) | 135 | +LIB3270_EXPORT int lib3270_is_tso(const H3270 *hSession) |
| 138 | { | 136 | { |
| 139 | - CHECK_SESSION_HANDLE(hSession); | ||
| 140 | return (hSession->host_type & LIB3270_HOST_TSO) != 0; | 137 | return (hSession->host_type & LIB3270_HOST_TSO) != 0; |
| 141 | } | 138 | } |
| 142 | 139 | ||
| @@ -152,9 +149,8 @@ LIB3270_EXPORT int lib3270_set_tso(H3270 *hSession, int on) | @@ -152,9 +149,8 @@ LIB3270_EXPORT int lib3270_set_tso(H3270 *hSession, int on) | ||
| 152 | return 0; | 149 | return 0; |
| 153 | } | 150 | } |
| 154 | 151 | ||
| 155 | -LIB3270_EXPORT int lib3270_is_as400(H3270 *hSession) | 152 | +LIB3270_EXPORT int lib3270_is_as400(const H3270 *hSession) |
| 156 | { | 153 | { |
| 157 | - CHECK_SESSION_HANDLE(hSession); | ||
| 158 | return (hSession->host_type & LIB3270_HOST_AS400) != 0; | 154 | return (hSession->host_type & LIB3270_HOST_AS400) != 0; |
| 159 | } | 155 | } |
| 160 | 156 | ||
| @@ -202,7 +198,7 @@ LIB3270_EXPORT int lib3270_set_host_type_by_name(H3270 *hSession, const char *na | @@ -202,7 +198,7 @@ LIB3270_EXPORT int lib3270_set_host_type_by_name(H3270 *hSession, const char *na | ||
| 202 | return errno = EINVAL; | 198 | return errno = EINVAL; |
| 203 | } | 199 | } |
| 204 | 200 | ||
| 205 | -LIB3270_EXPORT const char * lib3270_get_host_type_name(H3270 *hSession) | 201 | +LIB3270_EXPORT const char * lib3270_get_host_type_name(const H3270 *hSession) |
| 206 | { | 202 | { |
| 207 | size_t f; | 203 | size_t f; |
| 208 | 204 |
src/core/properties/string.c
| @@ -34,12 +34,12 @@ | @@ -34,12 +34,12 @@ | ||
| 34 | #include <lib3270/properties.h> | 34 | #include <lib3270/properties.h> |
| 35 | #include <lib3270/keyboard.h> | 35 | #include <lib3270/keyboard.h> |
| 36 | 36 | ||
| 37 | - static const char * get_version(H3270 GNUC_UNUSED(*hSession)) | 37 | + static const char * get_version(const H3270 GNUC_UNUSED(*hSession)) |
| 38 | { | 38 | { |
| 39 | return lib3270_get_version(); | 39 | return lib3270_get_version(); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | - static const char * get_revision(H3270 GNUC_UNUSED(*hSession)) | 42 | + static const char * get_revision(const H3270 GNUC_UNUSED(*hSession)) |
| 43 | { | 43 | { |
| 44 | return lib3270_get_revision(); | 44 | return lib3270_get_revision(); |
| 45 | } | 45 | } |
src/core/screen.c
| @@ -423,7 +423,7 @@ LIB3270_EXPORT unsigned int lib3270_get_cursor_address(H3270 *hSession) | @@ -423,7 +423,7 @@ LIB3270_EXPORT unsigned int lib3270_get_cursor_address(H3270 *hSession) | ||
| 423 | * @return Current address or -1 if invalid (sets errno). | 423 | * @return Current address or -1 if invalid (sets errno). |
| 424 | * | 424 | * |
| 425 | */ | 425 | */ |
| 426 | -LIB3270_EXPORT int lib3270_translate_to_address(H3270 *hSession, unsigned int row, unsigned int col) | 426 | +LIB3270_EXPORT int lib3270_translate_to_address(const H3270 *hSession, unsigned int row, unsigned int col) |
| 427 | { | 427 | { |
| 428 | FAIL_IF_NOT_ONLINE(hSession); | 428 | FAIL_IF_NOT_ONLINE(hSession); |
| 429 | 429 | ||
| @@ -600,11 +600,12 @@ LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_program_message(H3270 *session) | @@ -600,11 +600,12 @@ LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_program_message(H3270 *session) | ||
| 600 | * | 600 | * |
| 601 | * @return 0 if the terminal is ready (no message, keyboard unlocked), LIB3270_MESSAGE if not | 601 | * @return 0 if the terminal is ready (no message, keyboard unlocked), LIB3270_MESSAGE if not |
| 602 | * | 602 | * |
| 603 | + * @retval LIB3270_MESSAGE_KYBDLOCK Keyboard is locked. | ||
| 604 | + * @retval LIB3270_MESSAGE_NONE Terminal is ready. | ||
| 605 | + * | ||
| 603 | */ | 606 | */ |
| 604 | -LIB3270_EXPORT LIB3270_MESSAGE lib3270_lock_status(H3270 *hSession) | 607 | +LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_lock_status(const H3270 *hSession) |
| 605 | { | 608 | { |
| 606 | - CHECK_SESSION_HANDLE(hSession); | ||
| 607 | - | ||
| 608 | if(hSession->oia.status) | 609 | if(hSession->oia.status) |
| 609 | return hSession->oia.status; | 610 | return hSession->oia.status; |
| 610 | 611 | ||
| @@ -623,9 +624,9 @@ LIB3270_EXPORT LIB3270_MESSAGE lib3270_lock_status(H3270 *hSession) | @@ -623,9 +624,9 @@ LIB3270_EXPORT LIB3270_MESSAGE lib3270_lock_status(H3270 *hSession) | ||
| 623 | * @return Non zero if terminal is ready for commands. | 624 | * @return Non zero if terminal is ready for commands. |
| 624 | * | 625 | * |
| 625 | */ | 626 | */ |
| 626 | -LIB3270_EXPORT int lib3270_is_ready(H3270 *hSession) | 627 | +LIB3270_EXPORT int lib3270_is_ready(const H3270 *hSession) |
| 627 | { | 628 | { |
| 628 | - return lib3270_lock_status(hSession) == LIB3270_MESSAGE_NONE; | 629 | + return lib3270_get_lock_status(hSession) == LIB3270_MESSAGE_NONE; |
| 629 | } | 630 | } |
| 630 | 631 | ||
| 631 | 632 |
src/core/state.c
| @@ -31,136 +31,63 @@ | @@ -31,136 +31,63 @@ | ||
| 31 | 31 | ||
| 32 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ | 32 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ |
| 33 | 33 | ||
| 34 | -LIB3270_EXPORT LIB3270_CSTATE lib3270_get_connection_state(H3270 *h) | 34 | +LIB3270_EXPORT LIB3270_CSTATE lib3270_get_connection_state(const H3270 *h) |
| 35 | { | 35 | { |
| 36 | - if(!h) | ||
| 37 | - { | ||
| 38 | - errno = EINVAL; | ||
| 39 | - return -1; | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | return h->cstate; | 36 | return h->cstate; |
| 43 | } | 37 | } |
| 44 | 38 | ||
| 45 | -LIB3270_EXPORT int lib3270_pconnected(H3270 *h) | 39 | +LIB3270_EXPORT int lib3270_pconnected(const H3270 *h) |
| 46 | { | 40 | { |
| 47 | - if(!h) | ||
| 48 | - { | ||
| 49 | - errno = EINVAL; | ||
| 50 | - return -1; | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | return (((int) h->cstate) >= (int)LIB3270_RESOLVING); | 41 | return (((int) h->cstate) >= (int)LIB3270_RESOLVING); |
| 54 | } | 42 | } |
| 55 | 43 | ||
| 56 | -LIB3270_EXPORT int lib3270_half_connected(H3270 *h) | 44 | +LIB3270_EXPORT int lib3270_half_connected(const H3270 *h) |
| 57 | { | 45 | { |
| 58 | - if(!h) | ||
| 59 | - { | ||
| 60 | - errno = EINVAL; | ||
| 61 | - return -1; | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | return (h->cstate == LIB3270_RESOLVING || h->cstate == LIB3270_PENDING); | 46 | return (h->cstate == LIB3270_RESOLVING || h->cstate == LIB3270_PENDING); |
| 65 | } | 47 | } |
| 66 | 48 | ||
| 67 | -LIB3270_EXPORT int lib3270_connected(H3270 *h) | 49 | +LIB3270_EXPORT int lib3270_connected(const H3270 *h) |
| 68 | { | 50 | { |
| 69 | - if(!h) | ||
| 70 | - { | ||
| 71 | - errno = EINVAL; | ||
| 72 | - return -1; | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | return ((int) h->cstate >= (int)LIB3270_CONNECTED_INITIAL); | 51 | return ((int) h->cstate >= (int)LIB3270_CONNECTED_INITIAL); |
| 76 | } | 52 | } |
| 77 | 53 | ||
| 78 | -LIB3270_EXPORT int lib3270_disconnected(H3270 *h) | 54 | +LIB3270_EXPORT int lib3270_disconnected(const H3270 *h) |
| 79 | { | 55 | { |
| 80 | - if(!h) | ||
| 81 | - { | ||
| 82 | - errno = EINVAL; | ||
| 83 | - return -1; | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | return ((int) h->cstate == (int)LIB3270_NOT_CONNECTED); | 56 | return ((int) h->cstate == (int)LIB3270_NOT_CONNECTED); |
| 87 | } | 57 | } |
| 88 | 58 | ||
| 89 | - | ||
| 90 | -LIB3270_EXPORT int lib3270_in_neither(H3270 *h) | 59 | +LIB3270_EXPORT int lib3270_in_neither(const H3270 *h) |
| 91 | { | 60 | { |
| 92 | - if(!h) | ||
| 93 | - { | ||
| 94 | - errno = EINVAL; | ||
| 95 | - return -1; | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | return (h->cstate == LIB3270_CONNECTED_INITIAL); | 61 | return (h->cstate == LIB3270_CONNECTED_INITIAL); |
| 99 | } | 62 | } |
| 100 | 63 | ||
| 101 | -LIB3270_EXPORT int lib3270_in_ansi(H3270 *h) | 64 | +LIB3270_EXPORT int lib3270_in_ansi(const H3270 *h) |
| 102 | { | 65 | { |
| 103 | - if(!h) | ||
| 104 | - { | ||
| 105 | - errno = EINVAL; | ||
| 106 | - return -1; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | return (h->cstate == LIB3270_CONNECTED_ANSI || h->cstate == LIB3270_CONNECTED_NVT); | 66 | return (h->cstate == LIB3270_CONNECTED_ANSI || h->cstate == LIB3270_CONNECTED_NVT); |
| 110 | } | 67 | } |
| 111 | 68 | ||
| 112 | -LIB3270_EXPORT int lib3270_in_3270(H3270 *h) | 69 | +LIB3270_EXPORT int lib3270_in_3270(const H3270 *h) |
| 113 | { | 70 | { |
| 114 | - if(!h) | ||
| 115 | - { | ||
| 116 | - errno = EINVAL; | ||
| 117 | - return -1; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | return (h->cstate == LIB3270_CONNECTED_3270 || h->cstate == LIB3270_CONNECTED_TN3270E || h->cstate == LIB3270_CONNECTED_SSCP); | 71 | return (h->cstate == LIB3270_CONNECTED_3270 || h->cstate == LIB3270_CONNECTED_TN3270E || h->cstate == LIB3270_CONNECTED_SSCP); |
| 121 | } | 72 | } |
| 122 | 73 | ||
| 123 | -LIB3270_EXPORT int lib3270_in_sscp(H3270 *h) | 74 | +LIB3270_EXPORT int lib3270_in_sscp(const H3270 *h) |
| 124 | { | 75 | { |
| 125 | - if(!h) | ||
| 126 | - { | ||
| 127 | - errno = EINVAL; | ||
| 128 | - return -1; | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | return (h->cstate == LIB3270_CONNECTED_SSCP); | 76 | return (h->cstate == LIB3270_CONNECTED_SSCP); |
| 132 | } | 77 | } |
| 133 | 78 | ||
| 134 | -LIB3270_EXPORT int lib3270_in_tn3270e(H3270 *h) | 79 | +LIB3270_EXPORT int lib3270_in_tn3270e(const H3270 *h) |
| 135 | { | 80 | { |
| 136 | - if(!h) | ||
| 137 | - { | ||
| 138 | - errno = EINVAL; | ||
| 139 | - return -1; | ||
| 140 | - } | ||
| 141 | - | ||
| 142 | return (h->cstate == LIB3270_CONNECTED_TN3270E); | 81 | return (h->cstate == LIB3270_CONNECTED_TN3270E); |
| 143 | } | 82 | } |
| 144 | 83 | ||
| 145 | -LIB3270_EXPORT int lib3270_is_connected(H3270 *h) | 84 | +LIB3270_EXPORT int lib3270_is_connected(const H3270 *h) |
| 146 | { | 85 | { |
| 147 | - if(!h) | ||
| 148 | - { | ||
| 149 | - errno = EINVAL; | ||
| 150 | - return -1; | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | return (h->cstate == LIB3270_CONNECTED_TN3270E); | 86 | return (h->cstate == LIB3270_CONNECTED_TN3270E); |
| 154 | } | 87 | } |
| 155 | 88 | ||
| 156 | -LIB3270_EXPORT int lib3270_in_e(H3270 *h) | 89 | +LIB3270_EXPORT int lib3270_in_e(const H3270 *h) |
| 157 | { | 90 | { |
| 158 | - if(!h) | ||
| 159 | - { | ||
| 160 | - errno = EINVAL; | ||
| 161 | - return -1; | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | return (h->cstate >= LIB3270_CONNECTED_INITIAL_E); | 91 | return (h->cstate >= LIB3270_CONNECTED_INITIAL_E); |
| 165 | } | 92 | } |
| 166 | 93 |
src/core/wait.c
| @@ -53,7 +53,7 @@ LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds) | @@ -53,7 +53,7 @@ LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds) | ||
| 53 | 53 | ||
| 54 | do | 54 | do |
| 55 | { | 55 | { |
| 56 | - if(!lib3270_lock_status(hSession)) | 56 | + if(!lib3270_get_lock_status(hSession)) |
| 57 | return 0; | 57 | return 0; |
| 58 | 58 | ||
| 59 | if(!lib3270_connected(hSession)) | 59 | if(!lib3270_connected(hSession)) |
src/include/lib3270.h
| @@ -511,7 +511,7 @@ | @@ -511,7 +511,7 @@ | ||
| 511 | * | 511 | * |
| 512 | * @return URL of the predefined host in the format tn3270://hostname:service or tn3270s://hostname:service | 512 | * @return URL of the predefined host in the format tn3270://hostname:service or tn3270s://hostname:service |
| 513 | */ | 513 | */ |
| 514 | - LIB3270_EXPORT const char * lib3270_get_default_host(H3270 *hSession); | 514 | + LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 *hSession); |
| 515 | 515 | ||
| 516 | /** | 516 | /** |
| 517 | * @brief Set URL for the certificate revocation list. | 517 | * @brief Set URL for the certificate revocation list. |
| @@ -524,7 +524,7 @@ | @@ -524,7 +524,7 @@ | ||
| 524 | */ | 524 | */ |
| 525 | LIB3270_EXPORT int lib3270_set_crl_url(H3270 *hSession, const char *crl); | 525 | LIB3270_EXPORT int lib3270_set_crl_url(H3270 *hSession, const char *crl); |
| 526 | 526 | ||
| 527 | - LIB3270_EXPORT const char * lib3270_get_crl_url(H3270 *hSession); | 527 | + LIB3270_EXPORT const char * lib3270_get_crl_url(const H3270 *hSession); |
| 528 | 528 | ||
| 529 | /** | 529 | /** |
| 530 | * @brief Get hostname for the connect/reconnect operations. | 530 | * @brief Get hostname for the connect/reconnect operations. |
| @@ -534,9 +534,9 @@ | @@ -534,9 +534,9 @@ | ||
| 534 | * @return Pointer to host id set (internal data, do not change it) | 534 | * @return Pointer to host id set (internal data, do not change it) |
| 535 | * | 535 | * |
| 536 | */ | 536 | */ |
| 537 | - LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h); | 537 | + LIB3270_EXPORT const char * LIB3270_DEPRECATED(lib3270_get_hostname(const H3270 *h)); |
| 538 | 538 | ||
| 539 | - LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname); | 539 | + LIB3270_EXPORT void LIB3270_DEPRECATED(lib3270_set_hostname(H3270 *h, const char *hostname)); |
| 540 | 540 | ||
| 541 | /** | 541 | /** |
| 542 | * @brief Get SSL host option. | 542 | * @brief Get SSL host option. |
| @@ -544,32 +544,32 @@ | @@ -544,32 +544,32 @@ | ||
| 544 | * @return Non zero if the host URL has SSL scheme. | 544 | * @return Non zero if the host URL has SSL scheme. |
| 545 | * | 545 | * |
| 546 | */ | 546 | */ |
| 547 | - LIB3270_EXPORT int lib3270_get_secure_host(H3270 *hSession); | 547 | + LIB3270_EXPORT int lib3270_get_secure_host(const H3270 *hSession); |
| 548 | 548 | ||
| 549 | /** | 549 | /** |
| 550 | * @brief Get security state. | 550 | * @brief Get security state. |
| 551 | * | 551 | * |
| 552 | */ | 552 | */ |
| 553 | - LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_ssl_state(H3270 *session); | 553 | + LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_ssl_state(const H3270 *session); |
| 554 | 554 | ||
| 555 | - LIB3270_EXPORT long lib3270_get_SSL_verify_result(H3270 *session); | 555 | + LIB3270_EXPORT long lib3270_get_SSL_verify_result(const H3270 *session); |
| 556 | 556 | ||
| 557 | /** | 557 | /** |
| 558 | * @brief Get security state as text. | 558 | * @brief Get security state as text. |
| 559 | * | 559 | * |
| 560 | */ | 560 | */ |
| 561 | - LIB3270_EXPORT const char * lib3270_get_ssl_state_message(H3270 *hSession); | 561 | + LIB3270_EXPORT const char * lib3270_get_ssl_state_message(const H3270 *hSession); |
| 562 | 562 | ||
| 563 | - LIB3270_EXPORT const char * lib3270_get_ssl_state_icon_name(H3270 *hSession); | 563 | + LIB3270_EXPORT const char * lib3270_get_ssl_state_icon_name(const H3270 *hSession); |
| 564 | 564 | ||
| 565 | /** | 565 | /** |
| 566 | * @brief Get security state message. | 566 | * @brief Get security state message. |
| 567 | * | 567 | * |
| 568 | */ | 568 | */ |
| 569 | - LIB3270_EXPORT const char * lib3270_get_ssl_state_description(H3270 *hSession); | 569 | + LIB3270_EXPORT const char * lib3270_get_ssl_state_description(const H3270 *hSession); |
| 570 | 570 | ||
| 571 | - LIB3270_EXPORT char * lib3270_get_ssl_crl_text(H3270 *hSession); | ||
| 572 | - LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(H3270 *hSession); | 571 | + LIB3270_EXPORT char * lib3270_get_ssl_crl_text(const H3270 *hSession); |
| 572 | + LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(const H3270 *hSession); | ||
| 573 | 573 | ||
| 574 | 574 | ||
| 575 | /** | 575 | /** |
| @@ -580,9 +580,9 @@ | @@ -580,9 +580,9 @@ | ||
| 580 | * @return Pointer to service name (internal data, do not change it) | 580 | * @return Pointer to service name (internal data, do not change it) |
| 581 | * | 581 | * |
| 582 | */ | 582 | */ |
| 583 | - LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h); | 583 | + LIB3270_EXPORT const char * LIB3270_DEPRECATED(lib3270_get_srvcname(const H3270 *h)); |
| 584 | 584 | ||
| 585 | - LIB3270_EXPORT void lib3270_set_srvcname(H3270 *h, const char *srvc); | 585 | + LIB3270_EXPORT void LIB3270_DEPRECATED(lib3270_set_srvcname(H3270 *h, const char *srvc)); |
| 586 | 586 | ||
| 587 | /** | 587 | /** |
| 588 | * @brief Get HOST URL. | 588 | * @brief Get HOST URL. |
| @@ -590,7 +590,7 @@ | @@ -590,7 +590,7 @@ | ||
| 590 | * @return TN3270 Connection URL. | 590 | * @return TN3270 Connection URL. |
| 591 | * | 591 | * |
| 592 | */ | 592 | */ |
| 593 | - LIB3270_EXPORT const char * lib3270_get_url(H3270 *hSession); | 593 | + LIB3270_EXPORT const char * lib3270_get_url(const H3270 *hSession); |
| 594 | 594 | ||
| 595 | /** | 595 | /** |
| 596 | * @brief Get session options. | 596 | * @brief Get session options. |
| @@ -598,9 +598,9 @@ | @@ -598,9 +598,9 @@ | ||
| 598 | * @param h Session handle. | 598 | * @param h Session handle. |
| 599 | * | 599 | * |
| 600 | */ | 600 | */ |
| 601 | - LIB3270_EXPORT LIB3270_HOST_TYPE lib3270_get_host_type(H3270 *hSession); | 601 | + LIB3270_EXPORT LIB3270_HOST_TYPE lib3270_get_host_type(const H3270 *hSession); |
| 602 | 602 | ||
| 603 | - LIB3270_EXPORT const char * lib3270_get_host_type_name(H3270 *hSession); | 603 | + LIB3270_EXPORT const char * lib3270_get_host_type_name(const H3270 *hSession); |
| 604 | 604 | ||
| 605 | /** | 605 | /** |
| 606 | * @brief Get URL of the hostname for the connect/reconnect operations. | 606 | * @brief Get URL of the hostname for the connect/reconnect operations. |
| @@ -610,7 +610,7 @@ | @@ -610,7 +610,7 @@ | ||
| 610 | * @return Pointer to host URL set (internal data, do not change it) | 610 | * @return Pointer to host URL set (internal data, do not change it) |
| 611 | * | 611 | * |
| 612 | */ | 612 | */ |
| 613 | - LIB3270_EXPORT const char * lib3270_get_host(H3270 *h); | 613 | + LIB3270_EXPORT const char * lib3270_get_host(const H3270 *h); |
| 614 | 614 | ||
| 615 | 615 | ||
| 616 | /** | 616 | /** |
| @@ -655,7 +655,7 @@ | @@ -655,7 +655,7 @@ | ||
| 655 | * @return Connection state. | 655 | * @return Connection state. |
| 656 | * | 656 | * |
| 657 | */ | 657 | */ |
| 658 | - LIB3270_EXPORT LIB3270_CSTATE lib3270_get_connection_state(H3270 *h); | 658 | + LIB3270_EXPORT LIB3270_CSTATE lib3270_get_connection_state(const H3270 *h); |
| 659 | 659 | ||
| 660 | /** | 660 | /** |
| 661 | * @brief Pretend that a sequence of keys was entered at the keyboard. | 661 | * @brief Pretend that a sequence of keys was entered at the keyboard. |
| @@ -690,7 +690,7 @@ | @@ -690,7 +690,7 @@ | ||
| 690 | * @retval -EOVERFLOW The coordinates are out of the screen. | 690 | * @retval -EOVERFLOW The coordinates are out of the screen. |
| 691 | * | 691 | * |
| 692 | */ | 692 | */ |
| 693 | - LIB3270_EXPORT int lib3270_translate_to_address(H3270 *hSession, unsigned int row, unsigned int col); | 693 | + LIB3270_EXPORT int lib3270_translate_to_address(const H3270 *hSession, unsigned int row, unsigned int col); |
| 694 | 694 | ||
| 695 | /** | 695 | /** |
| 696 | * @brief Set string at current cursor position. | 696 | * @brief Set string at current cursor position. |
| @@ -979,30 +979,30 @@ | @@ -979,30 +979,30 @@ | ||
| 979 | * @return conected LU name or NULL if not connected. | 979 | * @return conected LU name or NULL if not connected. |
| 980 | * | 980 | * |
| 981 | */ | 981 | */ |
| 982 | - LIB3270_EXPORT const char * lib3270_get_luname(H3270 *hSession); | 982 | + LIB3270_EXPORT const char * lib3270_get_luname(const H3270 *hSession); |
| 983 | 983 | ||
| 984 | LIB3270_EXPORT int lib3270_set_luname(H3270 *hSession, const char *luname); | 984 | LIB3270_EXPORT int lib3270_set_luname(H3270 *hSession, const char *luname); |
| 985 | 985 | ||
| 986 | - LIB3270_EXPORT int lib3270_has_active_script(H3270 *h); | ||
| 987 | - LIB3270_EXPORT int lib3270_get_typeahead(H3270 *h); | ||
| 988 | - LIB3270_EXPORT int lib3270_get_undera(H3270 *h); | ||
| 989 | - LIB3270_EXPORT int lib3270_get_oia_box_solid(H3270 *h); | ||
| 990 | - LIB3270_EXPORT int lib3270_pconnected(H3270 *h); | ||
| 991 | - LIB3270_EXPORT int lib3270_half_connected(H3270 *h); | ||
| 992 | - LIB3270_EXPORT int lib3270_connected(H3270 *h); | ||
| 993 | - LIB3270_EXPORT int lib3270_disconnected(H3270 *h); | ||
| 994 | - LIB3270_EXPORT int lib3270_in_neither(H3270 *h); | ||
| 995 | - LIB3270_EXPORT int lib3270_in_ansi(H3270 *h); | ||
| 996 | - LIB3270_EXPORT int lib3270_in_3270(H3270 *h); | ||
| 997 | - LIB3270_EXPORT int lib3270_in_sscp(H3270 *h); | ||
| 998 | - LIB3270_EXPORT int lib3270_in_tn3270e(H3270 *h); | ||
| 999 | - LIB3270_EXPORT int lib3270_in_e(H3270 *h); | 986 | + LIB3270_EXPORT int lib3270_has_active_script(const H3270 *h); |
| 987 | + LIB3270_EXPORT int lib3270_get_typeahead(const H3270 *h); | ||
| 988 | + LIB3270_EXPORT int lib3270_get_undera(const H3270 *h); | ||
| 989 | + LIB3270_EXPORT int lib3270_get_oia_box_solid(const H3270 *h); | ||
| 990 | + LIB3270_EXPORT int lib3270_pconnected(const H3270 *h); | ||
| 991 | + LIB3270_EXPORT int lib3270_half_connected(const H3270 *h); | ||
| 992 | + LIB3270_EXPORT int lib3270_connected(const H3270 *h); | ||
| 993 | + LIB3270_EXPORT int lib3270_disconnected(const H3270 *h); | ||
| 994 | + LIB3270_EXPORT int lib3270_in_neither(const H3270 *h); | ||
| 995 | + LIB3270_EXPORT int lib3270_in_ansi(const H3270 *h); | ||
| 996 | + LIB3270_EXPORT int lib3270_in_3270(const H3270 *h); | ||
| 997 | + LIB3270_EXPORT int lib3270_in_sscp(const H3270 *h); | ||
| 998 | + LIB3270_EXPORT int lib3270_in_tn3270e(const H3270 *h); | ||
| 999 | + LIB3270_EXPORT int lib3270_in_e(const H3270 *h); | ||
| 1000 | 1000 | ||
| 1001 | - LIB3270_EXPORT int lib3270_is_ready(H3270 *h); | ||
| 1002 | - LIB3270_EXPORT int lib3270_is_connected(H3270 *h); | ||
| 1003 | - LIB3270_EXPORT int lib3270_is_secure(H3270 *h); | 1001 | + LIB3270_EXPORT int lib3270_is_ready(const H3270 *h); |
| 1002 | + LIB3270_EXPORT int lib3270_is_connected(const H3270 *h); | ||
| 1003 | + LIB3270_EXPORT int lib3270_is_secure(const H3270 *h); | ||
| 1004 | 1004 | ||
| 1005 | - LIB3270_EXPORT LIB3270_MESSAGE lib3270_lock_status(H3270 *h); | 1005 | + LIB3270_EXPORT LIB3270_MESSAGE lib3270_get_lock_status(const H3270 *h); |
| 1006 | 1006 | ||
| 1007 | /** | 1007 | /** |
| 1008 | * Run main iteration. | 1008 | * Run main iteration. |
| @@ -1071,7 +1071,7 @@ | @@ -1071,7 +1071,7 @@ | ||
| 1071 | * @return String with current encoding. | 1071 | * @return String with current encoding. |
| 1072 | * | 1072 | * |
| 1073 | */ | 1073 | */ |
| 1074 | - LIB3270_EXPORT const char * lib3270_get_display_charset(H3270 *session); | 1074 | + LIB3270_EXPORT const char * lib3270_get_display_charset(const H3270 *session); |
| 1075 | 1075 | ||
| 1076 | #define lib3270_get_charset(s) lib3270_get_display_charset(s) | 1076 | #define lib3270_get_charset(s) lib3270_get_display_charset(s) |
| 1077 | 1077 | ||
| @@ -1303,7 +1303,7 @@ | @@ -1303,7 +1303,7 @@ | ||
| 1303 | 1303 | ||
| 1304 | LIB3270_EXPORT int lib3270_set_model(H3270 *hSession, const char *name); | 1304 | LIB3270_EXPORT int lib3270_set_model(H3270 *hSession, const char *name); |
| 1305 | 1305 | ||
| 1306 | - LIB3270_EXPORT const char * lib3270_get_model(H3270 *session); | 1306 | + LIB3270_EXPORT const char * lib3270_get_model(const H3270 *session); |
| 1307 | LIB3270_EXPORT int lib3270_get_model_number(H3270 *hSession); | 1307 | LIB3270_EXPORT int lib3270_get_model_number(H3270 *hSession); |
| 1308 | 1308 | ||
| 1309 | LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name); | 1309 | LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name); |
| @@ -1398,7 +1398,7 @@ | @@ -1398,7 +1398,7 @@ | ||
| 1398 | 1398 | ||
| 1399 | 1399 | ||
| 1400 | LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, int colortype); | 1400 | LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, int colortype); |
| 1401 | - LIB3270_EXPORT int lib3270_get_color_type(H3270 *hSession); | 1401 | + LIB3270_EXPORT int lib3270_get_color_type(const H3270 *hSession); |
| 1402 | 1402 | ||
| 1403 | LIB3270_EXPORT int lib3270_set_host_type_by_name(H3270 *hSession, const char *name); | 1403 | LIB3270_EXPORT int lib3270_set_host_type_by_name(H3270 *hSession, const char *name); |
| 1404 | LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, LIB3270_HOST_TYPE opt); | 1404 | LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, LIB3270_HOST_TYPE opt); |
| @@ -1430,7 +1430,7 @@ | @@ -1430,7 +1430,7 @@ | ||
| 1430 | * @return Non zero if the host is TSO. | 1430 | * @return Non zero if the host is TSO. |
| 1431 | * | 1431 | * |
| 1432 | */ | 1432 | */ |
| 1433 | - LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession); | 1433 | + LIB3270_EXPORT int lib3270_is_tso(const H3270 *hSession); |
| 1434 | 1434 | ||
| 1435 | LIB3270_EXPORT int lib3270_set_tso(H3270 *hSession, int on); | 1435 | LIB3270_EXPORT int lib3270_set_tso(H3270 *hSession, int on); |
| 1436 | 1436 | ||
| @@ -1442,7 +1442,7 @@ | @@ -1442,7 +1442,7 @@ | ||
| 1442 | * @return Non zero if the host is AS400. | 1442 | * @return Non zero if the host is AS400. |
| 1443 | * | 1443 | * |
| 1444 | */ | 1444 | */ |
| 1445 | - LIB3270_EXPORT int lib3270_is_as400(H3270 *hSession); | 1445 | + LIB3270_EXPORT int lib3270_is_as400(const H3270 *hSession); |
| 1446 | 1446 | ||
| 1447 | LIB3270_EXPORT int lib3270_set_as400(H3270 *hSession, int on); | 1447 | LIB3270_EXPORT int lib3270_set_as400(H3270 *hSession, int on); |
| 1448 | 1448 |
src/include/lib3270/charset.h
| @@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
| 59 | } lib3270_remap_scope; | 59 | } lib3270_remap_scope; |
| 60 | 60 | ||
| 61 | LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name); | 61 | LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name); |
| 62 | - LIB3270_EXPORT const char * lib3270_get_host_charset(H3270 *hSession); | 62 | + LIB3270_EXPORT const char * lib3270_get_host_charset(const H3270 *hSession); |
| 63 | LIB3270_EXPORT void lib3270_reset_charset(H3270 *hSession, const char * host, const char * display, unsigned long cgcsgid); | 63 | LIB3270_EXPORT void lib3270_reset_charset(H3270 *hSession, const char * host, const char * display, unsigned long cgcsgid); |
| 64 | 64 | ||
| 65 | LIB3270_EXPORT void lib3270_remap_char(H3270 *hSession, unsigned short ebc, unsigned short iso, lib3270_remap_scope scope, unsigned char one_way); | 65 | LIB3270_EXPORT void lib3270_remap_char(H3270 *hSession, unsigned short ebc, unsigned short iso, lib3270_remap_scope scope, unsigned char one_way); |
src/include/lib3270/popup.h
| @@ -68,8 +68,8 @@ | @@ -68,8 +68,8 @@ | ||
| 68 | 68 | ||
| 69 | LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); | 69 | LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, va_list); |
| 70 | 70 | ||
| 71 | - LIB3270_EXPORT LIB3270_NOTIFY lib3270_get_ssl_state_icon(H3270 *hSession); | ||
| 72 | - LIB3270_EXPORT const char * lib3270_get_ssl_state_icon_name(H3270 *hSession); | 71 | + LIB3270_EXPORT LIB3270_NOTIFY lib3270_get_ssl_state_icon(const H3270 *hSession); |
| 72 | + LIB3270_EXPORT const char * lib3270_get_ssl_state_icon_name(const H3270 *hSession); | ||
| 73 | 73 | ||
| 74 | #ifdef __cplusplus | 74 | #ifdef __cplusplus |
| 75 | } | 75 | } |
src/include/lib3270/properties.h
| @@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
| 64 | { | 64 | { |
| 65 | const char * name; ///< @brief Property name. | 65 | const char * name; ///< @brief Property name. |
| 66 | const char * description; ///< @brief Property description. | 66 | const char * description; ///< @brief Property description. |
| 67 | - const char * (*get)(H3270 *hSession); ///< @brief Get value. | 67 | + const char * (*get)(const H3270 *hSession); ///< @brief Get value. |
| 68 | int (*set)(H3270 *hSession, const char * value); ///< @brief Set value. | 68 | int (*set)(H3270 *hSession, const char * value); ///< @brief Set value. |
| 69 | 69 | ||
| 70 | } LIB3270_STRING_PROPERTY; | 70 | } LIB3270_STRING_PROPERTY; |
| @@ -147,7 +147,7 @@ | @@ -147,7 +147,7 @@ | ||
| 147 | * @return Oversize definition (NULL if not set). | 147 | * @return Oversize definition (NULL if not set). |
| 148 | * | 148 | * |
| 149 | */ | 149 | */ |
| 150 | - LIB3270_EXPORT const char * lib3270_get_oversize(H3270 *hSession); | 150 | + LIB3270_EXPORT const char * lib3270_get_oversize(const H3270 *hSession); |
| 151 | 151 | ||
| 152 | /** | 152 | /** |
| 153 | * @brief Set oversize. | 153 | * @brief Set oversize. |
src/ssl/properties.c
| @@ -41,14 +41,8 @@ | @@ -41,14 +41,8 @@ | ||
| 41 | * @return Non zero if the host URL has SSL scheme. | 41 | * @return Non zero if the host URL has SSL scheme. |
| 42 | * | 42 | * |
| 43 | */ | 43 | */ |
| 44 | -LIB3270_EXPORT int lib3270_get_secure_host(H3270 *hSession) | 44 | +LIB3270_EXPORT int lib3270_get_secure_host(const H3270 *hSession) |
| 45 | { | 45 | { |
| 46 | - CHECK_SESSION_HANDLE(hSession); | ||
| 47 | - | ||
| 48 | - // TODO: Find a better way! | ||
| 49 | - if(!hSession->host.current) | ||
| 50 | - lib3270_set_url(hSession,NULL); | ||
| 51 | - | ||
| 52 | #ifdef HAVE_LIBSSL | 46 | #ifdef HAVE_LIBSSL |
| 53 | return hSession->ssl.enabled ? 1 : 0; | 47 | return hSession->ssl.enabled ? 1 : 0; |
| 54 | #else | 48 | #else |
| @@ -58,7 +52,7 @@ LIB3270_EXPORT int lib3270_get_secure_host(H3270 *hSession) | @@ -58,7 +52,7 @@ LIB3270_EXPORT int lib3270_get_secure_host(H3270 *hSession) | ||
| 58 | } | 52 | } |
| 59 | 53 | ||
| 60 | #ifdef SSL_ENABLE_CRL_CHECK | 54 | #ifdef SSL_ENABLE_CRL_CHECK |
| 61 | -LIB3270_EXPORT char * lib3270_get_ssl_crl_text(H3270 *hSession) | 55 | +LIB3270_EXPORT char * lib3270_get_ssl_crl_text(const H3270 *hSession) |
| 62 | { | 56 | { |
| 63 | 57 | ||
| 64 | if(hSession->ssl.crl.cert) | 58 | if(hSession->ssl.crl.cert) |
| @@ -86,14 +80,14 @@ LIB3270_EXPORT char * lib3270_get_ssl_crl_text(H3270 *hSession) | @@ -86,14 +80,14 @@ LIB3270_EXPORT char * lib3270_get_ssl_crl_text(H3270 *hSession) | ||
| 86 | 80 | ||
| 87 | } | 81 | } |
| 88 | #else | 82 | #else |
| 89 | -LIB3270_EXPORT char * lib3270_get_ssl_crl_text(H3270 GNUC_UNUSED(*hSession)) | 83 | +LIB3270_EXPORT char * lib3270_get_ssl_crl_text(const H3270 GNUC_UNUSED(*hSession)) |
| 90 | { | 84 | { |
| 91 | return NULL; | 85 | return NULL; |
| 92 | } | 86 | } |
| 93 | #endif // SSL_ENABLE_CRL_CHECK | 87 | #endif // SSL_ENABLE_CRL_CHECK |
| 94 | 88 | ||
| 95 | 89 | ||
| 96 | -LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(H3270 *hSession) | 90 | +LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(const H3270 *hSession) |
| 97 | { | 91 | { |
| 98 | #ifdef HAVE_LIBSSL | 92 | #ifdef HAVE_LIBSSL |
| 99 | if(hSession->ssl.con) | 93 | if(hSession->ssl.con) |
| @@ -124,7 +118,7 @@ LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(H3270 *hSession) | @@ -124,7 +118,7 @@ LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(H3270 *hSession) | ||
| 124 | 118 | ||
| 125 | #pragma GCC diagnostic push | 119 | #pragma GCC diagnostic push |
| 126 | #pragma GCC diagnostic ignored "-Wunused-parameter" | 120 | #pragma GCC diagnostic ignored "-Wunused-parameter" |
| 127 | - const char * lib3270_get_crl_url(H3270 *hSession) | 121 | + const char * lib3270_get_crl_url(const H3270 *hSession) |
| 128 | { | 122 | { |
| 129 | #ifdef SSL_ENABLE_CRL_CHECK | 123 | #ifdef SSL_ENABLE_CRL_CHECK |
| 130 | if(hSession->ssl.crl.url) | 124 | if(hSession->ssl.crl.url) |
src/ssl/state.c
| @@ -45,24 +45,24 @@ | @@ -45,24 +45,24 @@ | ||
| 45 | 45 | ||
| 46 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 46 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 47 | 47 | ||
| 48 | -LIB3270_EXPORT int lib3270_is_secure(H3270 *hSession) | 48 | +LIB3270_EXPORT int lib3270_is_secure(const H3270 *hSession) |
| 49 | { | 49 | { |
| 50 | return lib3270_get_ssl_state(hSession) == LIB3270_SSL_SECURE; | 50 | return lib3270_get_ssl_state(hSession) == LIB3270_SSL_SECURE; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | -LIB3270_EXPORT long lib3270_get_SSL_verify_result(H3270 *hSession) | 53 | +LIB3270_EXPORT long lib3270_get_SSL_verify_result(const H3270 *hSession) |
| 54 | { | 54 | { |
| 55 | - CHECK_SESSION_HANDLE(hSession); | ||
| 56 | #if defined(HAVE_LIBSSL) | 55 | #if defined(HAVE_LIBSSL) |
| 57 | if(hSession->ssl.con) | 56 | if(hSession->ssl.con) |
| 58 | return SSL_get_verify_result(hSession->ssl.con); | 57 | return SSL_get_verify_result(hSession->ssl.con); |
| 58 | +#else | ||
| 59 | + errno = ENOTSUP; | ||
| 59 | #endif // HAVE_LIBSSL | 60 | #endif // HAVE_LIBSSL |
| 60 | return -1; | 61 | return -1; |
| 61 | } | 62 | } |
| 62 | 63 | ||
| 63 | -LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_ssl_state(H3270 *hSession) | 64 | +LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_ssl_state(const H3270 *hSession) |
| 64 | { | 65 | { |
| 65 | - CHECK_SESSION_HANDLE(hSession); | ||
| 66 | return hSession->ssl.state; | 66 | return hSession->ssl.state; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| @@ -358,12 +358,12 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) | @@ -358,12 +358,12 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) | ||
| 358 | return NULL; | 358 | return NULL; |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | - static const struct ssl_status_msg * get_ssl_status_msg(H3270 *hSession) | 361 | + static const struct ssl_status_msg * get_ssl_status_msg(const H3270 *hSession) |
| 362 | { | 362 | { |
| 363 | return ssl_get_status_from_error_code(lib3270_get_SSL_verify_result(hSession)); | 363 | return ssl_get_status_from_error_code(lib3270_get_SSL_verify_result(hSession)); |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | - const char * lib3270_get_ssl_state_message(H3270 *hSession) | 366 | + const char * lib3270_get_ssl_state_message(const H3270 *hSession) |
| 367 | { | 367 | { |
| 368 | if(lib3270_get_ssl_state(hSession) != LIB3270_SSL_UNSECURE) | 368 | if(lib3270_get_ssl_state(hSession) != LIB3270_SSL_UNSECURE) |
| 369 | { | 369 | { |
| @@ -376,7 +376,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) | @@ -376,7 +376,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) | ||
| 376 | 376 | ||
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | - const char * lib3270_get_ssl_state_icon_name(H3270 *hSession) | 379 | + const char * lib3270_get_ssl_state_icon_name(const H3270 *hSession) |
| 380 | { | 380 | { |
| 381 | if(lib3270_get_ssl_state(hSession) != LIB3270_SSL_UNSECURE) | 381 | if(lib3270_get_ssl_state(hSession) != LIB3270_SSL_UNSECURE) |
| 382 | { | 382 | { |
| @@ -390,7 +390,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) | @@ -390,7 +390,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) | ||
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | 392 | ||
| 393 | - const char * lib3270_get_ssl_state_description(H3270 *hSession) | 393 | + const char * lib3270_get_ssl_state_description(const H3270 *hSession) |
| 394 | { | 394 | { |
| 395 | if(lib3270_get_ssl_state(hSession) != LIB3270_SSL_UNSECURE) | 395 | if(lib3270_get_ssl_state(hSession) != LIB3270_SSL_UNSECURE) |
| 396 | { | 396 | { |
| @@ -406,7 +406,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) | @@ -406,7 +406,7 @@ void set_ssl_state(H3270 *hSession, LIB3270_SSL_STATE state) | ||
| 406 | return _( "Unexpected or unknown security status"); | 406 | return _( "Unexpected or unknown security status"); |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | - LIB3270_NOTIFY lib3270_get_ssl_state_icon(H3270 *hSession) | 409 | + LIB3270_NOTIFY lib3270_get_ssl_state_icon(const H3270 *hSession) |
| 410 | { | 410 | { |
| 411 | if(lib3270_get_ssl_state(hSession) != LIB3270_SSL_UNSECURE) | 411 | if(lib3270_get_ssl_state(hSession) != LIB3270_SSL_UNSECURE) |
| 412 | { | 412 | { |