4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // David Wagner <dw6@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief UNAddressing public header */
26 #ifndef HH_UNAddressing_
27 #define HH_UNAddressing_ 1
32 #include <sys/socket.h>
34 #include "../../../Socket/Protocols/GenericAddressingPolicy.hh"
35 #include "../../../Utils/safe_bool.hh"
37 //#include "UNAddressing.mpp"
38 ///////////////////////////////hh.p////////////////////////////////////////
42 /** \brief Unix domain socket address
44 UNSocketAddress wraps the standard sockaddr_un datatype. It provides simple accessor methods
47 \implementation This implementation is based on sockaddr_un.
52 : public comparable_safe_bool<UNSocketAddress>
56 explicit UNSocketAddress(std::string const & path);
57 ///< Construct an address constant from given path
59 bool operator==(UNSocketAddress const & other) const;
60 ///< Compare UNSocketAddress for equality
62 std::string path() const ; ///< Return path as string
64 bool boolean_test() const; ///< \c true, if address is not empty
66 void clear(); ///< Clear address
68 struct sockaddr * sockaddr_p() ;
69 struct sockaddr const * sockaddr_p() const;
70 unsigned sockaddr_len() const;
73 struct sockaddr_un addr_;
76 /** \brief Write path to os
78 \related UNSocketAddress
80 std::ostream & operator<<(std::ostream & os, UNSocketAddress const & addr);
82 /// \addtogroup policy_impl_group
85 /** \brief Addressing policy supporting unix domain addressing
90 This addressing policy implements addressing using unix domain
93 The various members are directly imported from
94 GenericAddressingPolicy which see for a detailed
97 struct UNAddressingPolicy
98 : public AddressingPolicyBase,
99 private GenericAddressingPolicy<UNSocketAddress>
101 typedef UNSocketAddress Address;
103 using GenericAddressingPolicy<UNSocketAddress>::peer;
104 using GenericAddressingPolicy<UNSocketAddress>::local;
105 using GenericAddressingPolicy<UNSocketAddress>::connect;
106 using GenericAddressingPolicy<UNSocketAddress>::bind;
112 ///////////////////////////////hh.e////////////////////////////////////////
113 //#include "UNAddressing.cci"
114 //#include "UNAddressing.ct"
115 //#include "UNAddressing.cti"
122 // comment-column: 40
123 // c-file-style: "senf"
124 // indent-tabs-mode: nil
125 // ispell-local-dictionary: "american"
126 // compile-command: "scons -u test"