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:
EIM_HANDLE_CCSID (0) This is the CCSID of character data passed by the caller of EIM APIs with the specified EimHandle. The returned field is a 4 byte integer. EIM_HANDLE_DOMAIN (1) The EIM domain name. EIM_HANDLE_HOST (2) The host system for the EIM domain. EIM_HANDLE_PORT (3) The port for the EIM connection. The returned field is a 4 byte integer. EIM_HANDLE_SECPORT (4) Security type for this connection. The returned field is a 4 byte integer. Possible values: - 0 - Non-SLL
- 1- Port uses SSL
EIM_HANDLE_MASTER_HOST (5) If the EIM_HANDLE_HOST is a replica LDAP server, this value will indicate the master LDAP server. EIM_HANDLE_MASTER_PORT (6) If the EIM_HANDLE_HOST is a replica LDAP server, this value will indicate the port for the master LDAP server. The returned field is a 4 byte integer. EIM_HANDLE_MASTER_SECPORT (7) If the EIM_HANDLE_HOST is a replica LDAP server, this value will indicate the security type for the master LDAP server. The returned field is a 4 byte integer.
- 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.
EIMERR_ACCESS (1) Insufficient access to EIM data.
- EBADDATA
- eimrc is not valid.
- EBUSY
- Unable to allocate internal system object.
EIMERR_NOLOCK (26) Unable to allocate internal system object.
- ECONVERT
- Data conversion error.
EIMERR_DATA_CONVERSION (13) Error occurred when converting data between code pages.
- EINVAL
- Input parameter was not valid.
EIMERR_ATTR_INVAL (5) Attribute name is not valid. EIMERR_ATTRIB_SIZE (53) Length of EimAttribute is not valid. EIMERR_HANDLE_INVAL (17) EimHandle 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.
- 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.
EIMERR_NOT_CONN (31) Not connected to LDAP. Use eimConnect() API and try the request again.
- ENOTSUP
- Attribute type is not supported.
EIMERR_ATTR_NOTSUPP (6) Attribute not supported.
- EUNKNOWN
- Unexpected exception.
EIMERR_LDAP_ERR (23) Unexpected LDAP error. %s EIMERR_UNKNOWN (44) Unknown error or unknown system state.
Related Information
- eimCreateHandle()--Create an EIM
Handle
- eimDestroyHandle()--Destroy an EIM
Handle
- eimSetAttribute()--Set EIM Attributes
- eimConnectToMaster()--Connect to EIM
Master Domain
- eimConnect()--Connect to EIM Domain
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 ]