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

CommunicationPolicy.hh

Go to the documentation of this file.
00001 // $Id: CommunicationPolicy.hh 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 #ifndef HH_SENF_Socket_CommunicationPolicy_
00028 #define HH_SENF_Socket_CommunicationPolicy_ 1
00029 
00030 // Custom includes
00031 #include "SocketPolicy.hh"
00032 #include "AddressingPolicy.hh"
00033 #include "FileHandle.hh"
00034 
00035 //#include "CommunicationPolicy.mpp"
00036 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00037 
00038 struct sockaddr;
00039 
00040 namespace senf {
00041 
00043     //\{
00044 
00045     template <class SPolicy> class ServerSocketHandle;
00046 
00052     struct ConnectedCommunicationPolicy : public CommunicationPolicyBase
00053     {
00054 #       ifndef DOXYGEN
00055         template <class SPolicy>
00056         static void listen(ServerSocketHandle<SPolicy> const & handle, unsigned backlog,
00057                            typename IfAddressingPolicyIsNot<SPolicy,NoAddressingPolicy>::type * = 0);
00058 #       else
00059         template <class SPolicy>
00060         static void listen(ServerSocketHandle<SPolicy> const & handle, unsigned backlog);
00062 
00064 #       endif
00065 
00066 #       ifndef DOXYGEN
00067         template <class SPolicy>
00068         static int accept(ServerSocketHandle<SPolicy> const & handle,
00069                           typename ServerSocketHandle<SPolicy>::Address & address,
00070                           typename IfAddressingPolicyIsNot<SPolicy,NoAddressingPolicy>::type * = 0);
00071 #       else
00072         template <class SPolicy>
00073         static int accept(ServerSocketHandle<SPolicy> const & handle,
00074                           typename ServerSocketHandle<SPolicy>::Address & address);
00076 
00085 #       endif
00086 
00087         static int accept(FileHandle const & handle);
00089 
00097     private:
00098         static void do_listen(FileHandle const & handle, unsigned backlog);
00099         static int do_accept(FileHandle const & handle, struct sockaddr * addr, unsigned len);
00100     };
00101 
00109     struct UnconnectedCommunicationPolicy : public CommunicationPolicyBase
00110     {};
00111 
00112     //\}
00113 
00114 }
00115 
00116 
00117 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00118 #include "CommunicationPolicy.cci"
00119 //#include "CommunicationPolicy.ct"
00120 #include "CommunicationPolicy.cti"
00121 #endif
00122 
00123 
00124 // Local Variables:
00125 // mode: c++
00126 // fill-column: 100
00127 // c-file-style: "senf"
00128 // indent-tabs-mode: nil
00129 // ispell-local-dictionary: "american"
00130 // compile-command: "scons -u test"
00131 // comment-column: 40
00132 // End:

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