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