X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FProtocols%2FUN%2FUNAddressing.hh;h=22e16712022e5b0e59c7ebc10a47a2e46531cf11;hb=1ad3873b372da6187b1fbc645bf276287d2efb54;hp=4529e9150e74b2112addce9ce625b9233bf9f3cb;hpb=0de6c83e2769c7deb2ed3c57d7b26e8cb3fcca04;p=senf.git diff --git a/Socket/Protocols/UN/UNAddressing.hh b/Socket/Protocols/UN/UNAddressing.hh index 4529e91..22e1671 100644 --- a/Socket/Protocols/UN/UNAddressing.hh +++ b/Socket/Protocols/UN/UNAddressing.hh @@ -1,6 +1,7 @@ -// $Id$ -// // Copyright (C) 2007 +// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) +// Kompetenzzentrum NETwork research (NET) +// David Wagner // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -30,37 +31,76 @@ #include #include #include -#include "boost/filesystem/path.hpp" #include "../../../Socket/SocketPolicy.hh" #include "../../../Socket/ClientSocketHandle.hh" #include "../../../Socket/CommunicationPolicy.hh" #include "../../../Socket/Protocols/GenericAddressingPolicy.hh" -#include "UNAddress.hh" +#include "../../../Utils/safe_bool.hh" //#include "UNAddressing.mpp" ///////////////////////////////hh.p//////////////////////////////////////// + namespace senf { + + /** \brief Unix domain socket address + + UNSocketAddress wraps the standard sockaddr_un datatype. It provides simple accessor methods + to access the path. + + \implementation This implementation is based on sockaddr_un. + + \ingroup addr_group + + \fixme Why both std::string constructor and from_string member ? + */ class UNSocketAddress - : public ComparableSafeBool + : public comparable_safe_bool { public: + UNSocketAddress(); + explicit UNSocketAddress(std::string p); + ///< Construct an address constant from given path + static UNSocketAddress from_string(std::string const s); + ///< Create UNSocketAddress from string + + bool operator==(UNSocketAddress const & other) const; + ///< Compare UNSocketAddress for equality + + std::string path() const ; ///< Return path as string + + bool boolean_test() const; ///< \c true, if address is not empty + + void clear(); ///< Clear address - //UNSocketAddress(); - explicit UNSocketAddress(boost::filesystem::path p); - ///< Construct an address constant - static UNSocketAddress from_string(std::string const s); - static UNSocketAddress from_path(boost::filesystem::path const p); - static std::string path(); - static sockaddr_un sockaddr(); - struct sockaddr * sockaddr_p(); + struct sockaddr * sockaddr_p() ; struct sockaddr const * sockaddr_p() const; unsigned sockaddr_len() const; + private: - static struct sockaddr_un sockAddr; + struct sockaddr_un addr_; }; + + /** \brief Write path to os + + \related UNSocketAddress + */ std::ostream & operator<<(std::ostream & os, UNSocketAddress const & addr); + /// \addtogroup policy_impl_group + /// @{ + + /** \brief Addressing policy supporting unix domain addressing + \par Address Type: + UNAddress + + This addressing policy implements addressing using unix domain + addresses. + + The various members are directly imported from + GenericAddressingPolicy which see for a detailed + documentation. + */ struct UNAddressingPolicy : public AddressingPolicyBase, private GenericAddressingPolicy @@ -72,7 +112,10 @@ namespace senf { using GenericAddressingPolicy::connect; using GenericAddressingPolicy::bind; }; + + ///@} } + ///////////////////////////////hh.e//////////////////////////////////////// //#include "UNAddressing.cci" //#include "UNAddressing.ct"