diff options
Diffstat (limited to 'demos/guide/quic-server-block.c')
| -rw-r--r-- | demos/guide/quic-server-block.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/demos/guide/quic-server-block.c b/demos/guide/quic-server-block.c index f9db25d276dd..b40e888d22ea 100644 --- a/demos/guide/quic-server-block.c +++ b/demos/guide/quic-server-block.c @@ -16,14 +16,14 @@ /* Include the appropriate header file for SOCK_STREAM */ #ifdef _WIN32 /* Windows */ -# include <stdarg.h> -# include <winsock2.h> +#include <stdarg.h> +#include <winsock2.h> #else /* Linux/Unix */ -# include <err.h> -# include <sys/socket.h> -# include <sys/select.h> -# include <netinet/in.h> -# include <unistd.h> +#include <err.h> +#include <sys/socket.h> +#include <sys/select.h> +#include <netinet/in.h> +#include <unistd.h> #endif #include <openssl/bio.h> @@ -67,20 +67,39 @@ static void warnx(const char *fmt, ...) * are accepted. */ static const unsigned char alpn_ossltest[] = { - 8, 'h', 't', 't', 'p', '/', '1', '.', '0', - 10, 'h', 'q', '-', 'i', 'n', 't', 'e', 'r', 'o', 'p', + 8, + 'h', + 't', + 't', + 'p', + '/', + '1', + '.', + '0', + 10, + 'h', + 'q', + '-', + 'i', + 'n', + 't', + 'e', + 'r', + 'o', + 'p', }; /* * This callback validates and negotiates the desired ALPN on the server side. */ static int select_alpn(SSL *ssl, const unsigned char **out, - unsigned char *out_len, const unsigned char *in, - unsigned int in_len, void *arg) + unsigned char *out_len, const unsigned char *in, + unsigned int in_len, void *arg) { if (SSL_select_next_proto((unsigned char **)out, out_len, alpn_ossltest, - sizeof(alpn_ossltest), in, - in_len) == OPENSSL_NPN_NEGOTIATED) + sizeof(alpn_ossltest), in, + in_len) + == OPENSSL_NPN_NEGOTIATED) return SSL_TLSEXT_ERR_OK; return SSL_TLSEXT_ERR_ALERT_FATAL; } @@ -157,7 +176,7 @@ err: static int create_socket(uint16_t port) { int fd; - struct sockaddr_in sa = {0}; + struct sockaddr_in sa = { 0 }; /* Retrieve the file descriptor for a new UDP socket */ if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { |
