Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Node.h

Go to the documentation of this file.
00001 #ifndef __NODE_H
00002 #define __NODE_H
00003 
00004 #include <stdio.h>
00005 #include <vector>
00006 #include <string>
00007 #include "BasicObject.h"
00008 #include "GlobalConstants.h"
00009 //#include "NpPacket.h"
00010 //#include "TcpConnection.h"
00011 #include "SocketAddress.h"
00012 #include "ObservableInterface.h"
00013 #include "ListenerInterface.h"
00014 //#include "ConnectionInterface.h"
00015 #include "TimeValue.h"
00016 
00017 
00018 class Node : public BasicObject, public ListenerInterface, public ObservableInterface
00019 {
00020 public:
00021     Node();
00022     Node(const Node&);
00023     virtual ~Node();
00024 
00025         OS_SPEC_ENUM EventType {
00026                 CONNECTION_CLOSED
00027         };
00028 
00029         OS_SPEC_ENUM Capabilites {
00030                 Trusted  = 0x01,
00031                 NonFirewalled = 0x02
00032         };
00033 
00034     SocketAddress* getSocketAddress();
00035 
00036     TimeValue getRtt();
00037     void setRtt(TimeValue);
00038     
00039     int getVersionNumber();
00040     void setVersionNumber(int);
00041 
00042     bool isConnected();
00043         bool isNatted();
00044         bool isTrusted();
00045         bool isFirewalled();
00046     bool cantConnect();
00047 
00048     void setSocketAddress(SocketAddress* socketAddress);
00049     void setIsNatted(bool val);
00050         void setIsTrusted(bool val);
00051         void setIsFirewalled(bool val);
00052     void setCantConnect(bool);
00053 
00054         bool equals(Node* node);
00055     bool equals(ConnectionInterface* connection);
00056 
00057     //
00058     // required to be a ConnectionListener
00059     //
00060     void handleEvent(ObservableInterface*, int eventType, void* object);
00061 
00062     //
00063     // I/O functions
00064     //
00065     friend std::istream& operator >>(std::istream& in, Node& node);
00066     virtual void toStream(std::ostream& out);
00067 
00068     static string beginTag; 
00069     static string endTag;  
00070     static string TRUSTED_TAG;
00071     static string FIREWALL_TAG;
00072     static string NAT_TAG;
00073     static string SOCKET_ADDRESS_TAG;
00074     static string RTT_TAG;
00075     static string VERSION_TAG;
00076 
00077 protected:
00078     SocketAddress m_socketAddress;
00079 
00081         TimeValue m_rtt;
00082 
00084         bool m_isNatted;
00085 
00087         bool m_isFirewalled;
00088 
00090         bool m_isTrusted;
00091 
00093     int m_versionNumber;
00094 
00095     bool m_isConnected;
00096 
00097     bool m_cantConnect;
00098 };
00099 
00100 #endif

Generated at Thu Jul 11 13:31:51 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001