Mercurial > hg > nginx-quic
view src/event/ngx_event_quic.h @ 7690:ae35ccba7aa6 quic
Extracted transport part of the code into separate file.
All code dealing with serializing/deserializing
is moved int srv/event/ngx_event_quic_transport.c/h file.
All macros for dealing with data are internal to source file.
The header file exposes frame types and error codes.
The exported functions are currently packet header parsers and writers
and frames parser/writer.
The ngx_quic_header_t structure is updated with 'log' member. This avoids
passing extra argument to parsing functions that need to report errors.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 18 Mar 2020 12:58:27 +0300 |
parents | 61f9b873e2e7 |
children | e9891e8ee975 |
line wrap: on
line source
/* * Copyright (C) Nginx, Inc. */ #ifndef _NGX_EVENT_QUIC_H_INCLUDED_ #define _NGX_EVENT_QUIC_H_INCLUDED_ #include <ngx_event_openssl.h> #define quic_version 0xff000018 /* draft-24 (ngtcp2) */ //#define quic_version 0xff00001b /* draft-27 (FFN 76) */ struct ngx_quic_stream_s { uint64_t id; ngx_uint_t unidirectional:1; ngx_connection_t *parent; void *data; }; void ngx_quic_init_ssl_methods(SSL_CTX* ctx); void ngx_quic_run(ngx_connection_t *c, ngx_ssl_t *ssl, ngx_msec_t timeout, ngx_connection_handler_pt handler); ngx_connection_t *ngx_quic_create_uni_stream(ngx_connection_t *c); /********************************* DEBUG *************************************/ #if (NGX_DEBUG) #define ngx_quic_hexdump(log, fmt, data, len, ...) \ do { \ ngx_int_t m; \ u_char buf[2048]; \ \ if (log->log_level & NGX_LOG_DEBUG_EVENT) { \ m = ngx_hex_dump(buf, (u_char *) data, ngx_min(len, 1024)) - buf; \ ngx_log_debug(NGX_LOG_DEBUG_EVENT, log, 0, \ "%s: " fmt " %*s%s, len: %uz", \ __FUNCTION__, __VA_ARGS__, m, buf, \ len < 2048 ? "" : "...", len); \ } \ } while (0) #else #define ngx_quic_hexdump(log, fmt, data, len, ...) #endif #define ngx_quic_hexdump0(log, fmt, data, len) \ ngx_quic_hexdump(log, fmt "%s", data, len, "") \ #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */