Each function in the NSSS API can accept an optional parameter of type SS_EXT_T. This parameter has been included to provide access to extended functionality in the API for future expansions without having to change the interface.
// optional extension structuretypedefstruct_ss_extension{unsigned long clientVersion;//* INvoid *extParms;//* IN-pointer to optional data}SS_EXT_T;
A description of the extension structures and example of how to use them are showin in the following sections:
There are two levels of extension structures:
NSSO Function |
Extension Structure |
---|---|
SS_GSINFOEXT_T |
|
SS_READEXT_T |
|
SS_WRITEEXT_T |
|
SS_REMEXT_T |
|
SS_UNLOCKEXT_T |
|
SS_REMSTOREEXT_T |
|
SS_ENUMEXT_T |
|
SS_SETMPEXT_T |
NOTE:Please refer to the Section 5.0, Functions for a discussion of the fields in each of the extension structures mentioned above.
An example of how to use these extension structures is provided in the file sstst.c. Typically, the steps for using the two extension structure levels are:
Allocate storage for the extension structures. This can be done on the stack or as global variables. Typically it makes sense to have only one SS_SERVER_INFO_T structure used by all the function-specific extension structures because it was designed to preserve information between function calls. The structures are initialized as they are allocated in the following code fragment:
/* Structure passed to all API functions. */SS_EXT_T ext = {0};/* Example of structures for individual API functions */SSS_READEXT_T readInfo = {0};SSS_GSINFOEXT_T gsInfo = {0};
Initialize the extension structures. All function-specific extension structures point to the same server information structure:
readInfo.ssServerInfo = &serverInfo;gsInfo.ssServerInfo = &serverInfo;
Prepare to call an API function by placing the address of the function-specific extension structure into the extParms field of the generic extension structure:
ext.clientVersion = NSSS_VERSION_NUMBER;ext.extParms = &gsInfo;
Call the desired API function.
NOTE:If all of the state data (such as changes to context or server information, etc. that can be obtained through an initializing call to NSSSGetServiceInformation and used on subsequent calls) are not provided, each API call initializes the information automatically on entry and destroys it on return. So, when enabling an application that only requires a read from SecretStore, the overhead of initialization is neither required nor recommended through calling NSSSGetServiceInformation.