tech-net archive

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

Re: sockaddr printing functions



On Dec 1,  8:12pm, agc%pkgsrc.org@localhost (Alistair Crooks) wrote:
-- Subject: Re: sockaddr printing functions

| A few questions:
| 
| 1.  the xx_print calls sxx_snprintf internally with a local (stack)
| buffer, and then prints that out?

Yes.

| 2. why have multiple sxx_snprintf functions, and then pass a void *sa in to
| each? Is it one function with a void *sa, or many functions for each struct type?

I wanted to keep the sockaddr printing knowledge local to the stack. The
void * argument is to avoid pointer aliasing gymnastics.

| 3. why the format string?

The sockaddr_format() function in uipc_domain.c prints a prefix. I could
do that locally I guess and get rid of the prefix. Perhaps that's cleaner.

| 4. return values are same as standard printf and snprintf?

Yes, all snprintf like.

| > There are also constants that describe the max string length that xx_print
| > needs:
| > 	INET_ADDRSTRLEN, INET6_ADDRSTRLEN (existing)
| > 	ATALK_ADDRSTRLEN, LINK_ADDRSTRNEL (new)
| 
| LINK_ADDRSTRLEN?

sockaddr_dl -> DATALINK -> LINK

christos


Home | Main Index | Thread Index | Old Index