2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum NETwork research (NET)
4 // David Wagner <david.wagner@fokus.fraunhofer.de>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 \brief UNAddressing public header */
24 #ifndef HH_UNAddressing_
25 #define HH_UNAddressing_ 1
30 #include <sys/socket.h>
32 #include <boost/cstdint.hpp>
33 #include <boost/operators.hpp>
34 #include "../../../Socket/SocketPolicy.hh"
35 #include "../../../Socket/ClientSocketHandle.hh"
36 #include "../../../Socket/CommunicationPolicy.hh"
37 #include "../../../Socket/Protocols/GenericAddressingPolicy.hh"
38 #include "../../../Utils/safe_bool.hh"
39 #include "UNAddress.hh"
41 //#include "UNAddressing.mpp"
42 ///////////////////////////////hh.p////////////////////////////////////////
44 /** \brief Unix domain socket address
46 UNSocketAddress wraps the standard sockaddr_un datatype. It provides simple accessor methods
49 \implementation This implementation is based on sockaddr_un.
54 : public comparable_safe_bool<UNSocketAddress>
59 explicit UNSocketAddress(std::string p);
60 ///< Construct an address constant from given path
61 static UNSocketAddress from_string(std::string const s); ///< Create UNSocketAddress from string
62 std::string path() const ; ///< Return path as string
63 struct sockaddr_un sockaddr();
64 struct sockaddr * sockaddr_p() ;
65 struct sockaddr const * sockaddr_p() const;
66 unsigned sockaddr_len() const;
68 struct sockaddr_un sockAddr;
71 /** \brief Write path os
73 \related UNSocketAddress
75 std::ostream & operator<<(std::ostream & os, UNSocketAddress const & addr);
77 /// \addtogroup policy_impl_group
80 /** \brief Addressing policy supporting unix domain addressing
85 This addressing policy implements addressing using unix domain
88 The various members are directly imported from
89 GenericAddressingPolicy which see for a detailed
92 struct UNAddressingPolicy
93 : public AddressingPolicyBase,
94 private GenericAddressingPolicy<UNSocketAddress>
96 typedef UNSocketAddress Address;
98 using GenericAddressingPolicy<UNSocketAddress>::peer;
99 using GenericAddressingPolicy<UNSocketAddress>::local;
100 using GenericAddressingPolicy<UNSocketAddress>::connect;
101 using GenericAddressingPolicy<UNSocketAddress>::bind;
104 ///////////////////////////////hh.e////////////////////////////////////////
105 //#include "UNAddressing.cci"
106 //#include "UNAddressing.ct"
107 //#include "UNAddressing.cti"
114 // comment-column: 40
115 // c-file-style: "senf"
116 // indent-tabs-mode: nil
117 // ispell-local-dictionary: "american"
118 // compile-command: "scons -u test"