This file is indexed.

/usr/include/gnelib/ConnectionEventGenerator.h is in libgnelib-dev 0.75+svn20091130-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
#ifndef CONNECTIONEVENTGENERATOR_H_INCLUDED_C51B7986
#define CONNECTIONEVENTGENERATOR_H_INCLUDED_C51B7986

/* GNE - Game Networking Engine, a portable multithreaded networking library.
 * Copyright (C) 2001-2006 Jason Winnebeck 
 * Project website: http://www.gillius.org/gne/
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <gnelib/ConditionVariable.h>
#include <gnelib/Thread.h>
#include <gnelib/SmartPointers.h>

#include <nl.h>
#include <map>

namespace GNE {
class ReceiveEventListener;

/**
 * @ingroup internal
 *
 * A class used internally by GNE to generate the events in Connection.  Users
 * of GNE should not need to use or know about this class.  This class uses
 * nlPollGroup to check for events comming in on sockets.
 */
class ConnectionEventGenerator : public Thread {
protected:
  ConnectionEventGenerator();

public:
  typedef SmartPtr<ConnectionEventGenerator> sptr;
  typedef WeakPtr<ConnectionEventGenerator> wptr;

  /**
   * Creates a new instance of a ConnectionEventGenerator managed by a
   * SmartPtr.
   */
  static sptr create();

  virtual ~ConnectionEventGenerator();

  /**
   * Register a socket to receive events generated by this class.  If
   * the socket is already registered then this method has no effect (even
   * if the registered listener is NOT the one passed!)
   *
   * @param socket the low-level HawkNL socket for this connection.
   * @param conn the Connection class associated with the socket.
   */
  void reg(NLsocket socket, const SmartPtr<ReceiveEventListener>& listener);

  /**
   * Removes a socket.  If the socket is not registered, then no action takes
   * place.  This method will not block to wait for the unregistration to take
   * place.
   *
   * @param socket the low-level HawkNL socket for this connection.
   */
  void unreg(NLsocket socket);

  /**
   * Tells the event generator to shutdown.  This function is called
   * internally on library cleanup, so you should not call it.
   */
  void shutDown();

protected:
 /**
   * The thread that listens for events.
   */
  void run();

private:
  NLint group;

  typedef std::map<NLsocket, SmartPtr<ReceiveEventListener> > ConnectionsMap;
  typedef ConnectionsMap::iterator ConnectionsMapIter;

  ConnectionsMap connections;

  NLsocket* sockBuf;

  ConditionVariable mapCtrl;
};

}
#endif /* CONNECTIONEVENTGENERATOR_H_INCLUDED_C51B7986 */