- NDK 0.98, now with versionned headers. Too many changes to list, see the TinyKRNL...
[reactos.git] / reactos / ntoskrnl / include / internal / lpc.h
1 #ifndef __INCLUDE_INTERNAL_PORT_H
2 #define __INCLUDE_INTERNAL_PORT_H
3
4 /* EPORT.Type */
5
6 #define EPORT_TYPE_SERVER_RQST_PORT (0)
7 #define EPORT_TYPE_SERVER_COMM_PORT (1)
8 #define EPORT_TYPE_CLIENT_COMM_PORT (2)
9
10 /* EPORT.State */
11
12 #define EPORT_INACTIVE (0)
13 #define EPORT_WAIT_FOR_CONNECT (1)
14 #define EPORT_WAIT_FOR_ACCEPT (2)
15 #define EPORT_WAIT_FOR_COMPLETE_SRV (3)
16 #define EPORT_WAIT_FOR_COMPLETE_CLT (4)
17 #define EPORT_CONNECTED_CLIENT (5)
18 #define EPORT_CONNECTED_SERVER (6)
19 #define EPORT_DISCONNECTED (7)
20
21 extern POBJECT_TYPE LpcPortObjectType;
22 extern ULONG LpcpNextMessageId;
23 extern FAST_MUTEX LpcpLock;
24
25 typedef struct _EPORT_LISTENER
26 {
27 HANDLE ListenerPid;
28 LIST_ENTRY ListenerListEntry;
29 } EPORT_LISTENER, *PEPORT_LISTENER;
30
31 typedef struct _EPORT
32 {
33 KSPIN_LOCK Lock;
34 KSEMAPHORE Semaphore;
35 USHORT Type;
36 USHORT State;
37 struct _EPORT *RequestPort;
38 struct _EPORT *OtherPort;
39 ULONG QueueLength;
40 LIST_ENTRY QueueListHead;
41 ULONG ConnectQueueLength;
42 LIST_ENTRY ConnectQueueListHead;
43 ULONG MaxDataLength;
44 ULONG MaxConnectInfoLength;
45 ULONG MaxPoolUsage; /* size of NP zone */
46 } EPORT, *PEPORT;
47
48 typedef struct _EPORT_CONNECT_REQUEST_MESSAGE
49 {
50 PORT_MESSAGE MessageHeader;
51 PEPROCESS ConnectingProcess;
52 struct _SECTION_OBJECT* SendSectionObject;
53 LARGE_INTEGER SendSectionOffset;
54 ULONG SendViewSize;
55 ULONG ConnectDataLength;
56 UCHAR ConnectData[0];
57 } EPORT_CONNECT_REQUEST_MESSAGE, *PEPORT_CONNECT_REQUEST_MESSAGE;
58
59 typedef struct _EPORT_CONNECT_REPLY_MESSAGE
60 {
61 PORT_MESSAGE MessageHeader;
62 PVOID SendServerViewBase;
63 ULONG ReceiveClientViewSize;
64 PVOID ReceiveClientViewBase;
65 ULONG MaximumMessageSize;
66 ULONG ConnectDataLength;
67 UCHAR ConnectData[0];
68 } EPORT_CONNECT_REPLY_MESSAGE, *PEPORT_CONNECT_REPLY_MESSAGE;
69
70 typedef struct _QUEUEDMESSAGE
71 {
72 PEPORT Sender;
73 LIST_ENTRY QueueListEntry;
74 PORT_MESSAGE Message;
75 } QUEUEDMESSAGE, *PQUEUEDMESSAGE;
76
77 NTSTATUS
78 STDCALL
79 LpcRequestPort(
80 PEPORT Port,
81 PPORT_MESSAGE LpcMessage
82 );
83
84 NTSTATUS
85 STDCALL
86 LpcSendTerminationPort(
87 PEPORT Port,
88 LARGE_INTEGER CreationTime
89 );
90
91 /* Code in ntoskrnl/lpc/close.h */
92
93 VOID
94 STDCALL
95 LpcpClosePort(
96 IN PEPROCESS Process OPTIONAL,
97 IN PVOID Object,
98 IN ACCESS_MASK GrantedAccess,
99 IN ULONG ProcessHandleCount,
100 IN ULONG SystemHandleCount
101 );
102
103 VOID
104 STDCALL
105 LpcpDeletePort(IN PVOID ObjectBody);
106
107 /* Code in ntoskrnl/lpc/queue.c */
108
109 VOID
110 STDCALL
111 EiEnqueueConnectMessagePort(
112 IN OUT PEPORT Port,
113 IN PQUEUEDMESSAGE Message
114 );
115
116 VOID
117 STDCALL
118 EiEnqueueMessagePort(
119 IN OUT PEPORT Port,
120 IN PQUEUEDMESSAGE Message
121 );
122
123 VOID
124 STDCALL
125 EiEnqueueMessageAtHeadPort(
126 IN OUT PEPORT Port,
127 IN PQUEUEDMESSAGE Message
128 );
129
130 PQUEUEDMESSAGE
131 STDCALL
132 EiDequeueConnectMessagePort(IN OUT PEPORT Port);
133
134 PQUEUEDMESSAGE
135 STDCALL
136 EiDequeueMessagePort(IN OUT PEPORT Port);
137
138 /* Code in ntoskrnl/lpc/port.c */
139
140 NTSTATUS
141 STDCALL
142 LpcpInitializePort(
143 IN OUT PEPORT Port,
144 IN USHORT Type,
145 IN PEPORT Parent OPTIONAL
146 );
147
148 NTSTATUS
149 NTAPI
150 LpcpInitSystem (VOID);
151
152 /* Code in ntoskrnl/lpc/reply.c */
153
154 NTSTATUS
155 STDCALL
156 EiReplyOrRequestPort(
157 IN PEPORT Port,
158 IN PPORT_MESSAGE LpcReply,
159 IN ULONG MessageType,
160 IN PEPORT Sender
161 );
162
163 #endif /* __INCLUDE_INTERNAL_PORT_H */