+Option '--debug-messages' (default off) - variable 'captive_debug_messages'
[reactos.git] / ntoskrnl / lpc / queue.c
1 /* $Id$
2  * 
3  * COPYRIGHT:       See COPYING in the top level directory
4  * PROJECT:         ReactOS kernel
5  * FILE:            ntoskrnl/lpc/queue.c
6  * PURPOSE:         Communication mechanism
7  * PROGRAMMER:      David Welch (welch@cwcom.net)
8  * UPDATE HISTORY:
9  *                  Created 22/05/98
10  */
11
12 /* INCLUDES *****************************************************************/
13
14 #include <ddk/ntddk.h>
15 #include <internal/ob.h>
16 #include <internal/port.h>
17 #include <internal/dbg.h>
18
19 #define NDEBUG
20 #include <internal/debug.h>
21
22 /* FUNCTIONS *****************************************************************/
23
24 VOID STDCALL
25 EiEnqueueMessagePort (IN OUT    PEPORT          Port,
26                       IN        PQUEUEDMESSAGE  Message)
27 {
28   InsertTailList (&Port->QueueListHead,
29                   &Message->QueueListEntry);
30   Port->QueueLength++;
31 }
32
33 VOID STDCALL
34 EiEnqueueMessageAtHeadPort (IN OUT      PEPORT          Port,
35                             IN  PQUEUEDMESSAGE  Message)
36 {
37   InsertTailList (&Port->QueueListHead,
38                   &Message->QueueListEntry);
39   Port->QueueLength++;
40 }
41
42 PQUEUEDMESSAGE STDCALL
43 EiDequeueMessagePort (IN OUT    PEPORT  Port)
44 {
45   PQUEUEDMESSAGE        Message;
46   PLIST_ENTRY   entry;
47   
48   if (IsListEmpty(&Port->QueueListHead))
49     {
50       return(NULL);
51     }
52   entry = RemoveHeadList (&Port->QueueListHead);
53   Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
54   Port->QueueLength--;
55    
56   return (Message);
57 }
58
59
60 VOID STDCALL
61 EiEnqueueConnectMessagePort (IN OUT     PEPORT          Port,
62                              IN PQUEUEDMESSAGE  Message)
63 {
64   InsertTailList (&Port->ConnectQueueListHead,
65                   &Message->QueueListEntry);
66   Port->ConnectQueueLength++;
67 }
68
69
70 PQUEUEDMESSAGE STDCALL
71 EiDequeueConnectMessagePort (IN OUT     PEPORT  Port)
72 {
73   PQUEUEDMESSAGE        Message;
74   PLIST_ENTRY   entry;
75   
76   if (IsListEmpty(&Port->ConnectQueueListHead))
77     {
78       return(NULL);
79     }
80   entry = RemoveHeadList (&Port->ConnectQueueListHead);
81   Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
82   Port->ConnectQueueLength--;
83   
84   return (Message);
85 }
86
87
88 /* EOF */