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
  • File List
  • File Members

UDPServer.hh

Go to the documentation of this file.
00001 // $Id: UDPServer.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2009
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 
00026 #ifndef HH_SENF_Utils_Console_UDPServer_
00027 #define HH_SENF_Utils_Console_UDPServer_ 1
00028 
00029 // Custom includes
00030 #include <boost/utility.hpp>
00031 #include <senf/Socket/Protocols/INet/UDPSocketHandle.hh>
00032 #include <senf/Utils/Logger/SenfLog.hh>
00033 #include <senf/Scheduler/FdEvent.hh>
00034 #include "Parse.hh"
00035 #include "Executor.hh"
00036 
00037 //#include "UDPServer.mpp"
00038 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00039 
00040 namespace senf {
00041 namespace console {
00042 
00057     class UDPServer
00058         : public boost::noncopyable
00059     {
00060         SENF_LOG_CLASS_AREA();
00061         SENF_LOG_DEFAULT_LEVEL(senf::log::NOTICE);
00062     public:
00063         //-////////////////////////////////////////////////////////////////////////
00064         // Types
00065 
00066         typedef senf::ClientSocketHandle<
00067             senf::MakeSocketPolicy<senf::UDPv4SocketProtocol::Policy,
00068                                    senf::BSDAddressingPolicy>::policy > Handle;
00069 
00070         //-////////////////////////////////////////////////////////////////////////
00072         //\{
00073 
00074         explicit UDPServer(senf::INet4SocketAddress const & address);
00076         explicit UDPServer(senf::INet6SocketAddress const & address);
00078 
00079         //\}
00080         //-////////////////////////////////////////////////////////////////////////
00081 
00082         UDPServer & replies(bool enable); 
00083 
00084         UDPServer & replies(senf::INet4SocketAddress const & address);
00086 
00087         UDPServer & replies(senf::INet6SocketAddress const & address);
00089 
00091         UDPServer & emptyReplies(bool enable); 
00092 
00094         DirectoryNode & root() const;   
00095 
00096         UDPServer & root(DirectoryNode & root); 
00097 
00100     protected:
00101 
00102     private:
00103         void handleInput(int events);
00104 
00105         bool replies_;
00106         bool emptyReplies_;
00107         senf::GenericBSDSocketAddress target_;
00108 
00109         Handle handle_;
00110         senf::scheduler::FdEvent readevent_;
00111         CommandParser parser_;
00112         Executor executor_;
00113     };
00114 
00115 
00116 }}
00117 
00118 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00119 //#include "UDPServer.cci"
00120 //#include "UDPServer.ct"
00121 //#include "UDPServer.cti"
00122 #endif
00123 
00124 
00125 // Local Variables:
00126 // mode: c++
00127 // fill-column: 100
00128 // comment-column: 40
00129 // c-file-style: "senf"
00130 // indent-tabs-mode: nil
00131 // ispell-local-dictionary: "american"
00132 // compile-command: "scons -u test"
00133 // End:

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