Commit 90182b0994819c86d19347fafbae49ae57b256d1

Authored by Perry Werneck
2 parents 297d0c9c 12b95a78
Exists in master and in 2 other branches develop, macos

Merge branch 'develop' into network_module

@@ -284,6 +284,7 @@ @@ -284,6 +284,7 @@
284 <Unit filename="src/include/lib3270/properties.h" /> 284 <Unit filename="src/include/lib3270/properties.h" />
285 <Unit filename="src/include/lib3270/selection.h" /> 285 <Unit filename="src/include/lib3270/selection.h" />
286 <Unit filename="src/include/lib3270/session.h" /> 286 <Unit filename="src/include/lib3270/session.h" />
  287 + <Unit filename="src/include/lib3270/ssl.h" />
287 <Unit filename="src/include/lib3270/toggle.h" /> 288 <Unit filename="src/include/lib3270/toggle.h" />
288 <Unit filename="src/include/lib3270/trace.h" /> 289 <Unit filename="src/include/lib3270/trace.h" />
289 <Unit filename="src/include/linkedlist.h" /> 290 <Unit filename="src/include/linkedlist.h" />
src/core/properties/string.c
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 #include <lib3270/properties.h> 35 #include <lib3270/properties.h>
36 #include <lib3270/keyboard.h> 36 #include <lib3270/keyboard.h>
37 #include <lib3270/log.h> 37 #include <lib3270/log.h>
  38 + #include <lib3270/ssl.h>
