1// Port.h
2
3#ifndef USERLAND_FS_PORT_H
4#define USERLAND_FS_PORT_H
5
6#include <OS.h>
7
8namespace UserlandFSUtil {
9
10struct PortInfo {
11};
12
13class Port {
14public:
15			struct Info {
16				port_id			owner_port;
17				port_id			client_port;
18				int32			size;
19			};
20
21public:
22								Port(int32 size);
23								Port(const Info* info);
24								~Port();
25
26			void				Close();
27
28			status_t			InitCheck() const;
29
30			const Info*			GetInfo() const;
31
32			void*				GetBuffer() const;
33			int32				GetCapacity() const;
34
35			void*				GetMessage() const;
36			int32				GetMessageSize() const;
37
38			status_t			Send(int32 size);
39			status_t			SendAndReceive(int32 size);
40			status_t			Receive(bigtime_t timeout = -1);
41
42private:
43			friend class KernelDebug;
44
45			Info				fInfo;
46			uint8*				fBuffer;
47			int32				fCapacity;
48			int32				fMessageSize;
49			status_t			fInitStatus;
50			bool				fOwner;
51};
52
53}	// namespace UserlandFSUtil
54
55using UserlandFSUtil::PortInfo;
56using UserlandFSUtil::Port;
57
58#endif	// USERLAND_FS_PORT_H
59