LCOV - code coverage report
Current view: top level - eventdispatcher - udp_server_message_connection.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2022-06-18 10:10:36 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2012-2022  Made to Order Software Corp.  All Rights Reserved
       2             : //
       3             : // https://snapwebsites.org/project/eventdispatcher
       4             : // contact@m2osw.com
       5             : //
       6             : // This program is free software; you can redistribute it and/or modify
       7             : // it under the terms of the GNU General Public License as published by
       8             : // the Free Software Foundation; either version 2 of the License, or
       9             : // (at your option) any later version.
      10             : //
      11             : // This program is distributed in the hope that it will be useful,
      12             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             : // GNU General Public License for more details.
      15             : //
      16             : // You should have received a copy of the GNU General Public License along
      17             : // with this program; if not, write to the Free Software Foundation, Inc.,
      18             : // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
      19             : #pragma once
      20             : 
      21             : /** \file
      22             :  * \brief Listen for UDP messages.
      23             :  *
      24             :  * This class is used to create an object ready to listen for incoming
      25             :  * messages. It also supports a way to send messages either through the
      26             :  * send() function or setting the client/server flag to true and have
      27             :  * a client and a server within this class.
      28             :  */
      29             : 
      30             : // self
      31             : //
      32             : #include    "eventdispatcher/udp_client.h"
      33             : #include    "eventdispatcher/udp_server_connection.h"
      34             : #include    "eventdispatcher/dispatcher_support.h"
      35             : 
      36             : 
      37             : 
      38             : namespace ed
      39             : {
      40             : 
      41             : 
      42             : 
      43           0 : class udp_server_message_connection
      44             :     : public udp_server_connection
      45             :     , public dispatcher_support
      46             : {
      47             : public:
      48             :     typedef std::shared_ptr<udp_server_message_connection>    pointer_t;
      49             : 
      50             :     static size_t const         DATAGRAM_MAX_SIZE = 1024;
      51             : 
      52             :                                 udp_server_message_connection(
      53             :                                           addr::addr const & server_address
      54             :                                         , addr::addr const & client_address = addr::addr());
      55             : 
      56             :     bool                        send_message(
      57             :                                           message const & msg
      58             :                                         , std::string const & secret_code = std::string());
      59             : 
      60             :     static bool                 send_message(
      61             :                                           addr::addr const & client_address
      62             :                                         , message const & msg
      63             :                                         , std::string const & secret_code = std::string());
      64             : 
      65             :     static bool                 send_message(
      66             :                                           udp_client & client
      67             :                                         , message const & msg
      68             :                                         , std::string const & secret_code = std::string());
      69             : 
      70             :     // connection implementation
      71             :     virtual void                process_read() override;
      72             : 
      73             : private:
      74             :     udp_client::pointer_t       f_udp_client = udp_client::pointer_t();
      75             : };
      76             : 
      77             : 
      78             : 
      79             : } // namespace ed
      80             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.13