当前位置: 首页>>代码示例>>C++>>正文


C++ SSL_state_string_long函数代码示例

本文整理汇总了C++中SSL_state_string_long函数的典型用法代码示例。如果您正苦于以下问题:C++ SSL_state_string_long函数的具体用法?C++ SSL_state_string_long怎么用?C++ SSL_state_string_long使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SSL_state_string_long函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: apps_ssl_info_callback

/*
** Roughly copied from the openssl sample app in the openssl package
*/
PRIVATE void apps_ssl_info_callback (SSL * s, int where, int ret)
{
    char *str;
    int w = where & ~SSL_ST_MASK;
    if (w & SSL_ST_CONNECT)
	str="SSL_connect";
    else if (w & SSL_ST_ACCEPT)
	str="SSL_accept";
    else
	str="undefined";
    if (where & SSL_CB_LOOP) {
	HTTRACE(PROT_TRACE, "%s: %s\n" _ str _ SSL_state_string_long(s));
    } else if (where & SSL_CB_ALERT) {
	str = (where & SSL_CB_READ) ? "read" : "write";
	HTTRACE(PROT_TRACE, "SSL3 alert %s:%s:%s\n" _ str _
		SSL_alert_type_string_long(ret) _
		SSL_alert_desc_string_long(ret));
    } else if (where & SSL_CB_EXIT) {
	if (ret == 0) {
	    HTTRACE(PROT_TRACE, "%s: failed in %s\n" _ str _ SSL_state_string_long(s));
	} else if (ret < 0) {
	    HTTRACE(PROT_TRACE, "%s: error in %s\n" _ str _ SSL_state_string_long(s));
	}
    }
}
开发者ID:ChatanW,项目名称:WebDaM,代码行数:28,代码来源:HTSSL.c

示例2: openssl_info_callback

static void openssl_info_callback(const SSL *ssl, int where, int ret)
{
	struct ssl_iostream *ssl_io;

	ssl_io = SSL_get_ex_data(ssl, dovecot_ssl_extdata_index);
	if ((where & SSL_CB_ALERT) != 0) {
		switch (ret & 0xff) {
		case SSL_AD_CLOSE_NOTIFY:
			i_debug("%sSSL alert: %s",
				ssl_io->log_prefix,
				SSL_alert_desc_string_long(ret));
			break;
		default:
			i_debug("%sSSL alert: where=0x%x, ret=%d: %s %s",
				ssl_io->log_prefix, where, ret,
				SSL_alert_type_string_long(ret),
				SSL_alert_desc_string_long(ret));
			break;
		}
	} else if (ret == 0) {
		i_debug("%sSSL failed: where=0x%x: %s",
			ssl_io->log_prefix, where, SSL_state_string_long(ssl));
	} else {
		i_debug("%sSSL: where=0x%x, ret=%d: %s",
			ssl_io->log_prefix, where, ret,
			SSL_state_string_long(ssl));
	}
}
开发者ID:manuelm,项目名称:dovecot,代码行数:28,代码来源:iostream-openssl.c

示例3: log_state

static void
log_state (GstDtlsConnection * self, const gchar * str)
{
  GstDtlsConnectionPrivate *priv = self->priv;
  guint states = 0;

  states |= (! !SSL_is_init_finished (priv->ssl) << 0);
  states |= (! !SSL_in_init (priv->ssl) << 4);
  states |= (! !SSL_in_before (priv->ssl) << 8);
  states |= (! !SSL_in_connect_init (priv->ssl) << 12);
  states |= (! !SSL_in_accept_init (priv->ssl) << 16);
  states |= (! !SSL_want_write (priv->ssl) << 20);
  states |= (! !SSL_want_read (priv->ssl) << 24);

#if OPENSSL_VERSION_NUMBER < 0x10100001L
  GST_LOG_OBJECT (self, "%s: role=%s buf=(%d,%p:%d/%d) %x|%x %s",
      str,
      priv->is_client ? "client" : "server",
      pqueue_size (priv->ssl->d1->sent_messages),
      priv->bio_buffer,
      priv->bio_buffer_offset,
      priv->bio_buffer_len,
      states, SSL_get_state (priv->ssl), SSL_state_string_long (priv->ssl));
#else
  GST_LOG_OBJECT (self, "%s: role=%s buf=(%p:%d/%d) %x|%x %s",
      str,
      priv->is_client ? "client" : "server",
      priv->bio_buffer,
      priv->bio_buffer_offset,
      priv->bio_buffer_len,
      states, SSL_get_state (priv->ssl), SSL_state_string_long (priv->ssl));
#endif
}
开发者ID:MaZderMind,项目名称:gst-plugins-bad,代码行数:33,代码来源:gstdtlsconnection.c

