X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FProtocols%2FUN%2FUNAddressing.hh;h=eccb8d3578d9dd71c04cd5cb60896093bee1949e;hb=3863d46dd898b7bc35ea8c6ccd8563b18762a6b6;hp=f30cfdd82e7dd18b15880fe3f95fe748eb59f6f2;hpb=4225a17d92c3692e6d3f96a8dd5cb432cd402e61;p=senf.git diff --git a/Socket/Protocols/UN/UNAddressing.hh b/Socket/Protocols/UN/UNAddressing.hh index f30cfdd..eccb8d3 100644 --- a/Socket/Protocols/UN/UNAddressing.hh +++ b/Socket/Protocols/UN/UNAddressing.hh @@ -1,6 +1,9 @@ // $Id$ // -// Copyright (C) 2007 +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// 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 @@ -20,26 +23,22 @@ /** \file \brief UNAddressing public header */ -#ifndef HH_UNAddressing_ -#define HH_UNAddressing_ 1 +#ifndef HH_SENF_Socket_Protocols_UN_UNAddressing_ +#define HH_SENF_Socket_Protocols_UN_UNAddressing_ 1 // Custom includes #include #include #include #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 "../BSDAddressingPolicy.hh" +#include "../BSDSocketAddress.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 @@ -50,25 +49,30 @@ namespace senf { \ingroup addr_group */ class UNSocketAddress - : public ComparableSafeBool + : public BSDSocketAddress { public: + static short const addressFamily = AF_UNIX; + + UNSocketAddress(); - //UNSocketAddress(); - explicit UNSocketAddress(boost::filesystem::path p); + explicit UNSocketAddress(std::string const & path); ///< Construct an address constant from given path - static UNSocketAddress from_string(std::string const s); ///< Create UNSocketAddress from string - static UNSocketAddress from_path(boost::filesystem::path const p); ///< Create UNSocketAddress from path - std::string path() const ; ///< Return path as string - struct sockaddr_un sockaddr(); - struct sockaddr * sockaddr_p() ; - struct sockaddr const * sockaddr_p() const; - unsigned sockaddr_len(); + + UNSocketAddress(const UNSocketAddress& other); + UNSocketAddress& operator=(const UNSocketAddress& other); + + std::string path() const ; ///< Return path as string + void path(std::string const & path); + + using BSDSocketAddress::sockaddr_p; + using BSDSocketAddress::socklen_p; + private: - struct sockaddr_un sockAddr; + struct sockaddr_un addr_; }; - /** \brief Write path os + /** \brief Write path to os \related UNSocketAddress */ @@ -80,30 +84,32 @@ namespace senf { /** \brief Addressing policy supporting unix domain addressing \par Address Type: - UNAddress + UNSocketAddress This addressing policy implements addressing using unix domain addresses. The various members are directly imported from - GenericAddressingPolicy which see for a detailed + BSDAddressingPolicyMixin which see for a detailed documentation. */ - struct UNAddressingPolicy - : public AddressingPolicyBase, - private GenericAddressingPolicy + : public BSDAddressingPolicy, + private BSDAddressingPolicyMixin { typedef UNSocketAddress Address; - using GenericAddressingPolicy::peer; - using GenericAddressingPolicy::local; - using GenericAddressingPolicy::connect; - using GenericAddressingPolicy::bind; + using BSDAddressingPolicyMixin::peer; + using BSDAddressingPolicyMixin::local; + using BSDAddressingPolicyMixin::connect; + using BSDAddressingPolicyMixin::bind; }; + + ///@} } + ///////////////////////////////hh.e//////////////////////////////////////// -//#include "UNAddressing.cci" +#include "UNAddressing.cci" //#include "UNAddressing.ct" //#include "UNAddressing.cti" #endif