4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // David Wagner <dw6@berlios.de>
28 \brief UNAddressing public header */
30 #ifndef HH_SENF_Socket_Protocols_UN_UNAddressing_
31 #define HH_SENF_Socket_Protocols_UN_UNAddressing_ 1
36 #include <sys/socket.h>
38 #include <senf/Socket/Protocols/BSDAddressingPolicy.hh>
39 #include <senf/Socket/Protocols/BSDSocketAddress.hh>
41 //#include "UNAddressing.mpp"
42 //-/////////////////////////////////////////////////////////////////////////////////////////////////
46 /** \brief Unix domain socket address
48 UNSocketAddress wraps the standard sockaddr_un datatype. It provides simple accessor methods
51 \implementation This implementation is based on sockaddr_un.
56 : public BSDSocketAddress
59 static short const addressFamily = AF_UNIX;
63 explicit UNSocketAddress(std::string const & path);
64 ///< Construct an address constant from given path
66 UNSocketAddress(const UNSocketAddress& other);
67 UNSocketAddress& operator=(const UNSocketAddress& other);
69 std::string path() const ; ///< Return path as string
70 void path(std::string const & path);
72 using BSDSocketAddress::sockaddr_p;
73 using BSDSocketAddress::socklen_p;
76 struct sockaddr_un addr_;
79 /** \brief Write path to os
81 \related UNSocketAddress
83 std::ostream & operator<<(std::ostream & os, UNSocketAddress const & addr);
85 /// \addtogroup policy_impl_group
88 /** \brief Addressing policy supporting unix domain addressing
93 This addressing policy implements addressing using unix domain
96 The various members are directly imported from
97 BSDAddressingPolicyMixin which see for a detailed
100 struct UNAddressingPolicy
101 : public BSDAddressingPolicy,
102 private BSDAddressingPolicyMixin<UNSocketAddress>
104 typedef UNSocketAddress Address;
106 using BSDAddressingPolicyMixin<UNSocketAddress>::peer;
107 using BSDAddressingPolicyMixin<UNSocketAddress>::local;
108 using BSDAddressingPolicyMixin<UNSocketAddress>::connect;
109 using BSDAddressingPolicyMixin<UNSocketAddress>::bind;
115 //-/////////////////////////////////////////////////////////////////////////////////////////////////
116 #include "UNAddressing.cci"
117 //#include "UNAddressing.ct"
118 //#include "UNAddressing.cti"
125 // comment-column: 40
126 // c-file-style: "senf"
127 // indent-tabs-mode: nil
128 // ispell-local-dictionary: "american"
129 // compile-command: "scons -u test"