示例4: apps_ssl_info_callback

void
apps_ssl_info_callback(const SSL * s, int where, int ret)
{
	const char *str;
	int w;

	w = where & ~SSL_ST_MASK;

	if (w & SSL_ST_CONNECT)
		str = "SSL_connect";
	else if (w & SSL_ST_ACCEPT)
		str = "SSL_accept";
	else
		str = "undefined";

	if (where & SSL_CB_LOOP) {
		BIO_printf(bio_err, "%s:%s\n", str, SSL_state_string_long(s));
	} else if (where & SSL_CB_ALERT) {
		str = (where & SSL_CB_READ) ? "read" : "write";
		BIO_printf(bio_err, "SSL3 alert %s:%s:%s\n", str,
		    SSL_alert_type_string_long(ret),
		    SSL_alert_desc_string_long(ret));
	} else if (where & SSL_CB_EXIT) {
		if (ret == 0)
			BIO_printf(bio_err, "%s:failed in %s\n",
			    str, SSL_state_string_long(s));
		else if (ret < 0) {
			BIO_printf(bio_err, "%s:error in %s\n",
			    str, SSL_state_string_long(s));
		}
	}
}
开发者ID:bbbrumley,项目名称:openbsd,代码行数:32,代码来源:s_cb.c

示例5: MS_TRACE

	inline
	void DtlsTransport::onSSLInfo(int where, int ret)
	{
		MS_TRACE();

		int w = where & -SSL_ST_MASK;
		const char* role;

		if (w & SSL_ST_CONNECT)     role = "client";
		else if (w & SSL_ST_ACCEPT) role = "server";
		else                        role = "undefined";

		if (where & SSL_CB_LOOP)
		{
			MS_DEBUG("[role:%s, action:'%s']", role, SSL_state_string_long(this->ssl));
		}
		else if (where & SSL_CB_ALERT)
		{
			const char* alert_type;

			switch (*SSL_alert_type_string(ret))
			{
				case 'W':  alert_type = "warning";    break;
				case 'F':  alert_type = "fatal";      break;
				default:   alert_type = "undefined";
			}

			if (where & SSL_CB_READ)
				MS_DEBUG("received DTLS %s alert: %s", alert_type, SSL_alert_desc_string_long(ret));
			else if (where & SSL_CB_WRITE)
				MS_DEBUG("sending DTLS %s alert: %s", alert_type, SSL_alert_desc_string_long(ret));
			else
				MS_DEBUG("DTLS %s alert: %s", alert_type, SSL_alert_desc_string_long(ret));
		}
		else if (where & SSL_CB_EXIT)
		{
			if (ret == 0)
				MS_DEBUG("[role:%s, failed:'%s']", role, SSL_state_string_long(this->ssl));
			else if (ret < 0)
				MS_DEBUG("role: %s, waiting:'%s']", role, SSL_state_string_long(this->ssl));
		}
		else if (where & SSL_CB_HANDSHAKE_START)
		{
			MS_DEBUG("DTLS handshake start");
		}
		else if (where & SSL_CB_HANDSHAKE_DONE)
		{
			MS_DEBUG("DTLS handshake done");

			this->handshakeDoneNow = true;
		}

		// NOTE: checking SSL_get_shutdown(this->ssl) & SSL_RECEIVED_SHUTDOWN here upon
		// receipt of a close alert does not work (the flag is set after this callback).
	}
开发者ID:kurokky,项目名称:mediasoup,代码行数:55,代码来源:DtlsTransport.cpp

示例6: log_callback

/******************************************************************************
 ******************************************************************************
 ** Higher Level SSL_CTX Wrappers                                            **
 ******************************************************************************
 ******************************************************************************/
