contrib/ldns/str2host.c
ldns_status
ldns_str2rdf_alg(ldns_rdf **rd, const char *str)
{
	ldns_lookup_table *lt;
	ldns_status st;

	lt = ldns_lookup_by_name(ldns_algorithms, str);
	st = LDNS_STATUS_OK;

	if (lt) {
		/* it was given as a integer */
		*rd = ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, (uint8_t) lt->id);
		if (!*rd) {
			st = LDNS_STATUS_ERR;
		}
	} else {
		/* try as-is (a number) */
		st = ldns_str2rdf_int8(rd, str);
	}
	return st;
}
/* An alg field can either be specified as a 8 bits number
 * or by its symbolic name. Handle both
 */
An alg field can either be specified as a 8 bits number
or by its symbolic name. Handle both
An alg field can either be specified as a 8 bits number or by its symbolic name . Handle both
ldns_status
ldns_str2rdf_alg(ldns_rdf **rd, const char *str)
{
	ldns_lookup_table *lt;
	ldns_status st;
	lt = ldns_lookup_by_name(ldns_algorithms, str);
	st = LDNS_STATUS_OK;
	if (lt) {
		*rd = ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, (uint8_t) lt->id);
		if (!*rd) {
			st = LDNS_STATUS_ERR;
		}
	} else {
		st = ldns_str2rdf_int8(rd, str);
	}
	return st;
}
ldns_status ldns_str2rdf_alg ( ldns_rdf * * rd , const char * str ) { ldns_lookup_table * lt ; ldns_status st ; lt = ldns_lookup_by_name ( ldns_algorithms , str ) ; st = LDNS_STATUS_OK ; if ( lt ) { * rd = ldns_native2rdf_int8 ( LDNS_RDF_TYPE_INT8 , ( uint8_t ) lt -> id ) ; if ( ! * rd ) { st = LDNS_STATUS_ERR ; } } else { st = ldns_str2rdf_int8 ( rd , str ) ; } return st ; }
An alg field can either be specified as a 8 bits number
 or by its symbolic name.
An alg field can either be specified as a 8 bits number or by its symbolic name .
/* it was given as a integer */ /* try as-is (a number) */