eimGetAttribute()--Get EIM Attributes


  Syntax
 #include <eim.h>

 int eimGetAttribute(EimHandle          * eim,
                     enum EimHandleAttr   attrName,
                     unsigned int         lengthOfEimAttribute,
                     EimAttribute       * attribute,
         EimRC              * eimrc)

 
  Service Program Name: QSYS/QSYEIM

  Default Public Authority: *USE

  Threadsafe: Yes

The eimGetAttribute() function is used to get attributes for this EIM handle.

The ldap configuration file is used to retrieve information for the master host, master port, and secure port. If the host system is not a replica then the master information retrieved is the same as the host and port defined in the handle.



Authorities and Locks

None.


Parameters

eim  (Input)
The EIM handle returned by a previous call to eimCreateHandle().

attrName  (Input)
The name of the attribute to retrieve. This parameter is passed by value. Following are valid values:


lengthOfEimAttribute  (Input)
The number of bytes provided by the caller for the attribute information. Minimum size required is 16 bytes. This parameter is passed by value.

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

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

EimAttribute structure:

   typedef struct EimAttribute
   {
       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                          */
       EimListData  attribute;         /* handle attribute               */
   } EimAttribute;

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;
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.

EACCES
Access denied. Not enough permissions to access data.


EBADDATA
eimrc is not valid.

EBUSY
Unable to allocate internal system object.


ECONVERT
Data conversion error.


EINVAL
Input parameter was not valid.


ENOMEM
Unable to allocate required space.


ENOTCONN
LDAP connection has not been made. When configured for SSL we cannot retrieve the master information until a connection has been established to the configured system.


ENOTSUP
Attribute type is not supported.


EUNKNOWN
Unexpected exception.


Related Information


Example

The following example will get the domain for the EIM handle.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

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

int main(int argc, char *argv[])
{
    int            rc;
    char           eimerr[100];
    EimRC        * err;
    EimHandle    * handle;
    char         * data;
    char         * listData[1000];
    EimAttribute * list = (EimAttribute *) listData;

    /* Get eim handle from input arg.           */
    /* This handle is already connected to EIM. */
    handle = (EimHandle *)argv[1];

    /* Set up error structure.                  */
    memset(eimerr,0x00,100);
    err = (EimRC *)eimerr;
    err->memoryProvidedByCaller = 100;
    
    /* Get EIM domain name                      */
    if (0 != (rc = eimGetAttribute(handle,
                                   EIM_HANDLE_DOMAIN,
                                   1000,
                                   list,
                                   err)))
        printf("Get Attribute error = %d", rc);

    /* Print results                            */
    printf("   Bytes returned  = %d.\n", list->bytesReturned);
    printf("   Bytes available = %d.\n", list->bytesAvailable);

    printf("   Attr size = %d.\n", list->attribute.length);
    printf("   Attr disp = %d.\n", list->attribute.disp);

    data = (char * )list + list->attribute.disp;

    printf("     %s = %s.\n", "domain name", data);

    return 0;
}


API introduced: V5R2

[ Back to top | Security APIs | APIs by category ]