MCPcopy Create free account
hub / github.com/corosync/corosync / main_config_parser_cb

Function main_config_parser_cb

exec/coroparse.c:628–1684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628static int main_config_parser_cb(const char *path,
629 char *key,
630 char *value,
631 enum main_cp_cb_data_state *state,
632 enum parser_cb_type type,
633 const char **error_string,
634 icmap_map_t config_map,
635 void *user_data)
636{
637 int ii;
638 long long int val;
639 long long int min_val, max_val;
640 icmap_value_types_t val_type = ICMAP_VALUETYPE_BINARY;
641 unsigned long long int ull;
642 int add_as_string;
643 char key_name[ICMAP_KEYNAME_MAXLEN + 1];
644 static char formated_err[256];
645 struct main_cp_cb_data *data = (struct main_cp_cb_data *)user_data;
646 struct key_value_list_item *kv_item;
647 struct qb_list_head *iter, *tmp_iter;
648 int uid, gid, dscp;
649 cs_error_t cs_err;
650 const char *path_prefix;
651
652 cs_err = CS_OK;
653
654 /*
655 * Formally this check is not needed because length is checked by parse_section
656 */
657 if (strlen(path) >= sizeof(key_name)) {
658 if (snprintf(formated_err, sizeof(formated_err),
659 "Can't store path \"%s\" into key_name", path) >= sizeof(formated_err)) {
660 *error_string = "Can't format path into key_name error message";
661 } else {
662 *error_string = formated_err;
663 }
664 return (0);
665 }
666 /*
667 * Key_name is used in atoi_error/icmap_set_error, but many of icmap_set*
668 * are using path, so initialize key_name to valid value
669 */
670 strncpy(key_name, path, sizeof(key_name) - 1);
671
672 switch (type) {
673 case PARSER_CB_START:
674 memset(data, 0, sizeof(struct main_cp_cb_data));
675 qb_list_init(&data->logger_subsys_items_head);
676 qb_list_init(&data->member_items_head);
677 *state = MAIN_CP_CB_DATA_STATE_NORMAL;
678 break;
679 case PARSER_CB_END:
680 break;
681 case PARSER_CB_CLEANUP:
682 free(data->bindnetaddr);
683 free(data->mcastaddr);
684 free(data->broadcast);
685 free(data->knet_transport);

Callers

nothing calls this directly

Calls 15

safe_atoqFunction · 0.85
icmap_set_uint32_rFunction · 0.85
icmap_set_uint8_rFunction · 0.85
icmap_set_int32_rFunction · 0.85
str_to_ullFunction · 0.85
icmap_set_uint64_rFunction · 0.85
handle_crypto_modelFunction · 0.85
handle_compress_modelFunction · 0.85
get_dscp_valueFunction · 0.85
uid_determineFunction · 0.85
gid_determineFunction · 0.85
icmap_set_string_rFunction · 0.85

Tested by

no test coverage detected