This file is indexed.

/usr/include/libktorrent/interfaces/serverinterface.h is in libktorrent-dev 1.3.1-5.

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
/***************************************************************************
 *   Copyright (C) 2009 by Joris Guisson                                   *
 *   joris.guisson@gmail.com                                               *
 *                                                                         *
 *   This program 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.                                   *
 *                                                                         *
 *   This program 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 this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
 ***************************************************************************/

#ifndef BT_SERVERINTERFACE_H
#define BT_SERVERINTERFACE_H

#include <QObject>
#include <QStringList>
#include <ktorrent_export.h>
#include <util/constants.h>
#include <mse/encryptedpacketsocket.h>


namespace bt
{
	class SHA1Hash;
	class PeerManager;
	
	/**
		Base class for all servers which accept connections.
	*/
	class KTORRENT_EXPORT ServerInterface : public QObject
	{
		Q_OBJECT
	public:
		ServerInterface(QObject* parent = 0);
		virtual ~ServerInterface();
		
		
		/**
		* Change the port.
		* @param port The new port
		*/
		virtual bool changePort(Uint16 port) = 0;
		
		/// Set the port to use
		static void setPort(Uint16 p) {port = p;}
		
		/// Get the port in use
		static Uint16 getPort() {return port;}
		
		/**
		 * Add a PeerManager.
		 * @param pman The PeerManager
		 */
		static void addPeerManager(PeerManager* pman);
		
		/**
		* Remove a PeerManager.
		* @param pman The PeerManager
		*/
		static void removePeerManager(PeerManager* pman);
		
		/**
		* Find the PeerManager given the info_hash of it's torrent.
		* @param hash The info_hash
		* @return The PeerManager or 0 if one can't be found
		*/
		static PeerManager* findPeerManager(const SHA1Hash & hash);
		
		/**
		* Find the info_hash based on the skey hash. The skey hash is a hash
		* of 'req2' followed by the info_hash. This function finds the info_hash
		* which matches the skey hash.
		* @param skey HASH('req2',info_hash)
		* @param info_hash which matches
		* @return true If one was found
		*/
		static bool findInfoHash(const SHA1Hash & skey,SHA1Hash & info_hash);
		
		/**
		* Enable encryption. 
		* @param allow_unencrypted Allow unencrypted connections (if encryption fails)
		*/
		static void enableEncryption(bool allow_unencrypted);
		
		/**
		* Disable encrypted authentication.
		*/
		static void disableEncryption();
		
		static bool isEncryptionEnabled() {return encryption;}
		static bool unencryptedConnectionsAllowed() {return allow_unencrypted;}
		
		/**
			Get a list of potential IP addresses to bind to
		*/
		static QStringList bindAddresses();
		
		static void setUtpEnabled(bool on,bool only_use_utp);
		static bool isUtpEnabled() {return utp_enabled;}
		static bool onlyUseUtp() {return only_use_utp;}
		static void setPrimaryTransportProtocol(TransportProtocol proto);
		static TransportProtocol primaryTransportProtocol() {return primary_transport_protocol;}
		
	protected:
		void newConnection(mse::EncryptedPacketSocket::Ptr sock);
		
	protected:
		static Uint16 port;
		static QList<PeerManager*> peer_managers;
		static bool encryption;
		static bool allow_unencrypted;
		static bool utp_enabled;
		static bool only_use_utp;
		static TransportProtocol primary_transport_protocol;
	};

}

#endif // BT_SERVERINTERFACE_H