// $Id$
//
-// Copyright (C) 2006
+// Copyright (C) 2006
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-// Definition of non-inline non-template functions
+/** \file
+ \brief TCPv4SocketHandle and TCPv6SocketHandle non-inline non-template implementation
+ */
#include "TCPSocketHandle.hh"
//#include "TCPSocketHandle.ih"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////
+// senf::TCPv4SocketProtocol
+
prefix_ void senf::TCPv4SocketProtocol::init_client()
const
{
return std::auto_ptr<SocketProtocol>(new TCPv4SocketProtocol());
}
+///////////////////////////////////////////////////////////////////////////
+// senf::TCPv6SocketProtocol::
+
+prefix_ void senf::TCPv6SocketProtocol::init_client()
+ const
+{
+ int sock = ::socket(PF_INET6,SOCK_STREAM,0);
+ if (sock < 0)
+ throw SystemException(errno);
+ body().fd(sock);
+}
+
+prefix_ void
+senf::TCPv6SocketProtocol::init_client(INet6SocketAddress const & address)
+ const
+{
+ init_client();
+ connect(address);
+}
+
+prefix_ void senf::TCPv6SocketProtocol::init_server()
+ const
+{
+ int sock = ::socket(PF_INET6,SOCK_STREAM,0);
+ if (sock < 0)
+ throw SystemException(errno);
+ body().fd(sock);
+}
+
+prefix_ void senf::TCPv6SocketProtocol::init_server(INet6SocketAddress const & address,
+ unsigned backlog)
+ const
+{
+ init_server();
+ bind(address);
+ reuseaddr(true);
+ if (::listen(body().fd(),backlog) < 0)
+ throw SystemException(errno);
+}
+
+prefix_ std::auto_ptr<senf::SocketProtocol> senf::TCPv6SocketProtocol::clone()
+ const
+{
+ return std::auto_ptr<SocketProtocol>(new TCPv6SocketProtocol());
+}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "TCPSocketHandle.mpp"
\f
// Local Variables:
// mode: c++
+// fill-column: 100
// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
// End: