00001 /*************************************************************************** 00002 peer.h - description 00003 ------------------- 00004 begin : Fri Nov 2 2001 00005 copyright : (C) 2001 by Constantinos A. Kotsokalis 00006 email : ckotso@netmode.ntua.gr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef PEER_H 00019 #define PEER_H 00020 00027 class Peer; 00028 00029 // Common C++ headers 00030 #include <cc++/socket.h> 00031 #include <cc++/thread.h> 00032 #include <cc++/misc.h> 00033 00034 #ifdef CCXX_NAMESPACES 00035 using namespace std; 00036 using namespace ost; 00037 #endif 00038 00039 // Custom project headers 00040 #include "common.h" 00041 #include "peerconnect.h" 00042 #include "client.h" 00043 00044 // Standard C headers 00045 #include <stdio.h> 00046 00047 // Standard C++ Library templates) 00048 #include <string> 00049 #include <map> 00050 #include <vector> 00051 00057 class Peer : public Thread { 00058 public: 00059 // Class constructor 00060 Peer(uint16_t, Mutex *, Collector *); 00061 // Class destructor 00062 virtual ~Peer(); 00063 // Application logic implementer 00064 virtual void run(); 00065 00066 private: 00067 // Peer port to bind to 00068 uint16_t port; 00069 // Collector reference 00070 Collector *cl; 00071 // Locking mechanism 00072 Mutex *mtx; 00073 // finalizer 00074 virtual void final(); 00075 }; 00076 00077 #endif
1.2.18