// $Id$ // // Copyright (C) 2006 // Fraunhofer Institute for Open Communication Systems (FOKUS) // // The contents of this file are subject to the Fraunhofer FOKUS Public License // Version 1.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // http://senf.berlios.de/license.html // // The Fraunhofer FOKUS Public License Version 1.0 is based on, // but modifies the Mozilla Public License Version 1.1. // See the full license text for the amendments. // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License // for the specific language governing rights and limitations under the License. // // The Original Code is Fraunhofer FOKUS code. // // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. // (registered association), Hansastraße 27 c, 80686 Munich, Germany. // All Rights Reserved. // // Contributor(s): // Stefan Bund /** \file \brief ServerSocketHandle inline template implementation */ // Definition of inline template functions //#include "ServerSocketHandle.ih" // Custom includes #include #define prefix_ inline //-///////////////////////////////////////////////////////////////////////////////////////////////// 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); } //-///////////////////////////////////////////////////////////////////////////////////////////////// #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: