added ipcModuleUtil.h to simplify using the new plug-in API
git-svn-id: svn://10.0.0.236/trunk@133267 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include "ipcModule.h"
|
||||
#include "ipcModuleUtil.h"
|
||||
#include "ipcMessage.h"
|
||||
|
||||
IPC_EXPORT int IPC_GetModules(ipcDaemonMethods *, ipcModuleEntry **);
|
||||
|
||||
static const nsID TestModuleID =
|
||||
{ /* e628fc6e-a6a7-48c7-adba-f241d1128fb8 */
|
||||
0xe628fc6e,
|
||||
@@ -12,8 +10,6 @@ static const nsID TestModuleID =
|
||||
{0xad, 0xba, 0xf2, 0x41, 0xd1, 0x12, 0x8f, 0xb8}
|
||||
};
|
||||
|
||||
static ipcDaemonMethods *gDaemonMethods;
|
||||
|
||||
struct TestModule
|
||||
{
|
||||
static void Shutdown()
|
||||
@@ -27,29 +23,20 @@ struct TestModule
|
||||
ipcMessage outMsg;
|
||||
static const char buf[] = "pong";
|
||||
outMsg.Init(TestModuleID, buf, sizeof(buf));
|
||||
gDaemonMethods->sendMsg(client, &outMsg);
|
||||
IPC_SendMsg(client, &outMsg);
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
IPC_GetModules(ipcDaemonMethods *daemonMeths, ipcModuleEntry **entries)
|
||||
static ipcModuleMethods gTestMethods =
|
||||
{
|
||||
printf("*** testmodule: IPC_GetModules\n");
|
||||
IPC_MODULE_METHODS_VERSION,
|
||||
TestModule::Shutdown,
|
||||
TestModule::HandleMsg
|
||||
};
|
||||
|
||||
static ipcModuleMethods methods =
|
||||
{
|
||||
IPC_MODULE_METHODS_VERSION,
|
||||
TestModule::Shutdown,
|
||||
TestModule::HandleMsg
|
||||
};
|
||||
static ipcModuleEntry moduleEntry =
|
||||
{
|
||||
TestModuleID,
|
||||
&methods
|
||||
};
|
||||
static ipcModuleEntry gTestModuleEntry[] =
|
||||
{
|
||||
{ TestModuleID, &gTestMethods }
|
||||
};
|
||||
|
||||
gDaemonMethods = daemonMeths;
|
||||
|
||||
*entries = &moduleEntry;
|
||||
return 1;
|
||||
}
|
||||
IPC_IMPL_GETMODULES(TestModule, gTestModuleEntry)
|
||||
|
||||
Reference in New Issue
Block a user