Line data Source code
1 : #ifndef HEADER_fd_src_disco_events_fd_event_client_h 2 : #define HEADER_fd_src_disco_events_fd_event_client_h 3 : 4 : #include "fd_circq.h" 5 : #include "../keyguard/fd_keyguard_client.h" 6 : #include "../../ballet/x509/fd_x509_ca_store.h" 7 : #include "../../discof/genesis/fd_genesi_tile.h" 8 : 9 0 : #define FD_EVENT_CLIENT_STATE_DISCONNECTED (0) 10 0 : #define FD_EVENT_CLIENT_STATE_CONNECTING (1) 11 0 : #define FD_EVENT_CLIENT_STATE_AUTHENTICATING (2) 12 0 : #define FD_EVENT_CLIENT_STATE_CONNECTED (4) 13 : 14 : struct fd_event_client; 15 : typedef struct fd_event_client fd_event_client_t; 16 : 17 : struct fd_event_client_metrics { 18 : ulong transport_fail_cnt; 19 : ulong transport_success_cnt; 20 : ulong events_sent; 21 : ulong events_acked; 22 : ulong last_acked_id; 23 : ulong bytes_written; 24 : ulong bytes_read; 25 : ulong auth_fail_cnt; 26 : ulong invalid_msg_cnt; 27 : ulong connect_attempt_cnt; 28 : ulong handshake_timeout_cnt; 29 : ulong credit_stall_cnt; 30 : }; 31 : 32 : typedef struct fd_event_client_metrics fd_event_client_metrics_t; 33 : 34 : FD_PROTOTYPES_BEGIN 35 : 36 : FD_FN_CONST ulong 37 : fd_event_client_align( void ); 38 : 39 : FD_FN_CONST ulong 40 : fd_event_client_footprint( ulong buf_max ); 41 : 42 : void * 43 : fd_event_client_new( void * shmem, 44 : fd_keyguard_client_t * keyguard_client, 45 : fd_rng_t * rng, 46 : fd_circq_t * circq, 47 : int epoll_fd, 48 : int so_sndbuf, 49 : char const * endpoint, 50 : uchar const * identity_pubkey, 51 : char const * client_version, 52 : char const * commit_hash, 53 : char const * action, 54 : ulong instance_id, 55 : ulong boot_id, 56 : ulong machine_id, 57 : ulong buf_max, 58 : int use_tls, 59 : fd_x509_ca_store_t const * ca_store ); 60 : 61 : fd_event_client_t * 62 : fd_event_client_join( void * shec ); 63 : 64 : fd_event_client_metrics_t const * 65 : fd_event_client_metrics( fd_event_client_t const * client ); 66 : 67 : ulong 68 : fd_event_client_state( fd_event_client_t const * client ); 69 : 70 : ulong 71 : fd_event_client_id_reserve( fd_event_client_t * client ); 72 : 73 : void 74 : fd_event_client_init_genesis( fd_event_client_t * client, 75 : fd_genesis_meta_t const * genesis_meta ); 76 : 77 : void 78 : fd_event_client_init_shred_version( fd_event_client_t * client, 79 : ushort shred_version ); 80 : 81 : void 82 : fd_event_client_set_identity( fd_event_client_t * client, 83 : uchar const * identity_pubkey ); 84 : 85 : void 86 : fd_event_client_poll( fd_event_client_t * client, 87 : long now, 88 : int * charge_busy ); 89 : 90 : /* fd_event_client_next_deadline returns when fd_event_client_poll 91 : next needs to run absent any fd event: the earliest pending 92 : timeout (reconnect, connect, auth, response, heartbeat, gRPC 93 : deadlines). Returns now if TLS bytes are buffered inside OpenSSL 94 : (no fd event will announce them), LONG_MAX while awaiting the 95 : genesis/shred version frags. */ 96 : 97 : long 98 : fd_event_client_next_deadline( fd_event_client_t const * client, 99 : long now ); 100 : 101 : FD_PROTOTYPES_END 102 : 103 : #endif /* HEADER_fd_src_disco_events_fd_event_client_h */