Christos Zoulas
2014-12-01 16:04:38 UTC
Hi,
We have a hodgepodge set of functions that print sockaddr_* and I wanted
to try to clean that up:
1. consistent api
2. don't use static storage
3. testable from userland (with unit tests added)
For each socket type we have:
int xx_print(char *buf, size_t len, const struct xxaddr *);
and:
int sxx_snprintf(char *buf, size_t len, void *sa, const char *fmt, ...);
for xx [ "in" "in6" "at" "un" "dl" ]
[the dl portion is slightly different, and the un portion I have
not included in the patch]
There are also constants that describe the max string length that xx_print
needs:
INET_ADDRSTRLEN, INET6_ADDRSTRLEN (existing)
ATALK_ADDRSTRLEN, LINK_ADDRSTRNEL (new)
UNIX_ADDRSTRLEN (should we add this?)
The code is in:
http://www.netbsd.org/~christos/net.tar.gz
Comments?
christos
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
We have a hodgepodge set of functions that print sockaddr_* and I wanted
to try to clean that up:
1. consistent api
2. don't use static storage
3. testable from userland (with unit tests added)
For each socket type we have:
int xx_print(char *buf, size_t len, const struct xxaddr *);
and:
int sxx_snprintf(char *buf, size_t len, void *sa, const char *fmt, ...);
for xx [ "in" "in6" "at" "un" "dl" ]
[the dl portion is slightly different, and the un portion I have
not included in the patch]
There are also constants that describe the max string length that xx_print
needs:
INET_ADDRSTRLEN, INET6_ADDRSTRLEN (existing)
ATALK_ADDRSTRLEN, LINK_ADDRSTRNEL (new)
UNIX_ADDRSTRLEN (should we add this?)
The code is in:
http://www.netbsd.org/~christos/net.tar.gz
Comments?
christos
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de