static int _testCMPIcontext(const CMPIContext *ctx) { CMPIStatus rc = { CMPI_RC_OK, NULL }; CMPIValue value; CMPIData data; CMPIUint32 count = 0; CMPIUint32 count_for_new_context = 0; count = CMGetContextEntryCount(ctx, &rc); value.uint32 = 40; rc = CMAddContextEntry(ctx, "name1", &value, CMPI_uint32); value.real32 = (CMPIReal32) 40.123; rc = CMAddContextEntry(ctx, "name2", &value, CMPI_real32); data = CMGetContextEntry(ctx, "name1", &rc); data = CMGetContextEntry(ctx, "name2", &rc); count_for_new_context = CMGetContextEntryCount(ctx, &rc); CMGetContextEntry(ctx, "noEntry", &rc); if (rc.rc != CMPI_RC_ERR_NO_SUCH_PROPERTY) { return 1; } return 0; }
void socketcomm_serialize_context ( int socket, const struct BinarySerializerFT * sft, CONST CMPIContext * ctx ) { unsigned int size = CMGetContextEntryCount ( ctx, NULL ), i; TRACE_NORMAL(("serializing context with %d entries", size )); sft->serialize_UINT32 ( socket, size ); for ( i = 0; i < size; i++ ) { CMPIString * entryName; CMPIData entry = CMGetContextEntryAt ( ctx, i, &entryName, NULL ); TRACE_INFO(("serializing entry(%d): %s", i, CMGetCharsPtr ( entryName, NULL ) )); sft->serialize_CMPIString ( socket, entryName ); sft->serialize_CMPIData ( socket, entry ); } }