LCOV - code coverage report
Current view: top level - disco/gui - fd_gui_config_parse.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 4 0.0 %
Date: 2026-09-17 04:28:31 Functions: 0 0 -

          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 "../../flamenco/fd_flamenco_base.h"
       5             : 
       6             : /* https://github.com/anza-xyz/agave/blob/master/account-decoder/src/validator_info.rs */
       7           0 : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_NAME_SZ             (  80UL) /* +1UL for NULL terminator */
       8             : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_WEBSITE_SZ          (  80UL)
       9             : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_DETAILS_SZ          ( 300UL)
      10             : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_ICON_URI_SZ         (  80UL)
      11             : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_KEYBASE_USERNAME_SZ (  80UL)
      12           0 : #define FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_MAX_SZ              ( 576UL) /* does not include size of ConfigKeys */
      13           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)
      14             : 
      15             : /* The size of a ConfigKeys of length 2, which is the expected length of ValidatorInfo */
      16           0 : #define FD_GUI_CONFIG_PARSE_CONFIG_KEYS_MAX_SZ         (1UL + (32UL + 1UL)*2UL)
      17             : 
      18             : struct fd_gui_config_parse_info {
      19             :   fd_pubkey_t pubkey;
      20             :   char name    [ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_NAME_SZ     + 1UL ]; /* +1UL for NULL */
      21             :   char website [ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_WEBSITE_SZ  + 1UL ];
      22             :   char details [ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_DETAILS_SZ  + 1UL ];
      23             :   char icon_uri[ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_ICON_URI_SZ + 1UL ];
      24             :   char keybase_username[ FD_GUI_CONFIG_PARSE_VALIDATOR_INFO_KEYBASE_USERNAME_SZ + 1UL ];
      25             : 
      26             :   struct { ulong prev, next; } map;
      27             :   struct { ulong next; } pool;
      28             : };
      29             : 
      30             : typedef struct fd_gui_config_parse_info fd_gui_config_parse_info_t;
      31             : 
      32             : FD_PROTOTYPES_BEGIN
      33             : 
      34             : /* fd_gui_config_parse_validator_info parses the sz bytes at data as a
      35             :    ConfigProgram account holding a ValidatorInfo.  Returns 1 on success
      36             :    with info->pubkey and the string fields populated (a field that is
      37             :    absent, not a string, or longer than its max is set to the empty
      38             :    string).  Returns 0 if the account is not a ValidatorInfo or the
      39             :    JSON is malformed. */
      40             : 
      41             : int
      42             : fd_gui_config_parse_validator_info( uchar const *                data,
      43             :                                     ulong                        sz,
      44             :                                     fd_gui_config_parse_info_t * info );
      45             : 
      46             : FD_PROTOTYPES_END
      47             : 
      48             : #endif /* HEADER_fd_src_disco_gui_fd_gui_config_parse_h */

Generated by: LCOV version 1.14