UDPServer.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_Console_UDPServer_
18 #define HH_SENF_Utils_Console_UDPServer_ 1
19 
20 // Custom includes
21 #include <boost/noncopyable.hpp>
25 #include "Parse.hh"
26 #include "Executor.hh"
27 
28 //#include "UDPServer.mpp"
29 //-/////////////////////////////////////////////////////////////////////////////////////////////////
30 
31 namespace senf {
32 namespace console {
33 
48  class UDPServer
49  : public boost::noncopyable
50  {
52  SENF_LOG_DEFAULT_LEVEL(senf::log::NOTICE);
53  public:
54  //-////////////////////////////////////////////////////////////////////////
55  // Types
56 
60 
61  //-////////////////////////////////////////////////////////////////////////
63  //\{
64 
65  explicit UDPServer(senf::INet4SocketAddress const & address);
67  explicit UDPServer(senf::INet6SocketAddress const & address);
69 
70  //\}
71  //-////////////////////////////////////////////////////////////////////////
72 
73  UDPServer & replies(bool enable);
74 
75  UDPServer & replies(senf::INet4SocketAddress const & address);
77 
78  UDPServer & replies(senf::INet6SocketAddress const & address);
80 
82  UDPServer & emptyReplies(bool enable);
83 
85  DirectoryNode & root() const;
86 
88 
91  protected:
92 
93  private:
94  void handleInput(int events);
95 
96  bool replies_;
97  bool emptyReplies_;
99 
100  Handle handle_;
101  senf::scheduler::FdEvent readevent_;
102  CommandParser parser_;
103  Executor executor_;
104  };
105 
106 
107 }}
108 
109 //-/////////////////////////////////////////////////////////////////////////////////////////////////
110 //#include "UDPServer.cci"
111 //#include "UDPServer.ct"
112 //#include "UDPServer.cti"
113 #endif
114 
115 
116 // Local Variables:
117 // mode: c++
118 // fill-column: 100
119 // comment-column: 40
120 // c-file-style: "senf"
121 // indent-tabs-mode: nil
122 // ispell-local-dictionary: "american"
123 // compile-command: "scons -u test"
124 // End:
UDPServer & replies(bool enable)
Enable or disable reply packets.
Definition: UDPServer.cc:55
Parse commands.
Definition: Parse.hh:602
#define SENF_LOG_CLASS_AREA()
Config/console tree directory node.
Definition: Node.hh:406
senf::ClientSocketHandle< senf::MakeSocketPolicy< senf::UDPv4SocketProtocol::Policy, senf::BSDAddressingPolicy >::policy > Handle
Definition: UDPServer.hh:59
UDPServer(senf::INet4SocketAddress const &address)
Open UDP server on address.
Definition: UDPServer.cc:28
DirectoryNode & root() const
Get root node.
Definition: UDPServer.cc:85
Definition: Config.hh:28
Execute config/console commands.
Definition: Executor.hh:48
UDPServer & emptyReplies(bool enable)
Enable or disable empty reply packets.
Definition: UDPServer.cc:79
Parse public header.
Executor public header.
UDP Console server.
Definition: UDPServer.hh:48