LCOV - code coverage report
Current view: top level - eventdispatcher - tcp_bio_options.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2019-08-08 02:52:36 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // TCP Client & Server -- classes to ease handling sockets
       2             : // Copyright (c) 2012-2019  Made to Order Software Corp.  All Rights Reserved
       3             : //
       4             : // This program is free software; you can redistribute it and/or modify
       5             : // it under the terms of the GNU General Public License as published by
       6             : // the Free Software Foundation; either version 2 of the License, or
       7             : // (at your option) any later version.
       8             : //
       9             : // This program is distributed in the hope that it will be useful,
      10             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             : // GNU General Public License for more details.
      13             : //
      14             : // You should have received a copy of the GNU General Public License
      15             : // along with this program; if not, write to the Free Software
      16             : // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
      17             : #pragma once
      18             : 
      19             : // make sure we use OpenSSL with multi-thread support
      20             : // (TODO: move to .cpp once we have the SSL flags worked on!)
      21             : #define OPENSSL_THREAD_DEFINES
      22             : 
      23             : 
      24             : // C++ lib
      25             : //
      26             : #include <string>
      27             : 
      28             : 
      29             : // OpenSSL lib
      30             : //
      31             : // TODO: create our own set of flags
      32             : #include <openssl/ssl.h>
      33             : 
      34             : 
      35             : 
      36             : namespace ed
      37             : {
      38             : 
      39             : 
      40             : 
      41           0 : class tcp_bio_options
      42             : {
      43             : public:
      44             :     typedef std::uint32_t       ssl_options_t;
      45             :     typedef size_t              verification_depth_t;
      46             : 
      47             :     static constexpr verification_depth_t   MAX_VERIFICATION_DEPTH = 100;
      48             :     static constexpr ssl_options_t          DEFAULT_SSL_OPTIONS = SSL_OP_NO_SSLv2
      49             :                                                                 | SSL_OP_NO_SSLv3
      50             :                                                                 | SSL_OP_NO_TLSv1
      51             :                                                                 | SSL_OP_NO_COMPRESSION;
      52             : 
      53             :                                 tcp_bio_options();
      54             : 
      55             :     void                        set_verification_depth(verification_depth_t depth);
      56             :     verification_depth_t        get_verification_depth() const;
      57             : 
      58             :     void                        set_ssl_options(ssl_options_t ssl_options);
      59             :     ssl_options_t               get_ssl_options() const;
      60             : 
      61             :     void                        set_ssl_certificate_path(std::string const path);
      62             :     std::string const &         get_ssl_certificate_path() const;
      63             :     void                        set_keepalive(bool keepalive = true);
      64             :     bool                        get_keepalive() const;
      65             : 
      66             :     void                        set_sni(bool sni = true);
      67             :     bool                        get_sni() const;
      68             : 
      69             :     void                        set_host(std::string const & host);
      70             :     std::string const &         get_host() const;
      71             : 
      72             : private:
      73             :     verification_depth_t        f_verification_depth = 4;
      74             :     ssl_options_t               f_ssl_options = DEFAULT_SSL_OPTIONS;
      75             :     std::string                 f_ssl_certificate_path = std::string("/etc/ssl/certs");
      76             :     bool                        f_keepalive = true;
      77             :     bool                        f_sni = true;
      78             :     std::string                 f_host = std::string();
      79             : };
      80             : 
      81             : 
      82             : 
      83             : } // namespace ed
      84             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.12