LCOV - code coverage report
Current view: top level - libdbproxy - proxy.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2019-12-15 17:13:15 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Header:
       3             :  *      libsnapwebsites/src/libdbproxy/proxy.h
       4             :  *
       5             :  * Description:
       6             :  *      Handling of a data between libQtCassandra and our snapdbproxy
       7             :  *      daemon which is used to send CQL to Cassandra and receive the
       8             :  *      results.
       9             :  *
      10             :  * Documentation:
      11             :  *      See the corresponding .cpp file.
      12             :  *
      13             :  * License:
      14             :  *      Copyright (c) 2011-2019  Made to Order Software Corp.  All Rights Reserved
      15             :  * 
      16             :  *      https://snapwebsites.org/
      17             :  *      contact@m2osw.com
      18             :  * 
      19             :  *      Permission is hereby granted, free of charge, to any person obtaining a
      20             :  *      copy of this software and associated documentation files (the
      21             :  *      "Software"), to deal in the Software without restriction, including
      22             :  *      without limitation the rights to use, copy, modify, merge, publish,
      23             :  *      distribute, sublicense, and/or sell copies of the Software, and to
      24             :  *      permit persons to whom the Software is furnished to do so, subject to
      25             :  *      the following conditions:
      26             :  *
      27             :  *      The above copyright notice and this permission notice shall be included
      28             :  *      in all copies or substantial portions of the Software.
      29             :  *
      30             :  *      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      31             :  *      OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
      32             :  *      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
      33             :  *      IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
      34             :  *      CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
      35             :  *      TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
      36             :  *      SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
      37             :  */
      38             : #pragma once
      39             : 
      40             : // ourselves
      41             : //
      42             : #include "libdbproxy/order.h"
      43             : #include "libdbproxy/order_result.h"
      44             : 
      45             : // our lib
      46             : //
      47             : #include "libdbproxy/consistency_level.h"
      48             : 
      49             : //#include <QString>
      50             : //#include <QByteArray>
      51             : //#include <stdint.h>
      52             : 
      53             : // C++ lib
      54             : //
      55             : #include <memory>
      56             : 
      57             : // OS lib
      58             : //
      59             : #include <openssl/bio.h>
      60             : 
      61             : 
      62             : 
      63             : namespace libdbproxy
      64             : {
      65             : 
      66             : class proxy_io
      67             : {
      68             : public:
      69             :     virtual                 ~proxy_io() {}
      70             : 
      71             :     virtual ssize_t         read(void * buf, size_t count) = 0;
      72             :     virtual ssize_t         write(void const * buf, size_t count) = 0;
      73             : };
      74             : 
      75             : 
      76           0 : class proxy
      77             : {
      78             : public:
      79             :     typedef std::shared_ptr<proxy>    pointer_t;
      80             : 
      81             :                             proxy();  // server
      82             :                             proxy(QString const & host, int port);  // client
      83             : 
      84             :     order_result            sendOrder(order const & order);
      85             :     order                   receiveOrder(proxy_io & reader);
      86             :     bool                    sendResult(proxy_io & reader, order_result const & result);
      87             : 
      88             :     bool                    isConnected() const;
      89             : 
      90             : private:
      91             :     void                    bio_get();
      92             :     void                    bio_reset();
      93             :     int                     bio_read(void * buf, size_t size);
      94             :     int                     bio_write(void const * buf, size_t size);
      95             : 
      96             :     std::shared_ptr<BIO>    f_bio = std::shared_ptr<BIO>();
      97             : 
      98             :     QString const           f_host = QString();
      99             :     int const               f_port = 0;
     100             : };
     101             : 
     102             : 
     103             : } // namespace libdbproxy
     104             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.13