38 39
39 static const char * get_version(const H3270 GNUC_UNUSED(*hSession)) 40 static const char * get_version(const H3270 GNUC_UNUSED(*hSession))
40 { 41 {
src/include/lib3270.h
@@ -305,19 +305,6 @@ @@ -305,19 +305,6 @@
305 } LIB3270_HOST_TYPE_ENTRY; 305 } LIB3270_HOST_TYPE_ENTRY;
306 306
307 /** 307 /**
308 - * @brief SSL state  
309 - *  
310 - */  
311 - typedef enum lib3270_ssl_state  
312 - {  
313 - LIB3270_SSL_UNSECURE, /**< @brief No secure connection */  
314 - LIB3270_SSL_SECURE, /**< @brief Connection secure with CA check */  
315 - LIB3270_SSL_NEGOTIATED, /**< @brief Connection secure, no CA, self-signed or expired CRL */  
316 - LIB3270_SSL_NEGOTIATING, /**< @brief Negotiating SSL */  
317 - LIB3270_SSL_UNDEFINED /**< @brief Undefined */  
318 - } LIB3270_SSL_STATE;  
319 -  
320 - /**  
321 * @brief Field information. 308 * @brief Field information.
322 * 309 *
323 */ 310 */
@@ -525,27 +512,6 @@ @@ -525,27 +512,6 @@
525 LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 *hSession); 512 LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 *hSession);
526 513
527 /** 514 /**
528 - * @brief Set URL for the certificate revocation list.  
529 - *  
530 - * @param hSession Session handle.  
531 - * @param crl URL for the certificate revocation list.  
532 - *  
533 - * @return 0 on sucess, non zero on error (sets errno).  
534 - *  
535 - */  
536 - LIB3270_EXPORT int lib3270_crl_set_url(H3270 *hSession, const char *crl);  
537 - LIB3270_EXPORT const char * lib3270_crl_get_url(const H3270 *hSession);  
538 -  
539 - LIB3270_EXPORT int lib3270_crl_set_preferred_protocol(H3270 *hSession, const char *protocol);  
540 - LIB3270_EXPORT const char * lib3270_crl_get_preferred_protocol(const H3270 *hSession);  
541 -  
542 - /**  
543 - * @brief Get the available protocols for CRL download.  
544 - *  
545 - */  
546 - LIB3270_EXPORT const char ** lib3270_get_available_crl_protocols(void);  
547 -  
548 - /**  
549 * @brief Get hostname for the connect/reconnect operations. 515 * @brief Get hostname for the connect/reconnect operations.
550 * 516 *
551 * @param h Session handle. 517 * @param h Session handle.
@@ -558,40 +524,6 @@ @@ -558,40 +524,6 @@
558 LIB3270_EXPORT void LIB3270_DEPRECATED(lib3270_set_hostname(H3270 *h, const char *hostname)); 524 LIB3270_EXPORT void LIB3270_DEPRECATED(lib3270_set_hostname(H3270 *h, const char *hostname));
559 525
560 /** 526 /**
561 - * @brief Get SSL host option.  
562 - *  
563 - * @return Non zero if the host URL has SSL scheme.  
564 - *  
565 - */  
566 - LIB3270_EXPORT int lib3270_get_secure_host(const H3270 *hSession);  
567 -  
568 - /**  
569 - * @brief Get security state.  
570 - *  
571 - */  
572 - LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_ssl_state(const H3270 *session);  
573 -  
574 - LIB3270_EXPORT long lib3270_get_SSL_verify_result(const H3270 *session);  
575 -  
576 - /**  
577 - * @brief Get security state as text.  
578 - *  
579 - */  
580 - LIB3270_EXPORT const char * lib3270_get_ssl_state_message(const H3270 *hSession);  
581 -  
582 - LIB3270_EXPORT const char * lib3270_get_ssl_state_icon_name(const H3270 *hSession);  
583 -  
584 - /**  
585 - * @brief Get security state message.  
586 - *  
587 - */  
588 - LIB3270_EXPORT const char * lib3270_get_ssl_state_description(const H3270 *hSession);  
589 -  
590 - LIB3270_EXPORT char * lib3270_get_ssl_crl_text(const H3270 *hSession);  
591 - LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(const H3270 *hSession);  
592 -  
593 -  
594 - /**  
595 * @brief Get service or port for the connect/reconnect operations. 527 * @brief Get service or port for the connect/reconnect operations.
596 * 528 *
597 * @param h Session handle. 529 * @param h Session handle.
src/include/lib3270/session.h
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
41 41
42 #include <lib3270/popup.h> 42 #include <lib3270/popup.h>
43 #include <lib3270/toggle.h> 43 #include <lib3270/toggle.h>
  44 + #include <lib3270/ssl.h>
44 45
45 struct lib3270_session_callbacks 46 struct lib3270_session_callbacks
46 { 47 {
src/include/lib3270/ssl.h 0 → 100644
@@ -0,0 +1,113 @@ @@ -0,0 +1,113 @@
  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 ssl.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 + *
  28 + */
  29 +
  30 + /**
  31 + * @brief TN3270 SSL definitions.
  32 + *
  33 + * @author perry.werneck@gmail.com
  34 + *
  35 + */
  36 +
  37 +#ifndef LIB3270_SSL_H_INCLUDED
  38 +
  39 + #define LIB3270_SSL_H_INCLUDED 1
  40 +
  41 + #include <lib3270.h>
  42 +
  43 +#ifdef __cplusplus
  44 + extern "C" {
  45 +#endif
  46 +
  47 + /// @brief SSL state
  48 + typedef enum lib3270_ssl_state
  49 + {
  50 + LIB3270_SSL_UNSECURE, /**< @brief No secure connection */
  51 + LIB3270_SSL_SECURE, /**< @brief Connection secure with CA check */
  52 + LIB3270_SSL_NEGOTIATED, /**< @brief Connection secure, no CA, self-signed or expired CRL */
  53 + LIB3270_SSL_NEGOTIATING, /**< @brief Negotiating SSL */
  54 + LIB3270_SSL_UNDEFINED /**< @brief Undefined */
  55 + } LIB3270_SSL_STATE;
  56 +
  57 + /**
  58 + * @brief Set URL for the certificate revocation list.
  59 + *
  60 + * @param hSession Session handle.
  61 + * @param crl URL for the certificate revocation list.
  62 + *
  63 + * @return 0 on sucess, non zero on error (sets errno).
  64 + *
  65 + */
  66 + LIB3270_EXPORT int lib3270_crl_set_url(H3270 *hSession, const char *crl);
  67 + LIB3270_EXPORT const char * lib3270_crl_get_url(const H3270 *hSession);
  68 +
  69 + LIB3270_EXPORT int lib3270_crl_set_preferred_protocol(H3270 *hSession, const char *protocol);
  70 + LIB3270_EXPORT const char * lib3270_crl_get_preferred_protocol(const H3270 *hSession);
  71 +
  72 + /**
  73 + * @brief Get the available protocols for CRL download.
  74 + *
  75 + */
  76 + LIB3270_EXPORT const char ** lib3270_get_available_crl_protocols(void);
  77 +
  78 + /**
  79 + * @brief Get SSL host option.
  80 + *
  81 + * @return Non zero if the host URL has SSL scheme.
  82 + *
  83 + */
  84 + LIB3270_EXPORT int lib3270_get_secure_host(const H3270 *hSession);
  85 +
  86 + /**
  87 + * @brief Get security state.
  88 + *
  89 + */
  90 + LIB3270_EXPORT LIB3270_SSL_STATE lib3270_get_ssl_state(const H3270 *session);
  91 +
  92 + /**
  93 + * @brief Get security state as text.
  94 + *
  95 + */
  96 + LIB3270_EXPORT const char * lib3270_get_ssl_state_message(const H3270 *hSession);
  97 +
  98 + LIB3270_EXPORT const char * lib3270_get_ssl_state_icon_name(const H3270 *hSession);
  99 +
  100 + /**
  101 + * @brief Get security state message.
  102 + *
  103 + */
  104 + LIB3270_EXPORT const char * lib3270_get_ssl_state_description(const H3270 *hSession);
  105 +
  106 + LIB3270_EXPORT char * lib3270_get_ssl_crl_text(const H3270 *hSession);
  107 + LIB3270_EXPORT char * lib3270_get_ssl_peer_certificate_text(const H3270 *hSession);
  108 +
  109 +#ifdef __cplusplus
  110 + }
  111 +#endif
  112 +
  113 +#endif // LIB3270_SSL_H_INCLUDED