tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sockaddr printing functions



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


Home | Main Index | Thread Index | Old Index