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

ServiceEntry.h

Go to the documentation of this file.
00001 #ifndef __SERVICEENTRY_H
00002 #define __SERVICEENTRY_H
00003 
00004 #include <string>
00005 #include <list>
00006 #include "BasicObject.h"
00007 #include "Mutex.h"
00008 #include "Condition.h"
00009 
00010 class ServiceTable;
00011 class SAR;
00012 
00013 class ServiceEntry : public BasicObject
00014 {
00015 public:
00016     ServiceEntry(ServiceTable*);
00017 
00018     //ServiceEntry(const ServiceEntry&);
00019 
00020     virtual ~ServiceEntry();
00021 
00022     //
00023     // State changing functions
00024     //
00025     
00026     void toConnectingState();
00027 
00028     void toReconnectingState();
00029     
00030     void toDisconnectedState();
00031 
00032     void toBrokenState();
00033 
00034     void toConnectedState();
00035 
00036     void toFailedState();
00037 
00038     void connectionAccepted(int connectionDescriptor);
00039 
00040     //
00041     // State info functions
00042     //
00043 
00044     bool isReconnecting();
00045 
00046     bool isConnecting();
00047 
00048     bool isBroken();
00049 
00050     bool isConnected();
00051 
00052     bool isFailed();
00053 
00054     bool isDisconnected();
00055 
00056     
00057     //
00058     // other stuff
00059     //
00060 
00061     void incrementRetries();
00062 
00063     int getRetries();
00064 
00065     int getConnectionDescriptor();
00066 
00067     int getServiceNumber();
00068 
00069     SAR* getSar();
00070 
00071 
00072     bool isOrigin();
00073 
00074     bool isDestination();
00075 
00076     bool waitForConnectComplete(int timeToWait);
00077 
00078     bool waitForDisconnect(int timeToWait);
00079 
00080     void signalDisconnect();
00081 
00082     void signalConnectComplete();
00083 
00084     virtual void toStream(std::ostream& out);
00085 
00086 private:
00087 
00088     
00089     //
00090     // States
00091     //
00092 
00093     OS_SPEC_ENUM State {
00095             State_Connecting,     
00096 
00098             State_Reconnecting,
00099 
00101             State_Broken,
00102 
00104             State_Connected,
00105 
00107             State_Disconnected,
00108 
00110             State_Failed
00111     };
00112 
00113     State m_state;
00114 
00115     string stateToString();
00116 
00117 
00118     // 
00119     // Locations where this node can be in an end-to-end connection
00120     //
00121 
00122     OS_SPEC_ENUM TransportLayerRole {
00124         None,
00125 
00127         OriginPeer,     
00128 
00130         DestinationPeer,     
00131 
00132     };
00133 
00134     TransportLayerRole m_transportLayerRole;
00135 
00136     string transportLayerRoleToString();
00137 
00138 
00139     //
00140     // State info
00141     //
00142 
00144     int m_retry;
00145 
00147     int m_connectionDescriptor;
00148 
00151     int m_serviceNumber;
00152 
00154     SAR* m_sar;
00155 
00157     ServiceTable *m_serviceTable;
00158 
00160     Condition m_estReceivedCondition;
00161 
00163     Condition m_finReceivedCondition; 
00164 
00166     Mutex m_serviceEntryLock;
00167 };
00168 
00169 
00170 #endif
00171 

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