tls/m_tls.c
/*! Returns NULL if there is no ALPN support or on error, or will return the application. */
Returns NULL if there is no ALPN support or on error, or will return the application.
Returns NULL if there is no ALPN support or on error or will return the application .
char *M_tls_get_application(M_io_t *io, size_t id)
{
#if OPENSSL_VERSION_NUMBER < 0x1000200fL
	(void)io;
	(void)id;
	return NULL;
#else
	M_io_layer_t        *layer  = M_io_layer_acquire(io, id, "TLS");
	M_io_handle_t       *handle = M_io_layer_get_handle(layer);
	const unsigned char *app    = NULL;
	unsigned int         len    = 0;
	char                *ret    = NULL;
	if (layer == NULL)
		return NULL;
	if (handle->ssl) {
		SSL_get0_alpn_selected(handle->ssl, &app, &len);
		if (app && len >= 1) {
			ret = M_strdup_max((const char *)app, len);
		}
	}
	M_io_layer_release(layer);
	return ret;
#endif
}
char * M_tls_get_application ( M_io_t * io , size_t id ) { #if OPENSSL_VERSION_NUMBER < 0x1000200fL ( void ) io ; ( void ) id ; return NULL ; #else M_io_layer_t * layer = M_io_layer_acquire ( io , id , " " ) ; M_io_handle_t * handle = M_io_layer_get_handle ( layer ) ; const unsigned char * app = NULL ; unsigned int len = 0 ; char * ret = NULL ; if ( layer == NULL ) return NULL ; if ( handle -> ssl ) { SSL_get0_alpn_selected ( handle -> ssl , & app , & len ) ; if ( app && len >= 1 ) { ret = M_strdup_max ( ( const char * ) app , len ) ; } } M_io_layer_release ( layer ) ; return ret ; #endif }
Returns NULL if there is no ALPN support or on error, or will return the application.
Returns NULL if there is no ALPN support or on error or will return the application .
/* Docs don't say, but this does NOT have a length prefix so it isn't
		 * in the same format as everything else */ /* Skip over length indicator, and it isn't NULL terminated */