This file is indexed.

/usr/include/dclib-0.3/dclib/core/cconnection.h is in libdc-dev 0.3.24~svn3121-2.

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
/***************************************************************************
                          cconnection.h  -  description
                             -------------------
    begin                : Sat Oct 6 2001
    copyright            : (C) 2001-2003 by Mathias Küster
    email                : mathen@users.berlios.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef CCONNECTION_H
#define CCONNECTION_H

/**
  *@author Mathias Küster
  *
  * A network connection, it extends CSocket to provide some
  * buffers and state, and also a loop to send and receive the data.
  *
  * Although it inherits CThread dclib does not start any, the
  * Thread() function is probably called by CConnectionManager for
  * hubs or CDownloadManager for peers, which in turn run on CManager's
  * thread.
  */

#include <dclib/dcos.h>
#include <dclib/core/cthread.h>
#include <dclib/core/csocket.h>
#include <dclib/core/types.h>
#include <dclib/core/clist.h>

class CByteArray;
class CMutex;

class CConnection : public CThread, public CSocket {
public:
	/** */
	CConnection();
	/** */
	virtual ~CConnection();

	/** */
	int Connect();
	/** */
	int Connect( CString ip, eSocketType sockettype = estTCP );
	/** */
	int Connect( CString ip, int port, eSocketType sockettype = estTCP );
	/** */
	virtual int Disconnect( bool force = false );
	/** */
	int SetSocket( int handle, eSocketType sockettype = estTCP );

	/** */
	virtual void DataAvailable( const char *, int ) {};
	/** */
	virtual void DataSend() {};
	/** */
	virtual void DataTimeout() {};
	/** */
	virtual void Notify() {};
	/** */
	virtual void ConnectionState( eConnectionState ) {};
	/** */
	virtual void Thread();

	/**
	  * true  if all data send from the queue and the queue is empty
	  * false if data to send in the queue
	  */
	bool IsSendQueueEmpty();

	/** */
	virtual bool ChangeSocketMode( eSocketMode mode, CString cert = CString(), CString key = CString() );
	/** */
	void SetHost( CString ip, int port = 411 );
	/** */
	CString GetHost( bool peername = false );
	/** */
	CString GetIP() const;
	/** */
	int GetPort() const;
	/** */
	eConnectionState GetConnectionState() const;

protected:
	/** */
	int Write( const unsigned char * buffer, int len, bool direct = false );

private:
	/** */
	void StateConnect();
	/** */
	void StateConnecting();
	/** */
	void StateRead();
	/** */
	void StateSend();
	/** */
	void StateDisconnect();
	/** */
	void connectionState( eConnectionState e );

	/** */
	eConnectionState m_eState;
	/** */
	time_t m_timeNotify;
	/** check for connection/data timeout */
	time_t m_timeConnection;
	/** */
	CMutex * m_pConnMutex;
	/** */
	bool m_bForceDisconnect;
	/** */
	CString m_sIP;
	/** */
	int m_nPort;
	/** */
	CMutex * m_pSendListMutex;
	/** */
	CList<CByteArray> * m_pSendList;
	/** */
	CByteArray * m_pBuffer;
	/** */
	int m_nConnectTimeout;
};

/** inline functions */

/** */
inline void CConnection::SetHost( CString ip, int port )
{ m_sIP=ip;m_nPort=port; }
/** */
inline CString CConnection::GetIP() const
{ return m_sIP; }
/** */
inline int CConnection::GetPort() const
{ return m_nPort; }
/** */
inline eConnectionState CConnection::GetConnectionState() const
{ return m_eState; }

#endif