(file) Return to CIMOperationRequestDecoder.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Server

   1 martin 1.121 //%LICENSE////////////////////////////////////////////////////////////////
   2 martin 1.122 //
   3 martin 1.121 // Licensed to The Open Group (TOG) under one or more contributor license
   4              // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
   5              // this work for additional information regarding copyright ownership.
   6              // Each contributor licenses this file to you under the OpenPegasus Open
   7              // Source License; you may not use this file except in compliance with the
   8              // License.
   9 martin 1.122 //
  10 martin 1.121 // Permission is hereby granted, free of charge, to any person obtaining a
  11              // copy of this software and associated documentation files (the "Software"),
  12              // to deal in the Software without restriction, including without limitation
  13              // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  14              // and/or sell copies of the Software, and to permit persons to whom the
  15              // Software is furnished to do so, subject to the following conditions:
  16 martin 1.122 //
  17 martin 1.121 // The above copyright notice and this permission notice shall be included
  18              // in all copies or substantial portions of the Software.
  19 martin 1.122 //
  20 martin 1.121 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21 martin 1.122 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22 martin 1.121 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23              // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  24              // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25              // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26              // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27 martin 1.122 //
  28 martin 1.121 //////////////////////////////////////////////////////////////////////////
  29 mike   1.2   //
  30              //%/////////////////////////////////////////////////////////////////////////////
  31              
  32              #include <Pegasus/Common/Config.h>
  33 kumpf  1.28  #include <Pegasus/Common/Constants.h>
  34 mike   1.2   #include <cctype>
  35              #include <cstdio>
  36              #include <Pegasus/Common/XmlParser.h>
  37              #include <Pegasus/Common/XmlReader.h>
  38              #include <Pegasus/Common/XmlWriter.h>
  39              #include <Pegasus/Common/XmlConstants.h>
  40 kumpf  1.51  #include <Pegasus/Common/System.h>
  41 mike   1.2   #include <Pegasus/Common/Logger.h>
  42              #include <Pegasus/Common/Tracer.h>
  43 sage   1.41  #include <Pegasus/Common/StatisticalData.h>
  44 mike   1.2   #include "CIMOperationRequestDecoder.h"
  45 david  1.60  #include <Pegasus/Common/CommonUTF.h>
  46 humberto 1.59  #include <Pegasus/Common/MessageLoader.h>
  47 mike     1.120 #include <Pegasus/Common/BinaryCodec.h>
  48 humberto 1.59  
  49 mike     1.2   PEGASUS_USING_STD;
  50                
  51                PEGASUS_NAMESPACE_BEGIN
  52                
  53                CIMOperationRequestDecoder::CIMOperationRequestDecoder(
  54 sahana.prabhakar 1.126     MessageQueue* outputQueue,
  55 kumpf            1.104     Uint32 returnQueueId)
  56                            : Base(PEGASUS_QUEUENAME_OPREQDECODER),
  57 mday             1.16        _outputQueue(outputQueue),
  58                              _returnQueueId(returnQueueId),
  59                              _serverTerminating(false)
  60 mike             1.2   {
  61                        }
  62                        
  63                        CIMOperationRequestDecoder::~CIMOperationRequestDecoder()
  64                        {
  65                        }
  66                        
  67                        void CIMOperationRequestDecoder::sendResponse(
  68 kumpf            1.104     Uint32 queueId,
  69                            Buffer& message,
  70                            Boolean closeConnect)
  71                        {
  72                            MessageQueue* queue = MessageQueue::lookup(queueId);
  73                        
  74                            if (queue)
  75                            {
  76                                AutoPtr<HTTPMessage> httpMessage(new HTTPMessage(message));
  77                                httpMessage->setCloseConnect(closeConnect);
  78                                queue->enqueue(httpMessage.release());
  79                            }
  80 mike             1.2   }
  81                        
  82 kumpf            1.18  void CIMOperationRequestDecoder::sendIMethodError(
  83 kumpf            1.104     Uint32 queueId,
  84                            HttpMethod httpMethod,
  85                            const String& messageId,
  86                            const String& iMethodName,
  87                            const CIMException& cimException,
  88                            Boolean closeConnect)
  89 mday             1.16  {
  90 mike             1.96      Buffer message;
  91 kumpf            1.19      message = XmlWriter::formatSimpleIMethodErrorRspMessage(
  92                                iMethodName,
  93                                messageId,
  94 kumpf            1.53          httpMethod,
  95 kumpf            1.35          cimException);
  96 kumpf            1.18  
  97 j.alex           1.95      sendResponse(queueId, message,closeConnect);
  98 kumpf            1.18  }
  99 mday             1.16  
 100 kumpf            1.18  void CIMOperationRequestDecoder::sendMethodError(
 101 kumpf            1.104     Uint32 queueId,
 102                            HttpMethod httpMethod,
 103                            const String& messageId,
 104                            const String& methodName,
 105                            const CIMException& cimException,
 106                            Boolean closeConnect)
 107 kumpf            1.18  {
 108 mike             1.96      Buffer message;
 109 kumpf            1.19      message = XmlWriter::formatSimpleMethodErrorRspMessage(
 110                                methodName,
 111                                messageId,
 112 kumpf            1.53          httpMethod,
 113 kumpf            1.35          cimException);
 114 chip             1.92  
 115 j.alex           1.95      sendResponse(queueId, message,closeConnect);
 116 mike             1.2   }
 117                        
 118 kumpf            1.33  void CIMOperationRequestDecoder::sendHttpError(
 119 kumpf            1.104     Uint32 queueId,
 120                            const String& status,
 121                            const String& cimError,
 122                            const String& pegasusError,
 123                            Boolean closeConnect)
 124 kumpf            1.21  {
 125 mike             1.96      Buffer message;
 126 kumpf            1.33      message = XmlWriter::formatHttpErrorRspMessage(
 127                                status,
 128                                cimError,
 129 kumpf            1.37          pegasusError);
 130 chip             1.92  
 131 j.alex           1.95      sendResponse(queueId, message,closeConnect);
 132 kumpf            1.26  }
 133                        
 134 kumpf            1.104 void CIMOperationRequestDecoder::handleEnqueue(Message* message)
 135 mike             1.2   {
 136 kumpf            1.104     if (!message)
 137                                return;
 138 mike             1.2   
 139 kumpf            1.104     switch (message->getType())
 140                            {
 141                                case HTTP_MESSAGE:
 142                                     handleHTTPMessage((HTTPMessage*)message);
 143                                     break;
 144 kumpf            1.112 
 145                                default:
 146                                    // Unexpected message type
 147                                    PEGASUS_ASSERT(0);
 148                                    break;
 149 kumpf            1.104     }
 150 mday             1.16  
 151 kumpf            1.104     delete message;
 152 mday             1.16  }
 153 mike             1.2   
 154                        
 155 mday             1.16  void CIMOperationRequestDecoder::handleEnqueue()
 156                        {
 157 kumpf            1.104     Message* message = dequeue();
 158                            if (message)
 159                                handleEnqueue(message);
 160 mike             1.2   }
 161                        
 162                        //------------------------------------------------------------------------------
 163                        //
 164                        // From the HTTP/1.1 Specification (RFC 2626):
 165                        //
 166 chip             1.92  // Both types of message consist of a start-line, zero or more header fields
 167                        // (also known as "headers"), an empty line (i.e., a line with nothing
 168                        // preceding the CRLF) indicating the end of the header fields, and possibly
 169 mike             1.2   // a message-body.
 170                        //
 171                        // Example CIM request:
 172                        //
 173 chip             1.92  //     M-POST /cimom HTTP/1.1
 174                        //     HOST: www.erewhon.com
 175                        //     Content-Type: application/xml; charset="utf-8"
 176                        //     Content-Length: xxxx
 177                        //     Man: http://www.dmtf.org/cim/operation ; ns=73
 178                        //     73-CIMOperation: MethodCall
 179                        //     73-CIMMethod: EnumerateInstances
 180                        //     73-CIMObject: root/cimv2
 181                        //
 182 mike             1.2   //------------------------------------------------------------------------------
 183                        
 184                        void CIMOperationRequestDecoder::handleHTTPMessage(HTTPMessage* httpMessage)
 185                        {
 186 kumpf            1.104     PEG_METHOD_ENTER(TRC_DISPATCHER,
 187                                "CIMOperationRequestDecoder::handleHTTPMessage()");
 188 kumpf            1.20  
 189 kumpf            1.104     // Set the Accept-Language into the thread for this service.
 190                            // This will allow all code in this thread to get
 191                            // the languages for the messages returned to the client.
 192 kumpf            1.114     Thread::setLanguages(httpMessage->acceptLanguages);
 193 kumpf            1.104 
 194                            // Save queueId:
 195                        
 196                            Uint32 queueId = httpMessage->queueId;
 197                        
 198                            // Save userName and authType:
 199                        
 200                            String userName;
 201                            String authType;
 202                            Boolean closeConnect = httpMessage->getCloseConnect();
 203                        
 204                            PEG_TRACE((
 205                                TRC_HTTP,
 206 marek            1.118         Tracer::LEVEL4,
 207 kumpf            1.104         "CIMOperationRequestDecoder::handleHTTPMessage()- "
 208                                "httpMessage->getCloseConnect() returned %d",
 209                                closeConnect));
 210                        
 211 sushma.fernandes 1.109     userName = httpMessage->authInfo->getAuthenticatedUser();
 212                            authType = httpMessage->authInfo->getAuthType();
 213 kumpf            1.104 
 214                            // Parse the HTTP message:
 215                        
 216                            String startLine;
 217                            Array<HTTPHeader> headers;
 218                            char* content;
 219                            Uint32 contentLength;
 220                        
 221                            httpMessage->parse(startLine, headers, contentLength);
 222                        
 223                            // Parse the request line:
 224                        
 225                            String methodName;
 226                            String requestUri;
 227                            String httpVersion;
 228                            HttpMethod httpMethod = HTTP_METHOD__POST;
 229                        
 230                            HTTPMessage::parseRequestLine(
 231                                startLine, methodName, requestUri, httpVersion);
 232                        
 233                            //
 234 kumpf            1.104     //  Set HTTP method for the request
 235                            //
 236                            if (methodName == "M-POST")
 237                            {
 238                                httpMethod = HTTP_METHOD_M_POST;
 239                            }
 240                        
 241                            // Unsupported methods are caught in the HTTPAuthenticatorDelegator
 242                            PEGASUS_ASSERT(methodName == "M-POST" || methodName == "POST");
 243                        
 244                            //
 245                            //  Mismatch of method and version is caught in HTTPAuthenticatorDelegator
 246                            //
 247                            PEGASUS_ASSERT(!((httpMethod == HTTP_METHOD_M_POST) &&
 248                                             (httpVersion == "HTTP/1.0")));
 249 humberto         1.80  
 250 kumpf            1.104     // Process M-POST and POST messages:
 251 humberto         1.80  
 252 kumpf            1.104     if (httpVersion == "HTTP/1.1")
 253                            {
 254                                // Validate the presence of a "Host" header.  The HTTP/1.1 specification
 255                                // says this in section 14.23 regarding the Host header field:
 256                                //
 257                                //     All Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad
 258                                //     Request) status code to any HTTP/1.1 request message which lacks
 259                                //     a Host header field.
 260                                //
 261                                // Note:  The Host header value is not validated.
 262                        
 263 kumpf            1.124         const char* hostHeader;
 264 kumpf            1.104         Boolean hostHeaderFound = HTTPMessage::lookupHeader(
 265                                    headers, "Host", hostHeader, false);
 266 mike             1.2   
 267 kumpf            1.104         if (!hostHeaderFound)
 268                                {
 269                                    MessageLoaderParms parms(
 270                                        "Server.CIMOperationRequestDecoder.MISSING_HOST_HEADER",
 271                                        "HTTP request message lacks a Host header field.");
 272                                    sendHttpError(
 273                                        queueId,
 274                                        HTTP_STATUS_BADREQUEST,
 275                                        "",
 276                                        MessageLoader::getMessage(parms),
 277                                        closeConnect);
 278                                    PEG_METHOD_EXIT();
 279                                    return;
 280                                }
 281                            }
 282 mike             1.2   
 283 kumpf            1.104     // Validate the "CIMOperation" header:
 284 mike             1.2   
 285 kumpf            1.124     const char* cimOperation;
 286 kumpf            1.104     Boolean operationHeaderFound = HTTPMessage::lookupHeader(
 287                                headers, "CIMOperation", cimOperation, true);
 288                            // If the CIMOperation header was missing, the HTTPAuthenticatorDelegator
 289                            // would not have passed the message to us.
 290                            PEGASUS_ASSERT(operationHeaderFound);
 291                        
 292 kumpf            1.124     if (System::strcasecmp(cimOperation, "MethodCall") != 0)
 293 kumpf            1.104     {
 294                                // The Specification for CIM Operations over HTTP reads:
 295                                //     3.3.4. CIMOperation
 296                                //     If a CIM Server receives CIM Operation request with this
 297                                //     [CIMOperation] header, but with a missing value or a value
 298                                //     that is not "MethodCall", then it MUST fail the request with
 299                                //     status "400 Bad Request". The CIM Server MUST include a
 300                                //     CIMError header in the response with a value of
 301                                //     unsupported-operation.
 302                                MessageLoaderParms parms(
 303                                    "Server.CIMOperationRequestDecoder."
 304                                        "CIMOPERATION_VALUE_NOT_SUPPORTED",
 305                                    "CIMOperation value \"$0\" is not supported.",cimOperation);
 306                                sendHttpError(
 307                                    queueId,
 308                                    HTTP_STATUS_BADREQUEST,
 309                                    "unsupported-operation",
 310                                    MessageLoader::getMessage(parms),
 311                                    closeConnect);
 312                                PEG_METHOD_EXIT();
 313                                return;
 314 kumpf            1.104     }
 315                        
 316                            // Validate the "CIMBatch" header:
 317                        
 318 kumpf            1.124     const char* cimBatch;
 319                            if (HTTPMessage::lookupHeader(headers, "CIMBatch", cimBatch, true))
 320 kumpf            1.104     {
 321                                // The Specification for CIM Operations over HTTP reads:
 322                                //     3.3.9. CIMBatch
 323                                //     If a CIM Server receives CIM Operation Request for which the
 324                                //     CIMBatch header is present, but the Server does not support
 325                                //     Multiple Operations, then it MUST fail the request and
 326                                //     return a status of "501 Not Implemented".
 327                                sendHttpError(
 328                                    queueId,
 329                                    HTTP_STATUS_NOTIMPLEMENTED,
 330                                    "multiple-requests-unsupported",
 331                                    String::EMPTY,
 332                                    closeConnect);
 333                                PEG_METHOD_EXIT();
 334                                return;
 335                            }
 336                        
 337                            // Save these headers for later checking
 338                        
 339 kumpf            1.124     const char* cimProtocolVersion;
 340 kumpf            1.104     if (!HTTPMessage::lookupHeader(
 341                                headers, "CIMProtocolVersion", cimProtocolVersion, true))
 342                            {
 343                                // Mandated by the Specification for CIM Operations over HTTP
 344 kumpf            1.124         cimProtocolVersion = "1.0";
 345 kumpf            1.104     }
 346                        
 347 kumpf            1.124     String cimMethod;
 348 kumpf            1.104     if (HTTPMessage::lookupHeader(headers, "CIMMethod", cimMethod, true))
 349                            {
 350                                if (cimMethod == String::EMPTY)
 351                                {
 352                                    // This is not a valid value, and we use EMPTY to mean "absent"
 353                                    MessageLoaderParms parms(
 354                                        "Server.CIMOperationRequestDecoder.EMPTY_CIMMETHOD_VALUE",
 355                                        "Empty CIMMethod value.");
 356                                    sendHttpError(
 357                                        queueId,
 358                                        HTTP_STATUS_BADREQUEST,
 359                                        "header-mismatch",
 360                                        MessageLoader::getMessage(parms),
 361                                        closeConnect);
 362                                    PEG_METHOD_EXIT();
 363                                    return;
 364                                }
 365 mike             1.98  
 366 kumpf            1.104         try
 367                                {
 368                                    cimMethod = XmlReader::decodeURICharacters(cimMethod);
 369                                }
 370                                catch (const ParseError&)
 371                                {
 372                                    // The CIMMethod header value could not be decoded
 373                                    MessageLoaderParms parms(
 374                                        "Server.CIMOperationRequestDecoder."
 375                                            "CIMMETHOD_VALUE_SYNTAX_ERROR",
 376                                        "CIMMethod value syntax error.");
 377                                    sendHttpError(
 378                                        queueId,
 379                                        HTTP_STATUS_BADREQUEST,
 380                                        "header-mismatch",
 381                                        MessageLoader::getMessage(parms),
 382                                        closeConnect);
 383                                    PEG_METHOD_EXIT();
 384                                    return;
 385                                }
 386                            }
 387 mike             1.2   
 388 kumpf            1.124     String cimObject;
 389 kumpf            1.104     if (HTTPMessage::lookupHeader(headers, "CIMObject", cimObject, true))
 390                            {
 391                                if (cimObject == String::EMPTY)
 392                                {
 393                                    // This is not a valid value, and we use EMPTY to mean "absent"
 394                                    MessageLoaderParms parms(
 395                                        "Server.CIMOperationRequestDecoder.EMPTY_CIMOBJECT_VALUE",
 396                                        "Empty CIMObject value.");
 397                                    sendHttpError(
 398                                        queueId,
 399                                        HTTP_STATUS_BADREQUEST,
 400                                        "header-mismatch",
 401                                        MessageLoader::getMessage(parms),
 402                                        closeConnect);
 403                                    PEG_METHOD_EXIT();
 404                                    return;
 405                                }
 406 mike             1.2   
 407 kumpf            1.104         try
 408                                {
 409                                    cimObject = XmlReader::decodeURICharacters(cimObject);
 410                                }
 411                                catch (const ParseError&)
 412                                {
 413                                    // The CIMObject header value could not be decoded
 414                                    MessageLoaderParms parms(
 415                                        "Server.CIMOperationRequestDecoder."
 416                                            "CIMOBJECT_VALUE_SYNTAX_ERROR",
 417                                        "CIMObject value syntax error.");
 418                                    sendHttpError(
 419                                        queueId,
 420                                        HTTP_STATUS_BADREQUEST,
 421                                        "header-mismatch",
 422                                        MessageLoader::getMessage(parms),
 423                                        closeConnect);
 424                                    PEG_METHOD_EXIT();
 425                                    return;
 426                                }
 427                            }
 428 mike             1.2   
 429 kumpf            1.104     // Calculate the beginning of the content from the message size and
 430 kumpf            1.110     // the content length.
 431 mike             1.2   
 432 kumpf            1.104     content = (char*) httpMessage->message.getData() +
 433 kumpf            1.110         httpMessage->message.size() - contentLength;
 434 mike             1.2   
 435 kumpf            1.104     // Validate the "Content-Type" header:
 436 mike             1.2   
 437 kumpf            1.124     const char* cimContentType;
 438 kumpf            1.104     Boolean contentTypeHeaderFound = HTTPMessage::lookupHeader(
 439                                headers, "Content-Type", cimContentType, true);
 440 kumpf            1.115     String type;
 441                            String charset;
 442 mike             1.120     Boolean binaryRequest = false;
 443 kumpf            1.115 
 444 kumpf            1.123     if (!contentTypeHeaderFound ||
 445 kumpf            1.115         !HTTPMessage::parseContentTypeHeader(cimContentType, type, charset) ||
 446 mike             1.120         ((!String::equalNoCase(type, "application/xml") &&
 447 kumpf            1.115          !String::equalNoCase(type, "text/xml")) ||
 448 kumpf            1.123         !String::equalNoCase(charset, "utf-8"))
 449 mike             1.120 #if defined(PEGASUS_ENABLE_PROTOCOL_BINARY)
 450 kumpf            1.123         && !(binaryRequest = String::equalNoCase(type,
 451 mike             1.120             "application/x-openpegasus"))
 452                        #endif
 453                                )
 454 kumpf            1.104     {
 455 j.alex           1.95          MessageLoaderParms parms(
 456 kumpf            1.104             "Server.CIMOperationRequestDecoder.CIMCONTENTTYPE_SYNTAX_ERROR",
 457 kumpf            1.105             "HTTP Content-Type header error.");
 458 j.alex           1.95          sendHttpError(
 459                                    queueId,
 460                                    HTTP_STATUS_BADREQUEST,
 461 kumpf            1.105             "",
 462 j.alex           1.95              MessageLoader::getMessage(parms),
 463                                    closeConnect);
 464 kumpf            1.104         PEG_METHOD_EXIT();
 465                                return;
 466                            }
 467                            // Validating content falls within UTF8
 468                            // (required to be complaint with section C12 of Unicode 4.0 spec,
 469                            // chapter 3.)
 470 mike             1.120     else if (!binaryRequest)
 471 kumpf            1.104     {
 472                                Uint32 count = 0;
 473                                while(count<contentLength)
 474                                {
 475                                    if (!(isUTF8((char*)&content[count])))
 476                                    {
 477                                        MessageLoaderParms parms(
 478                                            "Server.CIMOperationRequestDecoder.INVALID_UTF8_CHARACTER",
 479                                            "Invalid UTF-8 character detected.");
 480                                        sendHttpError(
 481                                            queueId,
 482                                            HTTP_STATUS_BADREQUEST,
 483                                            "request-not-valid",
 484                                            MessageLoader::getMessage(parms),
 485                                            closeConnect);
 486                        
 487                                        PEG_METHOD_EXIT();
 488 mike             1.120                 return;
 489 kumpf            1.104             }
 490                                    UTF8_NEXT(content,count);
 491                                }
 492                            }
 493                        
 494 kumpf            1.123     // Check for "Accept: application/x-openpegasus" HTTP header to see if
 495 mike             1.120     // client can accept binary responses.
 496                        
 497                            bool binaryResponse;
 498                        
 499                            if (HTTPMessage::lookupHeader(headers, "Accept", type, true) &&
 500                                String::equalNoCase(type, "application/x-openpegasus"))
 501                            {
 502                                binaryResponse = true;
 503                            }
 504                            else
 505                            {
 506                                binaryResponse = false;
 507                            }
 508                        
 509 kumpf            1.104     // If it is a method call, then dispatch it to be handled:
 510                        
 511                            handleMethodCall(
 512                                queueId,
 513                                httpMethod,
 514                                content,
 515                                contentLength,
 516                                cimProtocolVersion,
 517                                cimMethod,
 518                                cimObject,
 519                                authType,
 520                                userName,
 521                                httpMessage->ipAddress,
 522                                httpMessage->acceptLanguages,
 523                                httpMessage->contentLanguages,
 524 mike             1.120         closeConnect,
 525                                binaryRequest,
 526                                binaryResponse);
 527 kumpf            1.104 
 528                            PEG_METHOD_EXIT();
 529                        }
 530                        
 531                        void CIMOperationRequestDecoder::handleMethodCall(
 532                            Uint32 queueId,
 533                            HttpMethod httpMethod,
 534                            char* content,
 535                            Uint32 contentLength,    // used for statistics only
 536 kumpf            1.124     const char* cimProtocolVersionInHeader,
 537 kumpf            1.104     const String& cimMethodInHeader,
 538                            const String& cimObjectInHeader,
 539                            const String& authType,
 540                            const String& userName,
 541                            const String& ipAddress,
 542                            const AcceptLanguageList& httpAcceptLanguages,
 543                            const ContentLanguageList& httpContentLanguages,
 544 mike             1.120     Boolean closeConnect,
 545                            Boolean binaryRequest,
 546                            Boolean binaryResponse)
 547 kumpf            1.104 {
 548                            PEG_METHOD_ENTER(TRC_DISPATCHER,
 549                                "CIMOperationRequestDecoder::handleMethodCall()");
 550                        
 551                            //
 552                            // If CIMOM is shutting down, return "Service Unavailable" response
 553                            //
 554                            if (_serverTerminating)
 555                            {
 556 j.alex           1.95          MessageLoaderParms parms(
 557 kumpf            1.104             "Server.CIMOperationRequestDecoder.CIMSERVER_SHUTTING_DOWN",
 558                                    "CIM Server is shutting down.");
 559 j.alex           1.95          sendHttpError(
 560                                    queueId,
 561 kumpf            1.104             HTTP_STATUS_SERVICEUNAVAILABLE,
 562                                    String::EMPTY,
 563 j.alex           1.95              MessageLoader::getMessage(parms),
 564                                    closeConnect);
 565 kumpf            1.104         PEG_METHOD_EXIT();
 566                                return;
 567                            }
 568                        
 569 thilo.boehm      1.119     PEG_TRACE((TRC_XML,Tracer::LEVEL4,
 570 marek            1.116         "CIMOperationRequestdecoder - XML content: %s",
 571                                content));
 572 kumpf            1.104 
 573 mike             1.120     //
 574                            // Handle binary messages:
 575                            //
 576 kumpf            1.104 
 577                            AutoPtr<CIMOperationRequestMessage> request;
 578                        
 579 mike             1.120     if (binaryRequest)
 580 kumpf            1.104     {
 581 mike             1.120         Buffer buf(content, contentLength);
 582                        
 583                                request.reset(BinaryCodec::decodeRequest(buf, queueId, _returnQueueId));
 584                        
 585                                if (!request.get())
 586                                {
 587                                    sendHttpError(
 588                                        queueId,
 589                                        HTTP_STATUS_BADREQUEST,
 590                                        "Corrupt binary request message",
 591                                        String::EMPTY,
 592                                        closeConnect);
 593                                    PEG_METHOD_EXIT();
 594                                    return;
 595                                }
 596                            }
 597                            else try
 598                            {
 599                                XmlParser parser(content);
 600                                XmlEntry entry;
 601                                String messageId;
 602 mike             1.120         const char* cimMethodName = "";
 603                        
 604 kumpf            1.104         //
 605                                // Process <?xml ... >
 606                                //
 607                        
 608                                // These values are currently unused
 609                                const char* xmlVersion = 0;
 610                                const char* xmlEncoding = 0;
 611 mike             1.2   
 612 kumpf            1.104         XmlReader::getXmlDeclaration(parser, xmlVersion, xmlEncoding);
 613 mike             1.2   
 614 kumpf            1.104         // Expect <CIM ...>
 615 chip             1.92  
 616 kumpf            1.104         const char* cimVersion = 0;
 617                                const char* dtdVersion = 0;
 618 mike             1.2   
 619 kumpf            1.104         XmlReader::getCimStartTag(parser, cimVersion, dtdVersion);
 620 mike             1.2   
 621 karl             1.108         if (!XmlReader::isSupportedCIMVersion(cimVersion))
 622 kumpf            1.104         {
 623                                    MessageLoaderParms parms(
 624                                        "Server.CIMOperationRequestDecoder.CIM_VERSION_NOT_SUPPORTED",
 625                                        "CIM version \"$0\" is not supported.",
 626                                         cimVersion);
 627                                    sendHttpError(
 628                                        queueId,
 629                                        HTTP_STATUS_NOTIMPLEMENTED,
 630                                        "unsupported-cim-version",
 631                                        MessageLoader::getMessage(parms),
 632                                        closeConnect);
 633 kumpf            1.23              PEG_METHOD_EXIT();
 634                                    return;
 635 kumpf            1.104         }
 636 kumpf            1.23  
 637 karl             1.108         if (!XmlReader::isSupportedDTDVersion(dtdVersion))
 638 kumpf            1.104         {
 639                                    MessageLoaderParms parms(
 640                                        "Server.CIMOperationRequestDecoder.DTD_VERSION_NOT_SUPPORTED",
 641                                        "DTD version \"$0\" is not supported.",
 642                                        dtdVersion);
 643                                    sendHttpError(
 644 j.alex           1.95                  queueId,
 645 kumpf            1.104                 HTTP_STATUS_NOTIMPLEMENTED,
 646                                        "unsupported-dtd-version",
 647                                        MessageLoader::getMessage(parms),
 648 j.alex           1.95                  closeConnect);
 649 kumpf            1.20              PEG_METHOD_EXIT();
 650 kumpf            1.34              return;
 651 kumpf            1.104         }
 652                        
 653                                // Expect <MESSAGE ...>
 654                        
 655                                String protocolVersion;
 656 kumpf            1.73  
 657 kumpf            1.104         if (!XmlReader::getMessageStartTag(
 658                                         parser, messageId, protocolVersion))
 659                                {
 660                                    MessageLoaderParms mlParms(
 661                                        "Server.CIMOperationRequestDecoder.EXPECTED_MESSAGE_ELEMENT",
 662                                        "expected MESSAGE element");
 663 mday             1.16  
 664 kumpf            1.104             throw XmlValidationError(parser.getLine(), mlParms);
 665                                }
 666 mday             1.16  
 667 kumpf            1.104         // Validate that the protocol version in the header matches the XML
 668                                if (!String::equalNoCase(protocolVersion, cimProtocolVersionInHeader))
 669                                {
 670 j.alex           1.95              MessageLoaderParms parms(
 671 kumpf            1.104                 "Server.CIMOperationRequestDecoder."
 672                                            "CIMPROTOCOL_VERSION_MISMATCH",
 673                                        "CIMProtocolVersion value \"$0\" does not match CIM request "
 674                                            "protocol version \"$1\".",
 675                                        cimProtocolVersionInHeader,
 676                                        protocolVersion);
 677 j.alex           1.95              sendHttpError(
 678                                        queueId,
 679                                        HTTP_STATUS_BADREQUEST,
 680                                        "header-mismatch",
 681                                        MessageLoader::getMessage(parms),
 682                                        closeConnect);
 683 kumpf            1.39              PEG_METHOD_EXIT();
 684                                    return;
 685 kumpf            1.104         }
 686 kumpf            1.39  
 687 karl             1.108         // Accept protocol version 1.x (see Bugzilla 1556)
 688                                if (!XmlReader::isSupportedProtocolVersion(protocolVersion))
 689 kumpf            1.104         {
 690                                    // See Specification for CIM Operations over HTTP section 4.3
 691 j.alex           1.95              MessageLoaderParms parms(
 692 kumpf            1.104                 "Server.CIMOperationRequestDecoder."
 693                                            "CIMPROTOCOL_VERSION_NOT_SUPPORTED",
 694                                        "CIMProtocolVersion \"$0\" is not supported.",
 695                                             protocolVersion);
 696 j.alex           1.95              sendHttpError(
 697                                        queueId,
 698 kumpf            1.104                 HTTP_STATUS_NOTIMPLEMENTED,
 699                                        "unsupported-protocol-version",
 700 j.alex           1.95                  MessageLoader::getMessage(parms),
 701                                        closeConnect);
 702 kumpf            1.23              PEG_METHOD_EXIT();
 703                                    return;
 704 kumpf            1.104         }
 705 kumpf            1.23  
 706 kumpf            1.104         if (XmlReader::testStartTag(parser, entry, "MULTIREQ"))
 707                                {
 708                                    // We wouldn't have gotten here if CIMBatch header was specified,
 709                                    // so this must be indicative of a header mismatch
 710 j.alex           1.95              MessageLoaderParms parms(
 711 kumpf            1.104                 "Server.CIMOperationRequestDecoder."
 712                                            "MULTI_REQUEST_MISSING_CIMBATCH_HTTP_HEADER",
 713                                        "Multi-request is missing CIMBatch HTTP header");
 714 j.alex           1.95              sendHttpError(
 715                                        queueId,
 716                                        HTTP_STATUS_BADREQUEST,
 717                                        "header-mismatch",
 718                                        MessageLoader::getMessage(parms),
 719                                        closeConnect);
 720 kumpf            1.23              PEG_METHOD_EXIT();
 721                                    return;
 722 kumpf            1.104             // Future: When MULTIREQ is supported, must ensure CIMMethod and
 723                                    // CIMObject headers are absent, and CIMBatch header is present.
 724                                }
 725                        
 726                                // Expect <SIMPLEREQ ...>
 727                        
 728                                XmlReader::expectStartTag(parser, entry, "SIMPLEREQ");
 729                        
 730                                // Check for <IMETHODCALL ...>
 731                        
 732                                if (XmlReader::getIMethodCallStartTag(parser, cimMethodName))
 733                                {
 734                                    // The Specification for CIM Operations over HTTP reads:
 735                                    //     3.3.6. CIMMethod
 736                                    //
 737                                    //     This header MUST be present in any CIM Operation Request
 738                                    //     message that contains a Simple Operation Request.
 739                                    //
 740                                    //     It MUST NOT be present in any CIM Operation Response message,
 741                                    //     nor in any CIM Operation Request message that is not a
 742                                    //     Simple Operation Request.
 743 kumpf            1.104             //
 744                                    //     The name of the CIM method within a Simple Operation Request
 745                                    //     is defined to be the value of the NAME attribute of the
 746                                    //     <METHODCALL> or <IMETHODCALL> element.
 747                                    //
 748                                    //     If a CIM Server receives a CIM Operation Request for which
 749                                    //     either:
 750                                    //
 751                                    //     - The CIMMethod header is present but has an invalid value,
 752                                    //       or;
 753                                    //     - The CIMMethod header is not present but the Operation
 754                                    //       Request Message is a Simple Operation Request, or;
 755                                    //     - The CIMMethod header is present but the Operation Request
 756                                    //       Message is not a Simple Operation Request, or;
 757                                    //     - The CIMMethod header is present, the Operation Request
 758                                    //       Message is a Simple Operation Request, but the
 759                                    //       CIMIdentifier value (when unencoded) does not match the
 760                                    //       unique method name within the Simple Operation Request,
 761                                    //
 762                                    //     then it MUST fail the request and return a status of
 763                                    //     "400 Bad Request" (and MUST include a CIMError header in the
 764 kumpf            1.104             //     response with a value of header-mismatch), subject to the
 765                                    //     considerations specified in Errors.
 766                                    if (!String::equalNoCase(cimMethodName, cimMethodInHeader))
 767                                    {
 768                                        // ATTN-RK-P3-20020304: How to decode cimMethodInHeader?
 769                                        if (cimMethodInHeader == String::EMPTY)
 770                                        {
 771                                            MessageLoaderParms parms(
 772                                                "Server.CIMOperationRequestDecoder."
 773                                                    "MISSING_CIMMETHOD_HTTP_HEADER",
 774                                                "Missing CIMMethod HTTP header.");
 775                                            sendHttpError(
 776                                                queueId,
 777                                                HTTP_STATUS_BADREQUEST,
 778                                                "header-mismatch",
 779                                                MessageLoader::getMessage(parms),
 780                                                closeConnect);
 781                                        }
 782                                        else
 783                                        {
 784                                            MessageLoaderParms parms(
 785 kumpf            1.104                         "Server.CIMOperationRequestDecoder."
 786                                                     "CIMMETHOD_VALUE_DOES_NOT_MATCH_REQUEST_METHOD",
 787                                                "CIMMethod value \"$0\" does not match CIM request "
 788                                                     "method \"$1\".",
 789                                                cimMethodInHeader,
 790                                                cimMethodName);
 791                                            sendHttpError(
 792                                                queueId,
 793                                                HTTP_STATUS_BADREQUEST,
 794                                                "header-mismatch",
 795                                                MessageLoader::getMessage(parms),
 796                                                closeConnect);
 797                                        }
 798                                        PEG_METHOD_EXIT();
 799                                        return;
 800                                    }
 801 kumpf            1.23  
 802 kumpf            1.104             // Expect <LOCALNAMESPACEPATH ...>
 803                        
 804                                    String nameSpace;
 805                        
 806                                    if (!XmlReader::getLocalNameSpacePathElement(parser, nameSpace))
 807                                    {
 808                                        MessageLoaderParms mlParms(
 809                                            "Server.CIMOperationRequestDecoder."
 810                                                "EXPECTED_LOCALNAMESPACEPATH_ELEMENT",
 811                                            "expected LOCALNAMESPACEPATH element");
 812                                        throw XmlValidationError(parser.getLine(), mlParms);
 813                                    }
 814                        
 815                                    // The Specification for CIM Operations over HTTP reads:
 816                                    //     3.3.7. CIMObject
 817                                    //
 818                                    //     This header MUST be present in any CIM Operation Request
 819                                    //     message that contains a Simple Operation Request.
 820                                    //
 821                                    //     It MUST NOT be present in any CIM Operation Response message,
 822                                    //     nor in any CIM Operation Request message that is not a
 823 kumpf            1.104             //     Simple Operation Request.
 824                                    //
 825                                    //     The header identifies the CIM object (which MUST be a Class
 826                                    //     or Instance for an extrinsic method, or a Namespace for an
 827                                    //     intrinsic method) on which the method is to be invoked, using
 828                                    //     a CIM object path encoded in an HTTP-safe representation.
 829                                    //
 830                                    //     If a CIM Server receives a CIM Operation Request for which
 831                                    //     either:
 832                                    //
 833                                    //     - The CIMObject header is present but has an invalid value,
 834                                    //       or;
 835                                    //     - The CIMObject header is not present but the Operation
 836                                    //       Request Message is a Simple Operation Request, or;
 837                                    //     - The CIMObject header is present but the Operation Request
 838                                    //       Message is not a Simple Operation Request, or;
 839                                    //     - The CIMObject header is present, the Operation Request
 840                                    //       Message is a Simple Operation Request, but the ObjectPath
 841                                    //       value does not match (where match is defined in the section
 842                                    //       section on Encoding CIM Object Paths) the Operation Request
 843                                    //       Message,
 844 kumpf            1.104             //
 845                                    //     then it MUST fail the request and return a status of
 846                                    //     "400 Bad Request" (and MUST include a CIMError header in the
 847                                    //     response with a value of header-mismatch), subject to the
 848                                    //     considerations specified in Errors.
 849                                    if (!String::equalNoCase(nameSpace, cimObjectInHeader))
 850                                    {
 851                                        if (cimObjectInHeader == String::EMPTY)
 852                                        {
 853                                            MessageLoaderParms parms(
 854                                                "Server.CIMOperationRequestDecoder."
 855                                                    "MISSING_CIMOBJECT_HTTP_HEADER",
 856                                                "Missing CIMObject HTTP header.");
 857                                            sendHttpError(
 858                                                queueId,
 859                                                HTTP_STATUS_BADREQUEST,
 860                                                "header-mismatch",
 861                                                MessageLoader::getMessage(parms),
 862                                                closeConnect);
 863                                        }
 864                                        else
 865 kumpf            1.104                 {
 866                                            MessageLoaderParms parms(
 867                                                "Server.CIMOperationRequestDecoder."
 868 kumpf            1.113                             "CIMOBJECT_VALUE_DOES_NOT_MATCH_REQUEST_OBJECT",
 869 kumpf            1.104                         "CIMObject value \"$0\" does not match CIM request "
 870                                                    "object \"$1\".",
 871                                                cimObjectInHeader,
 872                                                nameSpace);
 873                                            sendHttpError(
 874                                                queueId,
 875                                                HTTP_STATUS_BADREQUEST,
 876                                                "header-mismatch",
 877                                                MessageLoader::getMessage(parms),
 878                                                closeConnect);
 879                                        }
 880                                        PEG_METHOD_EXIT();
 881                                        return;
 882                                    }
 883                        
 884                                    // This try block only catches CIMExceptions, because they must be
 885                                    // responded to with a proper IMETHODRESPONSE.  Other exceptions are
 886                                    // caught in the outer try block.
 887                                    try
 888                                    {
 889                                        // Delegate to appropriate method to handle:
 890 kumpf            1.104 
 891                                        if (System::strcasecmp(cimMethodName, "GetClass") == 0)
 892                                            request.reset(decodeGetClassRequest(
 893                                                queueId, parser, messageId, nameSpace));
 894                                        else if (System::strcasecmp(cimMethodName, "GetInstance") == 0)
 895                                            request.reset(decodeGetInstanceRequest(
 896                                                queueId, parser, messageId, nameSpace));
 897                                        else if (System::strcasecmp(
 898                                                     cimMethodName, "EnumerateClassNames") == 0)
 899                                            request.reset(decodeEnumerateClassNamesRequest(
 900                                                queueId, parser, messageId, nameSpace));
 901                                        else if (System::strcasecmp(cimMethodName, "References") == 0)
 902                                            request.reset(decodeReferencesRequest(
 903                                                queueId, parser, messageId, nameSpace));
 904                                        else if (System::strcasecmp(
 905                                                     cimMethodName, "ReferenceNames") == 0)
 906                                            request.reset(decodeReferenceNamesRequest(
 907                                                queueId, parser, messageId, nameSpace));
 908                                        else if (System::strcasecmp(
 909                                                     cimMethodName, "AssociatorNames") == 0)
 910                                            request.reset(decodeAssociatorNamesRequest(
 911 kumpf            1.104                         queueId, parser, messageId, nameSpace));
 912                                        else if (System::strcasecmp(cimMethodName, "Associators") == 0)
 913                                            request.reset(decodeAssociatorsRequest(
 914                                                queueId, parser, messageId, nameSpace));
 915                                        else if (System::strcasecmp(
 916                                                     cimMethodName, "CreateInstance") == 0)
 917                                            request.reset(decodeCreateInstanceRequest(
 918                                                queueId, parser, messageId, nameSpace));
 919                                        else if (System::strcasecmp(
 920                                                     cimMethodName, "EnumerateInstanceNames")==0)
 921                                            request.reset(decodeEnumerateInstanceNamesRequest(
 922                                                queueId, parser, messageId, nameSpace));
 923                                        else if (System::strcasecmp(
 924                                                     cimMethodName, "DeleteQualifier") == 0)
 925                                            request.reset(decodeDeleteQualifierRequest(
 926                                                queueId, parser, messageId, nameSpace));
 927                                        else if (System::strcasecmp(cimMethodName, "GetQualifier") == 0)
 928                                            request.reset(decodeGetQualifierRequest(
 929                                                queueId, parser, messageId, nameSpace));
 930                                        else if (System::strcasecmp(cimMethodName, "SetQualifier") == 0)
 931                                            request.reset(decodeSetQualifierRequest(
 932 kumpf            1.104                         queueId, parser, messageId, nameSpace));
 933                                        else if (System::strcasecmp(
 934                                                     cimMethodName, "EnumerateQualifiers") == 0)
 935                                            request.reset(decodeEnumerateQualifiersRequest(
 936                                                queueId, parser, messageId, nameSpace));
 937                                        else if (System::strcasecmp(
 938                                                     cimMethodName, "EnumerateClasses") == 0)
 939                                            request.reset(decodeEnumerateClassesRequest(
 940                                                queueId, parser, messageId, nameSpace));
 941                                        else if (System::strcasecmp(
 942                                                     cimMethodName, "EnumerateInstances") == 0)
 943                                            request.reset(decodeEnumerateInstancesRequest(
 944                                                queueId, parser, messageId, nameSpace));
 945                                        else if (System::strcasecmp(cimMethodName, "CreateClass") == 0)
 946                                            request.reset(decodeCreateClassRequest(
 947                                                queueId, parser, messageId, nameSpace));
 948                                        else if (System::strcasecmp(cimMethodName, "ModifyClass") == 0)
 949                                            request.reset(decodeModifyClassRequest(
 950                                                queueId, parser, messageId, nameSpace));
 951                                        else if (System::strcasecmp(
 952                                                     cimMethodName, "ModifyInstance") == 0)
 953 kumpf            1.104                     request.reset(decodeModifyInstanceRequest(
 954                                                queueId, parser, messageId, nameSpace));
 955                                        else if (System::strcasecmp(cimMethodName, "DeleteClass") == 0)
 956                                            request.reset(decodeDeleteClassRequest(
 957                                                queueId, parser, messageId, nameSpace));
 958                                        else if (System::strcasecmp(
 959                                                     cimMethodName, "DeleteInstance") == 0)
 960                                            request.reset(decodeDeleteInstanceRequest(
 961                                                queueId, parser, messageId, nameSpace));
 962                                        else if (System::strcasecmp(cimMethodName, "GetProperty") == 0)
 963                                            request.reset(decodeGetPropertyRequest(
 964                                                queueId, parser, messageId, nameSpace));
 965                                        else if (System::strcasecmp(cimMethodName, "SetProperty") == 0)
 966                                            request.reset(decodeSetPropertyRequest(
 967                                                queueId, parser, messageId, nameSpace));
 968                                        else if (System::strcasecmp(cimMethodName, "ExecQuery") == 0)
 969                                            request.reset(decodeExecQueryRequest(
 970                                                queueId, parser, messageId, nameSpace));
 971                                        else
 972                                        {
 973                                            throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
 974 kumpf            1.104                         MessageLoaderParms(
 975                                                    "Server.CIMOperationRequestDecoder."
 976                                                        "UNRECOGNIZED_INTRINSIC_METHOD",
 977                                                    "Unrecognized intrinsic method: $0",
 978                                                    cimMethodName));
 979                                        }
 980                                    }
 981                                    catch (CIMException& e)
 982                                    {
 983                                        sendIMethodError(
 984                                            queueId,
 985                                            httpMethod,
 986                                            messageId,
 987                                            cimMethodName,
 988                                            e,
 989                                            closeConnect);
 990                        
 991                                        PEG_METHOD_EXIT();
 992                                        return;
 993                                    }
 994                                    catch (XmlException&)
 995 kumpf            1.104             {
 996                                        // XmlExceptions are handled below
 997                                        throw;
 998                                    }
 999                                    catch (Exception& e)
1000                                    {
1001                                        // Caught an unexpected exception from decoding.  Since we must
1002                                        // have had a problem reconstructing a CIM object, we'll treat
1003                                        // it as an invalid parameter
1004                                        sendIMethodError(
1005                                            queueId,
1006                                            httpMethod,
1007                                            messageId,
1008                                            cimMethodName,
1009                                            PEGASUS_CIM_EXCEPTION(
1010                                                CIM_ERR_INVALID_PARAMETER, e.getMessage()),
1011                                            closeConnect);
1012                        
1013                                        PEG_METHOD_EXIT();
1014                                        return;
1015                                    }
1016 kumpf            1.104 
1017                                    // Expect </IMETHODCALL>
1018                        
1019                                    XmlReader::expectEndTag(parser, "IMETHODCALL");
1020                                }
1021                                // Expect <METHODCALL ...>
1022                                else if (XmlReader::getMethodCallStartTag(parser, cimMethodName))
1023                                {
1024                                    CIMObjectPath reference;
1025                        
1026                                    // The Specification for CIM Operations over HTTP reads:
1027                                    //     3.3.6. CIMMethod
1028                                    //
1029                                    //     This header MUST be present in any CIM Operation Request
1030                                    //     message that contains a Simple Operation Request.
1031                                    //
1032                                    //     It MUST NOT be present in any CIM Operation Response message,
1033                                    //     nor in any CIM Operation Request message that is not a
1034                                    //     Simple Operation Request.
1035                                    //
1036                                    //     The name of the CIM method within a Simple Operation Request
1037 kumpf            1.104             //     is defined to be the value of the NAME attribute of the
1038                                    //     <METHODCALL> or <IMETHODCALL> element.
1039                                    //
1040                                    //     If a CIM Server receives a CIM Operation Request for which
1041                                    //     either:
1042                                    //
1043                                    //     - The CIMMethod header is present but has an invalid value,
1044                                    //       or;
1045                                    //     - The CIMMethod header is not present but the Operation
1046                                    //       Request Message is a Simple Operation Request, or;
1047                                    //     - The CIMMethod header is present but the Operation Request
1048                                    //       Message is not a Simple Operation Request, or;
1049                                    //     - The CIMMethod header is present, the Operation Request
1050                                    //       Message is a Simple Operation Request, but the
1051                                    //       CIMIdentifier value (when unencoded) does not match the
1052                                    //       unique method name within the Simple Operation Request,
1053                                    //
1054                                    //     then it MUST fail the request and return a status of
1055                                    //     "400 Bad Request" (and MUST include a CIMError header in the
1056                                    //     response with a value of header-mismatch), subject to the
1057                                    //     considerations specified in Errors.
1058 kumpf            1.104 
1059                                    // Extrinic methods can have UTF-8!
1060                                    String cimMethodNameUTF16(cimMethodName);
1061                                    if (cimMethodNameUTF16 != cimMethodInHeader)
1062                                    {
1063                                        // ATTN-RK-P3-20020304: How to decode cimMethodInHeader?
1064                                        if (cimMethodInHeader == String::EMPTY)
1065                                        {
1066                                            MessageLoaderParms parms(
1067                                                "Server.CIMOperationRequestDecoder."
1068                                                    "MISSING_CIMMETHOD_HTTP_HEADER",
1069                                                "Missing CIMMethod HTTP header.");
1070                                            sendHttpError(
1071                                                queueId,
1072                                                HTTP_STATUS_BADREQUEST,
1073                                                "header-mismatch",
1074                                                MessageLoader::getMessage(parms),
1075                                                closeConnect);
1076                                        }
1077                                        else
1078                                        {
1079 kumpf            1.104                     MessageLoaderParms parms(
1080                                                "Server.CIMOperationRequestDecoder."
1081                                                    "CIMMETHOD_VALUE_DOES_NOT_MATCH_REQUEST_METHOD",
1082                                                "CIMMethod value \"$0\" does not match CIM request "
1083                                                    "method \"$1\".",
1084                                                (const char*)cimMethodInHeader.getCString(),
1085                                                cimMethodName);
1086                                            sendHttpError(
1087                                                queueId,
1088                                                HTTP_STATUS_BADREQUEST,
1089                                                "header-mismatch",
1090                                                MessageLoader::getMessage(parms),
1091                                                closeConnect);
1092                                        }
1093                                        PEG_METHOD_EXIT();
1094                                        return;
1095                                    }
1096                        
1097                                    //
1098                                    // Check for <LOCALINSTANCEPATHELEMENT> or <LOCALCLASSPATHELEMENT>
1099                                    //
1100 kumpf            1.104             if (!(XmlReader::getLocalInstancePathElement(parser, reference) ||
1101                                          XmlReader::getLocalClassPathElement(parser, reference)))
1102                                    {
1103                                        MessageLoaderParms parms(
1104                                            "Common.XmlConstants.MISSING_ELEMENT_LOCALPATH",
1105                                            MISSING_ELEMENT_LOCALPATH);
1106                                        // this throw is not updated with MLP because
1107                                        // MISSING_ELEMENT_LOCALPATH is a hardcoded variable,
1108                                        // not a message
1109                                        throw XmlValidationError(parser.getLine(), parms);
1110                                    }
1111                        
1112                                    // The Specification for CIM Operations over HTTP reads:
1113                                    //     3.3.7. CIMObject
1114                                    //
1115                                    //     This header MUST be present in any CIM Operation Request
1116                                    //     message that contains a Simple Operation Request.
1117                                    //
1118                                    //     It MUST NOT be present in any CIM Operation Response message,
1119                                    //     nor in any CIM Operation Request message that is not a
1120                                    //     Simple Operation Request.
1121 kumpf            1.104             //
1122                                    //     The header identifies the CIM object (which MUST be a Class
1123                                    //     or Instance for an extrinsic method, or a Namespace for an
1124                                    //     intrinsic method) on which the method is to be invoked, using
1125                                    //     a CIM object path encoded in an HTTP-safe representation.
1126                                    //
1127                                    //     If a CIM Server receives a CIM Operation Request for which
1128                                    //     either:
1129                                    //
1130                                    //     - The CIMObject header is present but has an invalid value,
1131                                    //       or;
1132                                    //     - The CIMObject header is not present but the Operation
1133                                    //       Request Message is a Simple Operation Request, or;
1134                                    //     - The CIMObject header is present but the Operation Request
1135                                    //       Message is not a Simple Operation Request, or;
1136                                    //     - The CIMObject header is present, the Operation Request
1137                                    //       Message is a Simple Operation Request, but the ObjectPath
1138                                    //       value does not match (where match is defined in the section
1139                                    //       section on Encoding CIM Object Paths) the Operation Request
1140                                    //       Message,
1141                                    //
1142 kumpf            1.104             //     then it MUST fail the request and return a status of
1143                                    //     "400 Bad Request" (and MUST include a CIMError header in the
1144                                    //     response with a value of header-mismatch), subject to the
1145                                    //     considerations specified in Errors.
1146                                    if (cimObjectInHeader == String::EMPTY)
1147                                    {
1148                                        MessageLoaderParms parms(
1149                                            "Server.CIMOperationRequestDecoder."
1150                                                "MISSING_CIMOBJECT_HTTP_HEADER",
1151                                            "Missing CIMObject HTTP header.");
1152                                        sendHttpError(
1153                                            queueId,
1154                                            HTTP_STATUS_BADREQUEST,
1155                                            "header-mismatch",
1156                                            MessageLoader::getMessage(parms),
1157                                            closeConnect);
1158                                        PEG_METHOD_EXIT();
1159                                        return;
1160                                    }
1161                        
1162                                    CIMObjectPath headerObjectReference;
1163 kumpf            1.104             try
1164                                    {
1165                                        headerObjectReference.set(cimObjectInHeader);
1166                                    }
1167                                    catch (Exception&)
1168                                    {
1169                                        MessageLoaderParms parms(
1170                                            "Server.CIMOperationRequestDecoder."
1171                                                "COULD_NOT_PARSE_CIMOBJECT_VALUE",
1172                                            "Could not parse CIMObject value \"$0\".",
1173                                            cimObjectInHeader);
1174                                        sendHttpError(
1175                                            queueId,
1176                                            HTTP_STATUS_BADREQUEST,
1177                                            "header-mismatch",
1178                                            MessageLoader::getMessage(parms),
1179                                            closeConnect);
1180                                        PEG_METHOD_EXIT();
1181                                        return;
1182                                    }
1183                        
1184 kumpf            1.104             if (!reference.identical(headerObjectReference))
1185                                    {
1186                                        MessageLoaderParms parms(
1187                                            "Server.CIMOperationRequestDecoder."
1188 kumpf            1.113                         "CIMOBJECT_VALUE_DOES_NOT_MATCH_REQUEST_OBJECT",
1189 kumpf            1.104                     "CIMObject value \"$0\" does not match CIM request "
1190                                                "object \"$1\".",
1191                                            cimObjectInHeader,
1192 kumpf            1.113                     reference.toString());
1193 kumpf            1.104                 sendHttpError(
1194                                            queueId,
1195                                            HTTP_STATUS_BADREQUEST,
1196                                            "header-mismatch",
1197                                            MessageLoader::getMessage(parms),
1198                                            closeConnect);
1199                                        PEG_METHOD_EXIT();
1200                                        return;
1201                                    }
1202                        
1203                                    // This try block only catches CIMExceptions, because they must be
1204                                    // responded to with a proper METHODRESPONSE.  Other exceptions are
1205                                    // caught in the outer try block.
1206                                    try
1207                                    {
1208                                        // Delegate to appropriate method to handle:
1209                        
1210                                        request.reset(decodeInvokeMethodRequest(
1211                                           queueId,
1212                                           parser,
1213                                           messageId,
1214 kumpf            1.104                    reference,
1215                                           cimMethodNameUTF16)); // contains UTF-16 converted from UTF-8
1216                                    }
1217                                    catch (CIMException& e)
1218                                    {
1219                                        sendMethodError(
1220                                            queueId,
1221                                            httpMethod,
1222                                            messageId,
1223                                            cimMethodNameUTF16, // contains UTF-16 converted from UTF-8
1224                                            e,
1225                                            closeConnect);
1226                        
1227                                        PEG_METHOD_EXIT();
1228                                        return;
1229                                    }
1230                                    catch (XmlException&)
1231                                    {
1232                                        // XmlExceptions are handled below
1233                                        throw;
1234                                    }
1235 kumpf            1.104             catch (Exception& e)
1236                                    {
1237                                        // Caught an unexpected exception from decoding.  Since we must
1238                                        // have had a problem reconstructing a CIM object, we'll treata
1239                                        // it as an invalid parameter
1240                                        sendMethodError(
1241                                            queueId,
1242                                            httpMethod,
1243                                            messageId,
1244                                            cimMethodNameUTF16, // contains UTF-16 converted from UTF-8
1245                                            PEGASUS_CIM_EXCEPTION(
1246                                                CIM_ERR_INVALID_PARAMETER, e.getMessage()),
1247                                            closeConnect);
1248                        
1249                                        PEG_METHOD_EXIT();
1250                                        return;
1251                                    }
1252 kumpf            1.73  
1253 kumpf            1.104             // Expect </METHODCALL>
1254 mday             1.16  
1255 kumpf            1.104             XmlReader::expectEndTag(parser, "METHODCALL");
1256                                }
1257                                else
1258                                {
1259                                    MessageLoaderParms mlParms(
1260                                       "Server.CIMOperationRequestDecoder.EXPECTED_IMETHODCALL_ELEMENT",
1261                                       "expected IMETHODCALL or METHODCALL element");
1262                                    throw XmlValidationError(parser.getLine(),mlParms);
1263                                }
1264                        
1265                                // Expect </SIMPLEREQ>
1266                        
1267                                XmlReader::expectEndTag(parser, "SIMPLEREQ");
1268                        
1269                                // Expect </MESSAGE>
1270                        
1271                                XmlReader::expectEndTag(parser, "MESSAGE");
1272                        
1273                                // Expect </CIM>
1274                        
1275                                XmlReader::expectEndTag(parser, "CIM");
1276 kumpf            1.104     }
1277                            catch (XmlValidationError& e)
1278                            {
1279 thilo.boehm      1.119         PEG_TRACE((TRC_XML,Tracer::LEVEL1,
1280 kumpf            1.104             "CIMOperationRequestDecoder::handleMethodCall - "
1281 marek            1.116                 "XmlValidationError exception has occurred. Message: %s",
1282                                    (const char*) e.getMessage().getCString()));
1283 kumpf            1.24  
1284 kumpf            1.104         sendHttpError(
1285                                    queueId,
1286                                    HTTP_STATUS_BADREQUEST,
1287                                    "request-not-valid",
1288                                    e.getMessage(),
1289                                    closeConnect);
1290                                PEG_METHOD_EXIT();
1291                                return;
1292                            }
1293                            catch (XmlSemanticError& e)
1294                            {
1295 thilo.boehm      1.119         PEG_TRACE((TRC_XML,Tracer::LEVEL1,
1296 kumpf            1.104             "CIMOperationRequestDecoder::handleMethodCall - "
1297 marek            1.116                 "XmlSemanticError exception has occurred. Message: %s",
1298                                    (const char*) e.getMessage().getCString()));
1299 mday             1.16  
1300 kumpf            1.104         // ATTN-RK-P2-20020404: Is this the correct response for these errors?
1301                                sendHttpError(
1302                                    queueId,
1303                                    HTTP_STATUS_BADREQUEST,
1304                                    "request-not-valid",
1305                                    e.getMessage(),
1306                                    closeConnect);
1307                                PEG_METHOD_EXIT();
1308                                return;
1309                            }
1310                            catch (XmlException& e)
1311                            {
1312 thilo.boehm      1.119         PEG_TRACE((TRC_XML,Tracer::LEVEL1,
1313 kumpf            1.104             "CIMOperationRequestDecoder::handleMethodCall - "
1314 marek            1.116                 "XmlException has occurred. Message: %s",
1315                                    (const char*) e.getMessage().getCString()));
1316 kumpf            1.104 
1317                                sendHttpError(
1318                                    queueId,
1319                                    HTTP_STATUS_BADREQUEST,
1320                                    "request-not-well-formed",
1321                                    e.getMessage(),
1322                                    closeConnect);
1323                                PEG_METHOD_EXIT();
1324                                return;
1325                            }
1326                            catch (Exception& e)
1327                            {
1328                                // Don't know why I got this exception.  Seems like a bad thing.
1329                                // Any exceptions we're expecting should be caught separately and
1330                                // dealt with appropriately.  This is a last resort.
1331                                sendHttpError(
1332                                    queueId,
1333                                    HTTP_STATUS_INTERNALSERVERERROR,
1334                                    String::EMPTY,
1335                                    e.getMessage(),
1336                                    closeConnect);
1337 kumpf            1.104         PEG_METHOD_EXIT();
1338                                return;
1339                            }
1340                            catch (...)
1341                            {
1342                                // Don't know why I got whatever this is.  Seems like a bad thing.
1343                                // Any exceptions we're expecting should be caught separately and
1344                                // dealt with appropriately.  This is a last resort.
1345                                sendHttpError(
1346                                    queueId,
1347                                    HTTP_STATUS_INTERNALSERVERERROR,
1348                                    String::EMPTY,
1349                                    String::EMPTY,
1350                                    closeConnect);
1351                                PEG_METHOD_EXIT();
1352                                return;
1353                            }
1354                        
1355                            STAT_BYTESREAD
1356                        
1357                            request->authType = authType;
1358 kumpf            1.104     request->userName = userName;
1359                            request->ipAddress = ipAddress;
1360                            request->setHttpMethod (httpMethod);
1361 mike             1.120     request->binaryResponse = binaryResponse;
1362 sage             1.41  
1363 chuck            1.58  //l10n start
1364                        // l10n TODO - might want to move A-L and C-L to Message
1365                        // to make this more maintainable
1366 kumpf            1.104     // Add the language headers to the request
1367                            CIMMessage* cimmsg = dynamic_cast<CIMMessage*>(request.get());
1368                            if (cimmsg != NULL)
1369                            {
1370                                cimmsg->operationContext.insert(IdentityContainer(userName));
1371                                cimmsg->operationContext.set(
1372                                    AcceptLanguageListContainer(httpAcceptLanguages));
1373                                cimmsg->operationContext.set(
1374                                    ContentLanguageListContainer(httpContentLanguages));
1375                            }
1376                            else
1377                            {
1378                                ;    // l10n TODO - error back to client here
1379                            }
1380 chip             1.92  // l10n end
1381 chuck            1.58  
1382 kumpf            1.104     request->setCloseConnect(closeConnect);
1383                            _outputQueue->enqueue(request.release());
1384 chip             1.92  
1385 kumpf            1.104     PEG_METHOD_EXIT();
1386 mike             1.2   }
1387                        
1388 kumpf            1.104 CIMCreateClassRequestMessage*
1389                            CIMOperationRequestDecoder::decodeCreateClassRequest(
1390                                Uint32 queueId,
1391                                XmlParser& parser,
1392                                const String& messageId,
1393                                const CIMNamespaceName& nameSpace)
1394                        {
1395                            PEG_METHOD_ENTER(TRC_DISPATCHER,
1396                                "CIMOperationRequestDecoder::decodeCreateClassRequest()");
1397                        
1398                            STAT_GETSTARTTIME
1399                        
1400                            CIMClass newClass;
1401                            Boolean duplicateParameter = false;
1402                            Boolean gotClass = false;
1403                            Boolean emptyTag;
1404                        
1405                            for (const char* name;
1406                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
1407                            {
1408                                if (System::strcasecmp(name, "NewClass") == 0)
1409 kumpf            1.104         {
1410                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1411 kumpf            1.106             if (!XmlReader::getClassElement(parser, newClass))
1412                                    {
1413                                        throw PEGASUS_CIM_EXCEPTION(
1414                                            CIM_ERR_INVALID_PARAMETER, "NewClass");
1415                                    }
1416 kumpf            1.104             duplicateParameter = gotClass;
1417                                    gotClass = true;
1418                                }
1419                                else
1420                                {
1421                                    PEG_METHOD_EXIT();
1422                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1423                                }
1424 mike             1.2   
1425 kumpf            1.104         if (!emptyTag)
1426                                {
1427                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
1428                                }
1429 sage             1.41  
1430 kumpf            1.104         if (duplicateParameter)
1431                                {
1432                                    PEG_METHOD_EXIT();
1433                                    throw PEGASUS_CIM_EXCEPTION(
1434                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1435                                }
1436                            }
1437                        
1438                            if (!gotClass)
1439                            {
1440                                PEG_METHOD_EXIT();
1441                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1442                            }
1443                        
1444                            AutoPtr<CIMCreateClassRequestMessage> request(
1445                                new CIMCreateClassRequestMessage(
1446                                    messageId,
1447                                    nameSpace,
1448                                    newClass,
1449                                    QueueIdStack(queueId, _returnQueueId)));
1450                        
1451 kumpf            1.104     STAT_SERVERSTART
1452                        
1453                            PEG_METHOD_EXIT();
1454                            return request.release();
1455 mike             1.2   }
1456                        
1457                        CIMGetClassRequestMessage* CIMOperationRequestDecoder::decodeGetClassRequest(
1458 kumpf            1.104     Uint32 queueId,
1459                            XmlParser& parser,
1460                            const String& messageId,
1461                            const CIMNamespaceName& nameSpace)
1462                        {
1463                            PEG_METHOD_ENTER(TRC_DISPATCHER,
1464                                "CIMOperationRequestDecoder::decodeGetClassRequest()");
1465                        
1466                            STAT_GETSTARTTIME
1467                        
1468                            CIMName className;
1469                            Boolean localOnly = true;
1470                            Boolean includeQualifiers = true;
1471                            Boolean includeClassOrigin = false;
1472                            CIMPropertyList propertyList;
1473                            Boolean duplicateParameter = false;
1474                            Boolean gotClassName = false;
1475                            Boolean gotLocalOnly = false;
1476                            Boolean gotIncludeQualifiers = false;
1477                            Boolean gotIncludeClassOrigin = false;
1478                            Boolean gotPropertyList = false;
1479 kumpf            1.104     Boolean emptyTag;
1480                        
1481                            for (const char* name;
1482                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
1483                            {
1484                                if (System::strcasecmp(name, "ClassName") == 0)
1485                                {
1486                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1487                                    XmlReader::getClassNameElement(parser, className, true);
1488                                    duplicateParameter = gotClassName;
1489                                    gotClassName = true;
1490                                }
1491                                else if (System::strcasecmp(name, "LocalOnly") == 0)
1492                                {
1493                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1494                                    XmlReader::getBooleanValueElement(parser, localOnly, true);
1495                                    duplicateParameter = gotLocalOnly;
1496                                    gotLocalOnly = true;
1497                                }
1498                                else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
1499                                {
1500 kumpf            1.104             XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1501                                    XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
1502                                    duplicateParameter = gotIncludeQualifiers;
1503                                    gotIncludeQualifiers = true;
1504                                }
1505                                else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
1506                                {
1507                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1508                                    XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
1509                                    duplicateParameter = gotIncludeClassOrigin;
1510                                    gotIncludeClassOrigin = true;
1511                                }
1512                                else if (System::strcasecmp(name, "PropertyList") == 0)
1513                                {
1514                                    if (!emptyTag)
1515                                    {
1516                                        CIMValue pl;
1517                                        if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
1518                                        {
1519                                            Array<String> propertyListArray;
1520                                            pl.get(propertyListArray);
1521 kumpf            1.104                     Array<CIMName> cimNameArray;
1522                                            for (Uint32 i = 0; i < propertyListArray.size(); i++)
1523                                            {
1524                                                cimNameArray.append(propertyListArray[i]);
1525                                            }
1526                                            propertyList.set(cimNameArray);
1527                                        }
1528                                    }
1529                                    duplicateParameter = gotPropertyList;
1530                                    gotPropertyList = true;
1531                                }
1532                                else
1533                                {
1534                                    PEG_METHOD_EXIT();
1535                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1536                                }
1537                        
1538                                if (!emptyTag)
1539                                {
1540                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
1541                                }
1542 kumpf            1.104 
1543                                if (duplicateParameter)
1544                                {
1545                                    PEG_METHOD_EXIT();
1546                                    throw PEGASUS_CIM_EXCEPTION(
1547                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1548                                }
1549                            }
1550                        
1551                            if (!gotClassName)
1552                            {
1553                                PEG_METHOD_EXIT();
1554                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1555                            }
1556                        
1557                            AutoPtr<CIMGetClassRequestMessage> request(new CIMGetClassRequestMessage(
1558                                messageId,
1559                                nameSpace,
1560                                className,
1561                                localOnly,
1562                                includeQualifiers,
1563 kumpf            1.104         includeClassOrigin,
1564                                propertyList,
1565                                QueueIdStack(queueId, _returnQueueId)));
1566                        
1567                            STAT_SERVERSTART
1568                        
1569                            PEG_METHOD_EXIT();
1570                            return request.release();
1571                        }
1572                        
1573                        CIMModifyClassRequestMessage*
1574                            CIMOperationRequestDecoder::decodeModifyClassRequest(
1575                                Uint32 queueId,
1576                                XmlParser& parser,
1577                                const String& messageId,
1578                                const CIMNamespaceName& nameSpace)
1579                        {
1580                            STAT_GETSTARTTIME
1581                        
1582                            CIMClass modifiedClass;
1583                            Boolean duplicateParameter = false;
1584 kumpf            1.104     Boolean gotClass = false;
1585                            Boolean emptyTag;
1586                        
1587                            for (const char* name;
1588                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
1589                            {
1590                                if (System::strcasecmp(name, "ModifiedClass") == 0)
1591                                {
1592                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1593 kumpf            1.106             if (!XmlReader::getClassElement(parser, modifiedClass))
1594                                    {
1595                                        throw PEGASUS_CIM_EXCEPTION(
1596                                            CIM_ERR_INVALID_PARAMETER, "ModifiedClass");
1597                                    }
1598 kumpf            1.104             duplicateParameter = gotClass;
1599                                    gotClass = true;
1600                                }
1601                                else
1602                                {
1603                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1604                                }
1605                        
1606                                if (!emptyTag)
1607                                {
1608                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
1609                                }
1610                        
1611                                if (duplicateParameter)
1612                                {
1613                                    throw PEGASUS_CIM_EXCEPTION(
1614                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1615                                }
1616                            }
1617                        
1618                            if (!gotClass)
1619 kumpf            1.104     {
1620                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1621                            }
1622                        
1623                            AutoPtr<CIMModifyClassRequestMessage> request(
1624                                new CIMModifyClassRequestMessage(
1625                                    messageId,
1626                                    nameSpace,
1627                                    modifiedClass,
1628                                    QueueIdStack(queueId, _returnQueueId)));
1629                        
1630                            STAT_SERVERSTART
1631                        
1632                            return request.release();
1633                        }
1634                        
1635                        CIMEnumerateClassNamesRequestMessage*
1636                            CIMOperationRequestDecoder::decodeEnumerateClassNamesRequest(
1637                                Uint32 queueId,
1638                                XmlParser& parser,
1639                                const String& messageId,
1640 kumpf            1.104         const CIMNamespaceName& nameSpace)
1641                        {
1642                            STAT_GETSTARTTIME
1643                        
1644                            CIMName className;
1645                            Boolean deepInheritance = false;
1646                            Boolean duplicateParameter = false;
1647                            Boolean gotClassName = false;
1648                            Boolean gotDeepInheritance = false;
1649                            Boolean emptyTag;
1650                        
1651                            for (const char* name;
1652                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
1653                            {
1654                                if (System::strcasecmp(name, "ClassName") == 0)
1655                                {
1656                                    //
1657                                    //  ClassName may be NULL
1658                                    //
1659                                    if (!emptyTag)
1660                                    {
1661 kumpf            1.104                 XmlReader::getClassNameElement(parser, className, false);
1662                                    }
1663                                    duplicateParameter = gotClassName;
1664                                    gotClassName = true;
1665                                }
1666                                else if (System::strcasecmp(name, "DeepInheritance") == 0)
1667                                {
1668                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1669                                    XmlReader::getBooleanValueElement(parser, deepInheritance, true);
1670                                    duplicateParameter = gotDeepInheritance;
1671                                    gotDeepInheritance = true;
1672                                }
1673                                else
1674                                {
1675                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1676                                }
1677                        
1678                                if (!emptyTag)
1679                                {
1680                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
1681                                }
1682 kumpf            1.104 
1683                                if (duplicateParameter)
1684                                {
1685                                    throw PEGASUS_CIM_EXCEPTION(
1686                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1687                                }
1688                            }
1689                        
1690                            AutoPtr<CIMEnumerateClassNamesRequestMessage> request(
1691                                new CIMEnumerateClassNamesRequestMessage(
1692                                    messageId,
1693                                    nameSpace,
1694                                    className,
1695                                    deepInheritance,
1696                                    QueueIdStack(queueId, _returnQueueId)));
1697                        
1698                            STAT_SERVERSTART
1699                        
1700                            return request.release();
1701                        }
1702                        
1703 kumpf            1.104 CIMEnumerateClassesRequestMessage*
1704                            CIMOperationRequestDecoder::decodeEnumerateClassesRequest(
1705                                Uint32 queueId,
1706                                XmlParser& parser,
1707                                const String& messageId,
1708                                const CIMNamespaceName& nameSpace)
1709                        {
1710                            STAT_GETSTARTTIME
1711                        
1712                            CIMName className;
1713                            Boolean deepInheritance = false;
1714                            Boolean localOnly = true;
1715                            Boolean includeQualifiers = true;
1716                            Boolean includeClassOrigin = false;
1717                            Boolean duplicateParameter = false;
1718                            Boolean gotClassName = false;
1719                            Boolean gotDeepInheritance = false;
1720                            Boolean gotLocalOnly = false;
1721                            Boolean gotIncludeQualifiers = false;
1722                            Boolean gotIncludeClassOrigin = false;
1723                            Boolean emptyTag;
1724 kumpf            1.104 
1725                            for (const char* name;
1726                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
1727                            {
1728                                if (System::strcasecmp(name, "ClassName") == 0)
1729                                {
1730                                    //
1731                                    //  ClassName may be NULL
1732                                    //
1733                                    if (!emptyTag)
1734                                    {
1735                                        XmlReader::getClassNameElement(parser, className, false);
1736                                    }
1737                                    duplicateParameter = gotClassName;
1738                                    gotClassName = true;
1739                                }
1740                                else if (System::strcasecmp(name, "DeepInheritance") == 0)
1741                                {
1742                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1743                                    XmlReader::getBooleanValueElement(parser, deepInheritance, true);
1744                                    duplicateParameter = gotDeepInheritance;
1745 kumpf            1.104             gotDeepInheritance = true;
1746                                }
1747                                else if (System::strcasecmp(name, "LocalOnly") == 0)
1748                                {
1749                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1750                                    XmlReader::getBooleanValueElement(parser, localOnly, true);
1751                                    duplicateParameter = gotLocalOnly;
1752                                    gotLocalOnly = true;
1753                                }
1754                                else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
1755                                {
1756                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1757                                    XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
1758                                    duplicateParameter = gotIncludeQualifiers;
1759                                    gotIncludeQualifiers = true;
1760                                }
1761                                else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
1762                                {
1763                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1764                                    XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
1765                                    duplicateParameter = gotIncludeClassOrigin;
1766 kumpf            1.104             gotIncludeClassOrigin = true;
1767                                }
1768                                else
1769                                {
1770                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1771                                }
1772                        
1773                                if (!emptyTag)
1774                                {
1775                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
1776                                }
1777                        
1778                                if (duplicateParameter)
1779                                {
1780                                    throw PEGASUS_CIM_EXCEPTION(
1781                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1782                                }
1783                            }
1784                        
1785                            AutoPtr<CIMEnumerateClassesRequestMessage> request(
1786                                new CIMEnumerateClassesRequestMessage(
1787 kumpf            1.104             messageId,
1788                                    nameSpace,
1789                                    className,
1790                                    deepInheritance,
1791                                    localOnly,
1792                                    includeQualifiers,
1793                                    includeClassOrigin,
1794                                    QueueIdStack(queueId, _returnQueueId)));
1795                        
1796                            STAT_SERVERSTART
1797                        
1798                            return request.release();
1799                        }
1800                        
1801                        CIMDeleteClassRequestMessage*
1802                            CIMOperationRequestDecoder::decodeDeleteClassRequest(
1803                                Uint32 queueId,
1804                                XmlParser& parser,
1805                                const String& messageId,
1806                                const CIMNamespaceName& nameSpace)
1807                        {
1808 kumpf            1.104     STAT_GETSTARTTIME
1809                        
1810                            CIMName className;
1811                            Boolean duplicateParameter = false;
1812                            Boolean gotClassName = false;
1813                            Boolean emptyTag;
1814                        
1815                            for (const char* name;
1816                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
1817                            {
1818                                if (System::strcasecmp(name, "ClassName") == 0)
1819                                {
1820                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1821                                    XmlReader::getClassNameElement(parser, className);
1822                                    duplicateParameter = gotClassName;
1823                                    gotClassName = true;
1824                                }
1825                                else
1826                                {
1827                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1828                                }
1829 kumpf            1.104 
1830                                if (!emptyTag)
1831                                {
1832                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
1833                                }
1834                        
1835                                if (duplicateParameter)
1836                                {
1837                                    throw PEGASUS_CIM_EXCEPTION(
1838                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1839                                }
1840                            }
1841                        
1842                            if (!gotClassName)
1843                            {
1844                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1845                            }
1846                        
1847                            AutoPtr<CIMDeleteClassRequestMessage> request(
1848                                new CIMDeleteClassRequestMessage(
1849                                    messageId,
1850 kumpf            1.104             nameSpace,
1851                                    className,
1852                                    QueueIdStack(queueId, _returnQueueId)));
1853                        
1854                            STAT_SERVERSTART
1855                        
1856                            return request.release();
1857                        }
1858                        
1859                        CIMCreateInstanceRequestMessage*
1860                            CIMOperationRequestDecoder::decodeCreateInstanceRequest(
1861                                Uint32 queueId,
1862                                XmlParser& parser,
1863                                const String& messageId,
1864                                const CIMNamespaceName& nameSpace)
1865                        {
1866                            STAT_GETSTARTTIME
1867                        
1868                            CIMInstance newInstance;
1869                            Boolean duplicateParameter = false;
1870                            Boolean gotInstance = false;
1871 kumpf            1.104     Boolean emptyTag;
1872                        
1873                            for (const char* name;
1874                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
1875                            {
1876                                if (System::strcasecmp(name, "NewInstance") == 0)
1877                                {
1878                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1879                                    XmlReader::getInstanceElement(parser, newInstance);
1880                                    duplicateParameter = gotInstance;
1881                                    gotInstance = true;
1882                                }
1883                                else
1884                                {
1885                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1886                                }
1887                        
1888                                if (!emptyTag)
1889                                {
1890                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
1891                                }
1892 kumpf            1.104 
1893                                if (duplicateParameter)
1894                                {
1895                                    throw PEGASUS_CIM_EXCEPTION(
1896                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1897                                }
1898                            }
1899                        
1900                            if (!gotInstance)
1901                            {
1902                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
1903                            }
1904                        
1905                            AutoPtr<CIMCreateInstanceRequestMessage> request(
1906                                new CIMCreateInstanceRequestMessage(
1907                                    messageId,
1908                                    nameSpace,
1909                                    newInstance,
1910                                    QueueIdStack(queueId, _returnQueueId)));
1911                        
1912                            STAT_SERVERSTART
1913 kumpf            1.104 
1914                            return request.release();
1915                        }
1916                        
1917                        CIMGetInstanceRequestMessage*
1918                            CIMOperationRequestDecoder::decodeGetInstanceRequest(
1919                                Uint32 queueId,
1920                                XmlParser& parser,
1921                                const String& messageId,
1922                                const CIMNamespaceName& nameSpace)
1923                        {
1924                            STAT_GETSTARTTIME
1925                        
1926                            CIMObjectPath instanceName;
1927                            Boolean includeQualifiers = false;
1928                            Boolean includeClassOrigin = false;
1929                            CIMPropertyList propertyList;
1930                            Boolean duplicateParameter = false;
1931                            Boolean gotInstanceName = false;
1932                            Boolean gotLocalOnly = false;
1933                            Boolean gotIncludeQualifiers = false;
1934 kumpf            1.104     Boolean gotIncludeClassOrigin = false;
1935                            Boolean gotPropertyList = false;
1936                            Boolean emptyTag;
1937                        
1938                            for (const char* name;
1939                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
1940                            {
1941                                if (System::strcasecmp(name, "InstanceName") == 0)
1942                                {
1943                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1944                                    XmlReader::getInstanceNameElement(parser, instanceName);
1945                                    duplicateParameter = gotInstanceName;
1946                                    gotInstanceName = true;
1947                                }
1948                                else if (System::strcasecmp(name, "LocalOnly") == 0)
1949                                {
1950 kumpf            1.125             // This attribute is accepted for compatibility reasons, but is
1951                                    // not honored because it is deprecated.
1952                                    Boolean localOnly;
1953 kumpf            1.104             XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1954                                    XmlReader::getBooleanValueElement(parser, localOnly, true);
1955                                    duplicateParameter = gotLocalOnly;
1956                                    gotLocalOnly = true;
1957                                }
1958                                else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
1959                                {
1960                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1961                                    XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
1962                                    duplicateParameter = gotIncludeQualifiers;
1963                                    gotIncludeQualifiers = true;
1964                                }
1965                                else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
1966                                {
1967                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
1968                                    XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
1969                                    duplicateParameter = gotIncludeClassOrigin;
1970                                    gotIncludeClassOrigin = true;
1971                                }
1972                                else if (System::strcasecmp(name, "PropertyList") == 0)
1973                                {
1974 kumpf            1.104             if (!emptyTag)
1975                                    {
1976                                        CIMValue pl;
1977                                        if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
1978                                        {
1979                                            Array<String> propertyListArray;
1980                                            pl.get(propertyListArray);
1981                                            Array<CIMName> cimNameArray;
1982                                            for (Uint32 i = 0; i < propertyListArray.size(); i++)
1983                                            {
1984                                                cimNameArray.append(propertyListArray[i]);
1985                                            }
1986                                            propertyList.set(cimNameArray);
1987                                        }
1988                                    }
1989                                    duplicateParameter = gotPropertyList;
1990                                    gotPropertyList = true;
1991                                }
1992                                else
1993                                {
1994                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
1995 kumpf            1.104         }
1996                        
1997                                if (!emptyTag)
1998                                {
1999                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2000                                }
2001                        
2002                                if (duplicateParameter)
2003                                {
2004                                    throw PEGASUS_CIM_EXCEPTION(
2005                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2006                                }
2007                            }
2008                        
2009                            if (!gotInstanceName)
2010                            {
2011                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2012                            }
2013                        
2014                            AutoPtr<CIMGetInstanceRequestMessage> request(
2015                                new CIMGetInstanceRequestMessage(
2016 kumpf            1.104             messageId,
2017                                    nameSpace,
2018                                    instanceName,
2019 h.sterling       1.97  #ifdef PEGASUS_DISABLE_INSTANCE_QUALIFIERS
2020 kumpf            1.104             false,
2021 h.sterling       1.97  #else
2022 kumpf            1.104             includeQualifiers,
2023 h.sterling       1.97  #endif
2024 kumpf            1.104             includeClassOrigin,
2025                                    propertyList,
2026                                    QueueIdStack(queueId, _returnQueueId)));
2027                        
2028                            STAT_SERVERSTART
2029                        
2030                            return request.release();
2031                        }
2032                        
2033                        CIMModifyInstanceRequestMessage*
2034                            CIMOperationRequestDecoder::decodeModifyInstanceRequest(
2035                                Uint32 queueId,
2036                                XmlParser& parser,
2037                                const String& messageId,
2038                                const CIMNamespaceName& nameSpace)
2039                        {
2040                            STAT_GETSTARTTIME
2041                        
2042                            CIMInstance modifiedInstance;
2043                            Boolean includeQualifiers = true;
2044                            CIMPropertyList propertyList;
2045 kumpf            1.104     Boolean duplicateParameter = false;
2046                            Boolean gotInstance = false;
2047                            Boolean gotIncludeQualifiers = false;
2048                            Boolean gotPropertyList = false;
2049                            Boolean emptyTag;
2050                        
2051                            for (const char* name;
2052                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2053                            {
2054                                if (System::strcasecmp(name, "ModifiedInstance") == 0)
2055                                {
2056                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2057                                    XmlReader::getNamedInstanceElement(parser, modifiedInstance);
2058                                    duplicateParameter = gotInstance;
2059                                    gotInstance = true;
2060                                }
2061                                else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
2062                                {
2063                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2064                                    XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
2065                                    duplicateParameter = gotIncludeQualifiers;
2066 kumpf            1.104             gotIncludeQualifiers = true;
2067                                }
2068                                else if (System::strcasecmp(name, "PropertyList") == 0)
2069                                {
2070                                    if (!emptyTag)
2071                                    {
2072                                        CIMValue pl;
2073                                        if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
2074                                        {
2075                                            Array<String> propertyListArray;
2076                                            pl.get(propertyListArray);
2077                                            Array<CIMName> cimNameArray;
2078                                            for (Uint32 i = 0; i < propertyListArray.size(); i++)
2079                                            {
2080                                                cimNameArray.append(propertyListArray[i]);
2081                                            }
2082                                            propertyList.set(cimNameArray);
2083                                        }
2084                                    }
2085                                    duplicateParameter = gotPropertyList;
2086                                    gotPropertyList = true;
2087 kumpf            1.104         }
2088                                else
2089                                {
2090                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2091                                }
2092                        
2093                                if (!emptyTag)
2094                                {
2095                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2096                                }
2097                        
2098                                if (duplicateParameter)
2099                                {
2100                                    throw PEGASUS_CIM_EXCEPTION(
2101                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2102                                }
2103                            }
2104                        
2105                            if (!gotInstance)
2106                            {
2107                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2108 kumpf            1.104     }
2109                        
2110                            AutoPtr<CIMModifyInstanceRequestMessage> request(
2111                                new CIMModifyInstanceRequestMessage(
2112                                    messageId,
2113                                    nameSpace,
2114                                    modifiedInstance,
2115                                    includeQualifiers,
2116                                    propertyList,
2117                                    QueueIdStack(queueId, _returnQueueId)));
2118                        
2119                            STAT_SERVERSTART
2120                        
2121                            return request.release();
2122                        }
2123                        
2124                        CIMEnumerateInstancesRequestMessage*
2125                            CIMOperationRequestDecoder::decodeEnumerateInstancesRequest(
2126                                Uint32 queueId,
2127                                XmlParser& parser,
2128                                const String& messageId,
2129 kumpf            1.104         const CIMNamespaceName& nameSpace)
2130                        {
2131                            STAT_GETSTARTTIME
2132                        
2133                            CIMName className;
2134                            Boolean deepInheritance = true;
2135                            Boolean includeQualifiers = false;
2136                            Boolean includeClassOrigin = false;
2137                            CIMPropertyList propertyList;
2138                            Boolean duplicateParameter = false;
2139                            Boolean gotClassName = false;
2140                            Boolean gotDeepInheritance = false;
2141                            Boolean gotLocalOnly = false;
2142                            Boolean gotIncludeQualifiers = false;
2143                            Boolean gotIncludeClassOrigin = false;
2144                            Boolean gotPropertyList = false;
2145                            Boolean emptyTag;
2146                        
2147                            for (const char* name;
2148                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2149                            {
2150 kumpf            1.104         if (System::strcasecmp(name, "ClassName") == 0)
2151                                {
2152                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2153                                    XmlReader::getClassNameElement(parser, className, true);
2154                                    duplicateParameter = gotClassName;
2155                                    gotClassName = true;
2156                                }
2157                                else if (System::strcasecmp(name, "DeepInheritance") == 0)
2158                                {
2159                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2160                                    XmlReader::getBooleanValueElement(parser, deepInheritance, true);
2161                                    duplicateParameter = gotDeepInheritance;
2162                                    gotDeepInheritance = true;
2163                                }
2164                                else if (System::strcasecmp(name, "LocalOnly") == 0)
2165                                {
2166 kumpf            1.125             // This attribute is accepted for compatibility reasons, but is
2167                                    // not honored because it is deprecated.
2168                                    Boolean localOnly;
2169 kumpf            1.104             XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2170                                    XmlReader::getBooleanValueElement(parser, localOnly, true);
2171                                    duplicateParameter = gotLocalOnly;
2172                                    gotLocalOnly = true;
2173                                }
2174                                else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
2175                                {
2176                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2177                                    XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
2178                                    duplicateParameter = gotIncludeQualifiers;
2179                                    gotIncludeQualifiers = true;
2180                                }
2181                                else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
2182                                {
2183                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2184                                    XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
2185                                    duplicateParameter = gotIncludeClassOrigin;
2186                                    gotIncludeClassOrigin = true;
2187                                }
2188                                else if (System::strcasecmp(name, "PropertyList") == 0)
2189                                {
2190 kumpf            1.104             if (!emptyTag)
2191                                    {
2192                                        CIMValue pl;
2193                                        if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
2194                                        {
2195                                            Array<String> propertyListArray;
2196                                            pl.get(propertyListArray);
2197                                            Array<CIMName> cimNameArray;
2198                                            for (Uint32 i = 0; i < propertyListArray.size(); i++)
2199                                            {
2200                                                cimNameArray.append(propertyListArray[i]);
2201                                            }
2202                                            propertyList.set(cimNameArray);
2203                                        }
2204                                    }
2205                                    duplicateParameter = gotPropertyList;
2206                                    gotPropertyList = true;
2207                                }
2208                                else
2209                                {
2210                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2211 kumpf            1.104         }
2212                        
2213                                if (!emptyTag)
2214                                {
2215                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2216                                }
2217                        
2218                                if (duplicateParameter)
2219                                {
2220                                    throw PEGASUS_CIM_EXCEPTION(
2221                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2222                                }
2223                            }
2224                        
2225                            if (!gotClassName)
2226                            {
2227                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2228                            }
2229                        
2230                            AutoPtr<CIMEnumerateInstancesRequestMessage> request(
2231                                new CIMEnumerateInstancesRequestMessage(
2232 kumpf            1.104             messageId,
2233                                    nameSpace,
2234                                    className,
2235                                    deepInheritance,
2236 h.sterling       1.97  #ifdef PEGASUS_DISABLE_INSTANCE_QUALIFIERS
2237 kumpf            1.104             false,
2238 h.sterling       1.97  #else
2239 kumpf            1.104             includeQualifiers,
2240 h.sterling       1.97  #endif
2241 kumpf            1.104             includeClassOrigin,
2242                                    propertyList,
2243                                    QueueIdStack(queueId, _returnQueueId)));
2244                        
2245                            STAT_SERVERSTART
2246                        
2247                            return request.release();
2248                        }
2249                        
2250                        CIMEnumerateInstanceNamesRequestMessage*
2251                            CIMOperationRequestDecoder::decodeEnumerateInstanceNamesRequest(
2252                                Uint32 queueId,
2253                                XmlParser& parser,
2254                                const String& messageId,
2255                                const CIMNamespaceName& nameSpace)
2256                        {
2257                            STAT_GETSTARTTIME
2258                        
2259                            CIMName className;
2260                            Boolean duplicateParameter = false;
2261                            Boolean gotClassName = false;
2262 kumpf            1.104     Boolean emptyTag;
2263                        
2264                            for (const char* name;
2265                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2266                            {
2267                                if (System::strcasecmp(name, "ClassName") == 0)
2268                                {
2269                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2270                                    XmlReader::getClassNameElement(parser, className, true);
2271                                    duplicateParameter = gotClassName;
2272                                    gotClassName = true;
2273                                }
2274                                else
2275                                {
2276                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2277                                }
2278                        
2279                                if (!emptyTag)
2280                                {
2281                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2282                                }
2283 kumpf            1.104 
2284                                if (duplicateParameter)
2285                                {
2286                                    throw PEGASUS_CIM_EXCEPTION(
2287                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2288                                }
2289                            }
2290                        
2291                            if (!gotClassName)
2292                            {
2293                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2294                            }
2295                        
2296                            AutoPtr<CIMEnumerateInstanceNamesRequestMessage> request(
2297                                new CIMEnumerateInstanceNamesRequestMessage(
2298                                    messageId,
2299                                    nameSpace,
2300                                    className,
2301                                    QueueIdStack(queueId, _returnQueueId)));
2302                        
2303                            STAT_SERVERSTART
2304 kumpf            1.104 
2305                            return request.release();
2306                        }
2307                        
2308                        CIMDeleteInstanceRequestMessage*
2309                            CIMOperationRequestDecoder::decodeDeleteInstanceRequest(
2310                                Uint32 queueId,
2311                                XmlParser& parser,
2312                                const String& messageId,
2313                                const CIMNamespaceName& nameSpace)
2314                        {
2315                            STAT_GETSTARTTIME
2316                        
2317                            CIMObjectPath instanceName;
2318                            Boolean duplicateParameter = false;
2319                            Boolean gotInstanceName = false;
2320                            Boolean emptyTag;
2321                        
2322                            for (const char* name;
2323                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2324                            {
2325 kumpf            1.104         if (System::strcasecmp(name, "InstanceName") == 0)
2326                                {
2327                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2328                                    XmlReader::getInstanceNameElement(parser, instanceName);
2329                                    duplicateParameter = gotInstanceName;
2330                                    gotInstanceName = true;
2331                                }
2332                                else
2333                                {
2334                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2335                                }
2336                        
2337                                if (!emptyTag)
2338                                {
2339                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2340                                }
2341                        
2342                                if (duplicateParameter)
2343                                {
2344                                    throw PEGASUS_CIM_EXCEPTION(
2345                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2346 kumpf            1.104         }
2347                            }
2348                        
2349                            if (!gotInstanceName)
2350                            {
2351                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2352                            }
2353                        
2354                            AutoPtr<CIMDeleteInstanceRequestMessage> request(
2355                                new CIMDeleteInstanceRequestMessage(
2356                                    messageId,
2357                                    nameSpace,
2358                                    instanceName,
2359                                    QueueIdStack(queueId, _returnQueueId)));
2360                        
2361                            STAT_SERVERSTART
2362                        
2363                            return request.release();
2364                        }
2365                        
2366                        CIMSetQualifierRequestMessage*
2367 kumpf            1.104     CIMOperationRequestDecoder::decodeSetQualifierRequest(
2368                                Uint32 queueId,
2369                                XmlParser& parser,
2370                                const String& messageId,
2371                                const CIMNamespaceName& nameSpace)
2372                        {
2373                            STAT_GETSTARTTIME
2374                        
2375                            CIMQualifierDecl qualifierDeclaration;
2376                            Boolean duplicateParameter = false;
2377                            Boolean gotQualifierDeclaration = false;
2378                            Boolean emptyTag;
2379                        
2380                            for (const char* name;
2381                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2382                            {
2383                                if (System::strcasecmp(name, "QualifierDeclaration") == 0)
2384                                {
2385                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2386                                    XmlReader::getQualifierDeclElement(parser, qualifierDeclaration);
2387                                    duplicateParameter = gotQualifierDeclaration;
2388 kumpf            1.104             gotQualifierDeclaration = true;
2389                                }
2390                                else
2391                                {
2392                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2393                                }
2394                        
2395                                if (!emptyTag)
2396                                {
2397                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2398                                }
2399                        
2400                                if (duplicateParameter)
2401                                {
2402                                    throw PEGASUS_CIM_EXCEPTION(
2403                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2404                                }
2405                            }
2406                        
2407                            if (!gotQualifierDeclaration)
2408                            {
2409 kumpf            1.104         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2410                            }
2411                        
2412                            AutoPtr<CIMSetQualifierRequestMessage> request(
2413                                new CIMSetQualifierRequestMessage(
2414                                    messageId,
2415                                    nameSpace,
2416                                    qualifierDeclaration,
2417                                    QueueIdStack(queueId, _returnQueueId)));
2418                        
2419                            STAT_SERVERSTART
2420                        
2421                            return request.release();
2422                        }
2423                        
2424                        CIMGetQualifierRequestMessage*
2425                            CIMOperationRequestDecoder::decodeGetQualifierRequest(
2426                                Uint32 queueId,
2427                                XmlParser& parser,
2428                                const String& messageId,
2429                                const CIMNamespaceName& nameSpace)
2430 kumpf            1.104 {
2431                            STAT_GETSTARTTIME
2432                        
2433                            String qualifierNameString;
2434                            CIMName qualifierName;
2435                            Boolean duplicateParameter = false;
2436                            Boolean gotQualifierName = false;
2437                            Boolean emptyTag;
2438                        
2439                            for (const char* name;
2440                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2441                            {
2442                                if (System::strcasecmp(name, "QualifierName") == 0)
2443                                {
2444                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2445                                    XmlReader::getStringValueElement(parser, qualifierNameString, true);
2446                                    qualifierName = qualifierNameString;
2447                                    duplicateParameter = gotQualifierName;
2448                                    gotQualifierName = true;
2449                                }
2450                                else
2451 kumpf            1.104         {
2452                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2453                                }
2454                        
2455                                if (!emptyTag)
2456                                {
2457                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2458                                }
2459                        
2460                                if (duplicateParameter)
2461                                {
2462                                    throw PEGASUS_CIM_EXCEPTION(
2463                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2464                                }
2465                            }
2466                        
2467                            if (!gotQualifierName)
2468                            {
2469                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2470                            }
2471                        
2472 kumpf            1.104     AutoPtr<CIMGetQualifierRequestMessage> request(
2473                                new CIMGetQualifierRequestMessage(
2474                                    messageId,
2475                                    nameSpace,
2476                                    qualifierName,
2477                                    QueueIdStack(queueId, _returnQueueId)));
2478                        
2479                            STAT_SERVERSTART
2480                        
2481                            return request.release();
2482                        }
2483                        
2484                        CIMEnumerateQualifiersRequestMessage*
2485                            CIMOperationRequestDecoder::decodeEnumerateQualifiersRequest(
2486                                Uint32 queueId,
2487                                XmlParser& parser,
2488                                const String& messageId,
2489                                const CIMNamespaceName& nameSpace)
2490                        {
2491                            STAT_GETSTARTTIME
2492                            Boolean emptyTag;
2493 kumpf            1.104 
2494                            for (const char* name;
2495                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2496                            {
2497                                // No IPARAMVALUEs are defined for this operation
2498                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2499                            }
2500                        
2501                            AutoPtr<CIMEnumerateQualifiersRequestMessage> request(
2502                                new CIMEnumerateQualifiersRequestMessage(
2503                                    messageId,
2504                                    nameSpace,
2505                                    QueueIdStack(queueId, _returnQueueId)));
2506                        
2507                            STAT_SERVERSTART
2508                        
2509                            return request.release();
2510                        }
2511                        
2512                        CIMDeleteQualifierRequestMessage*
2513                            CIMOperationRequestDecoder::decodeDeleteQualifierRequest(
2514 kumpf            1.104         Uint32 queueId,
2515                                XmlParser& parser,
2516                                const String& messageId,
2517                                const CIMNamespaceName& nameSpace)
2518                        {
2519                            STAT_GETSTARTTIME
2520                        
2521                            String qualifierNameString;
2522                            CIMName qualifierName;
2523                            Boolean duplicateParameter = false;
2524                            Boolean gotQualifierName = false;
2525                            Boolean emptyTag;
2526                        
2527                            for (const char* name;
2528                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2529                            {
2530                                if (System::strcasecmp(name, "QualifierName") == 0)
2531                                {
2532                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2533                                    XmlReader::getStringValueElement(parser, qualifierNameString, true);
2534                                    qualifierName = qualifierNameString;
2535 kumpf            1.104             duplicateParameter = gotQualifierName;
2536                                    gotQualifierName = true;
2537                                }
2538                                else
2539                                {
2540                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2541                                }
2542                        
2543                                if (!emptyTag)
2544                                {
2545                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2546                                }
2547                        
2548                                if (duplicateParameter)
2549                                {
2550                                    throw PEGASUS_CIM_EXCEPTION(
2551                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2552                                }
2553                            }
2554                        
2555                            if (!gotQualifierName)
2556 kumpf            1.104     {
2557                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2558                            }
2559                        
2560                            AutoPtr<CIMDeleteQualifierRequestMessage> request(
2561                                new CIMDeleteQualifierRequestMessage(
2562                                    messageId,
2563                                    nameSpace,
2564                                    qualifierName,
2565                                    QueueIdStack(queueId, _returnQueueId)));
2566                        
2567                            STAT_SERVERSTART
2568                        
2569                            return request.release();
2570                        }
2571                        
2572                        CIMReferenceNamesRequestMessage*
2573                            CIMOperationRequestDecoder::decodeReferenceNamesRequest(
2574                                Uint32 queueId,
2575                                XmlParser& parser,
2576                                const String& messageId,
2577 kumpf            1.104         const CIMNamespaceName& nameSpace)
2578                        {
2579                            STAT_GETSTARTTIME
2580                        
2581                            CIMObjectPath objectName;
2582                            CIMName resultClass;
2583                            String role;
2584                            Boolean duplicateParameter = false;
2585                            Boolean gotObjectName = false;
2586                            Boolean gotResultClass = false;
2587                            Boolean gotRole = false;
2588                            Boolean emptyTag;
2589                        
2590                            for (const char* name;
2591                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2592                            {
2593                                if (System::strcasecmp(name, "ObjectName") == 0)
2594                                {
2595                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2596                                    XmlReader::getObjectNameElement(parser, objectName);
2597                                    duplicateParameter = gotObjectName;
2598 kumpf            1.104             gotObjectName = true;
2599                                }
2600                                else if (System::strcasecmp(name, "ResultClass") == 0)
2601                                {
2602                                    //
2603                                    //  ResultClass may be NULL
2604                                    //
2605                                    if (!emptyTag)
2606                                    {
2607                                        XmlReader::getClassNameElement(parser, resultClass, false);
2608                                    }
2609                                    duplicateParameter = gotResultClass;
2610                                    gotResultClass = true;
2611                                }
2612                                else if (System::strcasecmp(name, "Role") == 0)
2613                                {
2614                                    //
2615                                    //  Role may be NULL
2616                                    //
2617                                    if (!emptyTag)
2618                                    {
2619 kumpf            1.104                 XmlReader::getStringValueElement(parser, role, false);
2620                                    }
2621                                    duplicateParameter = gotRole;
2622                                    gotRole = true;
2623                                }
2624                                else
2625                                {
2626                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2627                                }
2628                        
2629                                if (!emptyTag)
2630                                {
2631                                   XmlReader::expectEndTag(parser, "IPARAMVALUE");
2632                                }
2633                        
2634                                if (duplicateParameter)
2635                                {
2636                                    throw PEGASUS_CIM_EXCEPTION(
2637                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2638                                }
2639                            }
2640 kumpf            1.104 
2641                            if (!gotObjectName)
2642                            {
2643                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2644                            }
2645                        
2646                            AutoPtr<CIMReferenceNamesRequestMessage> request(
2647                                new CIMReferenceNamesRequestMessage(
2648                                    messageId,
2649                                    nameSpace,
2650                                    objectName,
2651                                    resultClass,
2652                                    role,
2653                                    QueueIdStack(queueId, _returnQueueId)));
2654                        
2655                            STAT_SERVERSTART
2656                        
2657                            return request.release();
2658                        }
2659                        
2660                        CIMReferencesRequestMessage*
2661 kumpf            1.104     CIMOperationRequestDecoder::decodeReferencesRequest(
2662                                Uint32 queueId,
2663                                XmlParser& parser,
2664                                const String& messageId,
2665                                const CIMNamespaceName& nameSpace)
2666                        {
2667                            STAT_GETSTARTTIME
2668                        
2669                            CIMObjectPath objectName;
2670                            CIMName resultClass;
2671                            String role;
2672                            Boolean includeQualifiers = false;
2673                            Boolean includeClassOrigin = false;
2674                            CIMPropertyList propertyList;
2675                            Boolean duplicateParameter = false;
2676                            Boolean gotObjectName = false;
2677                            Boolean gotResultClass = false;
2678                            Boolean gotRole = false;
2679                            Boolean gotIncludeQualifiers = false;
2680                            Boolean gotIncludeClassOrigin = false;
2681                            Boolean gotPropertyList = false;
2682 kumpf            1.104     Boolean emptyTag;
2683                        
2684                            for (const char* name;
2685                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2686                            {
2687                                if (System::strcasecmp(name, "ObjectName") == 0)
2688                                {
2689                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2690                                    XmlReader::getObjectNameElement(parser, objectName);
2691                                    duplicateParameter = gotObjectName;
2692                                    gotObjectName = true;
2693                                }
2694                                else if (System::strcasecmp(name, "ResultClass") == 0)
2695                                {
2696                                    //
2697                                    //  ResultClass may be NULL
2698                                    //
2699                                    if (!emptyTag)
2700                                    {
2701                                        XmlReader::getClassNameElement(parser, resultClass, false);
2702                                    }
2703 kumpf            1.104             duplicateParameter = gotResultClass;
2704                                    gotResultClass = true;
2705                                }
2706                                else if (System::strcasecmp(name, "Role") == 0)
2707                                {
2708                                    //
2709                                    //  Role may be NULL
2710                                    //
2711                                    if (!emptyTag)
2712                                    {
2713                                        XmlReader::getStringValueElement(parser, role, false);
2714                                    }
2715                                    duplicateParameter = gotRole;
2716                                    gotRole = true;
2717                                }
2718                                else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
2719                                {
2720                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2721                                    XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
2722                                    duplicateParameter = gotIncludeQualifiers;
2723                                    gotIncludeQualifiers = true;
2724 kumpf            1.104         }
2725                                else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
2726                                {
2727                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2728                                    XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
2729                                    duplicateParameter = gotIncludeClassOrigin;
2730                                    gotIncludeClassOrigin = true;
2731                                }
2732                                else if (System::strcasecmp(name, "PropertyList") == 0)
2733                                {
2734                                    if (!emptyTag)
2735                                    {
2736                                        CIMValue pl;
2737                                        if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
2738                                        {
2739                                            Array<String> propertyListArray;
2740                                            pl.get(propertyListArray);
2741                                            Array<CIMName> cimNameArray;
2742                                            for (Uint32 i = 0; i < propertyListArray.size(); i++)
2743                                            {
2744                                                cimNameArray.append(propertyListArray[i]);
2745 kumpf            1.104                     }
2746                                            propertyList.set(cimNameArray);
2747                                        }
2748                                    }
2749                                    duplicateParameter = gotPropertyList;
2750                                    gotPropertyList = true;
2751                                }
2752                                else
2753                                {
2754                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2755                                }
2756                        
2757                               if (!emptyTag)
2758                               {
2759                                   XmlReader::expectEndTag(parser, "IPARAMVALUE");
2760                               }
2761                        
2762                               if (duplicateParameter)
2763                               {
2764                                   throw PEGASUS_CIM_EXCEPTION(
2765                                       CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2766 kumpf            1.104        }
2767                            }
2768                        
2769                            if (!gotObjectName)
2770                            {
2771                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2772                            }
2773                        
2774                            AutoPtr<CIMReferencesRequestMessage> request(
2775                                new CIMReferencesRequestMessage(
2776                                    messageId,
2777                                    nameSpace,
2778                                    objectName,
2779                                    resultClass,
2780                                    role,
2781                                    includeQualifiers,
2782                                    includeClassOrigin,
2783                                    propertyList,
2784                                    QueueIdStack(queueId, _returnQueueId)));
2785                        
2786                            STAT_SERVERSTART
2787 kumpf            1.104 
2788                            return request.release();
2789                        }
2790                        
2791                        CIMAssociatorNamesRequestMessage*
2792                            CIMOperationRequestDecoder::decodeAssociatorNamesRequest(
2793                                Uint32 queueId,
2794                                XmlParser& parser,
2795                                const String& messageId,
2796                                const CIMNamespaceName& nameSpace)
2797                        {
2798                            STAT_GETSTARTTIME
2799                        
2800                            CIMObjectPath objectName;
2801                            CIMName assocClass;
2802                            CIMName resultClass;
2803                            String role;
2804                            String resultRole;
2805                            Boolean duplicateParameter = false;
2806                            Boolean gotObjectName = false;
2807                            Boolean gotAssocClass = false;
2808 kumpf            1.104     Boolean gotResultClass = false;
2809                            Boolean gotRole = false;
2810                            Boolean gotResultRole = false;
2811                            Boolean emptyTag;
2812                        
2813                            for (const char* name;
2814                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2815                            {
2816                                if (System::strcasecmp(name, "ObjectName") == 0)
2817                                {
2818                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2819                                    XmlReader::getObjectNameElement(parser, objectName);
2820                                    duplicateParameter = gotObjectName;
2821                                    gotObjectName = true;
2822                                }
2823                                else if (System::strcasecmp(name, "AssocClass") == 0)
2824                                {
2825                                    //
2826                                    //  AssocClass may be NULL
2827                                    //
2828                                    if (!emptyTag)
2829 kumpf            1.104             {
2830                                        XmlReader::getClassNameElement(parser, assocClass, false);
2831                                    }
2832                                    duplicateParameter = gotAssocClass;
2833                                    gotAssocClass = true;
2834                                }
2835                                else if (System::strcasecmp(name, "ResultClass") == 0)
2836                                {
2837                                    //
2838                                    //  ResultClass may be NULL
2839                                    //
2840                                    if (!emptyTag)
2841                                    {
2842                                        XmlReader::getClassNameElement(parser, resultClass, false);
2843                                    }
2844                                    duplicateParameter = gotResultClass;
2845                                    gotResultClass = true;
2846                                }
2847                                else if (System::strcasecmp(name, "Role") == 0)
2848                                {
2849                                    //
2850 kumpf            1.104             //  Role may be NULL
2851                                    //
2852                                    if (!emptyTag)
2853                                    {
2854                                        XmlReader::getStringValueElement(parser, role, false);
2855                                    }
2856                                    duplicateParameter = gotRole;
2857                                    gotRole = true;
2858                                }
2859                                else if (System::strcasecmp(name, "ResultRole") == 0)
2860                                {
2861                                    //
2862                                    //  ResultRole may be NULL
2863                                    //
2864                                    if (!emptyTag)
2865                                    {
2866                                        XmlReader::getStringValueElement(parser, resultRole, false);
2867                                    }
2868                                    duplicateParameter = gotResultRole;
2869                                    gotResultRole = true;
2870                                }
2871 kumpf            1.104         else
2872                                {
2873                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
2874                                }
2875                        
2876                                if (!emptyTag)
2877                                {
2878                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
2879                                }
2880                        
2881                                if (duplicateParameter)
2882                                {
2883                                    throw PEGASUS_CIM_EXCEPTION(
2884                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2885                                }
2886                            }
2887                        
2888                            if (!gotObjectName)
2889                            {
2890                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
2891                            }
2892 kumpf            1.104 
2893                            AutoPtr<CIMAssociatorNamesRequestMessage> request(
2894                                new CIMAssociatorNamesRequestMessage(
2895                                    messageId,
2896                                    nameSpace,
2897                                    objectName,
2898                                    assocClass,
2899                                    resultClass,
2900                                    role,
2901                                    resultRole,
2902                                    QueueIdStack(queueId, _returnQueueId)));
2903                        
2904                            STAT_SERVERSTART
2905                        
2906                            return request.release();
2907                        }
2908                        
2909                        CIMAssociatorsRequestMessage*
2910                            CIMOperationRequestDecoder::decodeAssociatorsRequest(
2911                                Uint32 queueId,
2912                                XmlParser& parser,
2913 kumpf            1.104         const String& messageId,
2914                                const CIMNamespaceName& nameSpace)
2915                        {
2916                            STAT_GETSTARTTIME
2917                        
2918                            CIMObjectPath objectName;
2919                            CIMName assocClass;
2920                            CIMName resultClass;
2921                            String role;
2922                            String resultRole;
2923                            Boolean includeQualifiers = false;
2924                            Boolean includeClassOrigin = false;
2925                            CIMPropertyList propertyList;
2926                            Boolean duplicateParameter = false;
2927                            Boolean gotObjectName = false;
2928                            Boolean gotAssocClass = false;
2929                            Boolean gotResultClass = false;
2930                            Boolean gotRole = false;
2931                            Boolean gotResultRole = false;
2932                            Boolean gotIncludeQualifiers = false;
2933                            Boolean gotIncludeClassOrigin = false;
2934 kumpf            1.104     Boolean gotPropertyList = false;
2935                            Boolean emptyTag;
2936                        
2937                            for (const char* name;
2938                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
2939                            {
2940                                if (System::strcasecmp(name, "ObjectName") == 0)
2941                                {
2942                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2943                                    XmlReader::getObjectNameElement(parser, objectName);
2944                                    duplicateParameter = gotObjectName;
2945                                    gotObjectName = true;
2946                                }
2947                                else if (System::strcasecmp(name, "AssocClass") == 0)
2948                                {
2949                                    //
2950                                    //  AssocClass may be NULL
2951                                    //
2952                                    if (!emptyTag)
2953                                    {
2954                                        XmlReader::getClassNameElement(parser, assocClass, false);
2955 kumpf            1.104             }
2956                                    duplicateParameter = gotAssocClass;
2957                                    gotAssocClass = true;
2958                                }
2959                                else if (System::strcasecmp(name, "ResultClass") == 0)
2960                                {
2961                                    //
2962                                    //  ResultClass may be NULL
2963                                    //
2964                                    if (!emptyTag)
2965                                    {
2966                                        XmlReader::getClassNameElement(parser, resultClass, false);
2967                                    }
2968                                    duplicateParameter = gotResultClass;
2969                                    gotResultClass = true;
2970                                }
2971                                else if (System::strcasecmp(name, "Role") == 0)
2972                                {
2973                                    //
2974                                    //  Role may be NULL
2975                                    //
2976 kumpf            1.104             if (!emptyTag)
2977                                    {
2978                                        XmlReader::getStringValueElement(parser, role, false);
2979                                    }
2980                                    duplicateParameter = gotRole;
2981                                    gotRole = true;
2982                                }
2983                                else if (System::strcasecmp(name, "ResultRole") == 0)
2984                                {
2985                                    //
2986                                    //  ResultRole may be NULL
2987                                    //
2988                                    if (!emptyTag)
2989                                    {
2990                                        XmlReader::getStringValueElement(parser, resultRole, false);
2991                                    }
2992                                    duplicateParameter = gotResultRole;
2993                                    gotResultRole = true;
2994                                }
2995                                else if (System::strcasecmp(name, "IncludeQualifiers") == 0)
2996                                {
2997 kumpf            1.104             XmlReader::rejectNullIParamValue(parser, emptyTag, name);
2998                                    XmlReader::getBooleanValueElement(parser, includeQualifiers, true);
2999                                    duplicateParameter = gotIncludeQualifiers;
3000                                    gotIncludeQualifiers = true;
3001                                }
3002                                else if (System::strcasecmp(name, "IncludeClassOrigin") == 0)
3003                                {
3004                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
3005                                    XmlReader::getBooleanValueElement(parser, includeClassOrigin, true);
3006                                    duplicateParameter = gotIncludeClassOrigin;
3007                                    gotIncludeClassOrigin = true;
3008                                }
3009                                else if (System::strcasecmp(name, "PropertyList") == 0)
3010                                {
3011                                    if (!emptyTag)
3012                                    {
3013                                        CIMValue pl;
3014                                        if (XmlReader::getValueArrayElement(parser, CIMTYPE_STRING, pl))
3015                                        {
3016                                            Array<String> propertyListArray;
3017                                            pl.get(propertyListArray);
3018 kumpf            1.104                     Array<CIMName> cimNameArray;
3019                                            for (Uint32 i = 0; i < propertyListArray.size(); i++)
3020                                            {
3021                                                cimNameArray.append(propertyListArray[i]);
3022                                            }
3023                                            propertyList.set(cimNameArray);
3024                                        }
3025                                    }
3026                                    duplicateParameter = gotPropertyList;
3027                                    gotPropertyList = true;
3028                                }
3029                                else
3030                                {
3031                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3032                                }
3033                        
3034                                if (!emptyTag)
3035                                {
3036                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
3037                                }
3038                        
3039 kumpf            1.104         if (duplicateParameter)
3040                                {
3041                                    throw PEGASUS_CIM_EXCEPTION(
3042                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
3043                                }
3044                            }
3045                        
3046                            if (!gotObjectName)
3047                            {
3048                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
3049                            }
3050                        
3051                            AutoPtr<CIMAssociatorsRequestMessage> request(
3052                                new CIMAssociatorsRequestMessage(
3053                                    messageId,
3054                                    nameSpace,
3055                                    objectName,
3056                                    assocClass,
3057                                    resultClass,
3058                                    role,
3059                                    resultRole,
3060 kumpf            1.104             includeQualifiers,
3061                                    includeClassOrigin,
3062                                    propertyList,
3063                                    QueueIdStack(queueId, _returnQueueId)));
3064                        
3065                            STAT_SERVERSTART
3066                        
3067                            return request.release();
3068                        }
3069                        
3070                        CIMGetPropertyRequestMessage*
3071                            CIMOperationRequestDecoder::decodeGetPropertyRequest(
3072                                Uint32 queueId,
3073                                XmlParser& parser,
3074                                const String& messageId,
3075                                const CIMNamespaceName& nameSpace)
3076                        {
3077                            STAT_GETSTARTTIME
3078                        
3079                            CIMObjectPath instanceName;
3080                            String propertyName;
3081 kumpf            1.104     Boolean duplicateParameter = false;
3082                            Boolean gotInstanceName = false;
3083                            Boolean gotPropertyName = false;
3084                            Boolean emptyTag;
3085                        
3086                            for (const char* name;
3087                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
3088                            {
3089                                if (System::strcasecmp(name, "InstanceName") == 0)
3090                                {
3091                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
3092                                    XmlReader::getInstanceNameElement(parser, instanceName);
3093                                    duplicateParameter = gotInstanceName;
3094                                    gotInstanceName = true;
3095                                }
3096                                else if (System::strcasecmp(name, "PropertyName") == 0)
3097                                {
3098                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
3099                                    XmlReader::getStringValueElement(parser, propertyName, true);
3100                                    duplicateParameter = gotPropertyName;
3101                                    gotPropertyName = true;
3102 kumpf            1.104         }
3103                                else
3104                                {
3105                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3106                                }
3107                        
3108                                if (!emptyTag)
3109                                {
3110                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
3111                                }
3112                        
3113                                if (duplicateParameter)
3114                                {
3115                                    throw PEGASUS_CIM_EXCEPTION(
3116                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
3117                                }
3118                            }
3119                        
3120                            if (!gotInstanceName || !gotPropertyName)
3121                            {
3122                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
3123 kumpf            1.104     }
3124                        
3125                            AutoPtr<CIMGetPropertyRequestMessage> request(
3126                                new CIMGetPropertyRequestMessage(
3127                                    messageId,
3128                                    nameSpace,
3129                                    instanceName,
3130                                    propertyName,
3131                                    QueueIdStack(queueId, _returnQueueId)));
3132                        
3133                            STAT_SERVERSTART
3134                        
3135                            return request.release();
3136                        }
3137                        
3138                        CIMSetPropertyRequestMessage*
3139                            CIMOperationRequestDecoder::decodeSetPropertyRequest(
3140                                Uint32 queueId,
3141                                XmlParser& parser,
3142                                const String& messageId,
3143                                const CIMNamespaceName& nameSpace)
3144 kumpf            1.104 {
3145                            STAT_GETSTARTTIME
3146                        
3147                            CIMObjectPath instanceName;
3148                            String propertyName;
3149                            CIMValue propertyValue;
3150                            Boolean duplicateParameter = false;
3151                            Boolean gotInstanceName = false;
3152                            Boolean gotPropertyName = false;
3153                            Boolean gotNewValue = false;
3154                            Boolean emptyTag;
3155                        
3156                            for (const char* name;
3157                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
3158                            {
3159                                if (System::strcasecmp(name, "InstanceName") == 0)
3160                                {
3161                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
3162                                    XmlReader::getInstanceNameElement(parser, instanceName);
3163                                    duplicateParameter = gotInstanceName;
3164                                    gotInstanceName = true;
3165 kumpf            1.104         }
3166                                else if (System::strcasecmp(name, "PropertyName") == 0)
3167                                {
3168                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
3169                                    XmlReader::getStringValueElement(parser, propertyName, true);
3170                                    duplicateParameter = gotPropertyName;
3171                                    gotPropertyName = true;
3172                                }
3173                                else if (System::strcasecmp(name, "NewValue") == 0)
3174                                {
3175                                    if (emptyTag || !XmlReader::getPropertyValue(parser, propertyValue))
3176                                    {
3177                                        propertyValue.setNullValue(CIMTYPE_STRING, false);
3178                                    }
3179                                    duplicateParameter = gotNewValue;
3180                                    gotNewValue = true;
3181                                }
3182                                else
3183                                {
3184                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3185                                }
3186 kumpf            1.104 
3187                                if (!emptyTag)
3188                                {
3189                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
3190                                }
3191                        
3192                                if (duplicateParameter)
3193                                {
3194                                    throw PEGASUS_CIM_EXCEPTION(
3195                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
3196                                }
3197                            }
3198                        
3199                            if (!gotInstanceName || !gotPropertyName)
3200                            {
3201                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
3202                            }
3203                        
3204                            AutoPtr<CIMSetPropertyRequestMessage> request(
3205                                new CIMSetPropertyRequestMessage(
3206                                    messageId,
3207 kumpf            1.104             nameSpace,
3208                                    instanceName,
3209                                    propertyName,
3210                                    propertyValue,
3211                                    QueueIdStack(queueId, _returnQueueId)));
3212 kumpf            1.29  
3213 kumpf            1.104     STAT_SERVERSTART
3214 sage             1.41  
3215 kumpf            1.104     return request.release();
3216 kumpf            1.29  }
3217                        
3218                        CIMExecQueryRequestMessage* CIMOperationRequestDecoder::decodeExecQueryRequest(
3219 kumpf            1.104     Uint32 queueId,
3220                            XmlParser& parser,
3221                            const String& messageId,
3222                            const CIMNamespaceName& nameSpace)
3223                        {
3224                            STAT_GETSTARTTIME
3225                        
3226                            String queryLanguage;
3227                            String query;
3228                            Boolean duplicateParameter = false;
3229                            Boolean gotQueryLanguage = false;
3230                            Boolean gotQuery = false;
3231                            Boolean emptyTag;
3232                        
3233                            for (const char* name;
3234                                 XmlReader::getIParamValueTag(parser, name, emptyTag); )
3235                            {
3236                                if (System::strcasecmp(name, "QueryLanguage") == 0)
3237                                {
3238                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
3239                                    XmlReader::getStringValueElement(parser, queryLanguage, true);
3240 kumpf            1.104             duplicateParameter = gotQueryLanguage;
3241                                    gotQueryLanguage = true;
3242                                }
3243                                else if (System::strcasecmp(name, "Query") == 0)
3244                                {
3245                                    XmlReader::rejectNullIParamValue(parser, emptyTag, name);
3246                                    XmlReader::getStringValueElement(parser, query, true);
3247                                    duplicateParameter = gotQuery;
3248                                    gotQuery = true;
3249                                }
3250                                else
3251                                {
3252                                    throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
3253                                }
3254                        
3255                                if (!emptyTag)
3256                                {
3257                                    XmlReader::expectEndTag(parser, "IPARAMVALUE");
3258                                }
3259                        
3260                                if (duplicateParameter)
3261 kumpf            1.104         {
3262                                    throw PEGASUS_CIM_EXCEPTION(
3263                                        CIM_ERR_INVALID_PARAMETER, String::EMPTY);
3264                                }
3265                            }
3266                        
3267                            if (!gotQueryLanguage || !gotQuery)
3268                            {
3269                                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, String::EMPTY);
3270                            }
3271                        
3272                            AutoPtr<CIMExecQueryRequestMessage> request(
3273                                new CIMExecQueryRequestMessage(
3274                                    messageId,
3275                                    nameSpace,
3276                                    queryLanguage,
3277                                    query,
3278                                    QueueIdStack(queueId, _returnQueueId)));
3279                        
3280                            STAT_SERVERSTART
3281                        
3282 kumpf            1.104     return request.release();
3283                        }
3284                        
3285                        CIMInvokeMethodRequestMessage*
3286                            CIMOperationRequestDecoder::decodeInvokeMethodRequest(
3287                                Uint32 queueId,
3288                                XmlParser& parser,
3289                                const String& messageId,
3290                                const CIMObjectPath& reference,
3291                                const String& cimMethodName)
3292                        {
3293                            STAT_GETSTARTTIME
3294                        
3295                            CIMParamValue paramValue;
3296                            Array<CIMParamValue> inParameters;
3297                        
3298                            while (XmlReader::getParamValueElement(parser, paramValue))
3299                            {
3300                                inParameters.append(paramValue);
3301                            }
3302                        
3303 kumpf            1.104     AutoPtr<CIMInvokeMethodRequestMessage> request(
3304                                new CIMInvokeMethodRequestMessage(
3305                                    messageId,
3306                                    reference.getNameSpace(),
3307                                    reference,
3308                                    cimMethodName,
3309                                    inParameters,
3310                                    QueueIdStack(queueId, _returnQueueId)));
3311 kumpf            1.9   
3312 kumpf            1.104     STAT_SERVERSTART
3313 mike             1.2   
3314 kumpf            1.104     return request.release();
3315 mike             1.2   }
3316                        
3317                        void CIMOperationRequestDecoder::setServerTerminating(Boolean flag)
3318                        {
3319 kumpf            1.104     _serverTerminating = flag;
3320 mike             1.2   }
3321                        
3322                        PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2