[getdns-api] Feedback wanted for getdns_context_set_update_callback function (was Re: Questions and Suggestions After Implementing PHP Language Bindings)

Ray Bellis Ray.Bellis at nominet.org.uk
Sun Apr 12 10:33:52 CEST 2015


+1

Every API that provides callbacks should allow a void* client data.

It's essential for wrapping such APIs into languages like C++ where the client data can hold a pointer to "this".

Ray

Sent from my iPhone

On 11 Apr 2015, at 23:48, "Hollenbeck, Scott" <shollenbeck at verisign.com> wrote:

>> -----Original Message-----
>> From: getdns-api [mailto:getdns-api-bounces at vpnc.org] On Behalf Of
>> Willem Toorop
>> Sent: Tuesday, April 07, 2015 10:34 AM
>> To: getdns-api at vpnc.org
>> Subject: [getdns-api] Feedback wanted for
>> getdns_context_set_update_callback function (was Re: Questions and
>> Suggestions After Implementing PHP Language Bindings)
>> 
>> Dear All,
>> 
>> As Scott Hollenbeck has rightfully noticed (see quoted message below),
>> the API is inconsistent in its use of user registered functions.
>> 
>> A request callback function provided with an asynchronous requests, is
>> given alongside a (void *) user argument which will be passed when the
>> callback is called.  Similarly, user defined memory management
>> functions
>> accommodate a user argument (perhaps to point to a structure to help
>> with memory book-keeping).  In contrast, the
>> getdns_context_set_context_update_callback does provide these means.
>> 
>> I propose to replace it with a new function that allows an user
>> argument:
>> 
>> getdns_return_t
>> getdns_context_set_update_callback(
>>  getdns_context  *context,
>>  void            *userarg,
>>  void            (*value)(getdns_context       *context,
>>                           getdns_context_code_t changed_item,
>>                           void                 *userarg)
>> );
>> 
>> The new name is to keep the API backwards compatible.  An
>> implementation
>> can provide the old symbol, though undocumented.
>> What do you think?
> 
> Well, *I* certainly like this idea!
> 
> Scott
> 
> _______________________________________________
> getdns-api mailing list
> getdns-api at vpnc.org

_______________________________________________
getdns-api mailing list
getdns-api at vpnc.org



More information about the spec mailing list