set keyword svn property on more files
[senf.git] / Socket / Protocols / UN / UNProtocol.hh
1 // $Id$
2 //
3 // Copyright (C) 2007 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS) 
5 // Kompetenzzentrum NETwork research (NET)
6 //     David Wagner <dw6@berlios.de>
7 //
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.
12 //
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.
17 //
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.
22
23 /** \file
24     \brief UNProtocol public header */
25
26 #ifndef HH_UNProtocol_
27 #define HH_UNProtocol_ 1
28
29 // Custom includes
30 #include "../../../Socket/SocketProtocol.hh"
31 #include "UNAddressing.hh"
32 #include "../../../Socket/ClientSocketHandle.hh"
33 #include "../../../Socket/CommunicationPolicy.hh"
34
35 //#include "UNProtocol.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
37
38 namespace senf {
39
40     /// \addtogroup protocol_facets_group
41     /// @{
42
43     /** \brief Protocol facet providing Unix Domain Addressing related API
44
45         This protocol facet introduces all the socket api protocol members which are related to Unix 
46         Domain addressing.
47
48         \todo connect() is only available on stream sockets. We want to access bind() and connect()
49         via the ClientSocketHandle -> see SocketProtocol todo point
50      */
51     class UNProtocol
52         : public virtual SocketProtocol
53     {
54     public:
55         void connect(UNSocketAddress const & address) const; ///< Connect to a  unix domain socket 
56                                         /**< \todo make this obsolete by allowing access to the
57                                              ClientSocketHandle from ConcreateSocketProtocol
58                                              \param[in] address Address to connect to */
59         void bind(UNSocketAddress const & address) const; ///< Set local socket address (path)
60                                         /**< \todo make this obsolete by allowing access to the
61                                              ClientSocketHandle from ConcreateSocketProtocol
62                                              \param[in] address Address to set */
63         
64         virtual void close() const;   ///< Close socket
65                               /**< This override will automatically \c shutdown() the
66                                    socket whenever it is closed.
67                                    \throws senf::SystemException */  
68         virtual void terminate() const;       ///< Forcibly close socket
69                                         /**< This override will automatically \c shutdown() the
70                                            socket whenever it is called. Additionally it will
71                                            disable SO_LINGER to ensure, that v_terminate will not
72                                            block. Like the overriden method, this member will ignore
73                                            failures and will never throw. It therefore safe to be
74                                            called from a destructor. */        ///\name Abstract Interface Implementation
75         ///@{
76
77          unsigned available() const;
78          bool eof() const;
79          
80     private:
81         void check_and_unlink() const;  
82       
83         std::string path_;
84     };
85 }
86
87 ///////////////////////////////hh.e////////////////////////////////////////
88 //#include "UNProtocol.cci"
89 //#include "UNProtocol.ct"
90 //#include "UNProtocol.cti"
91 #endif
92
93 \f
94 // Local Variables:
95 // mode: c++
96 // fill-column: 100
97 // comment-column: 40
98 // c-file-style: "senf"
99 // indent-tabs-mode: nil
100 // ispell-local-dictionary: "american"
101 // compile-command: "scons -u test"
102 // End: