Writing authenticators in C

In the C code base, you need to provide at least four functions to implement an authenticator:
  1. new()
  2. activateMaster()
  3. ctivateSlave()
  4. slaveResponse()
In terms of functionality, functions 2 to 4 behave exactly the same as their Java™ counterpart implementation. If your new() function allocates any private memory, you then have to provide a free() function, which frees the private memory you have allocated.
new()
The new() function is executed when the authenticator is loaded by MQe. It serves as an initialization function for the authenticator. Its main functionality includes:
  • Allocating private memory, if required
  • Notifying the MQe system of the implementations for the activateMaster(), activateSlave(), slaveResponse(), and free() functions
  • Providing initial values for private variables
To notify the MQe of the existence of your implementation, call the mqeClassAlias_add() function, which has the following signature:
     MQERETURN mqeClassAlias_add(MQERETURN * pExceptBlock,
                        MQeStringHndl hWinCEAuthName,
                                 MQeStringHndl hModuleName,
                                  MQeStringHndl hInitFuncName);
In the previous example, the hWinCEAuthName is a string name for the authenticator. The hModuleName is the dynamically loadable library file name in which your authenticator has been compiled into, and the hInitFuncName is the name of your new function, which can be an arbitrary name. The new()function has the following signature:
     MQERETURN new(MQeAttrPlugin_SubclassInitInput * pInput,
                    MQeAuthenticator_SubclassInitOutput * pOutput
               );
The pOutput points to an MQeAuthenticator_SubclassInitOutput structure, which needs to be filled in. The MQeAuthenticator_SubclassInitOutput contains the following fields:
MQEVERSION version;
Assign MQE_CURRENT_VERSION to this variable.
MQeStringHndl hClassName;
Assign the Java class name of the authenticator, MQeString, to this variable.
MQEBOOL regRequired;
Assign MQE_FALSE to this variable.
MQEKEYTYPE keyType;
Assign MQE_KEY_NULL to this variable.
MQeAuthenticator_FreeFunc fFree;
Assign the address of the free() function to this variable.
MQeAuthenticator_ActivateMasterPrepFunc fActivateMasterPrep;
Assign the address of the activateMaster() function to this variable.
MQeAuthenticator_ActivateSlavePrepFunc fActivateSlavePrep;
Assign the address of the activateSlave() function to this variable.
MQeAuthenticator_ProcessSlaveResponseFunc fProcessSlaveResponse;
Assign the address of the activateSlave() function to this variable.
MQeAuthenticator_CloseFunc fClose;
Assign NULL to this variable.
MQEVOID * pSubclassPrivateData;
Assign the address of authenticator's private data memory to this variable.
Any pointers or handles that are not used in the implementation must be initialized to NULL.
free()
The signature of free() is:
MQERETURN free(MQeAuthenticatorHndl  hThis, 
                  MQeAttrPlugin_FreeInput * pInput,
                  MQeAttrPlugin_FreeOutput * pOutput
                 );
If the new() function allocates private memory, the pointer to the allocated memory can be retrieved into a pointer p using:
mqeAuthenticator_getPrivateData(hThis, pExceptBlock, (MQEVOID **) &p);
The pointer can then be used to free the memory. The MQeString assigned to the hClassName in the new() function, if any, are automatically freed by the system when mqeAttrBase_free is called.
activateMaster()
The signature of activateMaster() is:
MQERETURN activateMaster(MQeAuthenticatorHndl   hAuthenticator,
                           MQeAttrPlugin_ActivateMasterPrepInput *pInput,
                           MQeAttrPlugin_ActivateMasterPrepOutput * pOutput
                          );
Refer to description in the corresponding Java section for the required functionality for this function. The pOutput points to an MQeAttrPlugin_ActivateMasterPrepOutput structure which needs to be filled in. The MQeAttrPlugin_ActivateMasterPrepOutput contains the following fields:
MQEINT32 * pOutputDataLen;
Assign the length of the output data for activateSlave() to this variable.
MQEBYTE * pOutputData;
Assign the address of the output data buffer for activateSlave() to this variable.
activateSlave()
The signature of activateSlave() is:
    MQERETURN activateSlave(MQeAuthenticatorHndl hAuthenticator,
                            MQeAttrPlugin_ActivateSlavePrepInput *pInput,
                             MQeAttrPlugin_ActivateSlavePrepOutput *pOutput
                         );
Refer to description in the corresponding Java section for the required functionality for this function. The pInput points to an MQeAttrPlugin_ActivateSlavePrepInput structure which contains the input from the activateMaster() and the pOutput points to an MQeAttrPlugin_ActivateSlavePrepOutput structure which needs to be filled in. The MQeAttrPlugin_ActivateSlavePrepInput contains the following fields:
MQEINT32 * pInputDataLen;
Get the length of the input data from activateMaster() from this variable.
MQEBYTE * pInputData;
Get the address of the input data buffer from activateMaster() from this variable.
The MQeAttrPlugin_ActivateSlavePrepOutput contains the following fields:
MQEINT32 * pOutputDataLen;
Assign the length of the output data for slaveResponse() to this variable.
MQEBYTE * pOutputData;
Assign the address of the output data buffer for slaveResponse() to this variable.
slaveResponse()
The signature of slaveResponse() is:
    MQERETURN slaveResponse(MQeAuthenticatorHndl hAuthenticator,
                        MQeAttrPlugin_ProcessSlaveResponseInput *pInput,
                        MQeAttrPlugin_ProcessSlaveResponseOutput *pOutput
                         );
Refer to description in the corresponding Java section for the required functionality for this function. The pInput points to an MQeAttrPlugin_ProcessSlaveResponseInput structure which contains the input from the activateSlave(). The MQeAttrPlugin_ProcessSlaveResponseInput contains the following fields:
MQEINT32 * pInputDataLen;
Get the length of the input data from activateSlave() from this variable.
MQEBYTE * pInputData;
Get the address of the input data buffer from activateSlave() from this variable.

Terms of use | WebSphere software

(c) Copyright IBM Corporation 2004, 2005. All rights reserved.