Date: 2002-02-26 11:11:29
After N re-working I have finally come up with the following design
for an network & transport address.
socket address Feature Model
address : address [ Representation ,
Representation : sockaddr_in | sockaddr_in6 | SomeOther
Marshalling : NetworkByteOrder | LittleEndian | SomeOther
TransmissionType : Unicast | Broadcast | Multicast
Location : Local | Remote
In practice, Representation would be a Protocol Traits class.
Marshalling is, in every case I am aware of, NetworkByteOrder or None however
the possible variation point allows for the future ( as the C socket API does as
The TransmissionType prevents the creation of a TCP socket with anything other
than a Unicast address and could also validate the bit pattern within the
Location is relative to the current program or process. This is because you can
only bind and listen on a local address and connect or accept from a remote
address. Similarly with sendto and recvfrom.
This can be implemented using named template parameters and one layer for each
of the four policies.
This class can only be constructed with strings in the dotted decimal format.
I.e. "10.0.0.1" or possibly "10.0.0.1:12345". An address can not be created from
a hostname or DNS name. This is because the performance characteristics of DNS
lookup are substancially slower, potentially involving a number of network and
file accesses before returning. Therefore, for converting DNS names to addresses
and services to ports see resolver.
The default constructor and a constructor taking an already marshalled address
will go in the lowest ( base ) layer. The rest of the Constructors should
be implemented in the marshall layer.
To avoid having platform headers in the boost networking headers, I have
created, for instance csocket.h as my implementation of socket.h and am in the
process of doing this for cinet.h and all the other platform headers
specifically used for sockets.
I'm currently working on the generator and hope to post it in a few days.
comments and questions appreciated.
Visit our website at http://www.ubswarburg.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk