API Adapter Reference

prevnext

API Recorder Adapter API


An API Recorder Adapter is the interface between the Robot recording extensibility framework and a recording component (proxy library) that captures traffic between a designated target DLL and an application-under-test (AUT). The API Recorder Adapter and proxy library components must be in the same DLL. The recording functions used by the proxy library are documented in Chapter 4.

API Recorder Adapters implement the following calls:

Function Description
IsAPIRecorderAdapter() Identifies an API Recorder Adapter.
GetAPIRecAdapterInfo() Returns information about associated adapters and protocol.
GetApiAndWrapperNamePairs() Returns names of calls to be intercepted and their wrapper names.


IsAPIRecorderAdapter()

Identifies an API Recorder Adapter.


Syntax

BOOL IsAPIRecorderAdapter();

Comments

Return TRUE to indicate that this is an API Recorder Adapter. Any other response disables the adapter.


Example

extern "C"
BOOL LINKDLL IsAPIRecorderAdapter()
{
	 return TRUE;
}

See Also

IsAPIGenFiltExtAdapter(), IsAPISgenAdapter()


GetAPIRecAdapterInfo()

Returns information about associated adapters and protocol.


Syntax

int GetAPIRecAdapterInfo (TCHAR *info, size_t infoSize);


Element Description
info Pointer to a container for adapter information. Copy to this location a string containing the following comma-separated items:
  • The name of the DLL implementing this API recorder adapter.

  • The name of the target DLL. The recording component (proxy) records traffic between this target and the application-under-test. The calls to be intercepted and their corresponding wrapper names are specified by GetApiAndWrapperNamePairs().

  • The name of the Generator Filter Adapter DLL to be used with this adapter.

  • The name of the DLL implementing the API Script Generator Adapter to be used with this recorder adapter.

  • The protocol name. This is the public name (listed on the Generator Filtering tab of the Session Record Options dialog box) of the Generator Filter Adapter DLL, returned by GetDisplayName().

  • A description of this adapter, or "".

  • The version of this adapter, or "".

infoSize INPUT. The size allocated for info, which must not exceed this size.


Comments

Return RSR_SUCCESS to indicate that the call is complete.


Example

An adapter responds to this call as illustrated below. In the terms of this example, the following happens: if a Robot user selects API Recording from the Method tab and MyProtocol from the Generator Filtering tab and activates recording, traffic between the AUT and HelloWorld.dll specified by GetApiAndWrapperNamePairs() is routed to MyAPIRecorder.dll.

extern "C"
int LINKDLL GetApiRecAdapterInfo (TCHAR *info, size_t infoSize)
{
	 static TCHAR buffer[] =
	 	 "MyAPIRecorder.dll,"
	 	 "HellowWorld.dll,"
	 	 "MyGFA.dll,"
	 	 "MySGA.dll,"
	 	 "MyProtocol,"
	 	 "This is an example,"
	 	 "Version 0.1";
	 
	 if (_tcslen(buffer) >= infoSize)
	 	 return RSE_BUFFER_TOO_SHORT;
	 else
	 {
	 	 _tcscpy(info, buffer);
	 	 return RSR_SUCCESS;
	 }
}

See Also

IsAPIRecorderAdapter(), GetApiAndWrapperNamePairs()


GetApiAndWrapperNamePairs()

Returns names of calls to be intercepted and their wrapper names.


Syntax

LPSTR GetApiAndWrapperNamePairs (int *iNumPairs);

Element Description
iNumPairs The number of comma-separated pairs that are returned.


Comments

Your response to this call gives the name of each function call to be intercepted in the dialog between the target DLL and application-under-test, and the function's corresponding wrapper name. Calls to targeted functions are redirected to corresponding functions in the recording component (proxy library) of the API Recorder Adapter DLL.


Example

This example returns two API/wrapper pairs:

extern "C"
LPSTR GetApiAndWrapperNamePairs (int *iNumPairs)
{
	 static TCHAR szPairs[] = 
	 	 "HelloWorld1, pHelloWorld1, HelloWorld2, pHelloWorld2";
	 *iNumPairs = 2;
	 return szPairs;
}

See Also

IsAPIRecorderAdapter(), GetAPIRecAdapterInfo()

prevnext


Session Recording Extensibility Reference Rational Software Corporation
Copyright (c) 2003, Rational Software Corporation http://www.rational.com
support@rational.com
info@rational.com