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