summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormreddy <mreddy>2006-10-25 13:41:58 +0000
committermreddy <mreddy>2006-10-25 13:41:58 +0000
commita868202657c1e802e8950d079200a2bf560b0ef8 (patch)
tree42d0f321fbc9432aaa656f2303810a9603b27850
parentc292e947b504b786b66222359bdb5976a5e4b4d8 (diff)
downloadtog-pegasus-TASK-Bug2021_RemoteCMPIonWindows-branch.zip
tog-pegasus-TASK-Bug2021_RemoteCMPIonWindows-branch.tar.gz
tog-pegasus-TASK-Bug2021_RemoteCMPIonWindows-branch.tar.xz
TITLE: Remote CMPI on Windows
-rw-r--r--src/Pegasus/ProviderManager2/CMPIR/native/result.c146
-rw-r--r--src/Pegasus/ProviderManager2/CMPIR/native/selectexp.c7
-rw-r--r--src/Pegasus/ProviderManager2/CMPIR/native/string.c7
-rw-r--r--src/Pegasus/ProviderManager2/CMPIR/native/value.c315
4 files changed, 225 insertions, 250 deletions
diff --git a/src/Pegasus/ProviderManager2/CMPIR/native/result.c b/src/Pegasus/ProviderManager2/CMPIR/native/result.c
index 35033b3..8b68340 100644
--- a/src/Pegasus/ProviderManager2/CMPIR/native/result.c
+++ b/src/Pegasus/ProviderManager2/CMPIR/native/result.c
@@ -17,7 +17,7 @@
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
-//
+//
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
@@ -29,10 +29,6 @@
//
//==============================================================================
//
-// Author: Frank Scheffler
-//
-// Modified By: Adrian Schuur (schuur@de.ibm.com)
-//
//%/////////////////////////////////////////////////////////////////////////////
/*!
@@ -42,23 +38,23 @@
This is the native CMPIResult implementation as used for remote
providers. It reflects the well-defined interface of a regular
CMPIResult, however, it works independently from the management broker.
-
+
It is part of a native broker implementation that simulates CMPI data
types rather than interacting with the entities in a full-grown CIMOM.
- \author Frank Scheffler
*/
+#include <Pegasus/ProviderManager2/CMPIR/cmpir_common.h>
#include "mm.h"
#include "native.h"
struct native_result {
- CMPIResult result;
- int mem_state;
+ CMPIResult result;
+ int mem_state;
- CMPICount current;
- CMPIArray * data;
+ CMPICount current;
+ CMPIArray * data;
};
@@ -69,121 +65,121 @@ static struct native_result * __new_empty_result ( int, CMPIStatus * );
static CMPIStatus __rft_release ( CMPIResult * result )
{
- struct native_result * r = (struct native_result *) result;
+ struct native_result * r = (struct native_result *) result;
- if ( r->mem_state == TOOL_MM_NO_ADD ) {
+ if ( r->mem_state == TOOL_MM_NO_ADD ) {
- tool_mm_add ( result );
- return r->data->ft->release ( r->data );
- }
+ tool_mm_add ( result );
+ return r->data->ft->release ( r->data );
+ }
- CMReturn ( CMPI_RC_ERR_FAILED );
+ CMReturn ( CMPI_RC_ERR_FAILED );
}
static CMPIResult * __rft_clone ( CONST CMPIResult * result,
- CMPIStatus * rc )
+ CMPIStatus * rc )
{
- CMPIArray * a = ( (struct native_result *) result )->data;
- struct native_result * r = __new_empty_result ( TOOL_MM_NO_ADD, rc );
+ CMPIArray * a = ( (struct native_result *) result )->data;
+ struct native_result * r = __new_empty_result ( TOOL_MM_NO_ADD, rc );
+
+ if ( rc && rc->rc != CMPI_RC_OK )
+ return NULL;
- if ( rc && rc->rc != CMPI_RC_OK )
- return NULL;
-
- r->data = a->ft->clone ( a, rc );
+ r->data = a->ft->clone ( a, rc );
- return (CMPIResult *) r;
+ return (CMPIResult *) r;
}
static CMPIStatus __rft_returnData ( CONST CMPIResult * result,
- const CMPIValue * val,
- CONST CMPIType type )
+ const CMPIValue * val,
+ CONST CMPIType type )
{
- struct native_result * r = (struct native_result *) result;
+ struct native_result * r = (struct native_result *) result;
- if ( r->current == 0 ) {
+ if ( r->current == 0 ) {
- CMPIStatus rc;
- r->data = native_new_CMPIArray ( 1, type, &rc );
- if ( rc.rc != CMPI_RC_OK ) return rc;
+ CMPIStatus rc;
+ r->data = native_new_CMPIArray ( 1, type, &rc );
+ if ( rc.rc != CMPI_RC_OK ) return rc;
- } else native_array_increase_size ( r->data, 1 );
+ } else native_array_increase_size ( r->data, 1 );
- return CMSetArrayElementAt ( r->data,
- r->current++,
- val,
- type );
+ return CMSetArrayElementAt ( r->data,
+ r->current++,
+ val,
+ type );
}
static CMPIStatus __rft_returnInstance ( CONST CMPIResult * result,
- CONST CMPIInstance * instance )
+ CONST CMPIInstance * instance )
{
- CMPIValue v;
- v.inst = (CMPIInstance *)instance;
+ CMPIValue v;
+ v.inst = (CMPIInstance *)instance;
- return __rft_returnData ( result, &v, CMPI_instance );
+ return __rft_returnData ( result, &v, CMPI_instance );
}
static CMPIStatus __rft_returnObjectPath ( CONST CMPIResult * result,
- CONST CMPIObjectPath * cop )
+ CONST CMPIObjectPath * cop )
{
- CMPIValue v;
- v.ref = (CMPIObjectPath *)cop;
+ CMPIValue v;
+ v.ref = (CMPIObjectPath *)cop;
- return __rft_returnData ( result, &v, CMPI_ref );
+ return __rft_returnData ( result, &v, CMPI_ref );
}
static CMPIStatus __rft_returnDone ( CONST CMPIResult * result )
{
- CMReturn ( CMPI_RC_OK );
+ CMReturn ( CMPI_RC_OK );
}
static struct native_result * __new_empty_result ( int mm_add,
- CMPIStatus * rc )
+ CMPIStatus * rc )
{
- static CMPIResultFT rft = {
- NATIVE_FT_VERSION,
- __rft_release,
- __rft_clone,
- __rft_returnData,
- __rft_returnInstance,
- __rft_returnObjectPath,
- __rft_returnDone
- };
- static CMPIResult r = {
- "CMPIResult",
- &rft
- };
-
- struct native_result * result =
- (struct native_result *)
- tool_mm_alloc ( mm_add, sizeof ( struct native_result ) );
-
- result->result = r;
- result->mem_state = mm_add;
-
- if ( rc ) CMSetStatus ( rc, CMPI_RC_OK );
- return result;
+ static CMPIResultFT rft = {
+ NATIVE_FT_VERSION,
+ __rft_release,
+ __rft_clone,
+ __rft_returnData,
+ __rft_returnInstance,
+ __rft_returnObjectPath,
+ __rft_returnDone
+ };
+ static CMPIResult r = {
+ "CMPIResult",
+ &rft
+ };
+
+ struct native_result * result =
+ (struct native_result *)
+ tool_mm_alloc ( mm_add, sizeof ( struct native_result ) );
+
+ result->result = r;
+ result->mem_state = mm_add;
+
+ if ( rc ) CMSetStatus ( rc, CMPI_RC_OK );
+ return result;
}
-CMPIResult * native_new_CMPIResult ( CMPIStatus * rc )
+PEGASUS_EXPORT CMPIResult *PEGASUS_CMPIR_CDECL native_new_CMPIResult ( CMPIStatus * rc )
{
- return (CMPIResult *) __new_empty_result ( TOOL_MM_ADD, rc );
+ return (CMPIResult *) __new_empty_result ( TOOL_MM_ADD, rc );
}
-CMPIArray * native_result2array ( CMPIResult * result )
+PEGASUS_EXPORT CMPIArray * PEGASUS_CMPIR_CDECL native_result2array ( CMPIResult * result )
{
- struct native_result * r = (struct native_result *) result;
+ struct native_result * r = (struct native_result *) result;
- return r->data;
+ return r->data;
}
diff --git a/src/Pegasus/ProviderManager2/CMPIR/native/selectexp.c b/src/Pegasus/ProviderManager2/CMPIR/native/selectexp.c
index e8ede9e..9ef6d58 100644
--- a/src/Pegasus/ProviderManager2/CMPIR/native/selectexp.c
+++ b/src/Pegasus/ProviderManager2/CMPIR/native/selectexp.c
@@ -29,10 +29,6 @@
//
//==============================================================================
//
-// Author: Frank Scheffler
-//
-// Modified By: Adrian Schuur (schuur@de.ibm.com)
-//
//%/////////////////////////////////////////////////////////////////////////////
/*!
@@ -46,8 +42,6 @@
It is part of a native broker implementation that simulates CMPI data
types rather than interacting with the entities in a full-grown CIMOM.
- \author Frank Scheffler
-
\todo THIS IS NOT FULLY IMPLEMENTED YET!!!
*/
@@ -55,6 +49,7 @@
#include <stdlib.h>
#include <string.h>
+#include <Pegasus/ProviderManager2/CMPIR/cmpir_common.h>
#include "mm.h"
#include "native.h"
diff --git a/src/Pegasus/ProviderManager2/CMPIR/native/string.c b/src/Pegasus/ProviderManager2/CMPIR/native/string.c
index ad5141e..7bb7a24 100644
--- a/src/Pegasus/ProviderManager2/CMPIR/native/string.c
+++ b/src/Pegasus/ProviderManager2/CMPIR/native/string.c
@@ -29,10 +29,6 @@
//
//==============================================================================
//
-// Author: Frank Scheffler
-//
-// Modified By: Adrian Schuur (schuur@de.ibm.com)
-//
//%/////////////////////////////////////////////////////////////////////////////
/*!
@@ -46,14 +42,13 @@
It is part of a native broker implementation that simulates CMPI data
types rather than interacting with the entities in a full-grown CIMOM.
- \author Frank Scheffler
-
\todo Once CMGetCharPtr() macro uses the appropriate function call instead
of casting the internal hdl, store "CMPIString" type in there.
*/
#include <string.h>
+#include <Pegasus/ProviderManager2/CMPIR/cmpir_common.h>
#include "mm.h"
#include "native.h"
diff --git a/src/Pegasus/ProviderManager2/CMPIR/native/value.c b/src/Pegasus/ProviderManager2/CMPIR/native/value.c
index 1cfd005..a5e254b 100644
--- a/src/Pegasus/ProviderManager2/CMPIR/native/value.c
+++ b/src/Pegasus/ProviderManager2/CMPIR/native/value.c
@@ -17,7 +17,7 @@
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
-//
+//
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
@@ -29,10 +29,6 @@
//
//==============================================================================
//
-// Author: Frank Scheffler
-//
-// Modified By: Adrian Schuur (schuur@de.ibm.com)
-//
//%/////////////////////////////////////////////////////////////////////////////
/*!
@@ -41,246 +37,239 @@
This module provides means to clone and release CMPIValues.
- \author Frank Scheffler
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <Pegasus/ProviderManager2/CMPIR/cmpir_common.h>
#include "mm.h"
#include "native.h"
-#include "debug.h"
+#include <Pegasus/ProviderManager2/CMPIR/debug.h>
void native_release_CMPIValue ( CMPIType type, CMPIValue * val )
{
- switch ( type ) {
+ switch ( type ) {
- case CMPI_instance:
- CMRelease ( val->inst );
- break;
+ case CMPI_instance:
+ CMRelease ( val->inst );
+ break;
- case CMPI_ref:
- CMRelease ( val->ref );
- break;
+ case CMPI_ref:
+ CMRelease ( val->ref );
+ break;
- case CMPI_args:
- CMRelease ( val->args );
- break;
+ case CMPI_args:
+ CMRelease ( val->args );
+ break;
- case CMPI_filter:
- CMRelease ( val->filter );
- break;
+ case CMPI_filter:
+ CMRelease ( val->filter );
+ break;
- case CMPI_enumeration:
- CMRelease ( val->Enum );
- break;
+ case CMPI_enumeration:
+ CMRelease ( val->Enum );
+ break;
- case CMPI_string:
- CMRelease ( val->string );
- break;
+ case CMPI_string:
+ CMRelease ( val->string );
+ break;
- case CMPI_chars:
- tool_mm_add ( val->chars );
- break;
+ case CMPI_chars:
+ tool_mm_add ( val->chars );
+ break;
- case CMPI_dateTime:
- CMRelease ( val->dateTime );
- break;
+ case CMPI_dateTime:
+ CMRelease ( val->dateTime );
+ break;
- default:
- if ( type & CMPI_ARRAY ) {
- CMRelease ( val->array );
- }
- }
+ default:
+ if ( type & CMPI_ARRAY ) {
+ CMRelease ( val->array );
+ }
+ }
}
CMPIValue native_clone_CMPIValue ( CMPIType type,
- CONST CMPIValue * val,
- CMPIStatus * rc )
+ CONST CMPIValue * val,
+ CMPIStatus * rc )
{
- CMPIValue v;
+ CMPIValue v;
- if ( type & CMPI_ENC ) {
+ if ( type & CMPI_ENC ) {
- switch ( type ) {
+ switch ( type ) {
- case CMPI_instance:
- v.inst = CMClone ( val->inst, rc );
- break;
+ case CMPI_instance:
+ v.inst = CMClone ( val->inst, rc );
+ break;
- case CMPI_ref:
- v.ref = CMClone ( val->ref, rc );
- break;
+ case CMPI_ref:
+ v.ref = CMClone ( val->ref, rc );
+ break;
- case CMPI_args:
- v.args = CMClone ( val->args, rc );
- break;
+ case CMPI_args:
+ v.args = CMClone ( val->args, rc );
+ break;
- case CMPI_filter:
- v.filter = CMClone ( val->filter, rc );
- break;
+ case CMPI_filter:
+ v.filter = CMClone ( val->filter, rc );
+ break;
- case CMPI_enumeration:
- v.Enum = CMClone ( val->Enum, rc );
- break;
+ case CMPI_enumeration:
+ v.Enum = CMClone ( val->Enum, rc );
+ break;
- case CMPI_string:
- v.string = CMClone ( val->string, rc );
- break;
+ case CMPI_string:
+ v.string = CMClone ( val->string, rc );
+ break;
- case CMPI_chars:
- v.chars = strdup ( val->chars );
- CMSetStatus ( rc, CMPI_RC_OK );
- break;
+ case CMPI_chars:
+ v.chars = strdup ( val->chars );
+ CMSetStatus ( rc, CMPI_RC_OK );
+ break;
- case CMPI_dateTime:
- v.dateTime = CMClone ( val->dateTime, rc );
- break;
- }
+ case CMPI_dateTime:
+ v.dateTime = CMClone ( val->dateTime, rc );
+ break;
+ }
- } else if ( type & CMPI_ARRAY ) {
+ } else if ( type & CMPI_ARRAY ) {
- v.array = CMClone ( val->array, rc );
- } else {
+ v.array = CMClone ( val->array, rc );
+ } else {
- v = *val;
- CMSetStatus ( rc, CMPI_RC_OK );
- }
+ v = *val;
+ CMSetStatus ( rc, CMPI_RC_OK );
+ }
- return v;
+ return v;
}
extern CMPIString *__oft_toString( CMPIObjectPath * cop, CMPIStatus *rc);
char * value2Chars ( CMPIType type, CMPIValue * value )
{
- char str[256],*p;
- unsigned int size;
- CMPIString *cStr;
- TRACE_NORMAL(("value2string type 0x%x CMPIValue.", type));
+ char str[256],*p;
+ unsigned int size;
+ CMPIString *cStr;
+ TRACE_NORMAL(("value2string type 0x%x CMPIValue.", type));
- if ( type & CMPI_ARRAY ) {
+ if ( type & CMPI_ARRAY ) {
-// TRACE_INFO(("serializing array object type."));
-// return __serialize_CMPIArray ( fd, value->array );
+// TRACE_INFO(("serializing array object type."));
+// return __serialize_CMPIArray ( fd, value->array );
- } else if ( type & CMPI_ENC ) {
+ } else if ( type & CMPI_ENC ) {
- TRACE_INFO(("trying to stringify encapsulated data type."));
+ TRACE_INFO(("trying to stringify encapsulated data type."));
- switch ( type ) {
- case CMPI_instance:
- break;
+ switch ( type ) {
+ case CMPI_instance:
+ break;
- case CMPI_ref:
- cStr=__oft_toString(value->ref,NULL);
- return strdup((char*)cStr->hdl);
- break;
+ case CMPI_ref:
+ cStr=__oft_toString(value->ref,NULL);
+ return strdup((char*)cStr->hdl);
+ break;
- case CMPI_args:
- break;
+ case CMPI_args:
+ break;
- case CMPI_filter:
- break;
+ case CMPI_filter:
+ break;
- case CMPI_string:
- case CMPI_numericString:
- case CMPI_booleanString:
- case CMPI_dateTimeString:
- case CMPI_classNameString:
- size=strlen((char*)value->string->hdl);
+ case CMPI_string:
+ case CMPI_numericString:
+ case CMPI_booleanString:
+ case CMPI_dateTimeString:
+ case CMPI_classNameString:
+ size=(unsigned int) strlen((char*)value->string->hdl);
p=malloc(size+8);
- sprintf(p,"\"%s\"",(char*)value->string->hdl);
- return strdup(p);
+ sprintf(p,"\"%s\"",(char*)value->string->hdl);
+ return strdup(p);
- case CMPI_dateTime:
+ case CMPI_dateTime:
break;
- }
- TRACE_CRITICAL(("non-supported encapsulated data type."));
+ }
+ TRACE_CRITICAL(("non-supported encapsulated data type."));
- } else if ( type & CMPI_SIMPLE ) {
+ } else if ( type & CMPI_SIMPLE ) {
- TRACE_INFO(("serializing simple value."));
+ TRACE_INFO(("serializing simple value."));
- switch ( type ) {
- case CMPI_boolean:
- return strdup(value->boolean ? "true" : "false" );
+ switch ( type ) {
+ case CMPI_boolean:
+ return strdup(value->boolean ? "true" : "false" );
- case CMPI_char16:
- break;
- }
+ case CMPI_char16:
+ break;
+ }
- TRACE_CRITICAL(("non-supported simple data type."));
+ TRACE_CRITICAL(("non-supported simple data type."));
- } else if ( type & CMPI_INTEGER ) {
+ } else if ( type & CMPI_INTEGER ) {
- TRACE_INFO(("serializing integer value."));
+ TRACE_INFO(("serializing integer value."));
- switch ( type ) {
- case CMPI_uint8:
- sprintf(str,"%u",value->uint8);
- return strdup(str);
- case CMPI_sint8:
- sprintf(str,"%d",value->sint8);
- return strdup(str);
- case CMPI_uint16:
- sprintf(str,"%u",value->uint16);
- return strdup(str);
- case CMPI_sint16:
- sprintf(str,"%d",value->sint16);
- return strdup(str);
- case CMPI_uint32:
- sprintf(str,"%u",value->uint32);
- return strdup(str);
- case CMPI_sint32:
- sprintf(str,"%d",value->sint32);
- return strdup(str);
- case CMPI_uint64:
+ switch ( type ) {
+ case CMPI_uint8:
+ sprintf(str,"%u",value->uint8);
+ return strdup(str);
+ case CMPI_sint8:
+ sprintf(str,"%d",value->sint8);
+ return strdup(str);
+ case CMPI_uint16:
+ sprintf(str,"%u",value->uint16);
+ return strdup(str);
+ case CMPI_sint16:
+ sprintf(str,"%d",value->sint16);
+ return strdup(str);
+ case CMPI_uint32:
+ sprintf(str,"%lu",value->uint32);
+ return strdup(str);
+ case CMPI_sint32:
+ sprintf(str,"%ld",value->sint32);
+ return strdup(str);
+ case CMPI_uint64:
#if defined CMPI_PLATFORM_WIN32_IX86_MSVC
- sprintf(str,"I64u",value->uint64);
+ sprintf(str,"I64u",value->uint64);
#else
- sprintf(str,"%llu",value->uint64);
+ sprintf(str,"%llu",value->uint64);
#endif
- return strdup(str);
- case CMPI_sint64:
+ return strdup(str);
+ case CMPI_sint64:
#if defined CMPI_PLATFORM_WIN32_IX86_MSVC
sprintf(str,"%I64d",value->sint64);
#else
sprintf(str,"%lld",value->sint64);
#endif
- return strdup(str);
- }
-
- TRACE_CRITICAL(("non-supported integer data type."));
-
- } else if ( type & CMPI_REAL ) {
-
- char real_str[256];
+ return strdup(str);
+ }
- switch ( type ) {
- case CMPI_real32:
- sprintf(str,"%g",value->real32);
- return strdup(str);
- case CMPI_real64:
- sprintf(str,"%g",value->real64);
- return strdup(str);
- }
+ TRACE_CRITICAL(("non-supported integer data type."));
- TRACE_CRITICAL(("non-supported floating point data type."));
- }
+ } else if ( type & CMPI_REAL ) {
-// error_at_line ( -1, 0, __FILE__, __LINE__,
-// "Unable to stringify requested data type: 0x%x",
-// type );
+ switch ( type ) {
+ case CMPI_real32:
+ sprintf(str,"%g",value->real32);
+ return strdup(str);
+ case CMPI_real64:
+ sprintf(str,"%g",value->real64);
+ return strdup(str);
+ }
+ TRACE_CRITICAL(("non-supported floating point data type."));
+ }
sprintf(str,"*NOT RECOGNIZED VALUE TYPE %d*",type);
- return strdup(str);
+ return strdup(str);
}