CMPI 2.1.0 API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Generic MI factory function

CMPI_EXTERN_C CMPI<mitype>MI* Generic_Create<mitype>MI( const CMPIBroker* mb, const CMPIContext* ctx, const char* miName, CMPIStatus* rc);

_Generic_Create_<mitype>MI() is a generic factory function for an MI and is responsible for intializing the MI of type <mitype>\ with the name passed in miName.

<mitype> can be one of:

While this function executes, the MB will not call any other MI functions for this MI. This function will be called once for a specific MI, even if that MI services more than one namespace.

This function shall be declared with the CMPI_EXTERN_C modifier or an equivalent modifier; the name of this function shall be exported from the MI load library.

mbPoints to a CMPIBroker structure. This structure can be used throughout the life of this MI function group to invoke MB services.
ctxPoints to a CMPIContext object containing the context data for the invocation. This CMPIContext object contains the CMPIInitNameSpace entry indicating the namespace for which this MI is to be initialized. If this MI services more than one namespace, the CMPIInitNameSpace entry indicates one of those namespaces.
miNameName of the MI to be initialized.
[out]rcPoints to a CMPIStatus structure that upon return shall have been updated with the function return status.

If successful, a pointer to a valid CMPI<mitype>MI structure (CMPIInstanceMI, CMPIAssociationMI, CMPIPropertyMI, CMPIMethodMI, CMPIIndicationMI) for the MI identified by <mitype> and miName shall be returned, and the MB will consider this MI to be initialized (that is, functioning).

If not successful, NULL shall be returned, and the MI identified by <mitype> and miName is considered uninitialized (that is, malfunctioning) and will not be used by the MB. Specifically, the cleanup function for this MI (e.g. CMPIInstanceMIFT.cleanup()) will not be invoked by the MB in that case.

The following CMPIrc codes shall be used by the MI in the function return status:
  • CMPI_RC_OK - Function successful.
  • CMPI_RC_ERR_NOT_FOUND - MI name not found.
  • CMPI_RC_ERR_NOT_SUPPORTED - MI type not supported for this MI name.
  • CMPI_RC_ERR_ACCESS_DENIED - Not authorized.
  • CMPI_RC_ERR_FAILED - Other error occurred.
CMPI 2.1 documented these return codes for the first time. For backwards compatibility, MBs conforming to CMPI 2.1 that use MIs conforming to prior CMPI releases shall tolerate other uses of these return codes as well as additional return codes.
The _Generic_Create_PropertyMI() function is deprecated since CMPI 2.1, in accord with the deprecation of property client operations in DMTF specifications.