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 script versions of online
and offline
entry points. This example implements the VCSAgStartup
, online
, offline
, and monitor
entry points only.
Example: implementing agent using VCSAgStartup, C++, and script entry points
agent.C
and modify the VCSAgStartup()
function (the last several lines) to match the following example:
// Description: This functions registers the entry points //
VCSAG_LOG_INIT("VCSAgStartup");
VCSAgInitEntryPointStruct(V50);
VCSAgSetEntryPoint(VCSAgEPMonitor, res_monitor);
VCSAgSetEntryPoint(VCSAgEPOnline, res_online);
VCSAgSetEntryPoint(VCSAgEPOffline, res_offline);
VCSAgSetEntryPoint(VCSAgEPClean, res_clean);
// Description: Determine if the given file is online (file exists)
// or offline (file does not exist).
VCSAgResState res_monitor(const char *res_name, void
VCSAG_LOG_INIT("res_monitor");
VCSAG_RES_LOG_MSG(VCS_DBG1, VCS_DEFAULT_FLAGS, L"Inside
ret = VCSAgGetEncodedArgList(VCSAgUTF8, attr_val, VCSAgUCS2,
VCSAG_LOG_MSG(VCS_NOTICE, 1001, VCS_DEFAULT_FLAGS,
L"Unable to get the arguments");
ret = vcsag_get_attr_value((wchar_t**)new_args, L"PathName",
attrs = GetFileAttributes(pathName);
VCSAG_RES_LOG_MSG(VCS_DBG1, VCS_DEFAULT_FLAGS, L"Monitor
VCSAgDelEncodedArgList((void**)new_args);
agent.C
and build the agent by invoking make
. (Makefile
is provided.)
FileOnOff
agent built in step 6.
Note
Implement the online
and offline
entry points as instructed in step 3 on page 135.