os-cmpi-xen

view src/cmpiutil.h @ 121:4868ace2726b

Add initial consistence checks in test suite for Xen_MemoryPool, Xen_ProcessorPool and Xen_VirtualSystemManagementService.

Signed-off-by: Luke Szymanski <Lukasz.Szymanski@Unisys.com>
author Jim Fehlig <jfehlig@novell.com>
date Fri Jun 08 10:22:05 2007 -0600 (2007-06-08)
parents 92a3b51298ab
children 152ceecb9f39
line source
1 // Copyright (C) 2006 IBM Corporation
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 // ============================================================================
17 // Author: Dr. Gareth S. Bestor <bestor@us.ibm.com>
18 // Contributors:
19 // Summary: Some useful utility functions
20 // Description:
21 // TODO
22 // For more information about the SBLIM Project see:
23 // http://sblim.sourceforge.net/
24 // ============================================================================
26 #ifndef _CMPIUTIL_H_
27 # define _CMPIUTIL_H_
29 /* Include the required CMPI data types. */
30 #include "cmpidt.h"
32 /* Redefine the CMGetCharPtr() macro to better handle NULL strings. */
33 #ifdef CMGetCharPtr
34 # undef CMGetCharPtr
35 # define CMGetCharPtr(s) (((s)==NULL || *((void**)(s))==NULL)? NULL : (char*)s->hdl)
36 #endif
38 /* Useful shortcut for CMNewInstance(broker, CMNewObjectPath(broker,ns,cn,rc), rc). */
39 CMPIInstance * _CMNewInstance(const CMPIBroker *mb, char *ns, char *cn, CMPIStatus *rc);
41 /* Useful boolean constants. */
42 #ifndef CMPI_true
43 #define CMPI_true 1
44 #endif
46 #ifndef CMPI_false
47 #define CMPI_false 0
48 #endif
50 /* Functions for determining equality of CMPI data types. */
51 int _CMSameType( CMPIData value1, CMPIData value2 );
52 int _CMSameValue( CMPIData value1, CMPIData value2 );
53 int _CMSameObject( CMPIObjectPath * object1, CMPIObjectPath * object2 );
54 int _CMSameInstance( CMPIInstance * instance1, CMPIInstance * instance2 );
56 /* Return a string name for all the CMPI return codes. */
57 const char * _CMPIrcName ( CMPIrc rc );
59 /* Return a string name for all the CMPI data types. */
60 const char * _CMPITypeName ( CMPIType type );
62 /* Return a string representation of a CMPI value. */
63 char * _CMPIValueToString ( CMPIData data );
65 /*
66 * A function used to extract the key value from a key property.
67 */
68 typedef char * (*_CMPIKeyValExtractFunc_t)(char *, const char *, size_t);
70 /*
71 * Return the 'system' component of InstanceID property values.
72 * The system name will be returned in buffer buf of buf_len.
73 * Syntax of id parameter
74 * Xen:<domain name>[:<device name>]
75 */
76 char * _CMPIStrncpySystemNameFromID(char *buf, const char *id, size_t buf_len);
78 /*
79 * Return the 'device name' component of InstanceID property values.
80 * The device name be returned in buffer buf of buf_len.
81 * Syntax of id parameter
82 * Xen:<domain name>[:<device name>]
83 */
84 char * _CMPIStrncpyDeviceNameFromID(char *buf, const char *id, size_t buf_len);
86 #endif /* _CMPIUTIL_H_ */