ClearBox Server™ v1.2 Developer's Guide

ISynchronizer::GetSynchronizerInfo

Called by server when it attempts to get synchronization information from the NAS for the first time and must create synchronization object.

HRESULT GetSynchronizerInfo(
	[in] long nasIPAddr,
	[out] BSTR * progID,
	[out] BSTR * authority,
	[out] VARIANT_BOOL * success);

Parameters

nasIPAddr
[in] IP address of the NAS for which information is requested.
progID
[out] Extension must allocate this parameter as a string containing ProgID of synchronizer object which should be created for the specified NAS. If there's no corresponding ProgID, this parameter must be ignored.
authority
[out] Extension may set this parameter to authority string which may be required by synchronization object to initialize itself properly (e.g., password or SNMP community).
success
[out] Specifies whether extension supplies requested information in progID and authority (VARIANT_TRUE), or not (VARIANT_FALSE).

Return Values

If extension returns error code, it is assumed that no synchronizer should be created as if success was set to VARIANT_FALSE.

Thread Safety

This method is called in context of SYNC thread. (See Server Threads Model for details.) You should synchronize data which is shared with other threads.

Memory Management

Extension may allocate memory for progID and authority calling SysAllocString, and it is freed by server.

Remarks

Some synchronizators may require more than one authority string (e.g. both username and password). In this case server extension may pass two strings as one authority string, separated by some special symbol which cannot be member of any of these strings.

Example Code

This code makes server create synchronization module with specified ProgID and authority if NAS IP address is 192.168.2.1, no module is created for other NASes.

STDMETHODIMP CTest::GetSynchronizerInfo(long nasIPAddr,
	BSTR * progID, BSTR * authority, VARIANT_BOOL * success)
{
	in_addr addr;
	addr.S_un.S_addr=nasIPAddr;
	if (strcmp(inet_ntoa(addr),"192.168.2.1")==0)
	{
		*success=VARIANT_FALSE;
		*authority=SysAllocString(L"public");
		*progID=SysAllocString(L"SomeSynchro.SNMP.1");
	}
	else
		*success=VARIANT_FALSE;
	return S_OK;
}

See Also

ISynchronizer, Synchronization concepts, Synchronization process


© 2001-2003 XPerience Technologies. www.xperiencetech.com

Created by chm2web html help conversion utility.