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

SocketPolicy.hh

Go to the documentation of this file.
00001 // $Id:SocketPolicy.hh 218 2007-03-20 14:39:32Z tho $
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 
00231 #ifndef HH_SENF_Socket_SocketPolicy_
00232 #define HH_SENF_Socket_SocketPolicy_ 1
00233 
00234 // Custom includes
00235 
00236 //#include "SocketPolicy.mpp"
00237 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00238 
00239 namespace senf {
00240 
00242     //\{
00243 
00244     // This may be adapted to change the supported policies (however, ClientSocketHandle and
00245     // ServerSocketHandle will probably have to be adjusted accordingly)
00246 
00257 #   define SENF_SOCKET_POLICIES                 \
00258         (AddressingPolicy)                      \
00259         (FramingPolicy)                         \
00260         (CommunicationPolicy)                   \
00261         (ReadPolicy)                            \
00262         (WritePolicy)
00263 
00264     // Wer define these classes explicitly (and not with some macro
00265     // magic) because
00266     // a) AddressingPolicyBase is different from all the others
00267     // b) We want to document each one explicitly
00268 
00284     struct AddressingPolicyBase
00285     {
00286         virtual ~AddressingPolicyBase();
00287 
00288         class Address { Address(); };
00289     };
00290 
00301     struct FramingPolicyBase
00302     {
00303         virtual ~FramingPolicyBase();
00304     };
00305 
00326     struct CommunicationPolicyBase
00327     {
00328         virtual ~CommunicationPolicyBase();
00329     };
00330 
00349     struct ReadPolicyBase
00350     {
00351         virtual ~ReadPolicyBase();
00352     };
00353 
00372     struct WritePolicyBase
00373     {
00374         virtual ~WritePolicyBase();
00375     };
00376 
00377     // The implementation file will for each Policy declared above
00378     // define the following (SomePolicy is one of the above):
00379     //
00380     // struct SomePolicyBase;
00381     // typedef UndefinedSomePolicy;
00382     // template SomePolicyIs< SocketPolicy, Axis >
00383     // template IfSomePolicyIs< SocketPolicy, Axis >
00384     // template IfSomePolicyIsNot< SocketPolicy, Axis >
00385     //
00386     // Additionally the following are defined:
00387     //
00388     // class SocketPolicyBase
00389     // template SocketPolicy< ..policies.. >
00390     // template MakeSocketPolicy< ..args.. >
00391     // template SocketPolicyIsBaseOf< Base, Derived >
00392 
00393 #   ifdef DOXYGEN
00394 
00395     // The following stub definitions are only visible to doxygen
00396 
00400     typedef AddressingPolicyBase UnspecifiedAddressingPolicy;
00401 
00410     template <class SocketPolicy, class Trait>
00411     struct AddressingPolicyIs
00412     {};
00413 
00423     template <class SocketPolicy, class Trait>
00424     struct IfAddressingPolicyIs
00425     {};
00426 
00430     template <class SocketPolicy, class Trait>
00431     struct IfAddressingPolicyIsNot
00432     {};
00433 
00444     struct SocketPolicyBase
00445     {
00452         AddressingPolicyBase const & theAddressingPolicy() const = 0;
00453 
00454         virtual ~SocketPolicyBase();
00455     };
00456 
00471     template < class AddressingPolicy >
00472     struct SocketPolicy
00473     {
00489         static void checkBaseOf(SocketPolicyBase const & other);
00490     };
00491 
00501     template <class Arg1, class Arg2, class ArgN>
00502     struct MakeSocketPolicy
00503     {};
00504 
00518     template <class Base, class Derived>
00519     struct SocketPolicyIsBaseOf
00520     {};
00521 
00522 #   endif
00523 
00524     //\}
00525 }
00526 
00527 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00528 #include "SocketPolicy.ih"
00529 //#include "SocketPolicy.cci"
00530 #include "SocketPolicy.ct"
00531 //#include "SocketPolicy.cti"
00532 #endif
00533 
00534 
00535 // Local Variables:
00536 // mode: c++
00537 // fill-column: 100
00538 // c-file-style: "senf"
00539 // indent-tabs-mode: nil
00540 // ispell-local-dictionary: "american"
00541 // compile-command: "scons -u test"
00542 // comment-column: 40
00543 // End:

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