This file is indexed.

/usr/include/licq/proxy.h is in licq-dev 1.8.1-2build1.

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
/*
 * This file is part of Licq, an instant messaging client for UNIX.
 * Copyright (C) 2010-2011 Licq developers
 *
 * Licq is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Licq is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Licq; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef LICQ_PROXY_H
#define LICQ_PROXY_H

#include <string>
#include <sys/socket.h>


namespace Licq
{

class Proxy
{
public:
  Proxy();
  virtual ~Proxy();

  int error() const;
  std::string errorStr() const;

  const struct sockaddr* proxyAddr() const { return &myProxyAddr; };
  void setProxyAddr(const std::string& proxyName, int proxyPort);
  void setProxyAuth(const std::string& proxyLogin, const std::string& proxyPasswd);

  virtual bool initProxy() = 0;

  /**
   * Open a connection through proxy
   *
   * @param remoteName Name of host to connect to
   * @param remotePort Port to connect to
   * @return Socket connected to remote host through proxy or -1 on failure
   */
  int openConnection(const std::string& remoteName, int remotePort);

protected:
  /**
   * Internal call to sub class when connecting
   *
   * @param sock A socket connected to the proxy
   * @param remoteName Name of host to connect to
   * @param remotePort Port to connect to
   * @return Socket connected through proxy or -1 on failure (with sock closed)
   */
  virtual int openProxyConnection(int sock, const std::string& remoteName, int remotePort) = 0;

  // sockaddr is too small to hold a sockaddr_in6 so use union to allocate the extra space
  union
  {
    struct sockaddr myProxyAddr;
    struct sockaddr_storage myProxyAddrStorage;
  };

  enum ErrorType
  {
    ErrorNone           = 0,
    ErrorErrno          = 1,
    ErrorInternal       = 2,
  };

  ErrorType myErrorType;
  std::string myProxyName;
  int myProxyPort;
  std::string myProxyLogin;
  std::string myProxyPasswd;
};


class HttpProxy : public Proxy
{
public:
  HttpProxy();
  virtual ~HttpProxy();

  bool initProxy();

protected:
  int openProxyConnection(int sock, const std::string& remoteName, int remotePort);
};

} // namespace Licq

#endif