Line data Source code
1 : #ifndef HEADER_fd_src_waltz_quic_log_fd_quic_log_event_h 2 : #define HEADER_fd_src_waltz_quic_log_fd_quic_log_event_h 3 : 4 : /* fd_quic_log.h contains ABI definitions for quic shm logging. */ 5 : 6 : #include "../../../util/fd_util_base.h" 7 : 8 : /* fd_quic_log_abi_t contains all parameters required to consume log 9 : messages out from a quic_log interface. */ 10 : 11 : struct fd_quic_log_abi { 12 : ulong magic; /* ==FD_QUIC_LOG_MAGIC */ 13 : ulong mcache_off; 14 : uint chunk0; 15 : uint chunk1; 16 : }; 17 : 18 : typedef struct fd_quic_log_abi fd_quic_log_abi_t; 19 : 20 : /* FIXME document */ 21 : 22 : struct fd_quic_log_hdr { 23 : /* 0x00 */ ulong conn_id; 24 : /* 0x08 */ ulong pkt_num; 25 : /* 0x10 */ uchar ip4_saddr[4]; /* big endian */ 26 : /* 0x14 */ ushort udp_sport; /* little endian */ 27 : /* 0x16 */ uchar enc_level; 28 : /* 0x17 */ uchar flags; 29 : /* 0x18 */ 30 : }; 31 : 32 : typedef struct fd_quic_log_hdr fd_quic_log_hdr_t; 33 : 34 : /* Event IDs **********************************************************/ 35 : 36 : /* Event group: Connection events */ 37 : 38 : #define FD_QUIC_EVENT_CONN_NEW (0x01) /* connection opened */ 39 : #define FD_QUIC_EVENT_CONN_ESTABLISHED (0x02) /* connection established (handshake done) */ 40 81 : #define FD_QUIC_EVENT_CONN_QUIC_CLOSE (0x03) /* connection closed (due to QUIC) */ 41 : #define FD_QUIC_EVENT_CONN_APP_CLOSE (0x04) /* connection closed (due to app request) */ 42 : 43 : /* Event group: Object pool alloc failures */ 44 : 45 : #define FD_QUIC_EVENT_ALLOC_FAIL_PKT_META (0x101) /* fd_quic_pkt_meta_t */ 46 : #define FD_QUIC_EVENT_ALLOC_FAIL_CONN (0x102) /* fd_quic_conn_t */ 47 : #define FD_QUIC_EVENT_ALLOC_FAIL_STREAM (0x103) /* fd_quic_stream_t */ 48 : 49 : /* Event structs ******************************************************/ 50 : 51 : /* fd_quic_log_error_t is a generic error code container. 52 : src_file:src_line point to the source line of code that threw this 53 : error. flags&1==0 if the error originated locally. flags&1==1 if 54 : the error originated on the peer's side and was sent to us. 55 : 56 : code is defined depending on the FD_QUIC_EVENT_{...} error: 57 : 58 : CONN_QUIC_CLOSE: code[0] is a QUIC Transport Error Code 59 : (https://www.iana.org/assignments/quic/quic.xhtml#quic-transport-error-codes) 60 : code[1] is an fd_tls specific error code, if code[0] in [0x0100,0x01ff] 61 : CONN_APP_CLOSE: code[0] is the error code set by the application */ 62 : 63 : struct fd_quic_log_error { 64 : /* 0x00 */ fd_quic_log_hdr_t hdr; 65 : /* 0x18 */ ulong code[2]; /* protocol-specific error codes */ 66 : /* 0x28 */ char src_file[16]; /* e.g. "fd_quic.c" */ 67 : /* 0x38 */ uint src_line; 68 : /* 0x3c */ uchar flags; 69 : }; 70 : 71 : typedef struct fd_quic_log_error fd_quic_log_error_t; 72 : 73 : #endif /* HEADER_fd_src_waltz_quic_log_fd_quic_log_event_h */