[getdns-api] Distinguish strings from wire format in conversion functions

Willem Toorop willem at nlnetlabs.nl
Mon Feb 3 14:11:32 MST 2014


Maybe we should use bindatas for the wire format arguments. This is the
form that dnames will be given to the user by the response object (in
"name" and "qname" attributes and in rdata fields that contain dnames):

getdns_return_t getdns_convert_dns_name_to_fqdn(
    const struct getdns_bindata *dns_name_wire_fmt, char** name);

getdns_return_t getdns_convert_fqdn_to_dns_name(
    const char *fqdn_as_string, struct getdns_bindata **dns_name);

What do you think?

op 29-01-14 22:01, Goyal, Neel schreef:
> In response to this (and the memory part 3)
> 
> I agree we need to change the sigs to distinguish between characters and
> wire format elements.  I think we should change the functions to:
> 
> getdns_return_t getdns_convert_dns_name_to_fqdn(const uint8_t
> *dns_name_wire_fmt, char** name);
> 
> getdns_return_t getdns_convert_fqdn_to_dns_name(const char
> *fqdn_as_string, uint8_t** dns_name, size_t* name_len);
> 
> We should document that all char* must be null terminated (otherwise we
> need to add an input length parameter as well, which is ok), and all
> memory must be freed as needed.  The name we return in the first function
> will be guaranteed null terminated.
> 
> 
> 
> 
> On 1/21/14, 5:27 AM, "Willem Toorop" <willem at nlnetlabs.nl> wrote:
> 
>> Since the library used "Standard Integer Types" anyway, why not use it
>> in the conversion function prototypes (from 4.2) to distinguish strings
>>from wire format names:
>>
>> char *getdns_convert_dns_name_to_fqdn(const uint8_t *dns_name_wire_fmt);
>> uint8_t *getdns_convert_fqdn_to_dns_name(const char *fqdn_as_string);
>>
>> What do you think?
>> _______________________________________________
>> getdns-api mailing list
>> getdns-api at vpnc.org
> 



More information about the getdns-api mailing list