1 // AbstractConnection.h 2 3 #ifndef NET_FS_ABSTRACT_CONNECTION_H 4 #define NET_FS_ABSTRACT_CONNECTION_H 5 6 #include "Connection.h" 7 #include "Locker.h" 8 #include "Vector.h" 9 10 class AbstractConnection : public Connection { 11 protected: 12 AbstractConnection(); 13 14 public: 15 virtual ~AbstractConnection(); 16 17 virtual status_t Init(const char* parameters) = 0; 18 status_t Init(); 19 virtual void Close(); 20 21 // virtual User* GetAuthorizedUser(); 22 23 status_t AddDownStreamChannel(Channel* channel); 24 status_t AddUpStreamChannel(Channel* channel); 25 26 virtual int32 CountDownStreamChannels() const; 27 virtual Channel* DownStreamChannelAt(int32 index) const; 28 29 virtual status_t GetUpStreamChannel(Channel** channel, 30 bigtime_t timeout = B_INFINITE_TIMEOUT); 31 virtual status_t PutUpStreamChannel(Channel* channel); 32 33 protected: 34 typedef Vector<Channel*> ChannelVector; 35 36 status_t fInitStatus; 37 ChannelVector fDownStreamChannels; 38 sem_id fUpStreamChannelSemaphore; 39 Locker fUpStreamChannelLock; 40 ChannelVector fUpStreamChannels; 41 int32 fFreeUpStreamChannels; 42 }; 43 44 #endif // NET_FS_ABSTRACT_CONNECTION_H 45