LCOV - code coverage report
Current view: top level - home/h/core/forks/m4-libzmq/src - socks.hpp (source / functions) Hit Total Coverage
Test: zeromq-4.2.0 Code Coverage Lines: 0 2 0.0 %
Date: 2016-05-09 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :     Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
       3             : 
       4             :     This file is part of libzmq, the ZeroMQ core engine in C++.
       5             : 
       6             :     libzmq is free software; you can redistribute it and/or modify it under
       7             :     the terms of the GNU Lesser General Public License (LGPL) as published
       8             :     by the Free Software Foundation; either version 3 of the License, or
       9             :     (at your option) any later version.
      10             : 
      11             :     As a special exception, the Contributors give you permission to link
      12             :     this library with independent modules to produce an executable,
      13             :     regardless of the license terms of these independent modules, and to
      14             :     copy and distribute the resulting executable under terms of your choice,
      15             :     provided that you also meet, for each linked independent module, the
      16             :     terms and conditions of the license of that module. An independent
      17             :     module is a module which is not derived from or based on this library.
      18             :     If you modify this library, you must extend this exception to your
      19             :     version of the library.
      20             : 
      21             :     libzmq is distributed in the hope that it will be useful, but WITHOUT
      22             :     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      23             :     FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
      24             :     License for more details.
      25             : 
      26             :     You should have received a copy of the GNU Lesser General Public License
      27             :     along with this program.  If not, see <http://www.gnu.org/licenses/>.
      28             : */
      29             : 
      30             : #ifndef __ZMQ_SOCKS_HPP_INCLUDED__
      31             : #define __ZMQ_SOCKS_HPP_INCLUDED__
      32             : 
      33             : #include <string>
      34             : #include "fd.hpp"
      35             : #include "stdint.hpp"
      36             : 
      37             : namespace zmq
      38             : {
      39             : 
      40             :     struct socks_greeting_t
      41             :     {
      42             :         socks_greeting_t (uint8_t method);
      43             :         socks_greeting_t (uint8_t *methods_, uint8_t num_methods_);
      44             : 
      45             :         uint8_t methods [UINT8_MAX];
      46             :         const size_t num_methods;
      47             :     };
      48             : 
      49             :     class socks_greeting_encoder_t
      50             :     {
      51             :         public:
      52             :             socks_greeting_encoder_t ();
      53             :             void encode (const socks_greeting_t &greeting_);
      54             :             int output (fd_t fd_);
      55             :             bool has_pending_data () const;
      56             :             void reset ();
      57             : 
      58             :         private:
      59             :             size_t bytes_encoded;
      60             :             size_t bytes_written;
      61             :             uint8_t buf [2 + UINT8_MAX];
      62             :     };
      63             : 
      64             :     struct socks_choice_t
      65             :     {
      66             :         socks_choice_t (uint8_t method_);
      67             : 
      68             :         uint8_t method;
      69             :     };
      70             : 
      71             :     class socks_choice_decoder_t
      72             :     {
      73             :         public:
      74             :             socks_choice_decoder_t ();
      75             :             int input (fd_t fd_);
      76             :             bool message_ready () const;
      77             :             socks_choice_t decode ();
      78             :             void reset ();
      79             : 
      80             :         private:
      81             :             unsigned char buf [2];
      82             :             size_t bytes_read;
      83             :     };
      84             : 
      85           0 :     struct socks_request_t
      86             :     {
      87             :         socks_request_t (
      88             :             uint8_t command_, std::string hostname_, uint16_t port_);
      89             : 
      90             :         const uint8_t command;
      91             :         const std::string hostname;
      92             :         const uint16_t port;
      93             :     };
      94             : 
      95             :     class socks_request_encoder_t
      96             :     {
      97             :         public:
      98             :             socks_request_encoder_t ();
      99             :             void encode (const socks_request_t &req);
     100             :             int output (fd_t fd_);
     101             :             bool has_pending_data () const;
     102             :             void reset ();
     103             : 
     104             :         private:
     105             :             size_t bytes_encoded;
     106             :             size_t bytes_written;
     107             :             uint8_t buf [4 + UINT8_MAX + 1 + 2];
     108             :     };
     109             : 
     110           0 :     struct socks_response_t
     111             :     {
     112             :         socks_response_t (
     113             :             uint8_t response_code_, std::string address_, uint16_t port_);
     114             :         uint8_t response_code;
     115             :         std::string address;
     116             :         uint16_t port;
     117             :     };
     118             : 
     119             :     class socks_response_decoder_t
     120             :     {
     121             :         public:
     122             :             socks_response_decoder_t ();
     123             :             int input (fd_t fd_);
     124             :             bool message_ready () const;
     125             :             socks_response_t decode ();
     126             :             void reset ();
     127             : 
     128             :         private:
     129             :             int8_t buf [4 + UINT8_MAX + 1 + 2];
     130             :             size_t bytes_read;
     131             :     };
     132             : 
     133             : }
     134             : 
     135             : #endif

Generated by: LCOV version 1.10