⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proxy_provider.c

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 C
📖 第 1 页 / 共 3 页
字号:
};#ifdef CMPI_VER_100static CMPIStatus __AssociationMI_cleanup(CMPIAssociationMI * cThis,					  const CMPIContext * ctx, CMPIBoolean term)#elsestatic CMPIStatus __AssociationMI_cleanup(CMPIAssociationMI * cThis,					  CMPIContext * ctx)#endif{    RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) 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);};static CMPIStatus __AssociationMI_associators(CMPIAssociationMI * cThis,					      CONST CMPIContext * ctx,					      CONST CMPIResult * rslt,					      CONST CMPIObjectPath * cop,					      const char *assocclass,					      const char *resultclass,					      const char *role, const char *resultrole,					      CONST char **props){    CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };    RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) 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) {	    rc = comm->AssociationMI_associators(addr, rcThis, ctx, rslt,						 cop, assocclass,						 resultclass, role,						 resultrole, props);	} 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;	}    }    CMReturnDone(rslt);    if (tmp)	tmp->destructor(tmp);    else	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,			  "could not resolve location");    return rc;};static CMPIStatus __AssociationMI_associatorNames(CMPIAssociationMI *						  cThis, 						  CONST CMPIContext * ctx,						  CONST CMPIResult * rslt,						  CONST CMPIObjectPath * cop,						  const char *assocclass,						  const char *resultclass,						  const char *role, const char *resultrole){    CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };    RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) 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) {	    rc = comm->AssociationMI_associatorNames(addr, rcThis, ctx,						     rslt, cop, assocclass,						     resultclass, role,						     resultrole);	} 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;	}    }    CMReturnDone(rslt);    if (tmp)	tmp->destructor(tmp);    else	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,			  "could not resolve location");    return rc;};static CMPIStatus __AssociationMI_references(CMPIAssociationMI * cThis,					     CONST CMPIContext * ctx,					     CONST CMPIResult * rslt,					     CONST CMPIObjectPath * cop,					     const char *assocclass, const char *role,					     CONST char **props){    CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };    RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) 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) {	    rc = comm->AssociationMI_references(addr, rcThis, ctx, rslt,						cop, assocclass, role, props);	} 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;	}    }    CMReturnDone(rslt);    if (tmp)	tmp->destructor(tmp);    else	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,			  "could not resolve location");    return rc;};static CMPIStatus __AssociationMI_referenceNames(CMPIAssociationMI * cThis,						 CONST CMPIContext * ctx,						 CONST CMPIResult * rslt,						 CONST CMPIObjectPath * cop,						 const char *assocclass, const char *role){    CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };    RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) 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) {	    rc = comm->AssociationMI_referenceNames(addr, rcThis, ctx,						    rslt, cop, assocclass,						    role);	} 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;	}    }    CMReturnDone(rslt);    if (tmp)	tmp->destructor(tmp);    else	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,			  "could not resolve location");    return rc;};#ifdef CMPI_VER_100CMPIAssociationMI *_Generic_Create_AssociationMI(const CMPIBroker * broker,						 const CMPIContext * context,						 const char *provider,						 CMPIStatus *rc)#elseCMPIAssociationMI *_Generic_Create_AssociationMI(CMPIBroker * broker,						 CMPIContext * context,						 const char *provider)#endif{    static CMPIAssociationMIFT miFT = { CMPICurrentVersion, CMPICurrentVersion,	"Association" "RemoteCMPI", __AssociationMI_cleanup,	    __AssociationMI_associators,	__AssociationMI_associatorNames, __AssociationMI_references,	__AssociationMI_referenceNames    };    RemoteCMPIAssociationMI *mi = (RemoteCMPIAssociationMI *) calloc(1,								     sizeof								     (RemoteCMPIAssociationMI));    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 (CMPIAssociationMI *) mi;};#ifdef CMPI_VER_100static CMPIStatus __MethodMI_cleanup(CMPIMethodMI * cThis, const CMPIContext * ctx, CMPIBoolean term)#elsestatic CMPIStatus __MethodMI_cleanup(CMPIMethodMI * cThis, CMPIContext * ctx)#endif{    RemoteCMPIMethodMI *rcThis = (RemoteCMPIMethodMI *) 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);};static CMPIStatus __MethodMI_invokeMethod(CMPIMethodMI * cThis,					  CONST CMPIContext * ctx,					  CONST CMPIResult * rslt,					  CONST CMPIObjectPath * cop,					  const char *method, CONST CMPIArgs * in,					  CMPIArgs * out){    CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };    RemoteCMPIMethodMI *rcThis = (RemoteCMPIMethodMI *) cThis;    provider_address *addr;    provider_comm *comm;    TRACE_NORMAL(("Executing single-targeted remote provider "		   "call for: %s.", rcThis->provider));    if ((addr =	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);	if (comm != NULL) {	    rc = comm->MethodMI_invokeMethod(addr, rcThis, ctx, rslt, cop,					     method, in, out);	    CMReturnDone(rslt);	}	addr->destructor(addr);    } else	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,			  "could not resolve location");    return rc;};#ifdef CMPI_VER_100CMPIMethodMI *_Generic_Create_MethodMI(CMPIBroker * broker,				       const CMPIContext * context,				       const char *provider, 				       CMPIStatus *rc)#elseCMPIMethodMI *_Generic_Create_MethodMI(CMPIBroker * broker,				       CMPIContext * context,				       const char *provider)#endif{    static CMPIMethodMIFT miFT =	{ CMPICurrentVersion, CMPICurrentVersion, "Method" "RemoteCMPI",	__MethodMI_cleanup, __MethodMI_invokeMethod    };    RemoteCMPIMethodMI *mi =	(RemoteCMPIMethodMI *) calloc(1, sizeof(RemoteCMPIMethodMI));    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 (CMPIMethodMI *) mi;};#ifdef CMPI_VER_100static CMPIStatus __PropertyMI_cleanup(CMPIPropertyMI * cThis,				       const CMPIContext * ctx,				       CMPIBoolean term)#elsestatic CMPIStatus __PropertyMI_cleanup(CMPIPropertyMI * cThis,				       CMPIContext * ctx)#endif{    RemoteCMPIPropertyMI *rcThis = (RemoteCMPIPropertyMI *) 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);};static CMPIStatus __PropertyMI_setProperty(CMPIPropertyMI * cThis,					   CONST CMPIContext * ctx,					   CONST CMPIResult * rslt,					   CONST CMPIObjectPath * cop,					   const char *name, CONST CMPIData data){    CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };    RemoteCMPIPropertyMI *rcThis = (RemoteCMPIPropertyMI *) cThis;    provider_address *addr;    provider_comm *comm;    TRACE_NORMAL(("Executing single-targeted remote provider "		   "call for: %s.", rcThis->provider));    if ((addr =	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);	if (comm != NULL) {	    rc = comm->PropertyMI_setProperty(addr, rcThis, ctx, rslt, cop,					      name, data);	    CMReturnDone(rslt);	}	addr->destructor(addr);    } else	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,			  "could not resolve location");    return rc;};static CMPIStatus __PropertyMI_getProperty(CMPIPropertyMI * cThis,					   CONST CMPIContext * ctx,					   CONST CMPIResult * rslt,					   CONST CMPIObjectPath * cop, const char *name){    CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };    RemoteCMPIPropertyMI *rcThis = (RemoteCMPIPropertyMI *) cThis;    provider_address *addr;    provider_comm *comm;    TRACE_NORMAL(("Executing single-targeted remote provider "		   "call for: %s.", rcThis->provider));    if ((addr =	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);	if (comm != NULL) {	    rc = comm->PropertyMI_getProperty(addr, rcThis, ctx, rslt, cop,					      name);	    CMReturnDone(rslt);	}	addr->destructor(addr);    } else      {	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,			  "could not resolve location");      }    return rc;};#ifdef CMPI_VER_100CMPIPropertyMI *_Generic_Create_PropertyMI(CMPIBroker * broker,					   const CMPIContext * context,					   const char *provider,					   CMPIStatus *rc)#elseCMPIPropertyMI *_Generic_Create_PropertyMI(CMPIBroker * broker,					   CMPIContext * context,					   const char *provider)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -