This file is indexed.

/usr/include/Eris-1.3/Eris/Metaserver.h is in liberis-1.3-dev 1.3.14-3.

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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// TODO: Copyright stuff

#ifndef ERIS_METASERVER_H
#define ERIS_METASERVER_H

#include <Eris/Types.h>
#include <Eris/ServerInfo.h>

#include <Atlas/Objects/Decoder.h>

#include <sigc++/trackable.h>
#include <sigc++/signal.h>
#include <memory>

#ifndef __WIN32__
// pull in uint32_t on POSIX - is this generic?!
#include <stdint.h>
#else
// Apparently not. [MW]
#ifndef _STDINT_H_
#define _STDINT_H_

typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;

#endif  // _STDINT_H_

#endif // __WIN32__

// Forward decls
class udp_socket_stream;
class basic_socket_stream;
	
namespace Eris {
	
// Forward Declerations
class MetaQuery;
class BaseConnection;
class Timeout;
class PollData;
	
#ifndef uint32_t
	/* WIN32 hack ...
   	this is only true for 32bit machines but WIN64 is far ahead !! */

	#ifdef WINDOWS	
	typedef unsigned int uint32_t;
	#endif
	
	#ifdef MACOS
	#include <Types.h>
	// MacOS defines these anyway
	typedef Uint32	uint32_t;
	#endif
#endif

const int DATA_BUFFER_SIZE = 4096;

/// Storage of server information
typedef std::list<ServerInfo> ServerList;

/// Meta encapsulates the meta-game system, including the meta-server protocol and queries
class Meta : virtual public sigc::trackable,
		public Atlas::Objects::ObjectsDecoder
{
public:
    /** Create a Metaserver object, which manages all interaction with the
    metaserver itself, and querying active game servers. Clients might create
    this object when showing a 'server list' dialog, and use the signals
    and accessors to pouplate the list. Signals and methods are provided to
    support common things like displaying query progress, and canceling
    queries.
    @param msv The metaserver to query, specified as a hostname. Usually
    metaserver.worldforge.org, but that's up to you.
    @param maxQueries The maximum number of game server queries to have
    active at any one time. 10 is a sensible value, too low and querying will
    take a long time, too high and .... I'm not sure.
    */
    Meta(const std::string &msv, unsigned int maxQueries);
    virtual ~Meta();
    
    /** Return the total number of game servers the meta server knows about. */
    unsigned int getGameServerCount() const;

    /** Retrive one of the servers. Note the ServerInfo object may be invalid
    if the server has not yet been queried, or has timedout or otherwise
    failed to answer the query. */
    const ServerInfo& getInfoForServer(unsigned int index) const;

    /// Query a specific game server; emits a signal when complete
    void queryServerByIndex(unsigned int index);

    /** Refresh the entire server list. This will clear the current list,
    ask the meta-server for each game server, and then issue a query
    against every returned server. This process can take a large amount
    of real-time as the number of game servers increases. Completion
    of the entire refresh is indicated by the 'CompletedServerList' signal.
    */
    void refresh();

    /** Cancel outstanding refresh / queries. This is primarily intended for
    use with 'Refresh', which might takes several minutes to complete. Note
    that 'CompletedServerList' is not emitted following cancellation. 
    */
    void cancel();

// signals
	
    /// Emitted when information about a server is received
    sigc::signal<void, const ServerInfo&> ReceivedServerInfo;

    /**
    Emitted once the complete list of servers has been retrived from
    the metaserver. Argument is the total number of servers in the list
    */
    sigc::signal<void, int> CompletedServerList;
    
    /// Emitted when the entire server list has been refreshed
    sigc::signal<void> AllQueriesDone;

    /**
    Indicates a failure (usually network related) has occurred.
    The server list will be cleared, and the status set to INVALID. 
    */
    sigc::signal<void, const std::string&> Failure;
	
protected:
    friend class MetaQuery;
		
    virtual void objectArrived(const Atlas::Objects::Root& obj);

    void doFailure(const std::string &msg);
    void queryFailure(MetaQuery *q, const std::string& msg);

    void queryTimeout(MetaQuery *q);
    void metaTimeout();
    
    /** initiate a connection to the meta-server : this will issue a keep-alive followed
    by a list request. */
    void connect();
    
    /** tear down an existing connection to the server */
    void disconnect();
	
private:
/// process raw UDP packets from the meta-server
    void recv();
    
    /// Invoked when _bytesToRecv = 0 and expecting a command (_recvCmd = true)
    void recvCmd(uint32_t op);

    /// Invoked when _bytesToRecv = 0 and processing a command (_recvCmd = false)
    void processCmd();

    /// Request a portion of the server list from the meta-server
    /// @param offset The first index to retrieve
    void listReq(int offset = 0);

    void setupRecvCmd();
    void setupRecvData(int words, uint32_t got);
        
    void deleteQuery(MetaQuery* query);
        
    void internalQuery(unsigned int index);
        
    const std::string m_clientName;	///< the name to use when negotiating
    
    typedef enum
    {
        INVALID = 0,	///< The server list is not valid
        VALID,		///< The list is valid and completed
        GETTING_LIST,   ///< Retrieving the list of game servers from the metaserver
        QUERYING	///< Querying game servers for information
    } MetaStatus;

    MetaStatus m_status;
    /// the metaserver query, eg metaserver.worldforge.org
    const std::string m_metaHost;       
	
    typedef std::set<MetaQuery*> QuerySet;
    QuerySet m_activeQueries;
                
    /// queries we will execute when active slots become free
    typedef std::list<int> IntList;
    IntList m_pendingQueries;
    unsigned int m_maxActiveQueries;

    typedef std::vector<ServerInfo> ServerInfoArray;
    ServerInfoArray m_gameServers,
        m_lastValidList;

    // storage for the Metaserver protocol
    udp_socket_stream* m_stream;
    
	char _data[DATA_BUFFER_SIZE];
	char* _dataPtr;	///< The current insert/extract pointer in the buffer

	unsigned int _bytesToRecv, ///< The number of bytes to read before processing / dispatch
		_totalServers,		///< Total number of servers the Meta knows of
		_packed;		///< The servers in the curent LIST_RESP
		
	bool _recvCmd; 		///< true if the next block is a new command
	uint32_t _gotCmd;	///< the curent command being processed
	
    std::auto_ptr<Timeout> m_timeout;	///< Metaserver channel timeout
	
    void gotData(PollData&);
};
	
} // of namespace Eris

#endif