-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathipc.h
More file actions
58 lines (47 loc) · 1.22 KB
/
ipc.h
File metadata and controls
58 lines (47 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _BREEZE_SIMPLE_IPC_H_
#define _BREEZE_SIMPLE_IPC_H_
#define MAX_NAME_LEN 64
// 4M
#define MEMMAP_SIZE 4 * 1024 *1024
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push, 1)
typedef struct _IpcServer{
HANDLE mapFile;
HANDLE reqEvent;
HANDLE repEvent;
HANDLE readyEvent;
HANDLE doneEvent;
BYTE * buf;
DWORD timeout;
}IpcServer, *PIpcServer;
#pragma warning( push )
#pragma warning(disable:4200)
typedef struct _CommPacket{
ULONG size;
ULONG cmd;
BYTE data[0];
}CommPacket, *PCommPacket;
#pragma warning( pop )
#pragma pack(pop)
#ifdef __cplusplus
IpcServer* ServerCreate(LPCTSTR serverName = NULL);
#else
IpcServer* ServerCreate(LPCTSTR serverName);
#endif
BOOL ServerWaitClientDone(IpcServer* server);
BOOL ServerWaitForRequst(IpcServer* server);
VOID ServerReplied(IpcServer* server);
VOID ServerClose(IpcServer* server);
VOID ServerReady(IpcServer* server);
#ifdef __cplusplus
CommPacket* ClientRequest(ULONG cmd, const BYTE* data, SIZE_T size, LPCTSTR serverName = NULL, DWORD timeout = 1000);
#else
CommPacket* ClientRequest(ULONG cmd, const BYTE* data, SIZE_T size, LPCTSTR serverName, DWORD timeout);
#endif
VOID FreePacket(CommPacket *packet);
#ifdef __cplusplus
}
#endif
#endif