(file) Return to proxy_provider.c CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / CMPIR

   1 karl  1.8 //%2006////////////////////////////////////////////////////////////////////////
   2 schuur 1.1 //
   3 martin 1.6 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   6 schuur 1.1 // IBM Corp.; EMC Corporation, The Open Group.
   7 martin 1.6 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   9            // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
  11 karl   1.8 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
  12            // EMC Corporation; Symantec Corporation; The Open Group.
  13 schuur 1.1 //
  14            // Permission is hereby granted, free of charge, to any person obtaining a copy
  15            // of this software and associated documentation files (the "Software"), to
  16            // deal in the Software without restriction, including without limitation the
  17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  18            // sell copies of the Software, and to permit persons to whom the Software is
  19            // furnished to do so, subject to the following conditions:
  20 martin 1.6 // 
  21 schuur 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
  22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
  23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
  24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29            //
  30            //==============================================================================
  31            //
  32            // Author: Frank Scheffler
  33            //
  34            // Modified By:  Adrian Schuur (schuur@de.ibm.com)
  35            //
  36            //%/////////////////////////////////////////////////////////////////////////////
  37            
  38            /*!
  39              \file proxy_provider.c
  40              \brief Proxy Provider for CMPI to access remote providers.
  41            
  42 schuur 1.1   Remote providers are accessed by the MB through this proxy provider.
  43              The resolver is used to identify the remote peers either with a class-based
  44              object path or an instance-based one, depending on the provider call.
  45            
  46              Create() calls and cleanup() calls will not be relayed to remote locations,
  47              i.e. remote provider will be activated and cleaned up by their remote
  48              brokers automatically. Thus, these calls only gather necessary information,
  49              such as the broker handle.
  50            
  51              The results from the "real" MI calls will be either passed back directly,
  52              in case of an instance call with exactly one peer, or as a combined
  53              result, in case of enumerative calls.
  54            
  55              \author Frank Scheffler
  56            */
  57            
  58            #include <stdio.h>
  59            #include <stdlib.h>
  60            #include <string.h>
  61            #include <errno.h>
  62 konrad.r 1.3 #if defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU)
  63 schuur   1.1 #include <error.h>
  64 r.kieninger 1.2 #endif
  65 schuur      1.1 
  66                 #include "proxy.h"
  67                 #include "resolver.h"
  68                 #include "ticket.h"
  69                 #include "debug.h"
  70                 
  71                 CMPIBrokerExtFT *CMPI_BrokerExt_Ftab=NULL;
  72                 int nativeSide=0;
  73                 #ifdef __GNUC__MULTI__
  74                 
  75                 //! Contains the entities to be passed to an enumerative remote MI request.
  76                 struct enum_thread {
  77                     provider_comm *comm;
  78                     provider_address *addr;
  79                     CMPIContext *ctx;
  80                 };
  81                 
  82                 static CMPI_THREAD_TYPE spawn_enumerate_thread(provider_comm * comm,
  83                 		       provider_address * addr,
  84                 		       CMPIBroker * broker,
  85                 		       CMPIContext * ctx,
  86 schuur      1.1 		       CMPIStatus * (*__thread) (struct enum_thread *))
  87                 {
  88                     CMPI_THREAD_TYPE t;
  89                     struct enum_thread *et = (struct enum_thread *)
  90                 	malloc(sizeof(struct enum_thread));
  91                 
  92                     TRACE_NORMAL(("Spawning enumerative thread for "
  93                 		   "comm-layer \"%s\", address \"%s\"",
  94                 		   comm->id, addr->dst_address));
  95                     et->comm = comm;
  96                     et->addr = addr;
  97                     et->ctx = CBPrepareAttachThread(broker, ctx);
  98                     t=CMPI_BrokerExt_Ftab->newThread( (void *(*)(void *)) __thread, et,0);
  99                     return t;
 100                 }
 101                 
 102                 #endif
 103                 
 104 konrad.r    1.7 void cleanup_if_last ( void )
 105                 {
 106                 	static int cleanup_count = 0;
 107                   
 108                 	// If the counter has been called for all five cleanup
 109                 	// functions: Instance, Association, Indication, Property,
 110                 	// and Method..
 111                 	if (++cleanup_count	>= 5) {
 112                 		// then call all of underlaying cleanup functions.
 113                 		cleanup_ticket();
 114                 		cleanup_count = 0;
 115                  	}
 116                 }
 117                 
 118 konrad.r    1.5 #ifdef CMPI_VER_100
 119                 static CMPIStatus __InstanceMI_cleanup(CMPIInstanceMI * cThis,
 120 konrad.r    1.7 				       const CMPIContext * ctx, CMPIBoolean term)
 121 konrad.r    1.5 #else
 122 schuur      1.1 static CMPIStatus __InstanceMI_cleanup(CMPIInstanceMI * cThis,
 123                 				       CMPIContext * ctx)
 124 konrad.r    1.5 #endif
 125 schuur      1.1 {
 126                     RemoteCMPIInstanceMI *rcThis = (RemoteCMPIInstanceMI *) cThis;
 127                     TRACE_NORMAL(("Cleaning up proxy provider handle for: %s",
 128                 		   rcThis->provider));
 129 marek       1.4 
 130                     unload_provider_comms();
 131                 
 132 schuur      1.1     if (revoke_ticket(&rcThis->ticket)) {
 133                 	TRACE_CRITICAL(("ticket could not be revoked."));
 134                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 135                 			  "could not revoke ticket");
 136                     };
 137 konrad.r    1.7 	cleanup_if_last();
 138 schuur      1.1     free(rcThis->provider);
 139                     free(rcThis);
 140                     CMReturn(CMPI_RC_OK);
 141                 };
 142                 static CMPIStatus __InstanceMI_enumInstanceNames(CMPIInstanceMI * cThis,
 143 konrad.r    1.5 						 CONST CMPIContext * ctx,
 144                 						 CONST CMPIResult * rslt,
 145                 						 CONST CMPIObjectPath * cop)
 146 schuur      1.1 {
 147                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 148                     RemoteCMPIInstanceMI *rcThis = (RemoteCMPIInstanceMI *) cThis;
 149                     provider_address *addr, *tmp;
 150                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 151                 		   rcThis->provider));
 152                     tmp = addr =
 153                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 154                     for (; addr != NULL; addr = addr->next) {
 155                 	provider_comm *comm =
 156                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 157                 	if (comm != NULL) {
 158                 	    rc = comm->InstanceMI_enumInstanceNames(addr, rcThis, ctx,
 159                 						    rslt, cop);
 160                 	} else {
 161                 	    tmp->destructor(tmp);
 162                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 163                 			      "comm-layer not found");
 164                 	}
 165                 	if (rc.rc != CMPI_RC_OK) {
 166                 	    tmp->destructor(tmp);
 167 schuur      1.1 	    return rc;
 168                 	}
 169                     }
 170                     CMReturnDone(rslt);
 171                     if (tmp)
 172                 	tmp->destructor(tmp);
 173                     else
 174                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 175                 			  "could not resolve location");
 176                     return rc;
 177                 };
 178                 
 179                 
 180                 static CMPIStatus __InstanceMI_enumInstances(CMPIInstanceMI * cThis,
 181 konrad.r    1.5 					     CONST CMPIContext * ctx,
 182                 					     CONST CMPIResult * rslt,
 183                 					     CONST CMPIObjectPath * cop, CONST char **props)
 184 schuur      1.1 {
 185                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 186                     RemoteCMPIInstanceMI *rcThis = (RemoteCMPIInstanceMI *) cThis;
 187                     provider_address *addr, *tmp;
 188                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 189                 		   rcThis->provider));
 190                     tmp = addr =
 191                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 192                     for (; addr != NULL; addr = addr->next) {
 193                 	provider_comm *comm =
 194                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 195                 	if (comm != NULL) {
 196                 	    rc = comm->InstanceMI_enumInstances(addr, rcThis, ctx, rslt,
 197                 						cop, props);
 198                 	} else {
 199                 	    tmp->destructor(tmp);
 200                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 201                 			      "comm-layer not found");
 202                 	}
 203 konrad.r    1.7     
 204 schuur      1.1 	if (rc.rc != CMPI_RC_OK) {
 205                 	    tmp->destructor(tmp);
 206                 	    return rc;
 207                 	}
 208                     }
 209                     CMReturnDone(rslt);
 210                     if (tmp)
 211                 	tmp->destructor(tmp);
 212                     else
 213                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 214                 			  "could not resolve location");
 215                     return rc;
 216                 };
 217                 
 218                 
 219                 
 220                 
 221                 static CMPIStatus __InstanceMI_getInstance(CMPIInstanceMI * cThis,
 222 konrad.r    1.5 					   CONST CMPIContext * ctx,
 223                 					   CONST CMPIResult * rslt,
 224                 					   CONST CMPIObjectPath * cop, CONST char **props)
 225 schuur      1.1 {
 226                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 227                     RemoteCMPIInstanceMI *rcThis = (RemoteCMPIInstanceMI *) cThis;
 228                     provider_address *addr;
 229                     provider_comm *comm;
 230                     TRACE_NORMAL(("Executing single-targeted remote provider "
 231                 		   "call for: %s.", rcThis->provider));
 232                     if ((addr =
 233                 	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {
 234                 	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 235                 	if (comm != NULL) {
 236                 	    rc = comm->InstanceMI_getInstance(addr, rcThis, ctx, rslt, cop,
 237                 					      props);
 238                 	    CMReturnDone(rslt);
 239                 	}
 240                 	addr->destructor(addr);
 241                     } else
 242                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 243                 			  "could not resolve location");
 244                     return rc;
 245                 };
 246 schuur      1.1 
 247                 
 248                 static CMPIStatus __InstanceMI_createInstance(CMPIInstanceMI * cThis,
 249 konrad.r    1.5 					      CONST CMPIContext * ctx,
 250                 					      CONST CMPIResult * rslt,
 251                 					      CONST CMPIObjectPath * cop,
 252                 					      CONST CMPIInstance * inst)
 253 schuur      1.1 {
 254                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 255                     RemoteCMPIInstanceMI *rcThis = (RemoteCMPIInstanceMI *) cThis;
 256                     provider_address *addr;
 257                     provider_comm *comm;
 258                     TRACE_NORMAL(("Executing single-targeted remote provider "
 259                 		   "call for: %s.", rcThis->provider));
 260                     if ((addr =
 261                 	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {
 262                 	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 263                 	if (comm != NULL) {
 264                 	    rc = comm->InstanceMI_createInstance(addr, rcThis, ctx, rslt,
 265                 						 cop, inst);
 266                 	    CMReturnDone(rslt);
 267                 	}
 268                 	addr->destructor(addr);
 269                     } else
 270                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 271                 			  "could not resolve location");
 272                     return rc;
 273                 };
 274 schuur      1.1 
 275                 
 276 konrad.r    1.5 #ifdef CMPI_VER_100
 277                 /* This function prototype should be called 'modifyInstance' but since this
 278                    proxy provider is not using the MI macro stub functions which use that, it is
 279                    ok to leave it as is. */
 280                 static CMPIStatus __InstanceMI_setInstance(CMPIInstanceMI * cThis,
 281                 					   const CMPIContext * ctx,
 282                 					   const CMPIResult * rslt,
 283                 					   const CMPIObjectPath * cop,
 284                 					   const CMPIInstance * inst, const char **props)
 285                 #else
 286 schuur      1.1 
 287                 static CMPIStatus __InstanceMI_setInstance(CMPIInstanceMI * cThis,
 288                 					   CMPIContext * ctx,
 289                 					   CMPIResult * rslt,
 290                 					   CMPIObjectPath * cop,
 291                 					   CMPIInstance * inst, char **props)
 292 konrad.r    1.5 #endif
 293 schuur      1.1 {
 294                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 295                     RemoteCMPIInstanceMI *rcThis = (RemoteCMPIInstanceMI *) cThis;
 296                     provider_address *addr;
 297                     provider_comm *comm;
 298                     TRACE_NORMAL(("Executing single-targeted remote provider "
 299                 		   "call for: %s.", rcThis->provider));
 300                     if ((addr =
 301                 	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {
 302                 	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 303                 	if (comm != NULL) {
 304                 	    rc = comm->InstanceMI_setInstance(addr, rcThis, ctx, rslt, cop,
 305                 					      inst, props);
 306                 	    CMReturnDone(rslt);
 307                 	}
 308                 	addr->destructor(addr);
 309                     } else
 310                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 311                 			  "could not resolve location");
 312                     return rc;
 313                 };
 314 schuur      1.1 
 315                 
 316                 
 317                 
 318                 static CMPIStatus __InstanceMI_deleteInstance(CMPIInstanceMI * cThis,
 319 konrad.r    1.5 					      CONST CMPIContext * ctx,
 320                 					      CONST CMPIResult * rslt,
 321                 					      CONST CMPIObjectPath * cop)
 322 schuur      1.1 {
 323                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 324                     RemoteCMPIInstanceMI *rcThis = (RemoteCMPIInstanceMI *) cThis;
 325                     provider_address *addr;
 326                     provider_comm *comm;
 327                     TRACE_NORMAL(("Executing single-targeted remote provider "
 328                 		   "call for: %s.", rcThis->provider));
 329                     if ((addr =
 330                 	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {
 331                 	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 332                 	if (comm != NULL) {
 333                 	    rc = comm->InstanceMI_deleteInstance(addr, rcThis, ctx, rslt, cop);
 334                 	    CMReturnDone(rslt);
 335                 	}
 336                 	addr->destructor(addr);
 337                     } else
 338                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 339                 			  "could not resolve location");
 340                     return rc;
 341                 };
 342                 
 343 schuur      1.1 
 344                 static CMPIStatus __InstanceMI_execQuery(CMPIInstanceMI * cThis,
 345 konrad.r    1.5 					 CONST CMPIContext * ctx,
 346                 					 CONST CMPIResult * rslt,
 347                 					 CONST CMPIObjectPath * cop, CONST char *lang,
 348                 					 CONST char *query)
 349 schuur      1.1 {
 350                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 351                     RemoteCMPIInstanceMI *rcThis = (RemoteCMPIInstanceMI *) cThis;
 352                     provider_address *addr, *tmp;
 353                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 354                 		   rcThis->provider));
 355                     tmp = addr =
 356                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 357                     for (; addr != NULL; addr = addr->next) {
 358                 	provider_comm *comm =
 359                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 360                 	if (comm != NULL) {
 361                 	    rc = comm->InstanceMI_execQuery(addr, rcThis, ctx, rslt, cop,
 362                 					    lang, query);
 363                 	} else {
 364                 	    tmp->destructor(tmp);
 365                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 366                 			      "comm-layer not found");
 367                 	}
 368                 	if (rc.rc != CMPI_RC_OK) {
 369                 	    tmp->destructor(tmp);
 370 schuur      1.1 	    return rc;
 371                 	}
 372                     }
 373                     CMReturnDone(rslt);
 374                     if (tmp)
 375                 	tmp->destructor(tmp);
 376                     else
 377                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 378                 			  "could not resolve location");
 379                     return rc;
 380                 };
 381                 
 382                 
 383                 
 384                 
 385                 
 386 konrad.r    1.5 #ifdef CMPI_VER_100
 387                 CMPIInstanceMI *_Generic_Create_InstanceMI(const CMPIBroker * broker,
 388                 					   const CMPIContext * context,
 389                 					   const char *provider, CMPIStatus *rc)
 390                 #else
 391 schuur      1.1 CMPIInstanceMI *_Generic_Create_InstanceMI(CMPIBroker * broker,
 392                 					   CMPIContext * context,
 393                 					   const char *provider)
 394 konrad.r    1.5 #endif
 395 schuur      1.1 {
 396                     static CMPIInstanceMIFT miFT =
 397                 	{ CMPICurrentVersion,
 398                 	  CMPICurrentVersion,
 399                 	  "Instance" "RemoteCMPI",
 400                 	__InstanceMI_cleanup,
 401                 	__InstanceMI_enumInstanceNames,
 402                 	__InstanceMI_enumInstances,
 403                 	__InstanceMI_getInstance,
 404                 	__InstanceMI_createInstance,
 405                 	__InstanceMI_setInstance,
 406                 	__InstanceMI_deleteInstance,
 407                 	__InstanceMI_execQuery
 408                     };
 409                     RemoteCMPIInstanceMI *mi =
 410                 	(RemoteCMPIInstanceMI *) calloc(1, sizeof(RemoteCMPIInstanceMI));
 411                     TRACE_NORMAL(("Creating proxy provider handle for: %s", provider));
 412                 
 413                     CMPI_BrokerExt_Ftab=broker->xft;
 414                     mi->ref.ft = &miFT;
 415                     mi->provider = strdup(provider);
 416 schuur      1.1     mi->broker = broker;
 417                     mi->ticket = generate_ticket(broker);
 418                     return (CMPIInstanceMI *) mi;
 419                 };
 420                 
 421 konrad.r    1.5 #ifdef CMPI_VER_100
 422                 static CMPIStatus __AssociationMI_cleanup(CMPIAssociationMI * cThis,
 423 konrad.r    1.7 					  const CMPIContext * ctx, CMPIBoolean term)
 424 konrad.r    1.5 #else
 425 schuur      1.1 static CMPIStatus __AssociationMI_cleanup(CMPIAssociationMI * cThis,
 426                 					  CMPIContext * ctx)
 427 konrad.r    1.5 #endif
 428 schuur      1.1 {
 429                     RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) cThis;
 430                     TRACE_NORMAL(("Cleaning up proxy provider handle for: %s",
 431                 		   rcThis->provider));
 432 konrad.r    1.7 
 433                     unload_provider_comms();
 434                 	
 435 schuur      1.1     if (revoke_ticket(&rcThis->ticket)) {
 436                 	TRACE_CRITICAL(("ticket could not be revoked."));
 437                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 438                 			  "could not revoke ticket");
 439                     };
 440 konrad.r    1.7 	cleanup_if_last();
 441                 
 442 schuur      1.1     free(rcThis->provider);
 443                     free(rcThis);
 444                     CMReturn(CMPI_RC_OK);
 445                 };
 446                 
 447                 static CMPIStatus __AssociationMI_associators(CMPIAssociationMI * cThis,
 448 konrad.r    1.5 					      CONST CMPIContext * ctx,
 449                 					      CONST CMPIResult * rslt,
 450                 					      CONST CMPIObjectPath * cop,
 451 schuur      1.1 					      const char *assocclass,
 452                 					      const char *resultclass,
 453                 					      const char *role, const char *resultrole,
 454 konrad.r    1.5 					      CONST char **props)
 455 schuur      1.1 {
 456                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 457                     RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) cThis;
 458                     provider_address *addr, *tmp;
 459                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 460                 		   rcThis->provider));
 461                     tmp = addr =
 462                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 463                     for (; addr != NULL; addr = addr->next) {
 464                 	provider_comm *comm =
 465                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 466                 	if (comm != NULL) {
 467                 	    rc = comm->AssociationMI_associators(addr, rcThis, ctx, rslt,
 468                 						 cop, assocclass,
 469                 						 resultclass, role,
 470                 						 resultrole, props);
 471                 	} else {
 472                 	    tmp->destructor(tmp);
 473                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 474                 			      "comm-layer not found");
 475                 	}
 476 schuur      1.1 	if (rc.rc != CMPI_RC_OK) {
 477                 	    tmp->destructor(tmp);
 478                 	    return rc;
 479                 	}
 480                     }
 481                     CMReturnDone(rslt);
 482                     if (tmp)
 483                 	tmp->destructor(tmp);
 484                     else
 485                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 486                 			  "could not resolve location");
 487                     return rc;
 488                 };
 489                 
 490                 
 491                 static CMPIStatus __AssociationMI_associatorNames(CMPIAssociationMI *
 492 konrad.r    1.5 						  cThis, 
 493                 						  CONST CMPIContext * ctx,
 494                 						  CONST CMPIResult * rslt,
 495                 						  CONST CMPIObjectPath * cop,
 496 schuur      1.1 						  const char *assocclass,
 497                 						  const char *resultclass,
 498                 						  const char *role, const char *resultrole)
 499 konrad.r    1.5 
 500 schuur      1.1 {
 501                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 502                     RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) cThis;
 503                     provider_address *addr, *tmp;
 504                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 505                 		   rcThis->provider));
 506                     tmp = addr =
 507                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 508                     for (; addr != NULL; addr = addr->next) {
 509                 	provider_comm *comm =
 510                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 511                 	if (comm != NULL) {
 512                 	    rc = comm->AssociationMI_associatorNames(addr, rcThis, ctx,
 513                 						     rslt, cop, assocclass,
 514                 						     resultclass, role,
 515                 						     resultrole);
 516                 	} else {
 517                 	    tmp->destructor(tmp);
 518                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 519                 			      "comm-layer not found");
 520                 	}
 521 schuur      1.1 	if (rc.rc != CMPI_RC_OK) {
 522                 	    tmp->destructor(tmp);
 523                 	    return rc;
 524                 	}
 525                     }
 526                     CMReturnDone(rslt);
 527                     if (tmp)
 528                 	tmp->destructor(tmp);
 529                     else
 530                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 531                 			  "could not resolve location");
 532                     return rc;
 533                 };
 534                 
 535                 
 536                 static CMPIStatus __AssociationMI_references(CMPIAssociationMI * cThis,
 537 konrad.r    1.5 					     CONST CMPIContext * ctx,
 538                 					     CONST CMPIResult * rslt,
 539                 					     CONST CMPIObjectPath * cop,
 540 schuur      1.1 					     const char *assocclass, const char *role,
 541 konrad.r    1.5 					     CONST char **props)
 542 schuur      1.1 {
 543                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 544                     RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) cThis;
 545                     provider_address *addr, *tmp;
 546                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 547                 		   rcThis->provider));
 548                     tmp = addr =
 549                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 550                     for (; addr != NULL; addr = addr->next) {
 551                 	provider_comm *comm =
 552                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 553                 	if (comm != NULL) {
 554                 	    rc = comm->AssociationMI_references(addr, rcThis, ctx, rslt,
 555                 						cop, assocclass, role, props);
 556                 	} else {
 557                 	    tmp->destructor(tmp);
 558                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 559                 			      "comm-layer not found");
 560                 	}
 561                 	if (rc.rc != CMPI_RC_OK) {
 562                 	    tmp->destructor(tmp);
 563 schuur      1.1 	    return rc;
 564                 	}
 565                     }
 566                     CMReturnDone(rslt);
 567                     if (tmp)
 568                 	tmp->destructor(tmp);
 569                     else
 570                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 571                 			  "could not resolve location");
 572                     return rc;
 573                 };
 574                 
 575                 
 576                 
 577                 
 578                 
 579                 
 580                 static CMPIStatus __AssociationMI_referenceNames(CMPIAssociationMI * cThis,
 581 konrad.r    1.5 						 CONST CMPIContext * ctx,
 582                 						 CONST CMPIResult * rslt,
 583                 						 CONST CMPIObjectPath * cop,
 584 schuur      1.1 						 const char *assocclass, const char *role)
 585                 {
 586                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 587                     RemoteCMPIAssociationMI *rcThis = (RemoteCMPIAssociationMI *) cThis;
 588                     provider_address *addr, *tmp;
 589                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 590                 		   rcThis->provider));
 591                     tmp = addr =
 592                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 593                     for (; addr != NULL; addr = addr->next) {
 594                 	provider_comm *comm =
 595                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 596                 	if (comm != NULL) {
 597                 	    rc = comm->AssociationMI_referenceNames(addr, rcThis, ctx,
 598                 						    rslt, cop, assocclass,
 599                 						    role);
 600                 	} else {
 601                 	    tmp->destructor(tmp);
 602                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 603                 			      "comm-layer not found");
 604                 	}
 605 schuur      1.1 	if (rc.rc != CMPI_RC_OK) {
 606                 	    tmp->destructor(tmp);
 607                 	    return rc;
 608                 	}
 609                     }
 610                     CMReturnDone(rslt);
 611                     if (tmp)
 612                 	tmp->destructor(tmp);
 613                     else
 614                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 615                 			  "could not resolve location");
 616                     return rc;
 617                 };
 618                 
 619                 
 620                 
 621 konrad.r    1.5 #ifdef CMPI_VER_100
 622                 CMPIAssociationMI *_Generic_Create_AssociationMI(const CMPIBroker * broker,
 623                 						 const CMPIContext * context,
 624                 						 const char *provider,
 625                 						 CMPIStatus *rc)
 626 schuur      1.1 
 627 konrad.r    1.5 #else
 628 schuur      1.1 CMPIAssociationMI *_Generic_Create_AssociationMI(CMPIBroker * broker,
 629                 						 CMPIContext * context,
 630                 						 const char *provider)
 631 konrad.r    1.5 #endif
 632 schuur      1.1 {
 633                     static CMPIAssociationMIFT miFT = { CMPICurrentVersion, CMPICurrentVersion,
 634                 	"Association" "RemoteCMPI", __AssociationMI_cleanup,
 635                 	    __AssociationMI_associators,
 636                 	__AssociationMI_associatorNames, __AssociationMI_references,
 637                 	__AssociationMI_referenceNames
 638                     };
 639                     RemoteCMPIAssociationMI *mi = (RemoteCMPIAssociationMI *) calloc(1,
 640                 								     sizeof
 641                 								     (RemoteCMPIAssociationMI));
 642                     TRACE_NORMAL(("Creating proxy provider handle for: %s", provider));
 643                 
 644                     CMPI_BrokerExt_Ftab=broker->xft;
 645                     mi->ref.ft = &miFT;
 646                     mi->provider = strdup(provider);
 647                     mi->broker = broker;
 648                     mi->ticket = generate_ticket(broker);
 649                     return (CMPIAssociationMI *) mi;
 650                 };
 651                 
 652                 
 653 konrad.r    1.5 #ifdef CMPI_VER_100
 654 konrad.r    1.7 static CMPIStatus __MethodMI_cleanup(CMPIMethodMI * cThis, const CMPIContext * ctx, CMPIBoolean term)
 655 konrad.r    1.5 #else
 656 schuur      1.1 static CMPIStatus __MethodMI_cleanup(CMPIMethodMI * cThis, CMPIContext * ctx)
 657 konrad.r    1.5 #endif
 658 schuur      1.1 {
 659                     RemoteCMPIMethodMI *rcThis = (RemoteCMPIMethodMI *) cThis;
 660                     TRACE_NORMAL(("Cleaning up proxy provider handle for: %s",
 661                 		   rcThis->provider));
 662 konrad.r    1.7 
 663                     unload_provider_comms();
 664                 
 665 schuur      1.1     if (revoke_ticket(&rcThis->ticket)) {
 666                 	TRACE_CRITICAL(("ticket could not be revoked."));
 667                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 668                 			  "could not revoke ticket");
 669                     };
 670 konrad.r    1.7 	cleanup_if_last();
 671 schuur      1.1     free(rcThis->provider);
 672                     free(rcThis);
 673                     CMReturn(CMPI_RC_OK);
 674                 };
 675                 
 676                 static CMPIStatus __MethodMI_invokeMethod(CMPIMethodMI * cThis,
 677 konrad.r    1.5 					  CONST CMPIContext * ctx,
 678                 					  CONST CMPIResult * rslt,
 679                 					  CONST CMPIObjectPath * cop,
 680                 					  const char *method, CONST CMPIArgs * in,
 681 schuur      1.1 					  CMPIArgs * out)
 682                 {
 683                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 684                     RemoteCMPIMethodMI *rcThis = (RemoteCMPIMethodMI *) cThis;
 685                     provider_address *addr;
 686                     provider_comm *comm;
 687                     TRACE_NORMAL(("Executing single-targeted remote provider "
 688                 		   "call for: %s.", rcThis->provider));
 689                     if ((addr =
 690                 	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {
 691                 	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 692                 	if (comm != NULL) {
 693                 	    rc = comm->MethodMI_invokeMethod(addr, rcThis, ctx, rslt, cop,
 694                 					     method, in, out);
 695                 	    CMReturnDone(rslt);
 696                 	}
 697                 	addr->destructor(addr);
 698                     } else
 699                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 700                 			  "could not resolve location");
 701                     return rc;
 702 schuur      1.1 };
 703                 
 704                 
 705                 
 706                 
 707                 
 708                 
 709 konrad.r    1.5 #ifdef CMPI_VER_100
 710                 CMPIMethodMI *_Generic_Create_MethodMI(CMPIBroker * broker,
 711                 				       const CMPIContext * context,
 712                 				       const char *provider, 
 713                 				       CMPIStatus *rc)
 714 schuur      1.1 
 715 konrad.r    1.5 #else
 716 schuur      1.1 CMPIMethodMI *_Generic_Create_MethodMI(CMPIBroker * broker,
 717                 				       CMPIContext * context,
 718                 				       const char *provider)
 719 konrad.r    1.5 #endif
 720 schuur      1.1 {
 721                     static CMPIMethodMIFT miFT =
 722                 	{ CMPICurrentVersion, CMPICurrentVersion, "Method" "RemoteCMPI",
 723                 	__MethodMI_cleanup, __MethodMI_invokeMethod
 724                     };
 725                     RemoteCMPIMethodMI *mi =
 726                 	(RemoteCMPIMethodMI *) calloc(1, sizeof(RemoteCMPIMethodMI));
 727                     TRACE_NORMAL(("Creating proxy provider handle for: %s", provider));
 728                 
 729                     CMPI_BrokerExt_Ftab=broker->xft;
 730                     mi->ref.ft = &miFT;
 731                     mi->provider = strdup(provider);
 732                     mi->broker = broker;
 733                     mi->ticket = generate_ticket(broker);
 734                     return (CMPIMethodMI *) mi;
 735                 };
 736                 
 737                 
 738 konrad.r    1.5 #ifdef CMPI_VER_100
 739                 static CMPIStatus __PropertyMI_cleanup(CMPIPropertyMI * cThis,
 740                 				       const CMPIContext * ctx,
 741 konrad.r    1.7 				       CMPIBoolean term)
 742 konrad.r    1.5 
 743                 #else
 744 schuur      1.1 static CMPIStatus __PropertyMI_cleanup(CMPIPropertyMI * cThis,
 745                 				       CMPIContext * ctx)
 746 konrad.r    1.5 #endif
 747 schuur      1.1 {
 748                     RemoteCMPIPropertyMI *rcThis = (RemoteCMPIPropertyMI *) cThis;
 749                     TRACE_NORMAL(("Cleaning up proxy provider handle for: %s",
 750                 		   rcThis->provider));
 751 konrad.r    1.7 
 752                     unload_provider_comms();
 753                 
 754 schuur      1.1     if (revoke_ticket(&rcThis->ticket)) {
 755                 	TRACE_CRITICAL(("ticket could not be revoked."));
 756                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 757                 			  "could not revoke ticket");
 758                     };
 759 konrad.r    1.7 	cleanup_if_last();
 760 schuur      1.1     free(rcThis->provider);
 761                     free(rcThis);
 762                     CMReturn(CMPI_RC_OK);
 763                 };
 764                 
 765                 static CMPIStatus __PropertyMI_setProperty(CMPIPropertyMI * cThis,
 766 konrad.r    1.5 					   CONST CMPIContext * ctx,
 767                 					   CONST CMPIResult * rslt,
 768                 					   CONST CMPIObjectPath * cop,
 769                 					   const char *name, CONST CMPIData data)
 770 schuur      1.1 {
 771                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 772                     RemoteCMPIPropertyMI *rcThis = (RemoteCMPIPropertyMI *) cThis;
 773                     provider_address *addr;
 774                     provider_comm *comm;
 775                     TRACE_NORMAL(("Executing single-targeted remote provider "
 776                 		   "call for: %s.", rcThis->provider));
 777                     if ((addr =
 778                 	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {
 779                 	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 780                 	if (comm != NULL) {
 781                 	    rc = comm->PropertyMI_setProperty(addr, rcThis, ctx, rslt, cop,
 782                 					      name, data);
 783                 	    CMReturnDone(rslt);
 784                 	}
 785                 	addr->destructor(addr);
 786                     } else
 787                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 788                 			  "could not resolve location");
 789                     return rc;
 790                 };
 791 schuur      1.1 
 792                 
 793                 
 794                 
 795                 static CMPIStatus __PropertyMI_getProperty(CMPIPropertyMI * cThis,
 796 konrad.r    1.5 					   CONST CMPIContext * ctx,
 797                 					   CONST CMPIResult * rslt,
 798                 					   CONST CMPIObjectPath * cop, const char *name)
 799 schuur      1.1 {
 800                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 801                     RemoteCMPIPropertyMI *rcThis = (RemoteCMPIPropertyMI *) cThis;
 802                     provider_address *addr;
 803                     provider_comm *comm;
 804                     TRACE_NORMAL(("Executing single-targeted remote provider "
 805                 		   "call for: %s.", rcThis->provider));
 806                     if ((addr =
 807                 	 resolve_instance(rcThis->broker, ctx, cop, rcThis->provider, NULL))) {
 808                 	comm = load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 809                 	if (comm != NULL) {
 810                 	    rc = comm->PropertyMI_getProperty(addr, rcThis, ctx, rslt, cop,
 811                 					      name);
 812                 	    CMReturnDone(rslt);
 813                 	}
 814                 	addr->destructor(addr);
 815                     } else
 816 konrad.r    1.5       {
 817 schuur      1.1 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 818                 			  "could not resolve location");
 819 konrad.r    1.5       }
 820                 
 821 schuur      1.1     return rc;
 822 konrad.r    1.5 
 823 schuur      1.1 };
 824                 
 825                 
 826                 
 827                 
 828 konrad.r    1.5 #ifdef CMPI_VER_100
 829                 CMPIPropertyMI *_Generic_Create_PropertyMI(CMPIBroker * broker,
 830                 					   const CMPIContext * context,
 831                 					   const char *provider,
 832                 					   CMPIStatus *rc)
 833 schuur      1.1 
 834 konrad.r    1.5 #else
 835 schuur      1.1 CMPIPropertyMI *_Generic_Create_PropertyMI(CMPIBroker * broker,
 836                 					   CMPIContext * context,
 837                 					   const char *provider)
 838 konrad.r    1.5 #endif
 839 schuur      1.1 {
 840                     static CMPIPropertyMIFT miFT =
 841                 	{ CMPICurrentVersion, CMPICurrentVersion, "Property" "RemoteCMPI",
 842                 	__PropertyMI_cleanup, __PropertyMI_setProperty, __PropertyMI_getProperty
 843                     };
 844                     RemoteCMPIPropertyMI *mi =
 845                 	(RemoteCMPIPropertyMI *) calloc(1, sizeof(RemoteCMPIPropertyMI));
 846                     TRACE_NORMAL(("Creating proxy provider handle for: %s", provider));
 847                 
 848                     CMPI_BrokerExt_Ftab=broker->xft;
 849                     mi->ref.ft = &miFT;
 850                     mi->provider = strdup(provider);
 851                     mi->broker = broker;
 852                     mi->ticket = generate_ticket(broker);
 853                     return (CMPIPropertyMI *) mi;
 854                 };
 855                 
 856 konrad.r    1.5 #ifdef CMPI_VER_100
 857                 static CMPIStatus __IndicationMI_cleanup(CMPIIndicationMI * cThis,
 858 konrad.r    1.7 					 const CMPIContext * ctx, CMPIBoolean term)
 859 konrad.r    1.5 #else
 860 schuur      1.1 
 861                 static CMPIStatus __IndicationMI_cleanup(CMPIIndicationMI * cThis,
 862                 					 CMPIContext * ctx)
 863 konrad.r    1.5 #endif
 864 schuur      1.1 {
 865                     RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis;
 866                     TRACE_NORMAL(("Cleaning up proxy provider handle for: %s",
 867                 		   rcThis->provider));
 868 konrad.r    1.7 
 869                     unload_provider_comms();
 870                 
 871 schuur      1.1     if (revoke_ticket(&rcThis->ticket)) {
 872                 	TRACE_CRITICAL(("ticket could not be revoked."));
 873                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 874                 			  "could not revoke ticket");
 875                     };
 876 konrad.r    1.7 	cleanup_if_last();
 877 schuur      1.1     free(rcThis->provider);
 878                     free(rcThis);
 879                     CMReturn(CMPI_RC_OK);
 880                 };
 881                 
 882 konrad.r    1.5 #ifdef CMPI_VER_100
 883                 static CMPIStatus __IndicationMI_authorizeFilter(CMPIIndicationMI * cThis,
 884                 						 const CMPIContext * ctx,
 885                 						 const CMPISelectExp * filter,
 886                 						 const char *indType,
 887                 						 const CMPIObjectPath * cop,
 888                 						 const char *owner)
 889                 #else
 890 schuur      1.1 static CMPIStatus __IndicationMI_authorizeFilter(CMPIIndicationMI * cThis,
 891                 						 CMPIContext * ctx,
 892                 						 CMPIResult * rslt,
 893                 						 CMPISelectExp * filter,
 894                 						 const char *indType,
 895                 						 CMPIObjectPath * cop,
 896                 						 const char *owner)
 897 konrad.r    1.5 #endif
 898 schuur      1.1 {
 899                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 900                     RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis;
 901                     provider_address *addr, *tmp;
 902                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 903                 		   rcThis->provider));
 904                     tmp = addr =
 905                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 906                     for (; addr != NULL; addr = addr->next) {
 907                 	provider_comm *comm =
 908                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 909                 	if (comm != NULL) {
 910 konrad.r    1.5 #ifdef CMPI_VER_100
 911                 	    rc = comm->IndicationMI_authorizeFilter(addr, rcThis, ctx,
 912                 						     filter,
 913                 						    indType, cop,owner);
 914                 #else
 915                 	    // IBMKR: This looks like a wrong prototype.
 916 schuur      1.1 	    rc = comm->IndicationMI_authorizeFilter(addr, rcThis, ctx,
 917                 						    rslt, cop, filter,
 918                 						    indType, owner);
 919 konrad.r    1.5 #endif
 920 schuur      1.1 	} else {
 921                 	    tmp->destructor(tmp);
 922                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 923                 			      "comm-layer not found");
 924                 	}
 925                 	if (rc.rc != CMPI_RC_OK) {
 926                 	    tmp->destructor(tmp);
 927                 	    return rc;
 928                 	}
 929                     }
 930 konrad.r    1.5 #ifndef CMPI_VER_100
 931 schuur      1.1     CMReturnDone(rslt);
 932 konrad.r    1.5 #endif
 933 schuur      1.1     if (tmp)
 934                 	tmp->destructor(tmp);
 935                     else
 936                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 937                 			  "could not resolve location");
 938                     return rc;
 939                 };
 940                 
 941                 
 942                 
 943                 
 944                 
 945                 
 946 konrad.r    1.5 #ifdef CMPI_VER_100
 947                 static CMPIStatus __IndicationMI_mustPoll(CMPIIndicationMI * cThis,
 948                 					  const CMPIContext * ctx,
 949                 					  const CMPISelectExp * filter,
 950                 					  const char *indType, 
 951                 					  const CMPIObjectPath * cop)
 952 schuur      1.1 
 953 konrad.r    1.5 #else
 954 schuur      1.1 static CMPIStatus __IndicationMI_mustPoll(CMPIIndicationMI * cThis,
 955                 					  CMPIContext * ctx,
 956                 					  CMPIResult * rslt,
 957                 					  CMPISelectExp * filter,
 958                 					  const char *indType, CMPIObjectPath * cop)
 959 konrad.r    1.5 #endif
 960 schuur      1.1 {
 961                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
 962                     RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis;
 963                     provider_address *addr, *tmp;
 964                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
 965                 		   rcThis->provider));
 966                     tmp = addr =
 967                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
 968                     for (; addr != NULL; addr = addr->next) {
 969                 	provider_comm *comm =
 970                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
 971                 	if (comm != NULL) {
 972 konrad.r    1.5 #ifdef CMPI_VER_100
 973                 	  rc = comm->IndicationMI_mustPoll(addr, rcThis, ctx, filter,
 974                 					   indType, cop);
 975                 
 976                 #else
 977                 	  //IBMKR: The set of arguments looks wrong?
 978 schuur      1.1 	    rc = comm->IndicationMI_mustPoll(addr, rcThis, ctx, rslt, cop,
 979                 					     filter, indType);
 980 konrad.r    1.5 
 981                 #endif
 982 schuur      1.1 	} else {
 983                 	    tmp->destructor(tmp);
 984                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 985                 			      "comm-layer not found");
 986                 	}
 987                 	if (rc.rc != CMPI_RC_OK) {
 988                 	    tmp->destructor(tmp);
 989                 	    return rc;
 990                 	}
 991                     }
 992 konrad.r    1.5 #ifndef CMPI_VER_100
 993 schuur      1.1     CMReturnDone(rslt);
 994 konrad.r    1.5 #endif
 995 schuur      1.1     if (tmp)
 996                 	tmp->destructor(tmp);
 997                     else
 998                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
 999                 			  "could not resolve location");
