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