Line data Source code
1 : #ifndef HEADER_fd_src_disco_gui_fd_gui_config_parse_h 2 : #define HEADER_fd_src_disco_gui_fd_gui_config_parse_h 3 : 4 : #include "../../ballet/json/cJSON.h" 5 : #include "../../flamenco/types/fd_types_custom.h" 6 : #include "../../util/fd_util_base.h" 7 : 8 : /* https://github.com/anza-xyz/agave/blob/master/account-decoder/src/validator_info.rs */ 9 0 : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_NAME_SZ ( 80UL) /* +1UL for NULL terminator */ 10 0 : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_WEBSITE_SZ ( 80UL) 11 0 : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_DETAILS_SZ ( 300UL) 12 0 : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_ICON_URI_SZ ( 80UL) 13 0 : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_KEYBASE_USERNAME_SZ ( 80UL) 14 0 : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_MAX_SZ ( 576UL) /* does not include size of ConfigKeys */ 15 0 : #define FD_GUI_CONFIG_PARSE_MAX_VALID_ACCT_SZ (FD_GUI_CONFIG_PARSE_CONFIG_KEYS_MAX_SZ+FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_MAX_SZ) 16 : 17 : /* The size of a ConfigKeys of length 2, which is the expected length of ValidatorInfo */ 18 0 : #define FD_GUI_CONFIG_PARSE_CONFIG_KEYS_MAX_SZ (1UL + (32UL + 1UL)*2UL) 19 : 20 : struct fd_gui_config_parse_info { 21 : fd_pubkey_t pubkey; 22 : char name [ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_NAME_SZ + 1UL ]; /* +1UL for NULL */ 23 : char website [ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_WEBSITE_SZ + 1UL ]; 24 : char details [ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_DETAILS_SZ + 1UL ]; 25 : char icon_uri[ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_ICON_URI_SZ + 1UL ]; 26 : char keybase_username[ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_KEYBASE_USERNAME_SZ + 1UL ]; 27 : 28 : struct { ulong prev, next; } map; 29 : struct { ulong next; } pool; 30 : }; 31 : 32 : typedef struct fd_gui_config_parse_info fd_gui_config_parse_info_t; 33 : 34 : FD_PROTOTYPES_BEGIN 35 : 36 : int 37 : fd_gui_config_parse_validator_info_check( uchar const * data, 38 : ulong sz, 39 : cJSON ** out_json, 40 : fd_pubkey_t * out_pubkey ); 41 : 42 : void 43 : fd_gui_config_parse_validator_info( cJSON * json, fd_gui_config_parse_info_t * node_info ); 44 : 45 : FD_PROTOTYPES_END 46 : 47 : #endif /* HEADER_fd_src_disco_gui_fd_gui_config_parse_h */