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

ReadWritePolicy.cti

Go to the documentation of this file.
00001 // $Id: ReadWritePolicy.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 "ReadWritePolicy.ih"
00028 
00029 // Custom includes
00030 
00031 #define prefix_ inline
00032 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00033 
00034 #ifndef DOXYGEN
00035 template <class SPolicy>
00036 prefix_ unsigned senf::ReadablePolicy::
00037 readfrom(ClientSocketHandle<SPolicy> & handle, char * buffer, unsigned size,
00038          typename SPolicy::AddressingPolicy::Address & address,
00039          typename IfCommunicationPolicyIs<SPolicy,UnconnectedCommunicationPolicy>::type *)
00040 {
00041     return do_readfrom(handle, buffer, size, address.sockaddr_p(), address.socklen_p());
00042 }
00043 #else
00044 template <class SPolicy>
00045 prefix_ unsigned senf::ReadablePolicy::
00046 readfrom(ClientSocketHandle<SPolicy> & handle, char * buffer, unsigned size,
00047          typename Policy::AddressingPolicy::Address & address)
00048 {}
00049 #endif
00050 
00051 #ifndef DOXYGEN
00052 template <class SPolicy>
00053 prefix_ unsigned senf::WriteablePolicy::
00054 write(ClientSocketHandle<SPolicy> & handle, char const * buffer, unsigned size,
00055       typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type *)
00056 {
00057     return do_write(handle,buffer,size);
00058 }
00059 #else
00060 template <class SPolicy>
00061 prefix_ unsigned senf::WriteablePolicy::
00062 write(ClientSocketHandle<SPolicy> & handle, char const * buffer, unsigned size)
00063 {}
00064 #endif
00065 
00066 #ifndef DOXYGEN
00067 template <class SPolicy>
00068 prefix_ unsigned senf::WriteablePolicy::
00069 writeto(ClientSocketHandle<SPolicy> & handle,
00070         typename boost::call_traits<typename SPolicy::AddressingPolicy::Address>::param_type addr,
00071         char const * buffer, unsigned size,
00072         typename IfCommunicationPolicyIs<SPolicy,UnconnectedCommunicationPolicy>::type *)
00073 {
00074     return do_writeto(handle, buffer, size, addr.sockaddr_p(), addr.socklen());
00075 }
00076 #else
00077 template <class SPolicy>
00078 prefix_ unsigned senf::WriteablePolicy::
00079 writeto(ClientSocketHandle<SPolicy> & handle,
00080         typename Policy::AddressingPolicy::Address const & addr,
00081         char const * buffer, unsigned size)
00082 {}
00083 #endif
00084 
00085 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00086 #undef prefix_
00087 
00088 
00089 // Local Variables:
00090 // mode: c++
00091 // fill-column: 100
00092 // c-file-style: "senf"
00093 // indent-tabs-mode: nil
00094 // ispell-local-dictionary: "american"
00095 // compile-command: "scons -u test"
00096 // comment-column: 40
00097 // End:

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