static void
log_callback(const SSL *ssl, int where, int ret)
{
    const char *retstr = "";
    int should_log = 0;
    lcbio_SOCKET *sock = SSL_get_app_data(ssl);
    /* Ignore low-level SSL stuff */

    if (where & SSL_CB_ALERT) {
        should_log = 1;
    }
    if (where == SSL_CB_HANDSHAKE_START || where == SSL_CB_HANDSHAKE_DONE) {
        should_log = 1;
    }
    if ((where & SSL_CB_EXIT) && ret == 0) {
        should_log = 1;
    }

    if (!should_log) {
        return;
    }

    retstr = SSL_alert_type_string(ret);
    lcb_log(LOGARGS(ssl, LCB_LOG_TRACE), "sock=%p: ST(0x%x). %s. R(0x%x)%s",
        (void*)sock, where, SSL_state_string_long(ssl), ret, retstr);

    if (where == SSL_CB_HANDSHAKE_DONE) {
        lcb_log(LOGARGS(ssl, LCB_LOG_DEBUG), "sock=%p. Using SSL version %s. Cipher=%s", (void*)sock, SSL_get_version(ssl), SSL_get_cipher_name(ssl));
    }
}
开发者ID:00christian00,项目名称:couchnode,代码行数:35,代码来源:ssl_common.c

示例7: ssl_log_where_info

/* TODO(jboeuf): Remove when we are past the debugging phase with this code. */
static void ssl_log_where_info(const SSL* ssl, int where, int flag,
                               const char* msg) {
  if ((where & flag) && tsi_tracing_enabled) {
    gpr_log(GPR_INFO, "%20.20s - %30.30s  - %5.10s", msg,
            SSL_state_string_long(ssl), SSL_state_string(ssl));
  }
}
开发者ID:Infixz,项目名称:grpc,代码行数:8,代码来源:ssl_transport_security.c

示例8: sslLogCallback

/**
 * Callback used for debugging
 */
static void sslLogCallback(const SSL *ssl, int where, int ret) {
    const char *retstr = "";
    int should_log = 1;
    /* Ignore low-level SSL stuff */

    if (where & SSL_CB_ALERT) {
        should_log = 1;
    }
    if (where == SSL_CB_HANDSHAKE_START || where == SSL_CB_HANDSHAKE_DONE) {
        should_log = 1;
    }
    if ((where & SSL_CB_EXIT) && ret == 0) {
        should_log = 1;
    }

    if (!should_log) {
        return;
    }

    retstr = SSL_alert_type_string(ret);
    printf("ST(0x%x). %s. R(0x%x)%s\n", where, SSL_state_string_long(ssl), ret, retstr);

    if (where == SSL_CB_HANDSHAKE_DONE) {
        printf("Using SSL version %s. Cipher=%s\n", SSL_get_version(ssl), SSL_get_cipher_name(ssl));
    }
}
开发者ID:ewalshe,项目名称:hiredis,代码行数:29,代码来源:sslio.c

示例9: cbtls_info

void cbtls_info(const SSL *s, int where, int ret)
{
	const char *str, *state;
	int w;
	REQUEST *request = SSL_get_ex_data(s, FR_TLS_EX_INDEX_REQUEST);
	char buffer[1024];

	w = where & ~SSL_ST_MASK;
	if (w & SSL_ST_CONNECT) str="    TLS_connect";
	else if (w & SSL_ST_ACCEPT) str="    TLS_accept";
	else str="    (other)";

	state = SSL_state_string_long(s);
	state = state ? state : "NULL";
	buffer[0] = '\0';

	if (where & SSL_CB_LOOP) {
		RDEBUG2("%s: %s", str, state);
	} else if (where & SSL_CB_HANDSHAKE_START) {
		RDEBUG2("%s: %s", str, state);
	} else if (where & SSL_CB_HANDSHAKE_DONE) {
		RDEBUG2("%s: %s", str, state);
	} else if (where & SSL_CB_ALERT) {
		str=(where & SSL_CB_READ)?"read":"write";

		snprintf(buffer, sizeof(buffer), "TLS Alert %s:%s:%s",
			 str,
			 SSL_alert_type_string_long(ret),
			 SSL_alert_desc_string_long(ret));
	} else if (where & SSL_CB_EXIT) {
		if (ret == 0) {
			snprintf(buffer, sizeof(buffer), "%s: failed in %s",
				 str, state);

		} else if (ret < 0) {
			if (SSL_want_read(s)) {
				RDEBUG2("%s: Need to read more data: %s",
				       str, state);
			} else {
				snprintf(buffer, sizeof(buffer),
					 "%s: error in %s", str, state);
			}
		}
	}

	if (buffer[0]) {
		radlog(L_ERR, "%s", buffer);
		
		if (request) {
			VALUE_PAIR *vp;
			
			vp = pairmake("Module-Failure-Message", buffer, T_OP_ADD);
			if (vp) pairadd(&request->packet->vps, vp);
		}
	}
}
开发者ID:FabioPedretti,项目名称:freeradius-server,代码行数:56,代码来源:cb.c

