static void xccdf_item_dump_deps(struct xccdf_item *item, int depth) { struct oscap_list *conflicts = NULL, *requires = NULL; xccdf_deps_get(item, &conflicts, &requires); assume_r(conflicts != NULL && requires != NULL, /* void */); if (requires->itemcount > 0) { struct oscap_list_item *it; xccdf_print_depth(depth); printf("requires: "); for (it = requires->first; it; it = it->next) { struct oscap_list *nlist = it->data; if (it != requires->first) printf(" & "); if (nlist->itemcount == 0) continue; if (nlist->itemcount > 1) printf("("); xccdf_items_print_id_list(nlist, " | "); if (nlist->itemcount > 1) printf(")"); } printf("\n"); } if (conflicts->itemcount > 0) { xccdf_print_depth(depth); printf("conflicts: "); xccdf_items_print_id_list(conflicts, " | "); printf("\n"); } }
void xccdf_group_dump(struct xccdf_item *group, int depth) { xccdf_print_depth(depth); printf("Group : %s\n", (group ? group->item.id : "(NULL)")); if (group) { xccdf_item_print(group, depth + 1); xccdf_print_depth(depth + 1); printf("values"); oscap_list_dump(group->sub.group.values, (oscap_dump_func) xccdf_value_dump, depth + 2); xccdf_print_depth(depth + 1); printf("content"); oscap_list_dump(group->sub.group.content, (oscap_dump_func) xccdf_item_dump, depth + 2); } }
void xccdf_rule_dump(struct xccdf_item *rule, int depth) { xccdf_print_depth(depth); printf("Rule : %s\n", (rule ? rule->item.id : "(NULL)")); if (rule) { xccdf_item_print(rule, depth + 1); xccdf_item_dump_deps(rule, depth + 1); xccdf_print_depth(depth + 1); printf("idents"); oscap_list_dump(rule->sub.rule.idents, (oscap_dump_func) xccdf_ident_dump, depth + 2); xccdf_print_depth(depth + 1); printf("checks"); oscap_list_dump(rule->sub.rule.checks, (oscap_dump_func) xccdf_check_dump, depth + 2); } }
void xccdf_check_dump(struct xccdf_check *check, int depth) { if (check->id) { xccdf_print_depth(depth); printf("id : %s\n", check->id); } if (check->system) { xccdf_print_depth(depth); printf("system : %s\n", check->system); } if (check->selector) { xccdf_print_depth(depth); printf("selector: %s\n", check->selector); } if (check->content) { xccdf_print_depth(depth); printf("content : %s\n", check->content); } xccdf_print_depth(depth); printf("content-refs"); oscap_list_dump(check->content_refs, (oscap_dump_func) xccdf_check_content_ref_dump, depth + 1); }
void xccdf_print_textlist(struct oscap_text_iterator *txt, int depth, int max, const char *ellipsis) { if (txt == NULL) return; printf("\n"); while (oscap_text_iterator_has_more(txt)) { struct oscap_text *text = oscap_text_iterator_next(txt); xccdf_print_depth(depth); xccdf_print_max_text(text, max, ellipsis); printf("\n"); } oscap_text_iterator_free(txt); }
void xccdf_check_content_ref_dump(struct xccdf_check_content_ref *ref, int depth) { xccdf_print_depth(depth); printf("%s (%s)\n", ref->href, ref->name); }
void xccdf_ident_dump(struct xccdf_ident *ident, int depth) { xccdf_print_depth(depth); printf("ident : %s => %s\n", ident->system, ident->id); }