1 /* $Id: listen.c,v 1.3 2001/12/02 23:34:42 dwelch 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.
47 EXPORTED NTSTATUS STDCALL
48 NtListenPort (IN HANDLE PortHandle
,
49 IN PLPC_MESSAGE ConnectMsg
)
54 * Wait forever for a connection request.
58 Status
= NtReplyWaitReceivePort(PortHandle
,
63 * Accept only LPC_CONNECTION_REQUEST requests.
64 * Drop any other message.
66 if (!NT_SUCCESS(Status
) ||
67 LPC_CONNECTION_REQUEST
== ConnectMsg
->MessageType
)
69 DPRINT("Got message (type %x)\n", LPC_CONNECTION_REQUEST
);
72 DPRINT("Got message (type %x)\n", ConnectMsg
->MessageType
);