Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/net/queuedConnectionListener.h

Go to the documentation of this file.
00001 // Filename: queuedConnectionListener.h
00002 // Created by:  drose (09Feb00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef QUEUEDCONNECTIONLISTENER_H
00020 #define QUEUEDCONNECTIONLISTENER_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "connectionListener.h"
00025 #include "connection.h"
00026 #include "netAddress.h"
00027 #include "queuedReturn.h"
00028 
00029 #include <prlock.h>
00030 #include "pdeque.h"
00031 
00032 
00033 class EXPCL_PANDA ConnectionListenerData {
00034 public:
00035   // We need these methods to make VC++ happy when we try to
00036   // instantiate the template, below.  They don't do anything useful.
00037   INLINE bool operator == (const ConnectionListenerData &other) const;
00038   INLINE bool operator != (const ConnectionListenerData &other) const;
00039   INLINE bool operator < (const ConnectionListenerData &other) const;
00040 
00041   PT(Connection) _rendezvous;
00042   NetAddress _address;
00043   PT(Connection) _new_connection;
00044 };
00045 
00046 EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, QueuedReturn<ConnectionListenerData>);
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //       Class : QueuedConnectionListener
00050 // Description : This flavor of ConnectionListener will queue up all
00051 //               of the TCP connections it established for later
00052 //               detection by the client code.
00053 ////////////////////////////////////////////////////////////////////
00054 class EXPCL_PANDA QueuedConnectionListener : public ConnectionListener,
00055                                  public QueuedReturn<ConnectionListenerData> {
00056 PUBLISHED:
00057   QueuedConnectionListener(ConnectionManager *manager, int num_threads);
00058   virtual ~QueuedConnectionListener();
00059 
00060   bool new_connection_available();
00061   bool get_new_connection(PT(Connection) &rendezvous,
00062                           NetAddress &address,
00063                           PT(Connection) &new_connection);
00064   bool get_new_connection(PT(Connection) &new_connection);
00065 
00066 protected:
00067   virtual void connection_opened(const PT(Connection) &rendezvous,
00068                                  const NetAddress &address,
00069                                  const PT(Connection) &new_connection);
00070 };
00071 
00072 #include "queuedConnectionListener.I"
00073 
00074 #endif
00075 

Generated on Fri May 2 00:40:36 2003 for Panda by doxygen1.3