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 : FD_PROTOTYPES_BEGIN 10 : 11 : FD_FN_CONST ulong 12 : fd_sshttp_align( void ); 13 : 14 : FD_FN_CONST ulong 15 : fd_sshttp_footprint( void ); 16 : 17 : void * 18 : fd_sshttp_new( void * shmem ); 19 : 20 : fd_sshttp_t * 21 : fd_sshttp_join( void * sshttp ); 22 : 23 : char const * 24 : fd_sshttp_snapshot_name( fd_sshttp_t const * http ); 25 : 26 : ulong 27 : fd_sshttp_content_len( fd_sshttp_t const * http ); 28 : 29 : /* fd_sshttp_init initializes an sshttp connection to the given server. 30 : addr is the resolved IP address and port. hostname is a 31 : null-terminated string used for the Host header and TLS SNI. 32 : is_https indicates whether TLS should be used. path points to the 33 : URL path of length path_len. hops is the maximum number of HTTP 34 : redirects to follow, pass ULONG_MAX to preserve the current hops 35 : value (e.g. when following a redirect internally). now is the 36 : current timestamp. Returns 0 on success and -1 on failure. */ 37 : 38 : int 39 : fd_sshttp_init( fd_sshttp_t * http, 40 : fd_ip4_port_t addr, 41 : char const * hostname, 42 : int is_https, 43 : char const * path, 44 : ulong path_len, 45 : ulong hops, 46 : long now ); 47 : 48 : void 49 : fd_sshttp_cancel( fd_sshttp_t * http ); 50 : 51 0 : #define FD_SSHTTP_ADVANCE_ERROR (-1) 52 0 : #define FD_SSHTTP_ADVANCE_AGAIN ( 0) 53 0 : #define FD_SSHTTP_ADVANCE_DATA ( 1) 54 0 : #define FD_SSHTTP_ADVANCE_DONE ( 2) 55 : 56 : int 57 : fd_sshttp_advance( fd_sshttp_t * http, 58 : ulong * data_len, 59 : uchar * data, 60 : int * downloading, 61 : long now ); 62 : 63 : FD_PROTOTYPES_END 64 : 65 : #endif /* HEADER_fd_src_discof_restore_utils_fd_sshttp_h */