LCOV - code coverage report
Current view: top level - discof/restore/utils - fd_sshttp.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 5 0.0 %
Date: 2026-11-11 12:40:43 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_discof_restore_utils_fd_sshttp_h
       2             : #define HEADER_fd_src_discof_restore_utils_fd_sshttp_h
       3             : 
       4             : struct fd_sshttp_private;
       5             : typedef struct fd_sshttp_private fd_sshttp_t;
       6             : 
       7             : #include "../../../util/net/fd_net_headers.h"
       8             : 
       9             : #include <sys/uio.h>
      10             : 
      11             : FD_PROTOTYPES_BEGIN
      12             : 
      13             : FD_FN_CONST ulong
      14             : fd_sshttp_align( void );
      15             : 
      16             : FD_FN_CONST ulong
      17             : fd_sshttp_footprint( void );
      18             : 
      19             : void *
      20             : fd_sshttp_new( void * shmem,
      21             :                int    epoll_fd );
      22             : 
      23             : fd_sshttp_t *
      24             : fd_sshttp_join( void * sshttp );
      25             : 
      26             : /* fd_sshttp_load_ca_store loads the system CA certificate bundle for
      27             :    TLS certificate chain validation.  If no bundle is found, subsequent
      28             :    fd_sshttp_init calls with is_https set fail before connecting. */
      29             : 
      30             : void
      31             : fd_sshttp_load_ca_store( fd_sshttp_t * http );
      32             : 
      33             : char const *
      34             : fd_sshttp_snapshot_name( fd_sshttp_t const * http );
      35             : 
      36             : ulong
      37             : fd_sshttp_content_len( fd_sshttp_t const * http );
      38             : 
      39             : ulong
      40             : fd_sshttp_resolved_slot( fd_sshttp_t const * http );
      41             : 
      42             : uchar const *
      43             : fd_sshttp_resolved_hash( fd_sshttp_t const * http );
      44             : 
      45             : /* fd_sshttp_init initializes an sshttp connection to the given server.
      46             :    addr is the resolved IP address and port.  hostname is a
      47             :    null-terminated string used for the Host header and TLS SNI.  The
      48             :    hostname and path are copied; no caller memory is borrowed.
      49             :    is_https indicates whether TLS should be used.  path points to the
      50             :    URL path of length path_len.  hops is the maximum number of HTTP
      51             :    redirects to follow, pass ULONG_MAX to preserve the current hops
      52             :    value (e.g. when following a redirect internally).  now is the
      53             :    current timestamp.  Returns 0 on success and -1 on failure. */
      54             : 
      55             : int
      56             : fd_sshttp_init( fd_sshttp_t * http,
      57             :                 fd_ip4_port_t addr,
      58             :                 char const *  hostname,
      59             :                 int           is_https,
      60             :                 char const *  path,
      61             :                 ulong         path_len,
      62             :                 ulong         hops,
      63             :                 long          now );
      64             : 
      65             : void
      66             : fd_sshttp_cancel( fd_sshttp_t * http );
      67             : 
      68             : /* fd_sshttp_deadline returns the wallclock at which the current step
      69             :    times out, or LONG_MAX when idle. */
      70             : 
      71             : long
      72             : fd_sshttp_deadline( fd_sshttp_t const * http );
      73             : 
      74           0 : #define FD_SSHTTP_ADVANCE_ERROR (-1)
      75           0 : #define FD_SSHTTP_ADVANCE_AGAIN ( 0)
      76           0 : #define FD_SSHTTP_ADVANCE_DATA  ( 1)
      77           0 : #define FD_SSHTTP_ADVANCE_DONE  ( 2)
      78             : 
      79             : /* fd_sshttp_advance drives the connection.  Body bytes fill iov
      80             :    front to back; on ADVANCE_DATA *data_len is the total written.
      81             :    Bytes received alongside headers only ever fill iov[0]. */
      82             : 
      83             : #define FD_SSHTTP_IOV_MAX (2UL)
      84             : 
      85             : /* SO_RCVBUF for download sockets.  Bypasses the net.ipv4.tcp_rmem
      86             :    autotuning cap, which is too small for high bandwidth-delay links.
      87             :    Clamped by net.core.rmem_max, which the sysctl stage raises. */
      88             : 
      89           0 : #define FD_SSHTTP_SO_RCVBUF (128UL<<20)
      90             : 
      91             : int
      92             : fd_sshttp_advance( fd_sshttp_t *        http,
      93             :                    struct iovec const * iov,
      94             :                    ulong                iov_cnt,
      95             :                    ulong *              data_len,
      96             :                    int *                downloading,
      97             :                    long                 now );
      98             : 
      99             : FD_PROTOTYPES_END
     100             : 
     101             : #endif /* HEADER_fd_src_discof_restore_utils_fd_sshttp_h */

Generated by: LCOV version 1.14