Boost logo

Boost :

From: dmoore99atwork (dmoore_at_[hidden])
Date: 2002-01-23 07:59:08

> I suppose you could use a char buffer whose size equals to sizeof
> (wrapped_type):
> class socket_address {
> public:
> socket_address();
> private:
> // say, sizeof( sockaddr_in ) == 64
> char buf_[ 64 ];
> };
> D.P.

I would be pretty comfortable taking this approach if everyone was in
agreement that we were just targetting IPv4 and IPv6, because the
sizes of the in_addr, in6_addr, sockaddr_in, and sockaddr_in6 are
somewhat spelled out in various RFC documents.

Actually, since the sockets library (at least my design) requires
a "platform" class as a facade for the plaform specific stuff, we
might be able to encode the struture sizes in that class...

class socket_platform
  static const size_t addr_size=46;
  static const size_t addr_size=16;

This could also be part of a "protocol_traits" class, which is
something else I'm toying with.

Thanks for the feedback,

Boost list run by bdawes at, gregod at, cpdaniel at, john at