Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Directories
  • File List
  • File Members

SocketProtocol.cti

Go to the documentation of this file.
00001 // $Id: SocketProtocol.cti 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2006
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00027 //#include "SocketProtocol.ih"
00028 
00029 // Custom includes
00030 #include "SocketHandle.hh"
00031 
00032 #define prefix_ inline
00033 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00034 
00035 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00036 // senf::ConcreteSocketProtocol<SocketPolicy,Self>
00037 
00038 template <class SocketPolicy, class Self>
00039 prefix_ senf::ConcreteSocketProtocol<SocketPolicy,Self>::~ConcreteSocketProtocol()
00040 {}
00041 
00042 template <class SocketPolicy, class Self>
00043 prefix_ typename senf::ConcreteSocketProtocol<SocketPolicy,Self>::Policy const &
00044 senf::ConcreteSocketProtocol<SocketPolicy,Self>::policy()
00045     const
00046 {
00047     return policy_;
00048 }
00049 
00050 template <class SocketPolicy, class Self>
00051 prefix_ std::auto_ptr<senf::SocketBody>
00052 senf::ConcreteSocketProtocol<SocketPolicy,Self>::clone(bool isServer)
00053     const
00054 {
00055     return std::auto_ptr<SocketBody>(new ProtocolSocketBody<Self>(isServer));
00056 }
00057 
00058 template <class SocketPolicy, class Self>
00059 prefix_ std::auto_ptr<senf::SocketBody>
00060 senf::ConcreteSocketProtocol<SocketPolicy,Self>::clone(int fd, bool isServer)
00061     const
00062 {
00063     return std::auto_ptr<SocketBody>(new ProtocolSocketBody<Self>(isServer, fd));
00064 }
00065 
00066 template <class SocketPolicy, class Self>
00067 prefix_ senf::SocketBody & senf::ConcreteSocketProtocol<SocketPolicy,Self>::body()
00068     const
00069 {
00070     return const_cast< ProtocolSocketBody<Self> &>(
00071         static_cast< ProtocolSocketBody<Self> const & >(*this));
00072 }
00073 
00074 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00075 // protected members
00076 
00077 template <class SocketPolicy, class Self>
00078 prefix_ senf::ClientSocketHandle<SocketPolicy>
00079 senf::ConcreteSocketProtocol<SocketPolicy,Self>::clientHandle()
00080     const
00081 {
00082     return static_socket_cast< ClientSocketHandle<Policy> >(fh());
00083 }
00084 
00085 template <class SocketPolicy, class Self>
00086 prefix_ senf::ServerSocketHandle<SocketPolicy>
00087 senf::ConcreteSocketProtocol<SocketPolicy,Self>::serverHandle()
00088     const
00089 {
00090     return static_socket_cast< ServerSocketHandle<Policy> >(fh());
00091 }
00092 
00093 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00094 #undef prefix_
00095 
00096 
00097 // Local Variables:
00098 // mode: c++
00099 // fill-column: 100
00100 // c-file-style: "senf"
00101 // indent-tabs-mode: nil
00102 // ispell-local-dictionary: "american"
00103 // compile-command: "scons -u test"
00104 // comment-column: 40
00105 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research