1 /* $Id: listen.c,v 1.7 2003/07/11 01:23:15 royce Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/listen.c
6 * PURPOSE: Communication mechanism
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 /* INCLUDES ******************************************************************/
14 #include <ddk/ntddk.h>
15 #include <internal/ob.h>
16 #include <internal/port.h>
17 #include <internal/dbg.h>
20 #include <internal/debug.h>
22 /* FUNCTIONS *****************************************************************/
24 /**********************************************************************
29 * Listen on a named port and wait for a connection attempt.
32 * PortHandle [IN] LPC port to listen on.
34 * ConnectMsg [IN] User provided storage for a
35 * possible connection request LPC message.
38 * STATUS_SUCCESS if a connection request is received
39 * successfully; otherwise an error code.
41 * The buffer ConnectMessage is filled with the connection
42 * request message queued by NtConnectPort() in PortHandle.
46 EXPORTED NTSTATUS STDCALL
47 NtListenPort (IN HANDLE PortHandle
,
48 IN PLPC_MESSAGE ConnectMsg
)
53 * Wait forever for a connection request.
57 Status
= NtReplyWaitReceivePort(PortHandle
,
62 * Accept only LPC_CONNECTION_REQUEST requests.
63 * Drop any other message.
65 if (!NT_SUCCESS(Status
) ||
66 LPC_CONNECTION_REQUEST
== ConnectMsg
->MessageType
)
68 DPRINT("Got message (type %x)\n", LPC_CONNECTION_REQUEST
);
71 DPRINT("Got message (type %x)\n", ConnectMsg
->MessageType
);