📄 proxy_provider.c
字号:
#endif{ static CMPIPropertyMIFT miFT = { CMPICurrentVersion, CMPICurrentVersion, "Property" "RemoteCMPI", __PropertyMI_cleanup, __PropertyMI_setProperty, __PropertyMI_getProperty }; RemoteCMPIPropertyMI *mi = (RemoteCMPIPropertyMI *) calloc(1, sizeof(RemoteCMPIPropertyMI)); TRACE_NORMAL(("Creating proxy provider handle for: %s", provider)); CMPI_BrokerExt_Ftab=broker->xft; mi->ref.ft = &miFT; mi->provider = strdup(provider); mi->broker = broker; mi->ticket = generate_ticket(broker); return (CMPIPropertyMI *) mi;};#ifdef CMPI_VER_100static CMPIStatus __IndicationMI_cleanup(CMPIIndicationMI * cThis, const CMPIContext * ctx, CMPIBoolean term)#elsestatic CMPIStatus __IndicationMI_cleanup(CMPIIndicationMI * cThis, CMPIContext * ctx)#endif{ RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis; TRACE_NORMAL(("Cleaning up proxy provider handle for: %s", rcThis->provider)); unload_provider_comms(); if (revoke_ticket(&rcThis->ticket)) { TRACE_CRITICAL(("ticket could not be revoked.")); CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "could not revoke ticket"); }; cleanup_if_last(); free(rcThis->provider); free(rcThis); CMReturn(CMPI_RC_OK);};#ifdef CMPI_VER_100static CMPIStatus __IndicationMI_authorizeFilter(CMPIIndicationMI * cThis, const CMPIContext * ctx, const CMPISelectExp * filter, const char *indType, const CMPIObjectPath * cop, const char *owner)#elsestatic CMPIStatus __IndicationMI_authorizeFilter(CMPIIndicationMI * cThis, CMPIContext * ctx, CMPIResult * rslt, CMPISelectExp * filter, const char *indType, CMPIObjectPath * cop, const char *owner)#endif{ CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL }; RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis; provider_address *addr, *tmp; TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.", rcThis->provider)); tmp = addr = resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL); for (; addr != NULL; addr = addr->next) { provider_comm *comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx); if (comm != NULL) {#ifdef CMPI_VER_100 rc = comm->IndicationMI_authorizeFilter(addr, rcThis, ctx, filter, indType, cop,owner);#else // IBMKR: This looks like a wrong prototype. rc = comm->IndicationMI_authorizeFilter(addr, rcThis, ctx, rslt, cop, filter, indType, owner);#endif } else { tmp->destructor(tmp); CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "comm-layer not found"); } if (rc.rc != CMPI_RC_OK) { tmp->destructor(tmp); return rc; } }#ifndef CMPI_VER_100 CMReturnDone(rslt);#endif if (tmp) tmp->destructor(tmp); else CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "could not resolve location"); return rc;};#ifdef CMPI_VER_100static CMPIStatus __IndicationMI_mustPoll(CMPIIndicationMI * cThis, const CMPIContext * ctx, const CMPISelectExp * filter, const char *indType, const CMPIObjectPath * cop)#elsestatic CMPIStatus __IndicationMI_mustPoll(CMPIIndicationMI * cThis, CMPIContext * ctx, CMPIResult * rslt, CMPISelectExp * filter, const char *indType, CMPIObjectPath * cop)#endif{ CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL }; RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis; provider_address *addr, *tmp; TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.", rcThis->provider)); tmp = addr = resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL); for (; addr != NULL; addr = addr->next) { provider_comm *comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx); if (comm != NULL) {#ifdef CMPI_VER_100 rc = comm->IndicationMI_mustPoll(addr, rcThis, ctx, filter, indType, cop);#else //IBMKR: The set of arguments looks wrong? rc = comm->IndicationMI_mustPoll(addr, rcThis, ctx, rslt, cop, filter, indType);#endif } else { tmp->destructor(tmp); CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "comm-layer not found"); } if (rc.rc != CMPI_RC_OK) { tmp->destructor(tmp); return rc; } }#ifndef CMPI_VER_100 CMReturnDone(rslt);#endif if (tmp) tmp->destructor(tmp); else CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "could not resolve location"); return rc;};#ifdef CMPI_VER_100static CMPIStatus __IndicationMI_activateFilter(CMPIIndicationMI * cThis, const CMPIContext * ctx, const CMPISelectExp * filter, const char *indType, const CMPIObjectPath * cop, CMPIBoolean firstActivation)#elsestatic CMPIStatus __IndicationMI_activateFilter(CMPIIndicationMI * cThis, CMPIContext * ctx, CMPIResult * rslt, CMPISelectExp * filter, const char *indType, CMPIObjectPath * cop, CMPIBoolean firstActivation)#endif{ CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL }; RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis; provider_address *addr, *tmp; TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.", rcThis->provider)); tmp = addr = resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL); for (; addr != NULL; addr = addr->next) { provider_comm *comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx); if (comm != NULL) {#ifdef CMPI_VER_100 rc = comm->IndicationMI_activateFilter(addr, rcThis, ctx, filter, indType,cop, firstActivation);#else // IBMKR: This function prototype looks wrong. rc = comm->IndicationMI_activateFilter(addr, rcThis, ctx, rslt, cop, filter, indType, firstActivation);#endif } else { tmp->destructor(tmp); CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "comm-layer not found"); } if (rc.rc != CMPI_RC_OK) { tmp->destructor(tmp); return rc; } }#ifndef CMPI_VER_100 CMReturnDone(rslt);#endif if (tmp) tmp->destructor(tmp); else CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "could not resolve location"); return rc;};#ifdef CMPI_VER_100static CMPIStatus __IndicationMI_deActivateFilter(CMPIIndicationMI * cThis, const CMPIContext * ctx, const CMPISelectExp * filter, const char *indType, const CMPIObjectPath * cop, CMPIBoolean lastActivation)#elsestatic CMPIStatus __IndicationMI_deActivateFilter(CMPIIndicationMI * cThis, CMPIContext * ctx, CMPIResult * rslt, CMPISelectExp * filter, const char *indType, CMPIObjectPath * cop, CMPIBoolean lastActivation)#endif{ CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL }; RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis; provider_address *addr, *tmp; TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.", rcThis->provider)); tmp = addr = resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL); for (; addr != NULL; addr = addr->next) { provider_comm *comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx); if (comm != NULL) {#if defined (CMPI_VER_100) rc = comm->IndicationMI_deActivateFilter(addr, rcThis, ctx, filter,indType, cop, lastActivation);#else rc = comm->IndicationMI_deActivateFilter(addr, rcThis, ctx, rslt, cop, filter, indType, lastActivation);#endif } else { tmp->destructor(tmp); CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "comm-layer not found"); } if (rc.rc != CMPI_RC_OK) { tmp->destructor(tmp); return rc; } }#ifndef CMPI_VER_100 CMReturnDone(rslt);#endif if (tmp) tmp->destructor(tmp); else CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED, "could not resolve location"); return rc;};#ifdef CMPI_VER_100static CMPIStatus __IndicationMI_enableIndications(CMPIIndicationMI * cThis, const CMPIContext *ctx)#elsestatic CMPIStatus __IndicationMI_enableIndications(CMPIIndicationMI * cThis)#endif{ CMPIObjectPath *cop = NULL; CMPIStatus rc; RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis; provider_address *addr, *tmp; TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.", rcThis->provider)); tmp = addr = resolve_class (rcThis->broker, ctx, cop, rcThis->provider, NULL); for (; addr != NULL; addr = addr->next) { provider_comm *comm = load_provider_comm (addr->comm_layer_id, rcThis->broker, ctx); if (comm != NULL) {#if defined (CMPI_VER_100) rc = comm->IndicationMI_enableIndications (addr, rcThis, ctx);#else rc = comm->IndicationMI_enableIndications (addr, rcThis);#endif } else { tmp->destructor (tmp); TRACE_CRITICAL(( "comm-layer not found")); } } if (tmp){ tmp->destructor (tmp); } else { TRACE_CRITICAL(( "could not resolve location"));} return rc;}#ifdef CMPI_VER_100static CMPIStatus __IndicationMI_disableIndications(CMPIIndicationMI * cThis, const CMPIContext *ctx)#elsestatic CMPIStatus __IndicationMI_disableIndications(CMPIIndicationMI * cThis)#endif{ CMPIObjectPath *cop = NULL; CMPIStatus rc; RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis; provider_address *addr, *tmp; TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.", rcThis->provider)); tmp = addr = resolve_class (rcThis->broker, ctx, cop, rcThis->provider, NULL); for (; addr != NULL; addr = addr->next) { provider_comm *comm = load_provider_comm (addr->comm_layer_id, rcThis->broker, ctx); if (comm != NULL) {#if defined (CMPI_VER_100) rc = comm->IndicationMI_disableIndications (addr, rcThis, ctx);#else rc = comm->IndicationMI_disableIndications (addr, rcThis);#endif } else { tmp->destructor (tmp); TRACE_CRITICAL(( "comm-layer not found")); } } if (tmp) { tmp->destructor (tmp); } else { TRACE_CRITICAL(( "could not resolve location"));} return rc;}#ifdef CMPI_VER_100CMPIIndicationMI *_Generic_Create_IndicationMI(CMPIBroker * broker, const CMPIContext * context, const char *provider, CMPIStatus *rc)#elseCMPIIndicationMI *_Generic_Create_IndicationMI(CMPIBroker * broker, CMPIContext * context, const char *provider)#endif{ static CMPIIndicationMIFT miFT = { CMPICurrentVersion, CMPICurrentVersion, "Indication" "RemoteCMPI", __IndicationMI_cleanup, __IndicationMI_authorizeFilter, __IndicationMI_mustPoll, __IndicationMI_activateFilter, __IndicationMI_deActivateFilter, __IndicationMI_enableIndications, __IndicationMI_disableIndications, }; RemoteCMPIIndicationMI *mi = (RemoteCMPIIndicationMI *) calloc(1, sizeof (RemoteCMPIIndicationMI)); TRACE_NORMAL(("Creating proxy provider handle for: %s", provider)); CMPI_BrokerExt_Ftab=broker->xft; mi->ref.ft = &miFT; mi->provider = strdup(provider); mi->broker = broker; mi->ticket = generate_ticket(broker); return (CMPIIndicationMI *) mi;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -