basic implementation of Unix Domain Sockets, for now Datagram only. docs mostly missing.
dw6 [Wed, 19 Sep 2007 12:29:53 +0000 (12:29 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@446 270642c3-0616-0410-b53a-bc976706d245

12 files changed:
Socket/Protocols/INet/UDPSocketHandle.hh
Socket/Protocols/UN/SConscript [new file with mode: 0644]
Socket/Protocols/UN/UN.hh [new file with mode: 0644]
Socket/Protocols/UN/UNAddress.cc [new file with mode: 0644]
Socket/Protocols/UN/UNAddress.hh [new file with mode: 0644]
Socket/Protocols/UN/UNAddressing.cc [new file with mode: 0644]
Socket/Protocols/UN/UNAddressing.hh [new file with mode: 0644]
Socket/Protocols/UN/UNDatagramSocketHandle.cc [new file with mode: 0644]
Socket/Protocols/UN/UNDatagramSocketHandle.hh [new file with mode: 0644]
Socket/Protocols/UN/UNProtocol.cc [new file with mode: 0644]
Socket/Protocols/UN/UNProtocol.hh [new file with mode: 0644]
Socket/Protocols/UN/all_includes.hh [new file with mode: 0644]

index 46a7cb3..3a85354 100644 (file)
@@ -103,7 +103,7 @@ namespace senf {
                                              address.
                                              \param[in] local address to bind to */
                                         /**< \note This member is implicitly called from the
-                                             ProtocolClientSocketHandle::ProtocolClientSocketHandle()
+                                            ProtocolClientSocketHandle::ProtocolClientSocketHandle()
                                              constructor */
 
         ///@}
diff --git a/Socket/Protocols/UN/SConscript b/Socket/Protocols/UN/SConscript
new file mode 100644 (file)
index 0000000..6a163c1
--- /dev/null
@@ -0,0 +1,24 @@
+# -*- python -*-
+
+Import('env')
+import SENFSCons, glob
+
+###########################################################################
+
+SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh")
+                               if f not in ('all_includes.hh','UN.hh') and not f.endswith('.test.hh') ])
+
+sources = SENFSCons.GlobSources()
+
+allob = []
+
+allob.extend(
+    SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Utils' ] ) )
+
+for sc in glob.glob("*/SConscript"):
+    ob = SConscript(sc)
+    if ob : allob.extend(ob)
+
+SENFSCons.InstallIncludeFiles(env, [ 'UN.hh', 'all_includes.hh' ])
+
+Return('allob')
diff --git a/Socket/Protocols/UN/UN.hh b/Socket/Protocols/UN/UN.hh
new file mode 100644 (file)
index 0000000..356686e
--- /dev/null
@@ -0,0 +1,42 @@
+// $Id$
+//
+// Copyright (C) 2007 
+// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
+// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+//     Stefan Bund <g0dil@berlios.de>
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief INet public header */
+
+#ifndef HH_UN_
+#define HH_UN_ 1
+
+#include "all_includes.hh"
+
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/UNAddress.cc b/Socket/Protocols/UN/UNAddress.cc
new file mode 100644 (file)
index 0000000..870f2b9
--- /dev/null
@@ -0,0 +1,79 @@
+// $Id$
+//
+// Copyright (C) 2007 
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief UNAddress non-inline non-template implementation */
+
+#include "UNAddress.hh"
+//#include "UNAddress.ih"
+
+// Custom includes
+
+//#include "UNAddress.mpp"
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
+
+prefix_ senf::UNAddress::UNAddress()
+    //:path("")
+{
+    path = boost::filesystem::path("");
+}
+
+prefix_ senf::UNAddress::UNAddress(boost::filesystem::path p)
+    //:path(p)
+{
+    
+}
+
+
+prefix_ senf::UNAddress::UNAddress senf::UNAddress::fromString(std::string &  s)
+{
+    return senf::UNAddress::UNAddress(boost::filesystem::path(s));
+}
+
+prefix_ senf::UNAddress::UNAddress senf::UNAddress::fromPath(boost::filesystem::path & p){
+    return senf::UNAddress::UNAddress(p);
+}
+
+prefix_  std::string senf::UNAddress::pathString()
+{
+    return  path.string();
+}
+
+
+prefix_ const std::ostream & senf::operator<<(std::ostream & os, UNAddress const & addr)
+{
+    os << addr.pathString();
+    return os;
+}
+
+///////////////////////////////cc.e////////////////////////////////////////
+#undef prefix_
+//#include "UNAddress.mpp"
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/UNAddress.hh b/Socket/Protocols/UN/UNAddress.hh
new file mode 100644 (file)
index 0000000..36d4ffc
--- /dev/null
@@ -0,0 +1,68 @@
+// $Id$
+//
+// Copyright (C) 2007 
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief UNAddress public header */
+
+#ifndef HH_UNAddress_
+#define HH_UNAddress_ 1
+
+// Custom includes
+#include <string>
+#include <boost/operators.hpp>
+#include <boost/filesystem/path.hpp>
+#include "../../../Utils/SafeBool.hh"
+
+//#include "UNAddress.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
+namespace senf {
+    class UNAddress 
+        : public boost::filesystem::path,
+          public ComparableSafeBool<UNAddress>
+    {   
+    public: 
+        UNAddress(); 
+        explicit UNAddress(boost::filesystem::path);
+        static UNAddress fromString(std::string & s);
+        static UNAddress fromPath(boost::filesystem::path & p);
+        static std::string pathString();
+        struct AddressException : public std::exception {};
+    private:
+        static boost::filesystem::path path;
+    };
+const std::ostream & operator<<(std::ostream & os, UNAddress const & addr);
+
+}
+
+///////////////////////////////hh.e////////////////////////////////////////
+//#include "UNAddress.cci"
+//#include "UNAddress.ct"
+//#include "UNAddress.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/UNAddressing.cc b/Socket/Protocols/UN/UNAddressing.cc
new file mode 100644 (file)
index 0000000..abc278f
--- /dev/null
@@ -0,0 +1,107 @@
+// $Id$
+//
+// Copyright (C) 2007 
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief UNAddressing non-inline non-template implementation */
+
+#include "UNAddressing.hh"
+//#include "UNAddressing.ih"
+
+// Custom includes
+#include <stdio.h>
+#include <boost/operators.hpp>
+#include <boost/filesystem/path.hpp>
+#include "../../../Utils/SafeBool.hh"
+//#include "UNAddressing.mpp"
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
+prefix_ senf::UNSocketAddress::UNSocketAddress(boost::filesystem::path p)
+{
+    chdir(p.branch_path().string().c_str());
+//Check if the unix domain socket already exists...
+    if(!remove(p.leaf().c_str()))
+       printf("File already existed and therefore was deleted!\n");
+    else
+       printf("File not found, will be created.\n");
+    fflush(stdout);
+
+    sockAddr.sun_family = AF_UNIX; 
+    strcpy(sockAddr.sun_path, p.string().c_str());
+}
+
+    prefix_ senf::UNSocketAddress fromString(std::string s)
+{
+    return senf::UNSocketAddress::UNSocketAddress(boost::filesystem::path(s));
+}
+
+    prefix_ senf::UNSocketAddress fromPath(boost::filesystem::path p)
+{
+    return senf::UNSocketAddress::UNSocketAddress(p);
+}
+    prefix_ std::string senf::UNSocketAddress::path()
+{
+    return std::string(sockAddr.sun_path);
+}
+
+prefix_ sockaddr_un senf::UNSocketAddress::sockaddr()
+{
+    struct sockaddr_un out; 
+    out.sun_family = sockAddr.sun_family;
+    strcpy(out.sun_path, sockAddr.sun_path);
+    return out; 
+}
+
+prefix_ sockaddr * senf::UNSocketAddress::sockaddr_p()
+{
+    return reinterpret_cast <struct sockaddr  *> (&sockAddr); 
+}
+
+
+prefix_ sockaddr const  * senf::UNSocketAddress::sockaddr_p()
+    const
+{
+    return reinterpret_cast <struct sockaddr const  *> (&sockAddr); 
+}
+
+prefix_ unsigned senf::UNSocketAddress::sockaddr_len()
+    const
+{
+    return sizeof(sockAddr);
+}
+
+prefix_ std::ostream & operator<<(std::ostream & os, senf::UNSocketAddress::UNSocketAddress const & addr){
+    os << addr.path();
+    return os;
+}
+
+
+///////////////////////////////cc.e////////////////////////////////////////
+#undef prefix_
+//#include "UNAddressing.mpp"
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/UNAddressing.hh b/Socket/Protocols/UN/UNAddressing.hh
new file mode 100644 (file)
index 0000000..4529e91
--- /dev/null
@@ -0,0 +1,91 @@
+// $Id$
+//
+// Copyright (C) 2007 
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief UNAddressing public header */
+
+#ifndef HH_UNAddressing_
+#define HH_UNAddressing_ 1
+
+// Custom includes
+#include <iostream>
+#include <string>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <boost/cstdint.hpp>
+#include <boost/operators.hpp>
+#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 "UNAddressing.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
+namespace senf {
+    class UNSocketAddress
+        : public ComparableSafeBool<UNSocketAddress>
+    {
+    public:
+
+        //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 const * sockaddr_p() const;
+        unsigned sockaddr_len() const;
+    private:
+        static struct sockaddr_un sockAddr;
+    };
+    std::ostream & operator<<(std::ostream & os, UNSocketAddress const & addr);
+
+
+    struct UNAddressingPolicy
+        : public AddressingPolicyBase,
+          private GenericAddressingPolicy<UNSocketAddress>
+    {
+        typedef UNSocketAddress Address;
+
+        using GenericAddressingPolicy<UNSocketAddress>::peer;
+        using GenericAddressingPolicy<UNSocketAddress>::local;
+        using GenericAddressingPolicy<UNSocketAddress>::connect;
+        using GenericAddressingPolicy<UNSocketAddress>::bind;
+    };
+}
+///////////////////////////////hh.e////////////////////////////////////////
+//#include "UNAddressing.cci"
+//#include "UNAddressing.ct"
+//#include "UNAddressing.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/UNDatagramSocketHandle.cc b/Socket/Protocols/UN/UNDatagramSocketHandle.cc
new file mode 100644 (file)
index 0000000..360ec03
--- /dev/null
@@ -0,0 +1,64 @@
+// $Id$
+//
+// Copyright (C) 2007 
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief UNDatagramSocketHandle non-inline non-template implementation */
+
+#include "UNDatagramSocketHandle.hh"
+//#include "UNDatagramSocketHandle.ih"
+
+// Custom includes
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include "../../../Utils/Exception.hh"
+
+//#include "UNDatagramSocketHandle.mpp"
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
+
+prefix_ void senf::UNDatagramSocketProtocol::init_client() const
+{
+    int sock = ::socket(PF_UNIX,SOCK_DGRAM,0);
+    if (sock < 0)
+        throw SystemException(errno);
+    body().fd(sock);
+}
+
+prefix_ void senf::UNDatagramSocketProtocol::init_client(UNSocketAddress const & address) const
+{
+    init_client();
+    //bind(address);
+}
+
+///////////////////////////////cc.e////////////////////////////////////////
+#undef prefix_
+//#include "UNDatagramSocketHandle.mpp"
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/UNDatagramSocketHandle.hh b/Socket/Protocols/UN/UNDatagramSocketHandle.hh
new file mode 100644 (file)
index 0000000..a253105
--- /dev/null
@@ -0,0 +1,111 @@
+// $Id$
+//
+// Copyright (C) 2007 
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief UNDatagramSocketHandle public header */
+
+#ifndef HH_UNDatagramSocketHandle_
+#define HH_UNDatagramSocketHandle_ 1
+
+// Custom includes
+#include "UNAddressing.hh"
+#include "UNProtocol.hh"
+#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
+#include "../../../Socket/FramingPolicy.hh"
+#include "../../../Socket/CommunicationPolicy.hh"
+#include "../../../Socket/ReadWritePolicy.hh"
+#include "../../../Socket/BufferingPolicy.hh"
+#include "../../../Socket/ProtocolClientSocketHandle.hh"
+
+
+
+//#include "UNDatagramSocketHandle.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
+
+namespace senf {
+
+    /// \addtogroup concrete_protocol_group
+    /// @{
+
+    typedef MakeSocketPolicy<
+        UNAddressingPolicy,
+        DatagramFramingPolicy,
+        UnconnectedCommunicationPolicy,
+        ReadablePolicy,
+        WriteablePolicy,
+        SocketBufferingPolicy
+        >::policy UNDatagramSocket_Policy;   
+
+    class UNDatagramSocketProtocol
+        : public ConcreteSocketProtocol<UNDatagramSocket_Policy>,
+          public UNProtocol, 
+          public BSDSocketProtocol,
+          public AddressableBSDSocketProtocol
+    {
+    public:
+        ///////////////////////////////////////////////////////////////////////////
+        // internal interface
+
+        ///\name Constructors
+        ///@{
+
+        void init_client() const;       ///< Create unconnected client socket
+                                        /**< \note This member is implicitly called from the
+                                             ProtocolClientSocketHandle::ProtocolClientSocketHandle()
+                                             constructor */
+        void init_client(UNSocketAddress const & address) const;
+                                        ///< Create client socket and bind
+                                        /**< Creates a new client socket and bind to the given
+                                             address.
+                                             \param[in] local address to bind to */
+                                        /**< \note This member is implicitly called from the
+                                             ProtocolClientSocketHandle::ProtocolClientSocketHandle()
+                                             constructor */
+        
+        ///@}
+        ///\name Abstract Interface Implementation
+
+        std::auto_ptr<SocketProtocol> clone() const;
+
+        ///@}
+    };
+
+    typedef ProtocolClientSocketHandle<UNDatagramSocketProtocol> UNDatagramClientSocketHandle;
+
+    typedef MakeSocketPolicy<
+        UNDatagramSocket_Policy,
+        UNAddressingPolicy
+        >::policy UDPv6Socket_Policy;
+}
+///////////////////////////////hh.e////////////////////////////////////////
+//#include "UNDatagramSocketHandle.cci"
+//#include "UNDatagramSocketHandle.ct"
+//#include "UNDatagramSocketHandle.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/UNProtocol.cc b/Socket/Protocols/UN/UNProtocol.cc
new file mode 100644 (file)
index 0000000..d3afe3f
--- /dev/null
@@ -0,0 +1,64 @@
+// $Id$
+//
+// Copyright (C) 2007 
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief UNProtocol non-inline non-template implementation */
+
+#include "UNProtocol.hh"
+//#include "UNProtocol.ih"
+
+// Custom includes
+#include <sys/socket.h>
+#include "../../../Utils/Exception.hh"
+
+//#include "UNProtocol.mpp"
+#define prefix_
+///////////////////////////////cc.p////////////////////////////////////////
+prefix_ void senf::UNProtocol::connect(UNSocketAddress const & address) 
+    const 
+{
+    if(::connect(body().fd(),  address.sockaddr_p(), sizeof(address.sockaddr())) < 0)
+        throw SystemException(errno);
+}
+
+prefix_ void senf::UNProtocol::bind(UNSocketAddress const & address) 
+    const 
+{
+    if(::bind(body().fd(), address.sockaddr_p(), sizeof(address.sockaddr())) < 0)
+        throw SystemException(errno);
+}
+
+
+
+
+
+///////////////////////////////cc.e////////////////////////////////////////
+#undef prefix_
+//#include "UNProtocol.mpp"
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/UNProtocol.hh b/Socket/Protocols/UN/UNProtocol.hh
new file mode 100644 (file)
index 0000000..3434641
--- /dev/null
@@ -0,0 +1,78 @@
+// $Id$
+//
+// Copyright (C) 2007 
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+/** \file
+    \brief UNProtocol public header */
+
+#ifndef HH_UNProtocol_
+#define HH_UNProtocol_ 1
+
+// Custom includes
+#include "../../../Socket/SocketProtocol.hh"
+#include "UNAddressing.hh"
+#include "../../../Socket/ClientSocketHandle.hh"
+#include "../../../Socket/CommunicationPolicy.hh"
+
+//#include "UNProtocol.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
+
+namespace senf {
+
+    /// \addtogroup protocol_facets_group
+    /// @{
+
+    /** \brief Protocol facet providing Unix Domain Addressing related API
+
+        This protocol facet introduces all the socket api protocol members which are related to Unix 
+        Domain addressing.
+
+        \todo connect() is only available on stream sockets. We want to access bind() and connect()
+        via the ClientSocketHandle -> see SocketProtocol todo point
+     */
+    class UNProtocol
+        : public virtual SocketProtocol
+    {
+    public:
+        void connect(UNSocketAddress const & address) const; ///< Connect to remote address
+                                        /**< \todo make this obsolete by allowing access to the
+                                             ClientSocketHandle from ConcreateSocketProtocol
+                                             \param[in] address Address to connect to */
+        void bind(UNSocketAddress const & address) const; ///< Set local socket address
+                                        /**< \todo make this obsolete by allowing access to the
+                                             ClientSocketHandle from ConcreateSocketProtocol
+                                             \param[in] address Address to set */
+    };
+}
+
+///////////////////////////////hh.e////////////////////////////////////////
+//#include "UNProtocol.cci"
+//#include "UNProtocol.ct"
+//#include "UNProtocol.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
diff --git a/Socket/Protocols/UN/all_includes.hh b/Socket/Protocols/UN/all_includes.hh
new file mode 100644 (file)
index 0000000..16d8a1f
--- /dev/null
@@ -0,0 +1,4 @@
+#include "UNAddress.hh"
+#include "UNAddressing.hh"
+#include "UNDatagramSocketHandle.hh"
+#include "UNProtocol.hh"