Line data Source code
1 : #include "fd_quic_trace.h"
2 : #include "../../../waltz/quic/log/fd_quic_log_user.h"
3 : #include <stdio.h>
4 :
5 : static int
6 : before_frag( void * _ctx FD_FN_UNUSED,
7 : ulong in_idx FD_FN_UNUSED,
8 : ulong seq FD_FN_UNUSED,
9 0 : ulong sig ) {
10 0 : return !( fd_quic_log_sig_event( sig )==FD_QUIC_EVENT_CONN_QUIC_CLOSE );
11 0 : }
12 :
13 : static void
14 : during_frag( void * _ctx FD_PARAM_UNUSED,
15 : ulong in_idx FD_PARAM_UNUSED,
16 : ulong seq FD_PARAM_UNUSED,
17 : ulong sig FD_PARAM_UNUSED,
18 : ulong chunk,
19 : ulong sz,
20 0 : ulong ctl FD_PARAM_UNUSED ) {
21 0 : fd_quic_ctx_t * ctx = &fd_quic_trace_ctx;
22 0 : fd_memcpy( ctx->buffer, fd_chunk_to_laddr_const( fd_quic_trace_log_base, chunk ), sz );
23 0 : }
24 :
25 : static void
26 : after_frag( void * _ctx FD_FN_UNUSED,
27 : ulong in_idx FD_FN_UNUSED,
28 : ulong seq FD_FN_UNUSED,
29 : ulong sig FD_FN_UNUSED,
30 : ulong sz FD_FN_UNUSED,
31 : ulong tsorig FD_FN_UNUSED,
32 0 : fd_stem_context_t * stem FD_FN_UNUSED ) {
33 0 : fd_quic_ctx_t * ctx = &fd_quic_trace_ctx;
34 0 : fd_quic_log_error_t const * error = fd_type_pun_const( ctx->buffer );
35 0 : printf( "event=conn_close_quic conn_id=%016lx src_ip=%08x enc=%d pktnum=%8lu close_code=0x%lx loc=%.*s(%u)\n",
36 0 : error->hdr.conn_id,
37 0 : fd_uint_bswap( FD_LOAD( uint, error->hdr.ip4_saddr ) ),
38 0 : error->hdr.enc_level,
39 0 : error->hdr.pkt_num,
40 0 : error->code[0],
41 0 : (int)sizeof(error->src_file),
42 0 : error->src_file,
43 0 : error->src_line );
44 0 : }
45 :
46 :
47 : #define STEM_BURST (1UL)
48 : #define STEM_CALLBACK_CONTEXT_TYPE void
49 : #define STEM_CALLBACK_CONTEXT_ALIGN 1
50 0 : #define STEM_CALLBACK_BEFORE_FRAG before_frag
51 0 : #define STEM_CALLBACK_DURING_FRAG during_frag
52 0 : #define STEM_CALLBACK_AFTER_FRAG after_frag
53 : #include "../../../disco/stem/fd_stem.c"
54 :
55 : void
56 0 : fd_quic_trace_log_tile( fd_frag_meta_t const * in_mcache ) {
57 0 : fd_frag_meta_t const * in_mcache_tbl[1] = { in_mcache };
58 :
59 0 : uchar fseq_mem[ FD_FSEQ_FOOTPRINT ] __attribute__((aligned(FD_FSEQ_ALIGN)));
60 0 : ulong * fseq = fd_fseq_join( fd_fseq_new( fseq_mem, 0UL ) );
61 0 : ulong * fseq_tbl[1] = { fseq };
62 :
63 0 : fd_rng_t rng[1];
64 0 : FD_TEST( fd_rng_join( fd_rng_new( rng, (uint)fd_tickcount(), 0UL ) ) );
65 :
66 0 : uchar scratch[ sizeof(fd_stem_tile_in_t)+128 ] __attribute__((aligned(FD_STEM_SCRATCH_ALIGN)));
67 :
68 0 : stem_run1( /* in_cnt */ 1UL,
69 0 : /* in_mcache */ in_mcache_tbl,
70 0 : /* in_fseq */ fseq_tbl,
71 0 : /* out_cnt */ 0UL,
72 : /* out_mcache */ NULL,
73 0 : /* cons_cnt */ 0UL,
74 : /* cons_out */ NULL,
75 : /* cons_fseq */ NULL,
76 0 : /* stem_burst */ 1UL,
77 0 : /* stem_lazy */ 0L,
78 0 : /* rng */ rng,
79 0 : /* scratch */ scratch,
80 : /* ctx */ NULL );
81 :
82 0 : fd_fseq_delete( fd_fseq_leave( fseq ) );
83 0 : }
|