// $Id$ // // Copyright (C) 2006 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file \brief ServerSocketHandle inline template implementation */ // Definition of inline template functions //#include "ServerSocketHandle.ih" // Custom includes #include #define prefix_ inline ///////////////////////////////cti.p/////////////////////////////////////// template prefix_ senf::ServerSocketHandle::ServerSocketHandle() {} template template prefix_ senf::ServerSocketHandle:: ServerSocketHandle(ServerSocketHandle other, typename SocketHandle::template IsCompatible::type *) : SocketHandle(other,true) {} template prefix_ senf::ServerSocketHandle:: ServerSocketHandle(std::auto_ptr body) : SocketHandle(body) {} template template prefix_ typename senf::SocketHandle::template IsCompatible::type const & senf::ServerSocketHandle::operator=(ServerSocketHandle other) { assign(other); return *this; } /////////////////////////////////////////////////////////////////////////// // Server socket interface template prefix_ void senf::ServerSocketHandle::bind(AddressParam addr) { SPolicy::AddressingPolicy::bind(*this,addr); } template prefix_ void senf::ServerSocketHandle::listen(unsigned backlog) { SPolicy::CommunicationPolicy::listen(*this,backlog); } template prefix_ typename senf::ServerSocketHandle::Address senf::ServerSocketHandle::local() { typename SPolicy::AddressingPolicy::Address addr; this->local(addr); return addr; } template prefix_ void senf::ServerSocketHandle::local(Address & addr) { SPolicy::AddressingPolicy::local(*this,addr); } template prefix_ typename senf::ServerSocketHandle::ClientHandle senf::ServerSocketHandle::accept() { return ClientHandle(this->body().clone( SPolicy::CommunicationPolicy::accept(*this), false)); } template prefix_ std::pair::ClientHandle, typename senf::ServerSocketHandle::Address> senf::ServerSocketHandle::acceptfrom() { Address address; ClientHandle handle = acceptfrom(address); return std::make_pair(handle,address); } template prefix_ typename senf::ServerSocketHandle::ClientHandle senf::ServerSocketHandle::acceptfrom(Address & addr) { return ClientHandle(this->body().clone( SPolicy::CommunicationPolicy::accept(*this,addr), false)); } /////////////////////////////////////////////////////////////////////////// template prefix_ senf::ServerSocketHandle::ServerSocketHandle(FileHandle other, bool isChecked) : SocketHandle(other, isChecked) {} template prefix_ senf::ServerSocketHandle senf::ServerSocketHandle::cast_static(FileHandle handle) { return ServerSocketHandle(handle,true); } template prefix_ senf::ServerSocketHandle senf::ServerSocketHandle::cast_dynamic(FileHandle handle) { SocketHandle h (SocketHandle::cast_dynamic(handle)); if (! static_cast(FileHandle::body(handle)).isServer()) throw std::bad_cast(); return cast_static(handle); } template prefix_ void senf::ServerSocketHandle::state(SocketStateMap & map, unsigned lod) { map["handle"] = prettyName(typeid(*this)); if (this->valid()) { map["valid"] << "true"; this->body().state(map,lod); } else map["valid"] << "false"; } template prefix_ std::string senf::ServerSocketHandle::dumpState(unsigned lod) { SocketStateMap map; state(map,lod); return detail::dumpState(map); } ///////////////////////////////cti.e/////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" // comment-column: 40 // End: