main.c
/*
 * Process parsed content.
 * For non-ROAs, we grok for more data.
 * For ROAs, we want to extract the valid info.
 * In all cases, we gather statistics.
 */
Process parsed content.
For non-ROAs, we grok for more data.
For ROAs, we want to extract the valid info.
In all cases, we gather statistics.
Process parsed content . For non - ROAs we grok for more data . For ROAs we want to extract the valid info . In all cases we gather statistics .
static void
entity_process(int proc, int rsync, struct stats *st,
    struct entityq *q, const struct entity *ent, struct repotab *rt,
    size_t *eid, struct vrp_tree *tree)
{
	struct tal	*tal;
	struct cert	*cert;
	struct mft	*mft;
	struct roa	*roa;
	int		 c;
	switch (ent->type) {
	case RTYPE_TAL:
		st->tals++;
		tal = tal_read(proc);
		queue_add_from_tal(proc, rsync, q, tal, rt, eid);
		tal_free(tal);
		break;
	case RTYPE_CER:
		st->certs++;
		io_simple_read(proc, &c, sizeof(int));
		if (c == 0) {
			st->certs_fail++;
			break;
		}
		cert = cert_read(proc);
		if (cert->valid) {
			if (cert->mft != NULL)
				queue_add_from_cert(proc, rsync,
				    q, cert->mft, rt, eid);
		} else
			st->certs_invalid++;
		cert_free(cert);
		break;
	case RTYPE_MFT:
		st->mfts++;
		io_simple_read(proc, &c, sizeof(int));
		if (c == 0) {
			st->mfts_fail++;
			break;
		}
		mft = mft_read(proc);
		if (mft->stale)
			st->mfts_stale++;
		queue_add_from_mft_set(proc, q, mft, eid);
		mft_free(mft);
		break;
	case RTYPE_CRL:
		st->crls++;
		break;
	case RTYPE_ROA:
		st->roas++;
		io_simple_read(proc, &c, sizeof(int));
		if (c == 0) {
			st->roas_fail++;
			break;
		}
		roa = roa_read(proc);
		if (roa->valid)
			roa_insert_vrps(tree, roa, &st->vrps, &st->uniqs);
		else
			st->roas_invalid++;
		roa_free(roa);
		break;
	default:
		abort();
	}
}
static void entity_process ( int proc , int rsync , struct stats * st , struct entityq * q , const struct entity * ent , struct repotab * rt , size_t * eid , struct vrp_tree * tree ) { struct tal * tal ; struct cert * cert ; struct mft * mft ; struct roa * roa ; int c ; switch ( ent -> type ) { case RTYPE_TAL : st -> tals ++ ; tal = tal_read ( proc ) ; queue_add_from_tal ( proc , rsync , q , tal , rt , eid ) ; tal_free ( tal ) ; break ; case RTYPE_CER : st -> certs ++ ; io_simple_read ( proc , & c , sizeof ( int ) ) ; if ( c == 0 ) { st -> certs_fail ++ ; break ; } cert = cert_read ( proc ) ; if ( cert -> valid ) { if ( cert -> mft != NULL ) queue_add_from_cert ( proc , rsync , q , cert -> mft , rt , eid ) ; } else st -> certs_invalid ++ ; cert_free ( cert ) ; break ; case RTYPE_MFT : st -> mfts ++ ; io_simple_read ( proc , & c , sizeof ( int ) ) ; if ( c == 0 ) { st -> mfts_fail ++ ; break ; } mft = mft_read ( proc ) ; if ( mft -> stale ) st -> mfts_stale ++ ; queue_add_from_mft_set ( proc , q , mft , eid ) ; mft_free ( mft ) ; break ; case RTYPE_CRL : st -> crls ++ ; break ; case RTYPE_ROA : st -> roas ++ ; io_simple_read ( proc , & c , sizeof ( int ) ) ; if ( c == 0 ) { st -> roas_fail ++ ; break ; } roa = roa_read ( proc ) ; if ( roa -> valid ) roa_insert_vrps ( tree , roa , & st -> vrps , & st -> uniqs ) ; else st -> roas_invalid ++ ; roa_free ( roa ) ; break ; default : abort ( ) ; } }
Process parsed content.
Process parsed content .
/*
	 * For most of these, we first read whether there's any content
	 * at all---this means that the syntactic parse failed (X509
	 * certificate, for example).
	 * We follow that up with whether the resources didn't parse.
	 */ /*
			 * Process the revocation list from the
			 * certificate *first*, since it might mark that
			 * we're revoked and then we don't want to
			 * process the MFT.
			 */