3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/listen.c
6 * PURPOSE: Communication mechanism
8 * PROGRAMMERS: David Welch (welch@cwcom.net)
11 /* INCLUDES ******************************************************************/
15 #include <internal/debug.h>
17 /* FUNCTIONS *****************************************************************/
19 /**********************************************************************
24 * Listen on a named port and wait for a connection attempt.
27 * PortHandle [IN] LPC port to listen on.
29 * ConnectMsg [IN] User provided storage for a
30 * possible connection request LPC message.
33 * STATUS_SUCCESS if a connection request is received
34 * successfully; otherwise an error code.
36 * The buffer ConnectMessage is filled with the connection
37 * request message queued by NtConnectPort() in PortHandle.
41 /*EXPORTED*/ NTSTATUS STDCALL
42 NtListenPort (IN HANDLE PortHandle
,
43 IN PPORT_MESSAGE ConnectMsg
)
48 * Wait forever for a connection request.
52 Status
= NtReplyWaitReceivePort(PortHandle
,
57 * Accept only LPC_CONNECTION_REQUEST requests.
58 * Drop any other message.
60 if (!NT_SUCCESS(Status
) ||
61 LPC_CONNECTION_REQUEST
== ConnectMsg
->u2
.s2
.Type
)
63 DPRINT("Got message (type %x)\n", LPC_CONNECTION_REQUEST
);
66 DPRINT("Got message (type %x)\n", ConnectMsg
->u2
.s2
.Type
);