Sortix main manual
This manual documents Sortix main. You can instead view this document in the latest official manual.
NAME
SSL_CTX_set_alpn_protos, SSL_set_alpn_protos, SSL_CTX_set_alpn_select_cb, SSL_select_next_proto, SSL_get0_alpn_selected — handle application layer protocol negotiation (ALPN)SYNOPSIS
#include <openssl/ssl.h>SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, unsigned int protos_len);
SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, unsigned int protos_len);
SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg), void *arg);
SSL_select_next_proto(unsigned char **out, unsigned char *outlen, const unsigned char *server, unsigned int server_len, const unsigned char *client, unsigned int client_len);
SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, unsigned int *len);
DESCRIPTION
SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() are used by the client to set the list of protocols available to be negotiated. The protos must be in protocol-list format, described below. The length of protos is specified in protos_len.unsigned char vector[] = { 6, 's', 'p', 'd', 'y', '/', '1', 8, 'h', 't', 't', 'p', '/', '1', '.', '1' }; unsigned int length = sizeof(vector);
RETURN VALUES
SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() return 0 on success or non-zero on failure. WARNING: these functions reverse the return value convention.- OPENSSL_NPN_NEGOTIATED
- A match was found and is returned in out, outlen.
- OPENSSL_NPN_NO_OVERLAP
- No match was found. The first item in client, client_len is returned in out, outlen.
- SSL_TLSEXT_ERR_OK
- ALPN protocol selected.
- SSL_TLSEXT_ERR_ALERT_FATAL
- There was no overlap between the client's supplied list and the server configuration.
- SSL_TLSEXT_ERR_NOACK
- ALPN protocol not selected, e.g., because no ALPN protocols are configured for this connection.