Win32 utility to bootstrap the PSX subsystem (it is an optional subsystem, therefore...
[reactos.git] / posix / server / port / utils.c
1 /* $Id: utils.c,v 1.4 2003/12/21 20:11:46 ea 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: %s: ConnectionType=%d, expected %d",
49 TEXT(__FUNCTION__),
50 pConnectData->ConnectionType,
51 ConnectionType
52 );
53 return STATUS_UNSUCCESSFUL;
54 }
55 /* Check if the LPC protocol version matches */
56 if (PSX_LPC_PROTOCOL_VERSION != pConnectData->Version)
57 {
58 debug_print(
59 L"PSXSS: %s: Version=%d, expected %d",
60 TEXT(__FUNCTION__),
61 pConnectData->Version,
62 PSX_LPC_PROTOCOL_VERSION
63 );
64 pConnectData->Version = PSX_LPC_PROTOCOL_VERSION;
65 return STATUS_UNSUCCESSFUL;
66 }
67 return STATUS_SUCCESS;
68 }
69 /* EOF */