1// InsecureConnection.h 2 3#ifndef NET_FS_INSECURE_CONNECTION_H 4#define NET_FS_INSECURE_CONNECTION_H 5 6#ifdef HAIKU_TARGET_PLATFORM_BEOS 7# include <socket.h> 8#else 9# include <netinet/in.h> 10# include <sys/socket.h> 11#endif 12 13#include "AbstractConnection.h" 14 15// InsecureConnection 16class InsecureConnection : public AbstractConnection { 17public: 18 InsecureConnection(); 19 virtual ~InsecureConnection(); 20 21 status_t Init(int socket); // server side 22 virtual status_t Init(const char* parameters); // client side 23 24 status_t FinishInitialization(); 25 26private: 27 status_t _OpenClientChannel(in_addr serverAddr, 28 uint16 port, Channel** channel); 29 30 status_t _SendErrorReply(Channel* channel, 31 status_t error); 32}; 33 34// InsecureConnectionDefs 35namespace InsecureConnectionDefs { 36 37 // ConnectRequest 38 struct ConnectRequest { 39 int32 protocolVersion; 40 uint32 serverAddress; 41 int32 upStreamChannels; 42 int32 downStreamChannels; 43 }; 44 45 // ConnectReply 46 struct ConnectReply { 47 int32 error; 48 int32 upStreamChannels; 49 int32 downStreamChannels; 50 uint16 port; 51 }; 52 53 extern const int32 kProtocolVersion; 54 extern const bigtime_t kAcceptingTimeout; 55 56 // number of client up/down stream channels 57 extern const int32 kMinUpStreamChannels; 58 extern const int32 kMaxUpStreamChannels; 59 extern const int32 kDefaultUpStreamChannels; 60 extern const int32 kMinDownStreamChannels; 61 extern const int32 kMaxDownStreamChannels; 62 extern const int32 kDefaultDownStreamChannels; 63 64} // namespace InsecureConnectionDefs 65 66#endif // NET_FS_INSECURE_CONNECTION_H 67