Panda3D
|
00001 // Filename: connectionListener.h 00002 // Created by: drose (09Feb00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef CONNECTIONLISTENER_H 00016 #define CONNECTIONLISTENER_H 00017 00018 #include "pandabase.h" 00019 00020 #include "connectionReader.h" 00021 00022 class NetAddress; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : ConnectionListener 00026 // Description : This is a special kind of ConnectionReader that waits 00027 // for activity on a rendezvous port and accepts a TCP 00028 // connection (instead of attempting to read a datagram 00029 // from the rendezvous port). 00030 // 00031 // It is itself an abstract class, as it doesn't define 00032 // what to do with the established connection. See 00033 // QueuedConnectionListener. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA_NET ConnectionListener : public ConnectionReader { 00036 PUBLISHED: 00037 ConnectionListener(ConnectionManager *manager, int num_threads, 00038 const string &thread_name = string()); 00039 00040 protected: 00041 virtual void receive_datagram(const NetDatagram &datagram); 00042 virtual void connection_opened(const PT(Connection) &rendezvous, 00043 const NetAddress &address, 00044 const PT(Connection) &new_connection)=0; 00045 00046 virtual bool process_incoming_data(SocketInfo *sinfo); 00047 00048 private: 00049 }; 00050 00051 #endif