Merged revisions 570-572,574-575,578-579,581-595,598-611 via svnmerge from
[senf.git] / Socket / Protocols / INet / INetProtocol.hh
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institute for Open Communication Systems (FOKUS) 
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY 
6 //     Stefan Bund <g0dil@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 IPv[46]Protocol public header
25
26     \todo what about OOB data?
27
28     \todo Implement IP_RECVERR / MSG_ERRQUEUE. This should be placed
29     into an additional protocol facet since IP_RECVERR is only valid
30     for SOCK_DGRAM (UDP) and not SOCK_STREAM (TCP) sockets
31  */
32
33 #ifndef HH_INetProtocol_
34 #define HH_INetProtocol_ 1
35
36 // Custom includes
37 #include "../../../Socket/SocketProtocol.hh"
38 #include "INetAddressing.hh"
39 #include "../../../Socket/ClientSocketHandle.hh"
40 #include "../../../Socket/CommunicationPolicy.hh"
41
42 //#include "INetProtocol.mpp"
43 ///////////////////////////////hh.p////////////////////////////////////////
44
45 namespace senf {
46
47     /// \addtogroup protocol_facets_group
48     /// @{
49
50     class INetProtocol
51         : public virtual SocketProtocol
52     {
53     public:
54         void bindInterface(std::string const & iface) const;
55                                         ///< Bind socket to specific interface
56                                         /**< When a socket is bound to an interface, it will only
57                                              receive data received on that interface. If the
58                                              interface name is empty, the binding is removed.
59
60                                              \param[in] iface name of interface to bind to or empty
61                                                  to remove binding
62
63                                              \implementation Sets the SO_BINDTODEVICE socket option
64                                           */
65         std::string bindInterface();    ///< Get bound interface
66                                         /**< Returns the interface, the socket is currently bound
67                                              to. Returns the empty string, if not bound to any
68                                              interface.
69                                              \returns Bound interface name */
70     };
71
72     /** \brief Protocol facet providing IPv4 Addressing related API
73
74         This protocol facet introduces all the socket api protocol members which are related to IPv4
75         addressing.
76
77         \todo Is it safe, not to allow setting the interface index on add/drop? what does it do
78         (especially if the local address is given ?). What have I been thinking here ???
79
80         \todo connect() is only available on stream sockets. We want to access bind() and connect()
81         via the ClientSocketHandle -> see SocketProtocol todo point
82      */
83     class IPv4Protocol
84         : public virtual SocketProtocol
85     {
86     public:
87     };
88
89     /** \brief Protocol facet providing IPv6 Addressing related API
90
91         This protocol facet introduces all the socket api protocol members which are related to IPv6
92         addressing.
93      */
94     class IPv6Protocol
95         : public virtual SocketProtocol
96     {
97     public:
98     };
99
100     /// @}
101
102 }
103
104 ///////////////////////////////hh.e////////////////////////////////////////
105 //#include "INetProtocol.cci"
106 //#include "INetProtocol.ct"
107 //#include "INetProtocol.cti"
108 #endif
109
110 \f
111 // Local Variables:
112 // mode: c++
113 // fill-column: 100
114 // c-file-style: "senf"
115 // indent-tabs-mode: nil
116 // ispell-local-dictionary: "american"
117 // compile-command: "scons -u test"
118 // comment-column: 40
119 // End: