summaryrefslogtreecommitdiffhomepage
path: root/Kernel/NetworkKit/IPCEP.hxx
blob: 6b30ec04de8b359f178e6d2fe6a59c2fcc22ec82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* -------------------------------------------

	Copyright SoftwareLabs.

	File: IPCEP.hxx.
	Purpose: IPC protocol.

------------------------------------------- */

#ifndef _INC_IPC_ENDPOINT_HXX_
#define _INC_IPC_ENDPOINT_HXX_

#include <NewKit/Defines.hpp>
#include <NewKit/String.hpp>

/// @brief IPC Endpoint Protocol (IPCEP for short).

/// IA separator.
#define cRemoteSeparator "."

/// Interchange address, consists of domain:namespace.
#define cRemoteInvalid	"00.00.00.00:0000"
#define cRemoteBitWidth (96) /* 96-bit address space. */

#define cRemoteHeaderMagic (0x4950434550)

namespace NewOS
{
	/// @brief 96-bit number to represent the domain and namespace
	struct PACKED IPCEPAddress
	{
		UInt32 RemoteAddress;
		UInt64 RemoteNamespace;
	};

	typedef struct IPCEPAddress IPCEPAddressType;

	enum
	{
		eIPCEPLittleEndian = 0,
		eIPCEPBigEndian	   = 1
	};

	/// @brief IPCEP connection header
	typedef struct IPCEPConnectionHeader
	{
		UInt32			 IpcHeader;	   // cRemoteHeaderMagic
		UInt8			 IpcEndianess; // 0 : LE, 1 : BE
		SizeT			 IpcPacketSize;
		IPCEPAddressType IpcFrom;
		IPCEPAddressType IpcTo;
		UInt32			 IpcCRC32;
		SizeT			 IpcDataSize;
		Char			 IpcData[];
	} PACKED IPCEPConnectionHeader;
} // namespace NewOS

#endif // _INC_IPC_ENDPOINT_HXX_