4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.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 IPv[46]Protocol public header
26 \todo what about OOB data?
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
33 #ifndef HH_INetProtocol_
34 #define HH_INetProtocol_ 1
37 #include "SocketProtocol.hh"
38 #include "INetAddressing.hh"
39 #include "ClientSocketHandle.hh"
40 #include "CommunicationPolicy.hh"
42 //#include "INetProtocol.mpp"
43 ///////////////////////////////hh.p////////////////////////////////////////
47 /// \addtogroup protocol_facets_group
50 /** \brief Protocol facet providing IPv4 Addressing related API
52 This protocol facet introduces all the socket api protocol members which are related to IPv4
55 \todo Is it safe, not to allow setting the interface index on add/drop? what does it do
56 (especially if the local addres is given ?). What have I been thinking here ???
58 \todo move all multicast-methods into an extra IPv4MulticastProtocol class (it's only
59 available on datagram sockets)
61 \todo the multicast add/remove/iface semantics are quite unclear ...
63 \todo connect() is only available on stream sockets. We want to access bind() and connet()
64 via the ClientSocketHandle -> see SocketProtocol todo point
67 : public virtual SocketProtocol
70 void connect(INet4Address const & address) const; ///< Connect to remote address
71 /**< \todo make this obsolete by allowing access to the
72 ClientSocketHandle from ConcreateSocketProtocol
73 \param[in] address Address to connect to */
74 void bind(INet4Address const & address) const; ///< Set local socket address
75 /**< \todo make this obsolete by allowing access to the
76 ClientSocketHandle from ConcreateSocketProtocol
77 \param[in] address Address to set */
79 unsigned mcTTL() const; ///< Return current multicast TTL
80 void mcTTL(unsigned value) const; ///< Set multicast TTL
82 bool mcLoop() const; ///< Return current multicast loopback state
83 void mcLoop(bool value) const; ///< Set multicast loopback state
85 void mcAddMembership(INet4Address const & mcAddr) const;
86 ///< Join multicast group
87 /**< This member will add \a mcAddr to the list of multicast
88 groups received. The group is joined on the default
90 \param[in] mcAddr address of group to join
91 \todo fix this as soon as we have a real address class
92 (differend from the sockaddress class */
93 void mcAddMembership(INet4Address const & mcAddr, INet4Address const & localAddr) const;
94 ///< join multicast group on a specific address/interface
95 /**< This member will add \a mcAddr to the list of multicast
96 groups received. The group is joined on the interface
97 with the given local address.
98 \param[in] mcAddr address of group to join
99 \param[in] localAddr address of interface to join on
100 \todo fix this as soon as we have a real address class
101 (differend from the sockaddress class */
103 void mcDropMembership(INet4Address const & mcAddr) const;
104 ///< Leave multicast group
105 /**< This member will remove \a mcAddr from the list of
106 multicast groups received. The group is left from the
108 \param[in] mcAddr address of group to leave
109 \todo fix this as soon as we have a real address class
110 (differend from the sockaddress class */
111 void mcDropMembership(INet4Address const & mcAddr, INet4Address const & localAddr) const;
112 ///< leave multicast group on a specific address/interface
113 /**< This member will remove \a mcAddr from the list of
114 multicast groups received. The group is left from the
115 interface with the given local address.
116 \param[in] mcAddr address of group to leave
117 \param[in] localAddr address of interface to leave from
118 \todo fix this as soon as we have a real address class
119 (differend from the sockaddress class */
121 void mcIface(std::string iface = std::string()) const;
122 ///< set default multicast interface of the socket
123 /**< \param[in] iface name of interface */
126 /** \brief Protocol facet providing IPv6 Addressing related API
128 This protocol facet introduces all the socket api protocol members which are related to IPv6
132 : public virtual SocketProtocol
135 void connect(INet6SocketAddress const & address) const; ///< Connect to remote address
136 /**< \todo make this obsolete by allowing access to the
137 ClientSocketHandle from ConcreateSocketProtocol
138 \param[in] address Address to connect to */
139 void bind(INet6SocketAddress const & address) const; ///< Set local socket address
140 /**< \todo make this obsolete by allowing access to the
141 ClientSocketHandle from ConcreateSocketProtocol
142 \param[in] address Address to set */
149 ///////////////////////////////hh.e////////////////////////////////////////
150 //#include "INetProtocol.cci"
151 //#include "INetProtocol.ct"
152 //#include "INetProtocol.cti"
158 // c-file-style: "senf"