eimRetrieveConfiguration()--Retrieve EIM Configuration


  Syntax
 #include <eim.h>

 int eimRetrieveConfiguration(unsigned int     lengthOfEimConfig,
                              EimConfig      * configData,
                              int              ccsid,
			      EimRC          * eimrc)
  Service Program Name: QSYS/QSYEIM

  Default Public Authority: *USE

  Threadsafe: Yes

The eimRetrieveConfiguration() function retrieves the EIM configuration information for this system.


Authorities and Locks

No authorization is required.


Parameters

lengthOfEimConfig  (Input)
The number of bytes provided by the caller for the configuration information. Minimal size required is 36 bytes.

configData  (Output)
A pointer to the data to be returned.

The EimConfig structure contains information about the returned data. The API will return as much data as space has been provided.

EimConfig structure:

   typedef struct EimConfig
   {
       unsigned int bytesReturned;     /* Number of bytes actually returned
                                        by the API.                      */
       unsigned int bytesAvailable;    /* Number of bytes of available data
                                        that could have been returned by
                                        the API.                         */
       int          enable;            /* Flag to indicate if enabled to
                                          participate in EIM domain  
                                          0 = not enabled
                                          1 = enabled                    */
       EimListData  ldapURL;           /* ldap URL for domain controller */
       EimListData  localRegistry;     /* Local system registry          */
       EimListData  kerberosRegistry;  /* Kerberos registry              */

       EimListData  x509Registry;      /* X.509 registry                 */

   } EimConfig;

EimListData structure:

   typedef struct EimListData
   {
       unsigned int length;            /* Length of data                 */
       unsigned int disp;              /* Displacement to data.  This byte
                                        offset is relative to the start of
                                        the parent structure; that is, the
                                        structure containing this
                                        structure.                       */
   } EimListData;
ccsid   (Input)
The ccsid for the output data. If the ccsid is 0 or 65535 the default job ccsid will be used.

eimrc  (Input/Output)
The structure in which to return error code information. If the return value is not 0, eimrc is set with additional information. This parameter may be NULL. For the format of the structure, see EimRC--EIM Return Code Parameter.


Return Value

The return value from the API. Following each return value is the list of possible values for the messageCatalogMessageID field in the eimrc parameter for that value.

0
Request was successful.

EBADDATA
eimrc is not valid.

ECONVERT
Data conversion error.

EIMERR_DATA_CONVERSION (13) Error occurred when converting data between code pages.

EINVAL
Input parameter was not valid.

EIMERR_CCSID_INVAL (8) CCSID is outside of valid range or CCSID is not supported.
EIMERR_CONFIG_SIZE (10) Length of EimConfig is not valid.
EIMERR_PARM_REQ (34) Missing required parameter. Please check API documentation.
EIMERR_PTR_INVAL (35) Pointer parameter is not valid.
EIMERR_SPACE (41) Unexpected error accessing parameter.

ENOMEM
Unable to allocate required space.

EIMERR_NOMEM (27) No memory available. Unable to allocate required space.

EUNKNOWN
Unexpected exception.

EIMERR_LDAP_ERR (23) Unexpected LDAP error. %s
EIMERR_UNKNOWN (44) Unknown error or unknown system state.

Related Information


Example

See Code disclaimer information for information pertaining to code examples.

The following example retrieves the configuration information and prints out the results..

#include <eim.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

void printListData(char * fieldName,
                   void * entry,
                   int offset);

int main (int argc, char *argv[])
{
    int           rc;
    char          eimerr[100];
    EimRC       * err;
    char          listData[4000];
    EimConfig   * list = (EimConfig * ) listData;

    /* Set up error structure.                  */
    memset(eimerr,0x00,100);
    err = (EimRC *)eimerr;
    err->memoryProvidedByCaller = 100;
    
    /* Get configuration information            */
    if (0 != (rc = eimRetrieveConfiguration(4000,
                                            list,
                                            0,
                                            err)))
    {
        printf("Retrieve configuration error = %d", rc);
        return -1;
    }

    /* Print the results                        */
    printf("___________\n");
    printf("   bytesReturned    = %d\n", list->bytesReturned);
    printf("   bytesAvailable   = %d\n", list->bytesAvailable);
    printf("\n");

    if (0 == list->enable)
        printf("Disabled.\n");
    else
        printf("Enabled.\n");
    
    printListData("ldap URL",
                  list,
                  offsetof(EimConfig, ldapURL));
    printListData("local Registry",
                  list,
                  offsetof(EimConfig, localRegistry));
    printListData("kerberos registry",
                  list,
                  offsetof(EimConfig, kerberosRegistry));

    printListData("x.509 registry",
                  list,
                  offsetof(EimConfig, x509Registry));


    return 0;
}

void printListData(char * fieldName,
                   void * entry,
                   int offset)
{
    EimListData * listData;
    char * data;
    int dataLength;

    printf("     %s = ",fieldName);
    /* Address the EimListData object */
    listData = (EimListData *)((char *)entry + offset);
    
    /* Print out results */
    data = (char *)entry + listData->disp;
    dataLength = listData->length;
    
    if (dataLength > 0)
        printf("%.*s\n",dataLength, data);
    else
        printf("Not found.\n");
        
}


API introduced: V5R2
Top | Security APIs | APIs by category