4
* Copyright 2008 Massachusetts Institute of Technology.
7
* Export of this software from the United States of America may
8
* require a specific license from the United States Government.
9
* It is the responsibility of any person or organization contemplating
10
* export to obtain such a license before exporting.
12
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13
* distribute this software and its documentation for any purpose and
14
* without fee is hereby granted, provided that the above copyright
15
* notice appear in all copies and that both that copyright notice and
16
* this permission notice appear in supporting documentation, and that
17
* the name of M.I.T. not be used in advertising or publicity pertaining
18
* to distribution of the software without specific, written prior
19
* permission. Furthermore if you modify this software you must label
20
* your software as modified software and not distribute it in such a
21
* fashion that it might be confused with the original M.I.T. software.
22
* M.I.T. makes no representations about the suitability of
23
* this software for any purpose. It is provided "as is" without express
24
* or implied warranty.
30
#include "ccs_request.h" // header file generated by MIDL compiler
31
#include "cci_debugging.h"
32
#include "WorkQueue.h"
33
#include "win-utils.h"
34
#include "ccs_win_pipe.h"
37
const long rpcmsg, /* Message type */
38
const char tspHandle[], /* Client's tspdata* */
39
const char* pszUUID, /* Where client will listen for the reply */
40
const long lenRequest, /* Length of buffer */
41
const char pbRequest[], /* Data buffer */
42
const long serverStartTime, /* Which server session we're talking to */
43
long* return_status ) { /* Return code */
47
DWORD* p = (DWORD*)(tspHandle);
48
WIN_PIPE* pipe = NULL;
50
cci_debug_printf("%s rpcmsg:%d; UUID:<%s> SST:<%s>", __FUNCTION__, rpcmsg, pszUUID, serverStartTime);
52
status = (rpcmsg != CCMSG_REQUEST) && (rpcmsg != CCMSG_PING);
55
status = k5_ipc_stream_new (&stream); /* Create a stream for the request data */
58
if (!status) { /* Put the data into the stream */
59
status = k5_ipc_stream_write (stream, pbRequest, lenRequest);
62
pipe = ccs_win_pipe_new(pszUUID, *p);
63
worklist_add(rpcmsg, pipe, stream, serverStartTime);
64
*return_status = status;
69
const long rpcmsg, /* Message type */
70
const char tspHandle[], /* Client's tspdata* */
71
const char* pszUUID, /* Data buffer */
72
long* return_status ) { /* Return code */
74
DWORD* p = (DWORD*)(tspHandle);
75
WIN_PIPE* pipe = ccs_win_pipe_new(pszUUID, *p);
77
cci_debug_printf("%s; rpcmsg:%d; UUID: <%s>", __FUNCTION__, rpcmsg, pszUUID);
81
NULL, /* No payload with connect request */
82
(const time_t)0 ); /* No server session number with connect request */
86
// 'Authentication' is client setting a value in a file and the server
87
// returning that value plus one.
88
CC_UINT32 ccs_authenticate(const CC_CHAR* name) {
94
cci_debug_printf("%s ( %s )", __FUNCTION__, name);
96
hMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, (LPSTR)name);
100
pvalue = (PDWORD)MapViewOfFile(hMap, FILE_MAP_WRITE, 0, 0, 0);
110
UnmapViewOfFile(pvalue);
113
if (hMap) CloseHandle(hMap);
b'\\ No newline at end of file'