1000                     return rc;
1001                 };
1002                 
1003                 
1004                 
1005                 
1006 konrad.r    1.5 #ifdef CMPI_VER_100
1007                 static CMPIStatus __IndicationMI_activateFilter(CMPIIndicationMI * cThis,
1008                 						const CMPIContext * ctx,
1009                 						const CMPISelectExp * filter,
1010                 						const char *indType,
1011                 						const CMPIObjectPath * cop,
1012                 						CMPIBoolean firstActivation)
1013                 #else
1014 schuur      1.1 
1015                 static CMPIStatus __IndicationMI_activateFilter(CMPIIndicationMI * cThis,
1016                 						CMPIContext * ctx,
1017                 						CMPIResult * rslt,
1018                 						CMPISelectExp * filter,
1019                 						const char *indType,
1020                 						CMPIObjectPath * cop,
1021                 						CMPIBoolean firstActivation)
1022 konrad.r    1.5 #endif
1023 schuur      1.1 {
1024                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
1025                     RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis;
1026                     provider_address *addr, *tmp;
1027                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
1028                 		   rcThis->provider));
1029                     tmp = addr =
1030                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
1031                     for (; addr != NULL; addr = addr->next) {
1032                 	provider_comm *comm =
1033                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
1034                 	if (comm != NULL) {
1035 konrad.r    1.5 #ifdef CMPI_VER_100
1036                 	    rc = comm->IndicationMI_activateFilter(addr, rcThis, ctx,
1037                 						   filter, indType,cop,
1038                 						   firstActivation);
1039                 #else
1040                 	    // IBMKR: This function prototype looks wrong.
1041 schuur      1.1 	    rc = comm->IndicationMI_activateFilter(addr, rcThis, ctx, rslt,
1042                 						   cop, filter, indType,
1043                 						   firstActivation);
1044 konrad.r    1.5 
1045                 #endif
1046 schuur      1.1 	} else {
1047                 	    tmp->destructor(tmp);
1048                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
1049                 			      "comm-layer not found");
1050                 	}
1051                 	if (rc.rc != CMPI_RC_OK) {
1052                 	    tmp->destructor(tmp);
1053                 	    return rc;
1054                 	}
1055                     }
1056 konrad.r    1.5 #ifndef CMPI_VER_100
1057 schuur      1.1     CMReturnDone(rslt);
1058 konrad.r    1.5 #endif
1059 schuur      1.1     if (tmp)
1060                 	tmp->destructor(tmp);
1061                     else
1062                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
1063                 			  "could not resolve location");
1064                     return rc;
1065                 };
1066                 
1067                 
1068                 
1069                 
1070 konrad.r    1.5 #ifdef CMPI_VER_100
1071                 static CMPIStatus __IndicationMI_deActivateFilter(CMPIIndicationMI * cThis,
1072                 						  const CMPIContext * ctx,
1073                 						  const CMPISelectExp * filter,
1074                 						  const char *indType,
1075                 						  const CMPIObjectPath * cop,
1076                 						  CMPIBoolean lastActivation)
1077                 #else
1078 schuur      1.1 static CMPIStatus __IndicationMI_deActivateFilter(CMPIIndicationMI * cThis,
1079                 						  CMPIContext * ctx,
1080                 						  CMPIResult * rslt,
1081                 						  CMPISelectExp * filter,
1082                 						  const char *indType,
1083                 						  CMPIObjectPath * cop,
1084                 						  CMPIBoolean lastActivation)
1085 konrad.r    1.5 #endif
1086 schuur      1.1 {
1087                     CMPIStatus rc = { CMPI_RC_ERR_FAILED, NULL };
1088                     RemoteCMPIIndicationMI *rcThis = (RemoteCMPIIndicationMI *) cThis;
1089                     provider_address *addr, *tmp;
1090                     TRACE_NORMAL(("Executing fan-out remote provider call " "for: %s.",
1091                 		   rcThis->provider));
1092                     tmp = addr =
1093                 	resolve_class(rcThis->broker, ctx, cop, rcThis->provider, NULL);
1094                     for (; addr != NULL; addr = addr->next) {
1095                 	provider_comm *comm =
1096                 	    load_provider_comm(addr->comm_layer_id, rcThis->broker, ctx);
1097                 	if (comm != NULL) {
1098 konrad.r    1.5 #if defined (CMPI_VER_100)
1099                 	    rc = comm->IndicationMI_deActivateFilter(addr, rcThis, ctx,
1100                 						     filter,indType,
1101                 						     cop, lastActivation);
1102                 #else
1103 schuur      1.1 	    rc = comm->IndicationMI_deActivateFilter(addr, rcThis, ctx,
1104                 						     rslt, cop, filter,
1105                 						     indType, lastActivation);
1106 konrad.r    1.5 
1107                 #endif
1108 schuur      1.1 	} else {
1109                 	    tmp->destructor(tmp);
1110                 	    CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
1111                 			      "comm-layer not found");
1112                 	}
1113                 	if (rc.rc != CMPI_RC_OK) {
1114                 	    tmp->destructor(tmp);
1115                 	    return rc;
1116                 	}
1117                     }
1118 konrad.r    1.5 #ifndef CMPI_VER_100
1119 schuur      1.1     CMReturnDone(rslt);
1120 konrad.r    1.5 #endif
1121 schuur      1.1     if (tmp)
1122                 	tmp->destructor(tmp);
1123                     else
1124                 	CMReturnWithChars(rcThis->broker, CMPI_RC_ERR_FAILED,
1125                 			  "could not resolve location");
1126                     return rc;
1127                 };
1128                 
1129                 
1130 konrad.r    1.5 #ifdef CMPI_VER_100
1131                 static void __IndicationMI_enableIndications(CMPIIndicationMI * cThis, const CMPIContext *ctx)
1132                 #else
1133 schuur      1.1 static void __IndicationMI_enableIndications(CMPIIndicationMI * cThis)
1134 konrad.r    1.5 #endif
1135 schuur      1.1 {
1136                     TRACE_NORMAL(("enableIndications ignored"));
1137                 }
1138                 
1139                 
1140 konrad.r    1.5 #ifdef CMPI_VER_100
1141                 static void __IndicationMI_disableIndications(CMPIIndicationMI * cThis,const CMPIContext *ctx)
1142                 #else
1143 schuur      1.1 static void __IndicationMI_disableIndications(CMPIIndicationMI * cThis)
1144 konrad.r    1.5 #endif
1145 schuur      1.1 {
1146                     TRACE_NORMAL(("disableIndications ignored"));
1147                 }
1148                 
1149                 
1150 konrad.r    1.5 #ifdef CMPI_VER_100
1151                 CMPIIndicationMI *_Generic_Create_IndicationMI(CMPIBroker * broker,
1152                 					       const CMPIContext * context,
1153                 					       const char *provider,
1154                 					       CMPIStatus *rc)
1155                 #else
1156 schuur      1.1 CMPIIndicationMI *_Generic_Create_IndicationMI(CMPIBroker * broker,
1157                 					       CMPIContext * context,
1158                 					       const char *provider)
1159 konrad.r    1.5 #endif
1160 schuur      1.1 {
1161                     static CMPIIndicationMIFT miFT = { CMPICurrentVersion, CMPICurrentVersion,
1162                 	"Indication" "RemoteCMPI", __IndicationMI_cleanup,
1163                 	    __IndicationMI_authorizeFilter,
1164                 	    __IndicationMI_mustPoll,
1165                 	    __IndicationMI_activateFilter,
1166                 	    __IndicationMI_deActivateFilter,
1167                 	    __IndicationMI_enableIndications,
1168                             __IndicationMI_disableIndications,
1169                     };
1170                     RemoteCMPIIndicationMI *mi = (RemoteCMPIIndicationMI *) calloc(1,
1171                 								   sizeof
1172                 								   (RemoteCMPIIndicationMI));
1173                     TRACE_NORMAL(("Creating proxy provider handle for: %s", provider));
1174                 
1175                     CMPI_BrokerExt_Ftab=broker->xft;
1176                     mi->ref.ft = &miFT;
1177                     mi->provider = strdup(provider);
1178                     mi->broker = broker;
1179                     mi->ticket = generate_ticket(broker);
1180                     return (CMPIIndicationMI *) mi;
1181 schuur      1.1 };
1182                 
1183                 

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2