1 /* $Id: port.c,v 1.18 2004/08/04 12:50:42 ea Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/port.c
6 * PURPOSE: Communication mechanism
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 * ntoskrnl/nt/port.c moved in ntoskrnl/lpc/port.c
15 /* INCLUDES *****************************************************************/
19 #include <ddk/ntddk.h>
20 #include <internal/ob.h>
21 #include <internal/port.h>
22 #include <internal/dbg.h>
23 #include <internal/pool.h>
24 #include <rosrtl/string.h>
27 #include <internal/debug.h>
30 /* GLOBALS *******************************************************************/
32 POBJECT_TYPE ExPortType
= NULL
;
33 ULONG EiNextLpcMessageId
= 0;
35 static GENERIC_MAPPING ExpPortMapping
= {
37 STANDARD_RIGHTS_WRITE
,
41 /* FUNCTIONS *****************************************************************/
44 NTSTATUS INIT_FUNCTION
47 ExPortType
= ExAllocatePool(NonPagedPool
,sizeof(OBJECT_TYPE
));
49 RtlRosInitUnicodeStringFromLiteral(&ExPortType
->TypeName
,L
"Port");
51 ExPortType
->Tag
= TAG('L', 'P', 'R', 'T');
52 ExPortType
->MaxObjects
= ULONG_MAX
;
53 ExPortType
->MaxHandles
= ULONG_MAX
;
54 ExPortType
->TotalObjects
= 0;
55 ExPortType
->TotalHandles
= 0;
56 ExPortType
->PagedPoolCharge
= 0;
57 ExPortType
->NonpagedPoolCharge
= sizeof(EPORT
);
58 ExPortType
->Mapping
= &ExpPortMapping
;
59 ExPortType
->Dump
= NULL
;
60 ExPortType
->Open
= NULL
;
61 ExPortType
->Close
= NiClosePort
;
62 ExPortType
->Delete
= NiDeletePort
;
63 ExPortType
->Parse
= NULL
;
64 ExPortType
->Security
= NULL
;
65 ExPortType
->QueryName
= NULL
;
66 ExPortType
->OkayToClose
= NULL
;
67 ExPortType
->Create
= NiCreatePort
;
68 ExPortType
->DuplicationNotify
= NULL
;
70 ObpCreateTypeObject(ExPortType
);
72 EiNextLpcMessageId
= 0;
74 return(STATUS_SUCCESS
);
78 /**********************************************************************
83 * Initialize the EPORT object attributes. The Port
84 * object enters the inactive state.
87 * Port Pointer to an EPORT object to initialize.
90 * STATUS_SUCCESS if initialization succedeed. An error code
94 NiInitializePort (IN OUT PEPORT Port
,
96 IN PEPORT Parent OPTIONAL
)
98 if ((Type
!= EPORT_TYPE_SERVER_RQST_PORT
) &&
99 (Type
!= EPORT_TYPE_SERVER_COMM_PORT
) &&
100 (Type
!= EPORT_TYPE_CLIENT_COMM_PORT
))
102 return STATUS_INVALID_PARAMETER_2
;
104 memset (Port
, 0, sizeof(EPORT
));
105 KeInitializeSpinLock (& Port
->Lock
);
106 KeInitializeSemaphore( &Port
->Semaphore
, 0, LONG_MAX
);
107 Port
->RequestPort
= Parent
;
108 Port
->OtherPort
= NULL
;
109 Port
->QueueLength
= 0;
110 Port
->ConnectQueueLength
= 0;
112 Port
->State
= EPORT_INACTIVE
;
113 InitializeListHead (& Port
->QueueListHead
);
114 InitializeListHead (& Port
->ConnectQueueListHead
);
116 return (STATUS_SUCCESS
);
120 /* MISCELLANEA SYSTEM SERVICES */
123 /**********************************************************************
125 * NtImpersonateClientOfPort/2
136 NtImpersonateClientOfPort (HANDLE PortHandle
,
137 PLPC_MESSAGE ClientMessage
)
140 return(STATUS_NOT_IMPLEMENTED
);