The following example shows how to build the FileOnOff agent using your own VCSAgStartup
entry point, the C++ version of the monitor
entry point, and the script version of online
and offline
entry points. This example implements the VCSAgStartup
, online
, offline
, and monitor
entry points only.
Note To build an agent, you must first install Visual C++ on the system on which the agent will be built.
Example: implementing agent using VCSAgStartup, C++ and script entry points
C:\> md %VCS_HOME%\src\agent\FileOnOff
C:\> copy %VCS_HOME%\src\agent\Sample\* %VCS_HOME%\src\
C:\> cd %VCS_HOME%\src\agent\FileOnOff
sample.C
and modify the VCSAgStartup()
function (the last several lines) to match the following example:
VCSAG_LOG_INIT("VCSAgStartup");
VCSAgInitEntryPointStruct(V50);
VCSAgSetEntryPoint(VCSAgEPMonitor, res_monitor);
// This is a C++ implementation of the monitor entry
// point for the FileOnOff resource type. This function
// determines the status of a FileOnOff resource
// by checking if the corresponding file exists. It
// is assumed that the complete pathname of the file will
// be passed as the first ArgList attribute.
VCSAgResState res_monitor(const char *res_name, void
// Initialize the OUT parameters.
VCSAG_LOG_INIT("res_monitor");
VCSAG_RES_LOG_MSG(VCS_DBG1, VCS_DEFAULT_FLAGS,
ret = VCSAgGetEncodedArgList(VCSAgUTF8, attr_val,
VCSAG_LOG_MSG(VCS_NOTICE, 1001, VCS_DEFAULT_FLAGS,
L"Unable to get the arguments");
attrs = GetFileAttributes(new_args[0]);
VCSAG_RES_LOG_MSG(VCS_DBG1, VCS_DEFAULT_FLAGS, L"Monitor
VCSAgDelEncodedArgList((void**)new_args);
C:\> md %VCS_HOME%\bin\FileOnOff
%VCS_HOME%\bin\FileOnOff\FileOnOff.dll