This file is indexed.

/usr/include/dclib-0.3/dclib/core/csocket.h is in libdc-dev 0.3.24~svn3121-1.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/***************************************************************************
                          csocket.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 CSOCKET_H
#define CSOCKET_H

/**
  *@author Mathias Küster
  *
  * A network socket, including SSL support.
  *
  * On WIN32 this class will not work until CSocket::SysInit() has been
  * called, normally by dclibInitDepLibs(), but that should
  * be better than initialising WinSock2 every time
  * a CSocket is created.
  */

#include <dclib/dcos.h>
#include <dclib/dclib-ssl-use.h>
#include <dclib/core/cstring.h>
#include <dclib/core/ctraffic.h>

#if DCLIB_USES_OPENSSL == 1

#include <openssl/ssl.h>
#include <openssl/err.h>

#else

/* this may also work for SSL builds */
typedef struct ssl_st SSL;
typedef struct ssl_ctx_st SSL_CTX;

#endif

enum eSocketType {
	estTCP=0,
	estUDP
};

/*
 * esmSSLCLIENT and esmSSLSERVER are the old values for
 * changing to SSL mode during the NMDC protocol exchange
 *
 * esmFULLSSLCLIENT and esmFULLSSLSERVER are the new values
 * where the socket starts in SSL mode
 */
enum eSocketMode {
	esmSOCKET=0,
	esmSSLCLIENT,
	esmSSLSERVER,
	esmFULLSSLCLIENT,
	esmFULLSSLSERVER
};

enum eSocketLog {
	eslNONE=0,
	eslSEND,
	eslRECV,
	eslBOTH
};

enum eConnectState {
	ecsSUCCESS=0,
	ecsAGAIN,
	ecsERROR
};

class CSocket {
public: 
	/** */
	CSocket( eSocketType type = estTCP );
	/** */
	virtual ~CSocket();

	/** */
	static CTraffic m_Traffic;
	/** */
	static eSocketLog m_eSocketLog;
	/** */
	eConnectState Connect( CString Host, bool iAsync );
	/** */
	eConnectState Connect( CString Host, int Port, bool iAsync );
	/** */
	int IsConnect();
	/** */
	int Disconnect();
	/** */
	int Read( char * buffer, int len, int sec_timeout=0, int usec_timeout=0 );
	/** */
	int Write( const unsigned char * buffer, int len, int sec_timeout=0, int usec_timeout=0 );
	/** */
	int GetFreeSendBufferSize();

	/** */
	int SetSocket( int handle, eSocketType sockettype );

	/** */
	int Accept();
	/** */
	int Listen( int port, CString ip = CString() );
	/** */
	bool GetPeerName( CString * host, int * port );

	/** */
	CString GetSocketError() { return sError; };

	/** */
	virtual bool ChangeSocketMode( eSocketMode mode, CString cert = CString(), CString key = CString() );
	
	/** Get SSL version */
	CString GetSSLVersion();
	/** Get SSL cipher */
	CString GetSSLCipher();
	/** Verify peer SSL certificate */
	CString VerifyPeerCertificate();
	
	/** */
	eSocketMode GetSocketMode() { return m_eSocketMode; }
	/** Gets the IP address with port of most recent connection attempt */
	CString GetResolvedIP() const { return m_sIP; }

	/**
	 * Initialises WinSock2 DLL, does nothing on non WIN32.
	 * Returns 0 if successful or some other WSA error code otherwise.
	 * Should be called once on program startup.
	 */
	static int SysInit();
	/**
	 * Shuts down WinSock2 DLL, does nothing on non WIN32.
	 * Returns 0 if successful or some other WSA error code otherwise.
	 * Should be called once on program shutdown.
	 */
	static int SysDeInit();

protected:
	/** */
	eSocketType SocketType;
	/** */
	SOCKET iHandle;
	/** */
	eSocketMode m_eSocketMode;

	/** */
	SSL_CTX * m_pCTX;
	/** */
	SSL * m_pSSL;

private:
	/** */
	int SocketError();
	/** */
	CString ext_strerror( int err );
	/** */
	CString sError;
	/** the IP address and port of the most recent connection attempt */
	CString m_sIP;
};

#endif