eimChangeRegistryAlias()--Change EIM Registry Alias


  Syntax
 #include <eim.h>

 int eimChangeRegistryAlias(EimHandle          * eim,
                            char               * registryName,
                            char               * aliasType,
                            char               * aliasValue,
                            enum EimChangeType   changeType,
                            EimRC              * eimrc)
 
  Service Program Name: QSYS/QSYEIM

  Default Public Authority: *USE

  Threadsafe: Yes

The eimChangeRegistryAlias() function allows you to add or remove a registry alias for the defined registry.

One way to decouple names used by developers and names chosen by administrators is by using registry aliases. When designing applications, developers know the registry type their application uses and choose the registry alias their program will use. Developers communicate to the administrator which registry types their applications depend on along with the EIM registry aliases that must be associated with that registry type. The administrator adds the registry alias to the EIM registry of the appropriate type. The application can use eimGetRegistryNameFromAlias() API which, given a registry alias, returns the registry name for the entry(ies) with that registry alias.


Authorities and Locks

EIM Data
Access to EIM data is controlled by EIM access groups. LDAP administrators also have access to EIM data. The access groups whose members have authority to the EIM data for this API follow:

Parameters

eim  (Input)
The EIM handle returned by a previous call to eimCreateHandle(). A valid connection is required for this function.

registryName  (Input)
The name of the registry to be changed.

aliasType  (Input)
A type of alias for this registry. The user may supply their own alias type. There is a list of predefined alias types in eim.h.

aliasValue  (Input)
The value for this alias.

changeType  (Input)
The type of change to make. This could be add or remove.

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.

EBADNAME
Registry not found or insufficient access to EIM data.

EIMERR_NOREG (28) EIM Registry not found or insufficient access to EIM data.

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_CHGTYPE_INVAL (9) This change type is not valid with the requested attribute. Please check the API documentation.
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.

ENOMEM
Unable to allocate required space.

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

ENOTCONN
LDAP connection has not been made.

EIMERR_NOT_CONN (31) Not connected to LDAP. Use eimConnect() API and try the request again.

EROFS
LDAP connection is for read only. Need to connect to master.

EIMERR_READ_ONLY (36) LDAP connection is for read only. Use eimConnectToMaster() to get a write connection.

EUNKNOWN
Unexpected exception.

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

Restrictions

The wild card character (*) should not be used for registry aliases.

Related Information


Example

See Code disclaimer information for information pertaining to code examples.

The following example adds a couple aliases to the registry.

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

int main(int argc, char *argv[])
{
    int           rc;
    char          eimerr[100];
    EimRC       * err;
    EimHandle   * handle;

    /* 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;

    /* Add a dns alias for this registry       */
    if (0 != (rc = eimChangeRegistryAlias(handle,
                                           "MyRegistry",
                                           EIM_ALIASTYPE_DNS,
                                           "Clueless",
                                           EIM_ADD,
                                           err)))
    {
        printf("Change registry alias error = %d", rc);
        return -1;
    }
    /* Add a tcpip address as an alias         */
    if (0 != (rc = eimChangeRegistryAlias(handle,
                                           "MyRegistry",
                                           EIM_ALIASTYPE_TCPIP,
                                           "9.5.2.12",
                                           EIM_ADD,
                                           err)))
    {
        printf("Change registry alias error = %d", rc);
        return -1;
    }
              
    return 0;
}


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