This file is indexed.

/usr/include/dclib-0.3/dclib/core/ctraffic.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
150
151
152
153
/***************************************************************************
                     ctraffic.h  -  dclib network traffic stats
                             -------------------
    begin                : Fri Aug 09 2008
    copyright            : (C) 2001-2003 by Mathias Küster
    copyright            : (C) 2008 by Edward Sheldrake
    email                : ejs1920@yahoo.co.uk
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 CTRAFFIC_H
#define CTRAFFIC_H

/**
 * @author Mathias Küster
 *
 * Class split out of csocket.h
 * It's just a counter for network usage.
 */

#include <dclib/dcos.h>
#include <dclib/core/cmutex.h>

enum eTrafficType {
	ettRX=0,
	ettTX,
	ettDATARX,
	ettDATATX,
	ettCONTROLRX,
	ettCONTROLTX,
	ettRESET
};

class CTraffic {
public:
	/** Constructor - mutex must be locked until finished */
	CTraffic()
	{
		ResetTraffic();
	};
	/** Destructor */
	~CTraffic() {};
	
	/** Add bytes to the traffic stat */
	void AddTraffic( eTrafficType type, ulonglong n )
	{
		m_Mutex.Lock();
		
		switch ( type )
		{
			case ettRX:
				m_nRx += n;
				break;
			case ettTX:
				m_nTx += n;
				break;
			case ettDATARX:
				m_nDataRx += n;
				break;
			case ettDATATX:
				m_nDataTx += n;
				break;
			case ettCONTROLRX:
				m_nControlRx += n;
				break;
			case ettCONTROLTX:
				m_nControlTx += n;
				break;
			default:
				break;
		}
		
		m_Mutex.UnLock();
	}
	
	/** Get bytes for the traffic stat */
	ulonglong GetTraffic( eTrafficType type )
	{
		ulonglong n;
		
		m_Mutex.Lock();
		
		switch ( type )
		{
			case ettRX:
				n = m_nRx;
				break;
			case ettTX:
				n = m_nTx;
				break;
			case ettDATARX:
				n = m_nDataRx;
				break;
			case ettDATATX:
				n = m_nDataTx;
				break;
			case ettCONTROLRX:
				n = m_nControlRx;
				break;
			case ettCONTROLTX:
				n = m_nControlTx;
				break;
			default:
				n = 0;
				break;
		}
		
		m_Mutex.UnLock();
		
		return n;
	}
	
	/** Reset all traffic stats */
	void ResetTraffic()
	{
		m_Mutex.Lock();
		
		m_nRx        = 0;
		m_nTx        = 0;
		m_nDataRx    = 0;
		m_nDataTx    = 0;
		m_nControlRx = 0;
		m_nControlTx = 0;
		
		m_Mutex.UnLock();
	}
	
private:
	/** */
	CMutex m_Mutex;
	/** */
	ulonglong m_nRx;
	/** */
	ulonglong m_nTx;
	/** */
	ulonglong m_nDataRx;
	/** */
	ulonglong m_nDataTx;
	/** */
	ulonglong m_nControlRx;
	/** */
	ulonglong m_nControlTx;
};

#endif // CTRAFFIC_H