示例10: SSL_CTX_info_callback

void SSL_CTX_info_callback(const SSL* ssl, int where, int ret)
{
    FUNC_ENTRY;

	if (where & SSL_CB_LOOP)
	{
		Log(TRACE_PROTOCOL, 1, "SSL state %s:%s:%s",
                  (where & SSL_ST_CONNECT) ? "connect" : (where & SSL_ST_ACCEPT) ? "accept" : "undef",
                    SSL_state_string_long(ssl), SSL_get_cipher_name(ssl));
	}
	else if (where & SSL_CB_EXIT)
	{
		Log(TRACE_PROTOCOL, 1, "SSL %s:%s",
                  (where & SSL_ST_CONNECT) ? "connect" : (where & SSL_ST_ACCEPT) ? "accept" : "undef",
                    SSL_state_string_long(ssl));
	}
	else if (where & SSL_CB_ALERT)
	{
		Log(TRACE_PROTOCOL, 1, "SSL alert %s:%s:%s",
                  (where & SSL_CB_READ) ? "read" : "write",
                    SSL_alert_type_string_long(ret), SSL_alert_desc_string_long(ret));
	}
	else if (where & SSL_CB_HANDSHAKE_START)
	{
		Log(TRACE_PROTOCOL, 1, "SSL handshake started %s:%s:%s",
                  (where & SSL_CB_READ) ? "read" : "write",
                    SSL_alert_type_string_long(ret), SSL_alert_desc_string_long(ret));
	}
	else if (where & SSL_CB_HANDSHAKE_DONE)
	{
		Log(TRACE_PROTOCOL, 1, "SSL handshake done %s:%s:%s",
                  (where & SSL_CB_READ) ? "read" : "write",
                    SSL_alert_type_string_long(ret), SSL_alert_desc_string_long(ret));
		Log(TRACE_PROTOCOL, 1, "SSL certificate verification: %s",
                    SSL_get_verify_result_string(SSL_get_verify_result(ssl)));
	}
	else
	{
		Log(TRACE_PROTOCOL, 1, "SSL state %s:%s:%s", SSL_state_string_long(ssl),
                   SSL_alert_type_string_long(ret), SSL_alert_desc_string_long(ret));
	}
	FUNC_EXIT;
}
开发者ID:brc859844,项目名称:paho.mqtt.c,代码行数:43,代码来源:SSLSocket.c

示例11: ssl_Connection_state_string

@return: A string representing the state\n\
";
static PyObject *
ssl_Connection_state_string(ssl_ConnectionObj *self, PyObject *args)
{
    if (!PyArg_ParseTuple(args, ":state_string"))
        return NULL;

    return PyText_FromString(SSL_state_string_long(self->ssl));
}
开发者ID:svpcom,项目名称:pyopenssl-pypy,代码行数:10,代码来源:connection.c

示例12: openssl_info_callback

static void openssl_info_callback(const SSL *ssl, int where, int ret)
{
    struct ssl_iostream *ssl_io;

    ssl_io = SSL_get_ex_data(ssl, dovecot_ssl_extdata_index);
    if ((where & SSL_CB_ALERT) != 0) {
        i_warning("%s: SSL alert: where=0x%x, ret=%d: %s %s",
                  ssl_io->source, where, ret,
                  SSL_alert_type_string_long(ret),
                  SSL_alert_desc_string_long(ret));
    } else if (ret == 0) {
        i_warning("%s: SSL failed: where=0x%x: %s",
                  ssl_io->source, where, SSL_state_string_long(ssl));
    } else {
        i_debug("%s: SSL: where=0x%x, ret=%d: %s",
                ssl_io->source, where, ret,
                SSL_state_string_long(ssl));
    }
}
开发者ID:bdraco,项目名称:dovecot,代码行数:19,代码来源:iostream-openssl.c

