X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FLLAddressing.hh;h=cedd2a03834eeb74b55dd84e594fd1051e4804ce;hb=9a988902090d28007578e93bffd809f6bd913155;hp=ce699bea936e95716bc52a0913da699d89eae22b;hpb=c52cd7d87dbb525c1267aad27391b8b7365dbb57;p=senf.git diff --git a/Socket/LLAddressing.hh b/Socket/LLAddressing.hh index ce699be..cedd2a0 100644 --- a/Socket/LLAddressing.hh +++ b/Socket/LLAddressing.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -20,6 +20,10 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +/** \file + \brief LLSocketAddress and LLAddressingPolicy public header + */ + #ifndef HH_LLAddressing_ #define HH_LLAddressing_ 1 @@ -39,9 +43,29 @@ #include "LLAddressing.ih" ///////////////////////////////hh.p//////////////////////////////////////// -namespace satcom { -namespace lib { +namespace senf { + + /// \addtogroup addr_group + /// @{ + + /** \brief Link local address + + LLSocketAddress wraps the standard sockaddr_ll datatype. + + \todo I don't think the current implementation is + sensible. I'll have to reimplement this class probably + from scratch. + \implementation The class relies uses a very flexible + 'ForwardRange' representation for a raw ll + address (See Boost.Range). + This representation allows zero-copy implementations of + many operations, however it is probably not worth the + effort since the ll address is restricted to a max of 8 + bytes. Therefore this will be changed and the concrete + implementation is not documented very well ... + */ class LLSocketAddress { public: @@ -49,7 +73,7 @@ namespace lib { // as the representation for a hardware address. The restrictions // for the range are: // a) the range must never be larger than 8 elements - // b) the value_type must be convertible to unsigend char + // b) the value_type must be convertible to unsigned char // and really we need only a single-pass range. // // Since a hardware address is so short (a maximum of 8 @@ -64,7 +88,7 @@ namespace lib { // I'll leave it as it is ... typedef boost::iterator_range LLAddress; - + LLSocketAddress(); // And this is for bind explicit LLSocketAddress(unsigned protocol, std::string interface=""); @@ -100,29 +124,59 @@ namespace lib { struct ::sockaddr_ll addr_; }; + /** \brief + \related LLSocketAddress + */ detail::LLAddressFromStringRange llAddress(std::string address); + // The enable_if condition here allows only for classes as range. // However, excluding zero-terminated strings (which we want to // pass to above) I cannot think of a non-class ForwardRange // except for academic cases + // STOP: ... how about std::vector<...>::iterator ?? isn't that a ..pointer ? + /** \brief Convert raw link-local address into printable form + \related LLSocketAddress + */ template std::string llAddress(ForwardRange const & address, typename boost::enable_if< boost::is_class >::type * = 0); - class LLAddressingPolicy + /** \brief Signal invalid link local address syntax + \related LLSocketAddress + */ + struct InvalidLLSocketAddressException : public std::exception + { char const * what() const throw() { return "invalid ll address"; } }; + + /// @} + + /// \addtogroup policy_impl_group + /// @{ + + /** \brief Addressing policy supporting link-local addressing + + \par Address Type: + LLSocketAddress + + This addressing policy implements generic link local + addressing. The predominant type of link local addressing is + Ethernet addressing. + + Since the link layer does not support the notion of + connections, link local addresses do not support the connect() + or peer() members. + */ + struct LLAddressingPolicy : public AddressingPolicyBase, private GenericAddressingPolicy { - public: typedef LLSocketAddress Address; using GenericAddressingPolicy::local; using GenericAddressingPolicy::bind; }; - struct InvalidLLSocketAddressException : public std::exception - { char const * what() const throw() { return "invalid ll address"; } }; -}} + /// @} +} ///////////////////////////////hh.e//////////////////////////////////////// #include "LLAddressing.cci" @@ -134,5 +188,8 @@ namespace lib { // Local Variables: // mode: c++ -// c-file-style: "satcom" +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" // End: