This file is indexed.

/usr/include/gloox/socks5bytestreamserver.h is in libgloox-dev 1.0.11-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
  Copyright (c) 2007-2014 by Jakob Schroeter <js@camaya.net>
  This file is part of the gloox library. http://camaya.net/gloox

  This software is distributed under a license. The full license
  agreement can be found in the file LICENSE in this distribution.
  This software may not be copied, modified, sold or distributed
  other than expressed in the named license agreement.

  This software is distributed without any warranty.
*/


#ifndef SOCKS5BYTESTREAMSERVER_H__
#define SOCKS5BYTESTREAMSERVER_H__

#include "macros.h"
#include "connectionhandler.h"
#include "connectiontcpserver.h"
#include "logsink.h"
#include "mutex.h"

namespace gloox
{

  /**
   * @brief A server listening for SOCKS5 bytestreams.
   *
   * @note You can use a single SOCKS5BytestreamServer instance with multiple Client objects.
   *
   * @note It is safe to put a SOCKS5BytestreamServer instance into a separate thread.
   *
   * @author Jakob Schroeter <js@camaya.net>
   * @since 0.9
   */
  class GLOOX_API SOCKS5BytestreamServer : public ConnectionHandler, public ConnectionDataHandler
  {

    friend class SOCKS5BytestreamManager;

    public:
      /**
       * Constructs a new SOCKS5BytestreamServer.
       * @param logInstance A LogSink to use.
       * @param port The local port to listen on.
       * @param ip The local IP to bind to. If empty, the server will listen on all local interfaces.
       */
      SOCKS5BytestreamServer( const LogSink& logInstance, int port, const std::string& ip = EmptyString );

      /**
       * Destructor.
       */
      ~SOCKS5BytestreamServer();

      /**
       * Starts listening on the specified interface and port.
       * @return Returns @c ConnNoError on success, @c ConnIoError on failure (e.g. if the port
       * is already in use).
       */
      ConnectionError listen();

      /**
       * Call this function repeatedly to check for incoming connections and to negotiate
       * them.
       * @param timeout The timeout to use for select in microseconds.
       * @return The state of the listening socket.
       */
      ConnectionError recv( int timeout );

      /**
       * Stops listening and unbinds from the interface and port.
       */
      void stop();

      /**
       * Expose our TCP Connection localPort
       * Returns the local port.
       * @return The local port.
       */
      int localPort() const;

      /**
       * Expose our TCP Connection localInterface
       * Returns the locally bound IP address.
       * @return The locally bound IP address.
       */
      const std::string localInterface() const;

      /**
       * Exposes the local socket.
       * @return The local socket.
       */
      int serverSocket() const { return m_tcpServer->socket(); }

      // reimplemented from ConnectionHandler
      virtual void handleIncomingConnection( ConnectionBase* server, ConnectionBase* connection );

      // reimplemented from ConnectionDataHandler
      virtual void handleReceivedData( const ConnectionBase* connection, const std::string& data );

      // reimplemented from ConnectionDataHandler
      virtual void handleConnect( const ConnectionBase* connection );

      // reimplemented from ConnectionDataHandler
      virtual void handleDisconnect( const ConnectionBase* connection, ConnectionError reason );

    private:
      SOCKS5BytestreamServer& operator=( const SOCKS5BytestreamServer& );
      void registerHash( const std::string& hash );
      void removeHash( const std::string& hash );
      ConnectionBase* getConnection( const std::string& hash );

      enum NegotiationState
      {
        StateDisconnected,
        StateUnnegotiated,
        StateAuthmethodAccepted,
        StateAuthAccepted,
        StateDestinationAccepted,
        StateActive
      };

      struct ConnectionInfo
      {
        NegotiationState state;
        std::string hash;
      };

      typedef std::map<ConnectionBase*, ConnectionInfo> ConnectionMap;
      ConnectionMap m_connections;

      typedef std::list<const ConnectionBase*> ConnectionList;
      ConnectionList m_oldConnections;

      typedef std::list<std::string> HashMap;
      HashMap m_hashes;

      ConnectionTCPServer* m_tcpServer;

      util::Mutex m_mutex;
      const LogSink& m_logInstance;
      std::string m_ip;
      int m_port;

  };

}

#endif // SOCKS5BYTESTREAMSERVER_H__