(file) Return to CIMResponseData.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 r.kieninger 1.1 //%LICENSE////////////////////////////////////////////////////////////////
  2                 //
  3                 // 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                 //
 10                 // 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                 //
 17                 // The above copyright notice and this permission notice shall be included
 18                 // in all copies or substantial portions of the Software.
 19                 //
 20                 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21                 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 r.kieninger 1.1 // 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                 //
 28                 //////////////////////////////////////////////////////////////////////////
 29                 //
 30                 //%/////////////////////////////////////////////////////////////////////////////
 31                 
 32 r.kieninger 1.3.2.1 #ifndef Pegasus_CIMResponseData_h
 33 r.kieninger 1.1     #define Pegasus_CIMResponseData_h
 34                     
 35                     #include <Pegasus/Common/Config.h>
 36                     #include <Pegasus/Common/CIMInstance.h>
 37                     #include <Pegasus/Common/Linkage.h>
 38                     #include <Pegasus/Common/CIMBuffer.h>
 39 r.kieninger 1.3.2.1 #include <Pegasus/Common/SCMOClass.h>
 40                     #include <Pegasus/Common/SCMOInstance.h>
 41                     #include <Pegasus/Common/SCMODump.h>
 42 r.kieninger 1.1     
 43                     PEGASUS_NAMESPACE_BEGIN
 44                     
 45                     typedef Array<Sint8> ArraySint8;
 46                     #define PEGASUS_ARRAY_T ArraySint8
 47                     # include <Pegasus/Common/ArrayInter.h>
 48                     #undef PEGASUS_ARRAY_T
 49                     
 50 r.kieninger 1.3.2.1 
 51 marek       1.3.2.4 class PEGASUS_COMMON_LINKAGE CIMResponseData
 52 r.kieninger 1.3.2.1 {
 53                     public:
 54                     
 55                         enum ResponseDataEncoding {
 56 marek       1.3.2.4         RESP_ENC_CIM = 1,
 57                             RESP_ENC_BINARY = 2,
 58                             RESP_ENC_XML = 4,
 59 marek       1.3.2.9         RESP_ENC_SCMO = 8
 60 r.kieninger 1.3.2.1     };
 61                     
 62 marek       1.3.2.4     enum ResponseDataContent {
 63                             RESP_INSTNAMES = 1,
 64                             RESP_INSTANCES = 2,
 65                             RESP_INSTANCE = 3,
 66                             RESP_OBJECTS = 4,
 67 r.kieninger 1.3.2.10         RESP_OBJECTPATHS = 5
 68 marek       1.3.2.4      };
 69 r.kieninger 1.3.2.1  
 70 r.kieninger 1.3.2.11     CIMResponseData(ResponseDataContent content):
 71                              _encoding(0),_dataType(content),
 72                              _defaultNamespace(0), _defaultNamespaceLen(0)
 73 marek       1.3.2.6      {};
 74 r.kieninger 1.3.2.1  
 75 r.kieninger 1.3.2.11 
 76                          ~CIMResponseData()
 77                          {
 78                              free(_defaultNamespace);
 79                          }
 80                      
 81 marek       1.3.2.4      // C++ objects interface handling
 82                      
 83                          // Instance Names handling
 84                          Array<CIMObjectPath>& getInstanceNames();
 85 r.kieninger 1.3.2.1  
 86                          void setInstanceNames(const Array<CIMObjectPath>& x)
 87                          {
 88 marek       1.3.2.4          _instanceNames=x;
 89                              _encoding |= RESP_ENC_CIM;
 90 r.kieninger 1.3.2.1      }
 91                          void appendInstanceName(const CIMObjectPath& x)
 92                          {
 93                              _instanceNames.append(x);
 94 marek       1.3.2.4          _encoding |= RESP_ENC_CIM;
 95 r.kieninger 1.3.2.1      }
 96                      
 97 marek       1.3.2.4      // Instance handling
 98                          CIMInstance& getInstance();
 99 r.kieninger 1.3.2.1  
100 marek       1.3.2.4      void setInstance(const CIMInstance& x)
101 r.kieninger 1.3.2.1      {
102 marek       1.3.2.4          _instances.clear();
103                              _instances.append(x);
104                              _encoding |= RESP_ENC_CIM;
105 r.kieninger 1.3.2.1      }
106                      
107 marek       1.3.2.4      // Instances handling
108                          Array<CIMInstance>& getInstances();
109 r.kieninger 1.3.2.3  
110 marek       1.3.2.4      void setInstances(const Array<CIMInstance>& x)
111 r.kieninger 1.1          {
112 marek       1.3.2.4          _instances=x;
113                              _encoding |= RESP_ENC_CIM;
114 r.kieninger 1.1          }
115 marek       1.3.2.4      void appendInstance(const CIMInstance& x)
116 r.kieninger 1.1          {
117 marek       1.3.2.4          _instances.append(x);
118                              _encoding |= RESP_ENC_CIM;
119 r.kieninger 1.1          }
120                      
121 marek       1.3.2.4      // Objects handling
122                          Array<CIMObject>& getObjects();
123                          void setObjects(const Array<CIMObject>& x)
124 r.kieninger 1.1          {
125 marek       1.3.2.4          _objects=x;
126                              _encoding |= RESP_ENC_CIM;
127 r.kieninger 1.1          }
128 marek       1.3.2.4      void appendObject(const CIMObject& x)
129 r.kieninger 1.3.2.3      {
130 marek       1.3.2.4          _objects.append(x);
131                              _encoding |= RESP_ENC_CIM;
132 r.kieninger 1.3.2.3      }
133                      
134 marek       1.3.2.4      // SCMO representation, single instance stored as one element array
135                          // object paths are represented as SCMOInstance
136                          Array<SCMOInstance>& getSCMO();
137 r.kieninger 1.1      
138 marek       1.3.2.5      void setSCMO(const Array<SCMOInstance>& x);
139                      
140 marek       1.3.2.4      void appendSCMO(const Array<SCMOInstance>& x)
141 r.kieninger 1.1          {
142 marek       1.3.2.4          _scmoInstances.appendArray(x);
143                              _encoding |= RESP_ENC_SCMO;
144 r.kieninger 1.1          }
145                      
146 marek       1.3.2.4      // Binary data is just a data stream
147                          Array<Uint8>& getBinary();
148                          bool setBinary(CIMBuffer& in, bool hasLen=true);
149 marek       1.3.2.5  
150 marek       1.3.2.4      // Xml data is unformatted, no need to differentiate between instance
151                          // instances and object paths or objects
152                          bool setXml(CIMBuffer& in);
153 r.kieninger 1.1      
154 marek       1.3.2.4      // function used by OperationAggregator to aggregate response data in a
155                          // single ResponseData object
156                          void appendResponseData(const CIMResponseData & x);
157 r.kieninger 1.1      
158 marek       1.3.2.8      // Function used by CMPI layer to complete the namespace on all data held
159                          // Input (x) has to have a valid namespace
160                          void completeNamespace(const SCMOInstance * x);
161 marek       1.3.2.7  
162 marek       1.3.2.6      // Function primarily used by CIMOperationRequestDispatcher to complete
163                          // namespace and hostname on a,an,r and rn operations in the
164                          // OperationAggregator
165                          void completeHostNameAndNamespace(
166                              const String & hn,
167                              const CIMNamespaceName & ns);
168                      
169 marek       1.3.2.4      // Encoding responses
170 r.kieninger 1.1      
171 marek       1.3.2.4      // binary format used with Provider Agents and OP Clients
172 r.kieninger 1.3.2.1      void encodeBinaryResponse(CIMBuffer& out);
173 marek       1.3.2.4      // Xml format used with Provider Agents only
174                          void encodeInternalXmlResponse(CIMBuffer& out);
175                          // official Xml format(CIM over Http) used to communicate to clients
176 r.kieninger 1.3.2.1      void encodeXmlResponse(Buffer& out);
177 r.kieninger 1.1      
178                      private:
179                      
180 marek       1.3.2.4      // helper functions to transform different formats into one-another
181                          // functions work on the internal data and calling of them should be
182                          // avoided
183 r.kieninger 1.1      
184 marek       1.3.2.4      void _resolveToCIM();
185                          void _resolveToSCMO();
186 r.kieninger 1.1      
187 marek       1.3.2.4      void _resolveBinary();
188 r.kieninger 1.1      
189 marek       1.3.2.4      void _resolveXmlToSCMO();
190                          void _resolveXmlToCIM();
191 r.kieninger 1.1      
192 marek       1.3.2.4      void _resolveSCMOToCIM();
193                          void _resolveCIMToSCMO();
194 r.kieninger 1.1      
195 marek       1.3.2.4      // Helper functions for this class only, do NOT externalize
196                          SCMOInstance _getSCMOFromCIMInstance(const CIMInstance& cimInst);
197 marek       1.3.2.6      SCMOInstance _getSCMOFromCIMObject(const CIMObject& cimObj);
198 marek       1.3.2.4      SCMOInstance _getSCMOFromCIMObjectPath(const CIMObjectPath& cimPath);
199                          SCMOClass* _getSCMOClass(const char* ns,const char* cls);
200 r.kieninger 1.1      
201 marek       1.3.2.4      // Bitflags in this integer will reflect what data representation types
202                          // are currently stored in this CIMResponseData object
203                          Uint32 _encoding;
204 r.kieninger 1.1      
205 marek       1.3.2.4      // Storing type of data in this enumeration
206                          ResponseDataContent _dataType;
207 r.kieninger 1.1      
208 marek       1.3.2.4      // unused arrays are represented by ArrayRepBase _empty_rep
209                          // which is a 16 byte large static shared across all of them
210                          // so, even though this object looks large, it holds just
211                          // 2 integer and 9 pointers
212 r.kieninger 1.1      
213                          // For XML encoding.
214                          Array<ArraySint8> _referencesData;
215 marek       1.3.2.4      Array<ArraySint8> _instanceData;
216 r.kieninger 1.1          Array<String> _hostsData;
217                          Array<CIMNamespaceName> _nameSpacesData;
218                      
219 r.kieninger 1.3.2.11 
220 r.kieninger 1.1          // For binary encoding.
221                          Array<Uint8> _binaryData;
222 r.kieninger 1.3.2.11     char* _defaultNamespace;
223                          Uint32 _defaultNamespaceLen;
224 r.kieninger 1.1      
225 marek       1.3.2.4      // Default C++ encoding
226                          Array<CIMObjectPath> _instanceNames;
227                          Array<CIMInstance> _instances;
228                          Array<CIMObject> _objects;
229                      
230                          // SCMO encoding
231                          Array<SCMOInstance> _scmoInstances;
232                      
233 r.kieninger 1.1      };
234                      
235                      PEGASUS_NAMESPACE_END
236                      
237                      #endif /* Pegasus_CIMResponseData_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2