// $Id$
//
// Copyright (C) 2006
-// Fraunhofer Institute for Open Communication Systems (FOKUS)
-// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
#include "SocketHandle.ih"
// Custom includes
+#include "../Utils/senfassert.hh"
#include "../Utils/Exception.hh"
#include "SocketProtocol.hh"
#define prefix_ inline
///////////////////////////////cci.p///////////////////////////////////////
-prefix_ senf::SocketBody::SocketBody(std::auto_ptr<SocketProtocol> protocol,
- bool isServer)
- : protocol_(protocol), isServer_(isServer)
+prefix_ senf::SocketBody::SocketBody(bool isServer)
+ : isServer_(isServer)
+{}
+
+prefix_ senf::SocketBody::SocketBody(bool isServer, int fd)
+ : FileBody(fd), isServer_(isServer)
+{}
+
+prefix_ senf::SocketProtocol & senf::SocketBody::protocol()
+ const
{
- BOOST_ASSERT( ! protocol_->body_ );
- protocol_->body_ = this;
+ return const_cast<SocketProtocol &>(v_protocol());
}
-prefix_ senf::SocketBody::SocketBody(std::auto_ptr<SocketProtocol> protocol,
- bool isServer, int fd)
- : FileBody(fd), protocol_(protocol), isServer_(isServer)
+prefix_ bool senf::SocketBody::isServer()
{
- BOOST_ASSERT( ! protocol_->body_ );
- protocol_->body_ = this;
+ return isServer_;
}
-prefix_ senf::SocketProtocol const & senf::SocketBody::protocol()
+prefix_ std::auto_ptr<senf::SocketBody> senf::SocketBody::clone(bool isServer)
const
{
- return *protocol_;
+ return protocol().clone(isServer);
}
-prefix_ bool senf::SocketBody::isServer()
+prefix_ std::auto_ptr<senf::SocketBody> senf::SocketBody::clone(int fd, bool isServer)
+ const
{
- return isServer_;
+ return protocol().clone(fd, isServer);
}
///////////////////////////////////////////////////////////////////////////