brolley wrote:
> [...]
> I've just pushed the following to the brolley/dev branch in the pcpfans
> repository:
Thanks!
> I just want to add a few notes to the information in the commit message and to
> solicit review and comments.
>
> * The new __pmDiscoverServices() API is as was discussed on this list and on
> IRC. Not much to add in the way of notes for that one.
Since it should be usable by normal clients, let's remove the __ prefix.
> * __pmServiceListFree() is to be used for freeing the list returned by
> __pmDiscoverService().
I'd be just as happy if the appending code from pmns.c:stitch_list (or
equivalent elsewhere) were factored out into a general
int __pmStringArrayAppend (char ***buffer, const char *appendee);
function, and reused generally, so that a caller need only call free() on
the result, instead of a purpose-specific free function.
> * I exposed the data structure __pmServiceInfo along with the functions
> __pmServiceInfoAlloc(), __pmServiceInfoFree() and __pmAddDiscoveredService
> () in case there is a need for clients to manually add services which are
> known to them by other means than the supported discovery mechanisms
> (currently only PMCD via Avahi). If the consensus is that this is not
> needed, then we can easily hide them again.
(My guess is that such clients would find adding a URL-string no harder.)
> * Although __pmDiscoverServices() returns an array of urls as strings,
> __pmServiceInfo maintains the information as __pmSockAddr which I feel
> will
> be easier to work with internally once we start adding filters and other
> manipulations. __pmSockAddr is easily converted to a string at the end of
> it all using __pmSockAddrToString.
(Ditto.) Plus the kinds of filtering we were talking about on the
other threads were performed by making PMAPI calls on contexts opened
from the URL strings, not something based on the sockaddrs.
> [...]
> * I added a prototype option (-p) to pminfo just so that I could demonstrate
> that the new API is working. It can be removed at any time.
Right, it's a good quick hack to see the new code work. A tiny
pmfind(1) should come along at some point to replace it though.
> * The urls returned for IPv6 PMCDs are similar to pcp://
> [fe80::5eff:35ff:fe07:55ca]:44321. That is, the address is enclosed in []
> in order to separate the address from the port. This is a common notation
> among IPv6-enabled applications. Currently, PCP's url parser does not
> accept this notation. It should be an easy fix which I can have ready
> quickly.
Good point!
- FChE
|