3ba0d6fe7b755ca0efcd220a297b7da61b3964ff
[reactos.git] / posix / server / port / utils.c
1 /* $Id: utils.c,v 1.3 2002/10/29 04:45:58 rex Exp $
2 *
3 * PROJECT : ReactOS / POSIX+ Environment Subsystem Server
4 * FILE : reactos/subsys/psx/server/port/utils.c
5 * DESCRIPTION: LPC port utilities.
6 * DATE : 2002-04-07
7 * AUTHOR : Emanuele Aliberti <eal@users.sf.net>
8 *
9 * --------------------------------------------------------------------
10 *
11 * This software is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version.
15 *
16 * This software is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this software; see the file COPYING. If not, write
23 * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
24 * MA 02139, USA.
25 *
26 * --------------------------------------------------------------------
27 */
28 #include <psxss.h>
29 #include "utils.h"
30
31 /**********************************************************************
32 * PsxCheckConnectionRequest/2
33 *
34 * DESCRIPTION
35 * Check if we can accept the connection request sent to
36 * an LPC port. Protocol version and ConnectionType MUST match.
37 */
38 NTSTATUS STDCALL
39 PsxCheckConnectionRequest (
40 IN OUT PPSX_CONNECT_PORT_DATA pConnectData,
41 IN PSX_CONNECTION_TYPE ConnectionType
42 )
43 {
44 /* Check if the caller is ConnectionType */
45 if (ConnectionType != pConnectData->ConnectionType)
46 {
47 debug_print(
48 L"PSXSS: "__FUNCTION__": ConnectionType=%d, expected %d",
49 pConnectData->ConnectionType,
50 ConnectionType
51 );
52 return STATUS_UNSUCCESSFUL;
53 }
54 /* Check if the LPC protocol version matches */
55 if (PSX_LPC_PROTOCOL_VERSION != pConnectData->Version)
56 {
57 debug_print(
58 L"PSXSS: "__FUNCTION__": Version=%d, expected %d",
59 pConnectData->Version,
60 PSX_LPC_PROTOCOL_VERSION
61 );
62 pConnectData->Version = PSX_LPC_PROTOCOL_VERSION;
63 return STATUS_UNSUCCESSFUL;
64 }
65 return STATUS_SUCCESS;
66 }
67 /* EOF */