Subject: Re: improving ABI "survival rate"

Re: improving ABI "survival rate"

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 27 Nov 2008 20:09:48 +0100 (CET)

On Thu, 27 Nov 2008, Yang Tse wrote:

>> A very minor thing that would help is a "size of struct" field that
>> ares_save_options() could use to work even with added fields.
>
> Given the fact that a change, such as the IPv6 servers one, might break ABI
> but actually not modify the size of the ares_options struct, maybe it would
> be better to use a "struct signature" or "struct version" member for this
> case.

Right, an version number of some sorts is probably best. That could then be
set to "ARES_OPTION_VERSION" or similar by just about all applications and it
would magically be correct, but c-ares could then be made to survive in the
future when older versions are passed in.

>> A somewhat bigger change is to require a particular ares function to
>> allocate and return the struct, so that it could set internal magic in it
>> too to deal with different sizes in the future etc.
>
> Probably today isn't one of my best days, but I'm having real trouble here
> trying to see how it would be done in this case if a change such as the one
> derived from the "IPv6 servers patch" takes place.

Well, that would simply do the above mentioned version number stuff for the
application in a slightly more hidden (from the app's view) way.

>> The biggest change would be to simply not expose the struct and
>> introduce a ares_setopt() style function for setting specific options
>
> This is certainly quite a big change. The question is if there's someone
> which really wishes to take on this. Maybe It could be proposed as a 'Google
> Summer of Code' proposal.

I wouldn't call it it _that_ big but I certainly see it a bit too big to get
done right now for the next release. I still like this approach since it makes
things more stable and thus I'm interested in how c-ares users would like it.

In fact, it struck me just now that we can in fact introduce ares_setopt()
right now and move the 'rotate' and the new 'ipv6servers' to get set by this
new function only, and then we'd remain ABI compatible with the previous
release and still start moving towards this new approach!

What do you say about that?

-- 
  / daniel.haxx.se
Received on 2008-11-27