1 // ServerConnection.h 2 3 #ifndef NET_FS_SERVER_CONNECTION_H 4 #define NET_FS_SERVER_CONNECTION_H 5 6 #include <fsproto.h> 7 8 #include <Referenceable.h> 9 10 #include "Locker.h" 11 #include "RequestHandler.h" 12 13 class ConnectionBrokenEvent; 14 class ExtendedServerInfo; 15 class RequestConnection; 16 class ShareVolume; 17 class VolumeManager; 18 19 class ServerConnection : public BReferenceable, private RequestHandler { 20 public: 21 ServerConnection(VolumeManager* volumeManager, 22 ExtendedServerInfo* serverInfo); 23 ~ServerConnection(); 24 25 status_t Init(vnode_id connectionBrokenTarget); 26 void Close(); 27 28 bool IsConnected(); 29 30 RequestConnection* GetRequestConnection() const; 31 32 status_t AddVolume(ShareVolume* volume); 33 void RemoveVolume(ShareVolume* volume); 34 ShareVolume* GetVolume(int32 volumeID); 35 36 private: 37 virtual status_t VisitConnectionBrokenRequest( 38 ConnectionBrokenRequest* request); 39 virtual status_t VisitNodeMonitoringRequest( 40 NodeMonitoringRequest* request); 41 42 private: 43 struct VolumeMap; 44 45 Locker fLock; 46 VolumeManager* fVolumeManager; 47 ExtendedServerInfo* fServerInfo; 48 RequestConnection* fConnection; 49 VolumeMap* fVolumes; 50 ConnectionBrokenEvent* fConnectionBrokenEvent; 51 volatile bool fConnected; 52 }; 53 54 #endif // NET_FS_SERVER_CONNECTION_H 55