xref: /haiku/src/add-ons/kernel/file_systems/netfs/headers/shared/PortChannel.h (revision 5a1d355fdf2747f80f8c46e2539f844a0b813346)
1 // PortChannel.h
2 
3 #ifndef NET_FS_PORT_CHANNEL_H
4 #define NET_FS_PORT_CHANNEL_H
5 
6 #include <OS.h>
7 
8 #include "Channel.h"
9 
10 class PortChannel : public Channel {
11 public:
12 	struct Info {
13 		port_id	sendPort;
14 		port_id	receivePort;
15 	};
16 
17 public:
18 								PortChannel();
19 								PortChannel(const Info* info, bool inverse);
20 								PortChannel(port_id sendPort,
21 									port_id receivePort);
22 	virtual						~PortChannel();
23 
24 			status_t			InitCheck() const;
25 			void				GetInfo(Info* info) const;
26 
27 	virtual	void				Close();
28 
29 	virtual	status_t			Send(const void* buffer, int32 size);
30 	virtual	status_t			Receive(void* buffer, int32 size);
31 
32 private:
33 			port_id				fSendPort;
34 			port_id				fReceivePort;
35 			uint8*				fBuffer;
36 			int32				fBufferSize;
37 			int32				fBufferOffset;
38 			int32				fBufferContentSize;
39 };
40 
41 #endif	// NET_FS_PORT_CHANNEL_H
42