1 // PortConnection.h 2 3 #ifndef NET_FS_PORT_CONNECTION_H 4 #define NET_FS_PORT_CONNECTION_H 5 6 #include <OS.h> 7 8 #include "AbstractConnection.h" 9 #include "PortChannel.h" 10 11 // PortConnection 12 class PortConnection : public AbstractConnection { 13 public: 14 PortConnection(); 15 virtual ~PortConnection(); 16 17 status_t Init(Channel* channel, int32 upStreamChannels, 18 int32 downStreamChannels); // server side 19 virtual status_t Init(const char* parameters); // client side 20 21 status_t FinishInitialization(); 22 23 private: 24 static status_t _CreateChannel(PortChannel** channel, 25 PortChannel::Info* info = NULL, 26 bool inverse = false); 27 28 private: 29 int32 fUpStreamChannels; 30 int32 fDownStreamChannels; 31 }; 32 33 // PortConnectionDefs 34 namespace PortConnectionDefs { 35 36 // ConnectRequest 37 struct ConnectRequest { 38 int32 protocolVersion; 39 int32 upStreamChannels; 40 int32 downStreamChannels; 41 PortChannel::Info channelInfo; 42 }; 43 44 // ConnectReply 45 struct ConnectReply { 46 int32 error; 47 int32 upStreamChannels; 48 int32 downStreamChannels; 49 }; 50 51 extern const int32 kProtocolVersion; 52 extern const char* kPortConnectionPortName; 53 54 // number of client up/down stream channels 55 extern const int32 kMinUpStreamChannels; 56 extern const int32 kMaxUpStreamChannels; 57 extern const int32 kDefaultUpStreamChannels; 58 extern const int32 kMinDownStreamChannels; 59 extern const int32 kMaxDownStreamChannels; 60 extern const int32 kDefaultDownStreamChannels; 61 } 62 63 #endif // NET_FS_PORT_CONNECTION_H 64