fun with sockaddr...
baueran at in.tum.de
Sun Sep 15 09:05:45 EST 2002
> For example:
> h1 = h2 = '\0';
> if (getnameinfo((struct sockaddr *)&ss,
> ((struct sockaddr *)&ss)->sa_len, h1, sizeof(h1),
> p, sizeof(p), niflag) != 0)
> return 0;
> As far as I can tell, sockaddr doesn't have a sa_len element (and the compiler
> agrees). The man page for getnameinfo() doesn't help me much - it also uses
> the sa_len approach.
I used this stuff a bit in Mailfilter and I believe sa_len returned the
size of the sockaddr_xyz struct. Glibc used to have a macro called
SA_LEN(sa), but that's gone now, as far as I can tell. So, you can
define your own along the lines of
#define SA_LEN(sa) sizeof(struct sockaddr_xyz)
You get the idea, I hope.
(o_ Andreas Bauer, baueran at in.tum.de, http://home.in.tum.de/baueran/
//\ "Should've bought a Holden, Frank!" -- Ozzie in Bad Taste
More information about the linux