VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/ipc/ipcd/test/module/TestModule.cpp@ 1

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1#include <stdio.h>
2#include "ipcModuleUtil.h"
3
4#define TEST_MODULE_ID \
5{ /* e628fc6e-a6a7-48c7-adba-f241d1128fb8 */ \
6 0xe628fc6e, \
7 0xa6a7, \
8 0x48c7, \
9 {0xad, 0xba, 0xf2, 0x41, 0xd1, 0x12, 0x8f, 0xb8} \
10}
11static const nsID kTestModuleID = TEST_MODULE_ID;
12
13struct TestModule
14{
15 static void Init()
16 {
17 printf("*** TestModule::Init\n");
18 }
19
20 static void Shutdown()
21 {
22 printf("*** TestModule::Shutdown\n");
23 }
24
25 static void HandleMsg(ipcClientHandle client,
26 const nsID &target,
27 const void *data,
28 PRUint32 dataLen)
29 {
30 printf("*** TestModule::HandleMsg [%s]\n", (const char *) data);
31
32 static const char buf[] = "pong";
33 IPC_SendMsg(client, kTestModuleID, buf, sizeof(buf));
34 }
35
36 static void ClientUp(ipcClientHandle client)
37 {
38 printf("*** TestModule::ClientUp [%u]\n", IPC_GetClientID(client));
39 }
40
41 static void ClientDown(ipcClientHandle client)
42 {
43 printf("*** TestModule::ClientDown [%u]\n", IPC_GetClientID(client));
44 }
45};
46
47static ipcModuleMethods gTestMethods =
48{
49 IPC_MODULE_METHODS_VERSION,
50 TestModule::Init,
51 TestModule::Shutdown,
52 TestModule::HandleMsg,
53 TestModule::ClientUp,
54 TestModule::ClientDown
55};
56
57static ipcModuleEntry gTestModuleEntry[] =
58{
59 { TEST_MODULE_ID, &gTestMethods }
60};
61
62IPC_IMPL_GETMODULES(TestModule, gTestModuleEntry)
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette