Line data Source code
1 : #ifndef HEADER_fd_src_discof_restore_utils_fd_sshttp_private_h 2 : #define HEADER_fd_src_discof_restore_utils_fd_sshttp_private_h 3 : 4 : #include "fd_sshttp.h" 5 : 6 : #include "../../../waltz/tls/fd_tls.h" 7 : #include "../../../waltz/tlsrec/fd_tlsrec_sock.h" 8 : #include "../../../ballet/x509/fd_x509_ca_store.h" 9 : #include "../../../ballet/x509/fd_x509_verify.h" 10 : 11 12 : #define FD_SSHTTP_MAGIC (0xF17EDA2CE5811900) /* FIREDANCE HTTP V0 */ 12 : 13 36 : #define FD_SSHTTP_STATE_INIT (0) /* start */ 14 0 : #define FD_SSHTTP_STATE_CONNECT (1) /* connecting ssl */ 15 0 : #define FD_SSHTTP_STATE_REQ (2) /* sending request */ 16 30 : #define FD_SSHTTP_STATE_RESP (3) /* receiving response headers */ 17 6 : #define FD_SSHTTP_STATE_DL (4) /* downloading response body */ 18 0 : #define FD_SSHTTP_STATE_REDIRECT (5) /* following a redirect */ 19 0 : #define FD_SSHTTP_STATE_DONE (6) /* done */ 20 : 21 0 : #define FD_SSHTTP_DEADLINE_NANOS (1L*1000L*1000L*1000L) /* 1 second */ 22 : 23 : struct fd_sshttp_private { 24 : int state; 25 : long deadline; 26 : ulong empty_recvs; 27 : 28 : ulong hops; 29 : 30 : char location[ PATH_MAX ]; 31 : ulong location_len; 32 : 33 : fd_ip4_port_t addr; 34 : char const * hostname; 35 : int is_https; 36 : int sockfd; 37 : 38 : char request[ 4096UL ]; 39 : ulong request_len; 40 : ulong request_sent; 41 : 42 : ulong response_len; 43 : char response[ USHORT_MAX ]; 44 : 45 : char snapshot_name[ PATH_MAX ]; 46 : ulong resolved_slot; /* effective slot from redirect filename */ 47 : uchar resolved_hash[ 32 ]; /* binary hash from redirect filename */ 48 : 49 : fd_tls_t tls; 50 : fd_chacha_rng_t rng[1]; 51 : fd_tlsrec_conn_t tls_conn; 52 : 53 : fd_x509_ca_store_t ca_store; 54 : int ca_store_loaded; 55 : 56 : fd_tlsrec_sock_t tls_sock[1]; 57 : 58 : ulong content_len; 59 : ulong content_read; 60 : 61 : ulong magic; 62 : }; 63 : 64 : #endif /* HEADER_fd_src_discof_restore_utils_fd_sshttp_private_h */