示例13: log_callback

/******************************************************************************
 ******************************************************************************
 ** Higher Level SSL_CTX Wrappers                                            **
 ******************************************************************************
 ******************************************************************************/
static void
log_callback(const SSL *ssl, int where, int ret)
{
    const char *retstr = "";
    lcbio_SOCKET *sock = SSL_get_app_data(ssl);
    if (where & SSL_CB_ALERT) {
        retstr = SSL_alert_type_string(ret);
    }
    lcb_log(LOGARGS(ssl, LCB_LOG_TRACE), "sock=%p: ST(0x%x). %s. R(0x%x)%s",
        (void*)sock, where, SSL_state_string_long(ssl), ret, retstr);
}
开发者ID:Sweebr,项目名称:couchnode,代码行数:16,代码来源:ssl_common.c

示例14: cbtls_info

USES_APPLE_DEPRECATED_API	/* OpenSSL API has been deprecated by Apple */

#include <freeradius-devel/radiusd.h>

#ifdef WITH_TLS
void cbtls_info(SSL const *s, int where, int ret)
{
	char const *str, *state;
	int w;
	REQUEST *request = SSL_get_ex_data(s, FR_TLS_EX_INDEX_REQUEST);
	char buffer[1024];

	w = where & ~SSL_ST_MASK;
	if (w & SSL_ST_CONNECT) str="    TLS_connect";
	else if (w & SSL_ST_ACCEPT) str="    TLS_accept";
	else str="    (other)";

	state = SSL_state_string_long(s);
	state = state ? state : "NULL";
	buffer[0] = '\0';

	if (where & SSL_CB_LOOP) {
		RDEBUG2("%s: %s", str, state);
	} else if (where & SSL_CB_HANDSHAKE_START) {
		RDEBUG2("%s: %s", str, state);
	} else if (where & SSL_CB_HANDSHAKE_DONE) {
		RDEBUG2("%s: %s", str, state);
	} else if (where & SSL_CB_ALERT) {
		str=(where & SSL_CB_READ)?"read":"write";

		snprintf(buffer, sizeof(buffer), "TLS Alert %s:%s:%s",
			 str,
			 SSL_alert_type_string_long(ret),
			 SSL_alert_desc_string_long(ret));
	} else if (where & SSL_CB_EXIT) {
		if (ret == 0) {
			snprintf(buffer, sizeof(buffer), "%s: failed in %s",
				 str, state);

		} else if (ret < 0) {
			if (SSL_want_read(s)) {
				RDEBUG2("%s: Need to read more data: %s",
				       str, state);
			} else {
				snprintf(buffer, sizeof(buffer),
					 "%s: error in %s", str, state);
			}
		}
	}

	if (buffer[0] && request) {
		REDEBUG("SSL says: %s", buffer);
	}
}
开发者ID:AlainRomeyer,项目名称:freeradius-server,代码行数:54,代码来源:cb.c

示例15: info_cb

/* Debug callback tracks SSL connection states and errors.  
 * Initialized by SSL_CTX_set_info_callback.  Invoked when
 * tb_errorlevel >= TN_NOTICE.  Copied from apps/s_cb.c.
 */
void info_cb(SSL *s,int where,int ret) {
  char *str="undefined";
  int w=where& ~SSL_ST_MASK;
  if (w & SSL_ST_CONNECT) str="SSL_connect";
  else if (w & SSL_ST_ACCEPT) str="SSL_accept";
  if (where & SSL_CB_LOOP) 
    fprintf(stderr,"%s:%s\n",str,SSL_state_string_long(s));
  else if (where & SSL_CB_ALERT) {
    str=(where & SSL_CB_READ)?"read":"write";
    fprintf(stderr,"SSL3 alert %s:%s:%s\n",
            str,
            SSL_alert_type_string_long(ret),
            SSL_alert_desc_string_long(ret));
  }
  else if (where & SSL_CB_EXIT) {
    if (ret == 0)
      fprintf(stderr,"%s:failed in %s\n",str,SSL_state_string_long(s));
    else if (ret < 0) 
      fprintf(stderr,"%s:error in %s\n",str,SSL_state_string_long(s));
  }
}
开发者ID:BackupTheBerlios,项目名称:toolbox,代码行数:25,代码来源:Sock_ssl.c


注:本文中的SSL_state_string_long函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。