LCOV - code coverage report
Current view: top level - waltz/tlsrec - fd_tlsrec_frag.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 19 19 100.0 %
Date: 2026-09-17 04:28:31 Functions: 7 100 7.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_waltz_tlsrec_fd_tlsrec_frag_h
       2             : #define HEADER_fd_src_waltz_tlsrec_fd_tlsrec_frag_h
       3             : 
       4             : #include "../fd_waltz_base.h"
       5             : 
       6       15342 : #define FD_TLSREC_CAP (0x8000UL)   /* 32 KiB max TLS record buffer */
       7             : 
       8             : /* FD_TLSREC_PLAINTEXT_MAX is the most plaintext a single record may
       9             :    carry (RFC 8446 Section 5.1: 2^14).  FD_TLSREC_PAYLOAD_MAX is the
      10             :    largest TLSCiphertext.length a peer may send (Section 5.2: 2^14 +
      11             :    256).  Larger incoming records are a record_overflow error. */
      12             : 
      13   127913627 : #define FD_TLSREC_PLAINTEXT_MAX (16384UL)
      14   127889606 : #define FD_TLSREC_PAYLOAD_MAX   (FD_TLSREC_PLAINTEXT_MAX+256UL)
      15             : 
      16             : struct fd_tlsrec_slice {
      17             :   uchar * data;
      18             :   uchar * data_end;
      19             : };
      20             : typedef struct fd_tlsrec_slice fd_tlsrec_slice_t;
      21             : 
      22             : static inline fd_tlsrec_slice_t *
      23   256921440 : fd_tlsrec_slice_init( fd_tlsrec_slice_t * frag, uchar * data, ulong data_sz ) {
      24   256921440 :   frag->data     = data;
      25   256921440 :   frag->data_end = data_sz ? data + data_sz : data;
      26   256921440 :   return frag;
      27   256921440 : }
      28             : 
      29             : static inline ulong
      30   128961048 : fd_tlsrec_slice_sz( fd_tlsrec_slice_t const * frag ) {
      31   128961048 :   return (ulong)frag->data_end - (ulong)frag->data;
      32   128961048 : }
      33             : 
      34             : FD_FN_PURE static inline int
      35   256990612 : fd_tlsrec_slice_is_empty( fd_tlsrec_slice_t const * frag ) {
      36   256990612 :   return frag->data >= frag->data_end;
      37   256990612 : }
      38             : 
      39             : static inline void *
      40      110475 : fd_tlsrec_slice_pop( fd_tlsrec_slice_t * frag, ulong sz ) {
      41      110475 :   void * data = frag->data;
      42      110475 :   frag->data += sz;
      43      110475 :   return data;
      44      110475 : }
      45             : 
      46             : #endif /* HEADER_fd_src_waltz_tlsrec_fd_tlsrec_frag_h */

Generated by: LCOV version 1.14