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 : ulong 30 : fd_sshttp_resolved_slot( fd_sshttp_t const * http ); 31 : 32 : uchar const * 33 : fd_sshttp_resolved_hash( fd_sshttp_t const * http ); 34 : 35 : /* fd_sshttp_init initializes an sshttp connection to the given server. 36 : addr is the resolved IP address and port. hostname is a 37 : null-terminated string used for the Host header and TLS SNI. 38 : is_https indicates whether TLS should be used. path points to the 39 : URL path of length path_len. hops is the maximum number of HTTP 40 : redirects to follow, pass ULONG_MAX to preserve the current hops 41 : value (e.g. when following a redirect internally). now is the 42 : current timestamp. Returns 0 on success and -1 on failure. */ 43 : 44 : int 45 : fd_sshttp_init( fd_sshttp_t * http, 46 : fd_ip4_port_t addr, 47 : char const * hostname, 48 : int is_https, 49 : char const * path, 50 : ulong path_len, 51 : ulong hops, 52 : long now ); 53 : 54 : void 55 : fd_sshttp_cancel( fd_sshttp_t * http ); 56 : 57 0 : #define FD_SSHTTP_ADVANCE_ERROR (-1) 58 0 : #define FD_SSHTTP_ADVANCE_AGAIN ( 0) 59 0 : #define FD_SSHTTP_ADVANCE_DATA ( 1) 60 0 : #define FD_SSHTTP_ADVANCE_DONE ( 2) 61 : 62 : int 63 : fd_sshttp_advance( fd_sshttp_t * http, 64 : ulong * data_len, 65 : uchar * data, 66 : int * downloading, 67 : long now ); 68 : 69 : FD_PROTOTYPES_END 70 : 71 : #endif /* HEADER_fd_src_discof_restore_utils_fd_sshttp_h */