Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4777 Added Files: Makefile args.c array.c broker.c cimXmlParser.c cimXmlParser.h cimXmlResp.c cimXmlResp.h cimXmlResp.y cmcimacs.h datetime.c enumeration.c genericlist.c genericlist.h instance.c native.h objectpath.c property.c rules setEnv setting.cmpi string.c test.c tool.h utilList.h utilStringBuffer.c utilStringBuffer.h value.c ylwrap Log Message: added new files for sfcc --- NEW FILE: genericlist.h --- /* * genericList.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Keith Pomakis <po...@po...> * Contributions: Adrian Schuur <sc...@de...> * * Description: * * list implementation. * */ /************************************************************************ ************************************************************************* ** ** ** Generic List Library ** ** ** ** by Keith Pomakis ** ** kpp...@je... ** ** ** ** Spring, 1994 ** ** ** ************************************************************************* ************************************************************************/ #ifndef GENERIC_LIST_DEFINED #define GENERIC_LIST_DEFINED #include "utilList.h" typedef struct GLE_struct { void *pointer; struct GLE_struct *previous; struct GLE_struct *next; } Generic_list_element; typedef struct { Generic_list_element *current; Generic_list_element pre_element, post_element, deleted_element; int (*lt) (void *a, void *b); unsigned int num_of_elements; } Generic_list_info; typedef struct { Generic_list_info *info; } Generic_list; #define Generic_stack Generic_list #define Generic_queue Generic_list /****************************************************************************/ /* Stack operations */ #define initialize_stack initialize_list #define destroy_stack destroy_list #define push add_to_beginning #define pop remove_from_beginning #define peek_at_top peek_at_beginning #define copy_stack copy_list /* Queue operations */ #define initialize_queue initialize_list #define destroy_queue destroy_list #define enqueue add_to_end #define dequeue remove_from_beginning #define dequeue_all remove_all #define peek_at_head peek_at_beginning #define peek_at_tail peek_at_end #define copy_queue copy_list #endif /* GENERIC_LIST_DEFINED */ --- NEW FILE: objectpath.c --- /*! \file objectpath.c \brief Native CMPIObjectPath implementation. This is the native CMPIObjectPath implementation as used for remote providers. It reflects the well-defined interface of a regular CMPIObjectPath, 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. (C) Copyright IBM Corp. 2003 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://oss.software.ibm.com/developerworks/opensource/license-cpl.html \author Frank Scheffler $Revision: 1.1 $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "cmcidt.h" #include "cmcift.h" #include "cmcimacs.h" #include "tool.h" #include "native.h" #include "utilStringBuffer.h" extern char *keytype2Chars(CMPIType type); struct native_cop { CMPIObjectPath cop; int mem_state; char * namespace; char * classname; struct native_property * keys; }; static struct native_cop * __new_empty_cop ( int, const char *, const char *, CMPIStatus * ); /****************************************************************************/ static CMPIStatus __oft_release ( CMPIObjectPath * cop ) { struct native_cop * o = (struct native_cop *) cop; if ( o->mem_state == TOOL_MM_NO_ADD ) { o->mem_state = TOOL_MM_ADD; tool_mm_add ( o ); tool_mm_add ( o->classname ); tool_mm_add ( o->namespace ); propertyFT.release ( o->keys ); CMReturn ( CMPI_RC_OK ); } CMReturn ( CMPI_RC_ERR_FAILED ); } static CMPIObjectPath * __oft_clone ( CMPIObjectPath * cop, CMPIStatus * rc ) { CMPIStatus tmp; struct native_cop * o = (struct native_cop *) cop; struct native_cop * new = __new_empty_cop ( TOOL_MM_NO_ADD, o->namespace, o->classname, &tmp ); if ( tmp.rc == CMPI_RC_OK ) { new->keys = propertyFT.clone ( o->keys, rc ); } else if ( rc ) CMSetStatus ( rc, tmp.rc ); return (CMPIObjectPath *) new; } static CMPIStatus __oft_setNameSpace ( CMPIObjectPath * cop, const char * namespace ) { struct native_cop * o = (struct native_cop *) cop; char * ns = ( namespace )? strdup ( namespace ): NULL; if ( o->mem_state == TOOL_MM_NO_ADD ) { free ( o->namespace ); } else { tool_mm_add ( ns ); } o->namespace = ns; CMReturn ( CMPI_RC_OK ); } static CMPIString * __oft_getNameSpace ( CMPIObjectPath * cop, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return native_new_CMPIString ( o->namespace, rc ); } static CMPIStatus __oft_setHostName ( CMPIObjectPath * cop, const char * hn ) { CMReturn ( CMPI_RC_ERR_NOT_SUPPORTED ); } static CMPIString * __oft_getHostName ( CMPIObjectPath * cop, CMPIStatus * rc ) { if ( rc ) CMSetStatus ( rc, CMPI_RC_ERR_NOT_SUPPORTED ); return NULL; } static CMPIStatus __oft_setClassName ( CMPIObjectPath * cop, const char * classname ) { struct native_cop * o = (struct native_cop *) cop; char * cn = ( classname )? strdup ( classname ): NULL; if ( o->mem_state == TOOL_MM_NO_ADD ) { free ( o->classname ); } else { tool_mm_add ( cn ); } o->classname = cn; CMReturn ( CMPI_RC_OK ); } static CMPIString * __oft_getClassName ( CMPIObjectPath * cop, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return native_new_CMPIString ( o->classname, rc ); } static CMPIStatus __oft_addKey ( CMPIObjectPath * cop, const char * name, CMPIValue * value, CMPIType type ) { struct native_cop * o = (struct native_cop *) cop; CMReturn ( ( propertyFT.addProperty ( &o->keys, o->mem_state, name, type, CMPI_keyValue, value ) )? CMPI_RC_ERR_ALREADY_EXISTS: CMPI_RC_OK ); } static CMPIData __oft_getKey ( CMPIObjectPath * cop, const char * name, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return propertyFT.getDataProperty ( o->keys, name, rc ); } static CMPIData __oft_getKeyAt ( CMPIObjectPath * cop, unsigned int index, CMPIString ** name, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return propertyFT.getDataPropertyAt ( o->keys, index, name, rc ); } static unsigned int __oft_getKeyCount ( CMPIObjectPath * cop, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return propertyFT.getPropertyCount ( o->keys, rc ); } static CMPIStatus __oft_setNameSpaceFromObjectPath ( CMPIObjectPath * cop, CMPIObjectPath * src ) { struct native_cop * s = (struct native_cop *) src; return __oft_setNameSpace ( cop, s->namespace ); } static CMPIString *__oft_toString(CMPIObjectPath * cop, CMPIStatus * rc); static struct native_cop * __new_empty_cop ( int mm_add, const char * namespace, const char * classname, CMPIStatus * rc ) { static CMPIObjectPathFT oft = { NATIVE_FT_VERSION, __oft_release, __oft_clone, __oft_setNameSpace, __oft_getNameSpace, __oft_setHostName, __oft_getHostName, __oft_setClassName, __oft_getClassName, __oft_addKey, __oft_getKey, __oft_getKeyAt, __oft_getKeyCount, __oft_setNameSpaceFromObjectPath, NULL, NULL, NULL, NULL, NULL, __oft_toString }; static CMPIObjectPath o = { "CMPIObjectPath", &oft }; struct native_cop * cop = (struct native_cop *) tool_mm_alloc ( mm_add, sizeof ( struct native_cop ) ); cop->cop = o; cop->mem_state = mm_add; cop->classname = ( classname )? strdup ( classname ): NULL; cop->namespace = ( namespace )? strdup ( namespace ): NULL; if ( mm_add == TOOL_MM_ADD ) { tool_mm_add ( cop->classname ); tool_mm_add ( cop->namespace ); } if ( rc ) CMSetStatus ( rc, CMPI_RC_OK ); return cop; } CMPIObjectPath * newCMPIObjectPath ( const char * namespace, const char * classname, CMPIStatus * rc ) { return (CMPIObjectPath *) __new_empty_cop ( TOOL_MM_ADD, namespace, classname, rc ); } extern char *value2Chars(CMPIType type, CMPIValue * value); char *pathToChars(CMPIObjectPath * cop, CMPIStatus * rc, char *str, int uri) { // "//atp:9999/root/cimv25:TennisPlayer.first="Patrick",last="Rafter"; CMPIString *ns; CMPIString *cn; CMPIString *name; CMPIData data; unsigned int i, m, s; char *v; char *colon=":"; *str = 0; if (uri) colon="%3A"; ns = cop->ft->getNameSpace(cop, rc); cn = cop->ft->getClassName(cop, rc); if (ns && ns->hdl && *(char*)ns->hdl) { if (uri==0) strcpy(str,(char*)ns->hdl); else { char *cns=(char*)ns->hdl; for (s=i=0, m=strlen(cns); i<m; i++,s++) { if (cns[i]=='/') { str[s++]='%'; str[s++]='2'; str[s]='F'; } else str[s]=cns[i]; } str[s]=0; } CMRelease(ns); strcat(str,colon); } strcat(str, (char *) cn->hdl); CMRelease(cn); for (i = 0, m = cop->ft->getKeyCount(cop, rc); i < m; i++) { data = cop->ft->getKeyAt(cop, i, &name, rc); if (i) strcat(str, ","); else strcat(str, "."); strcat(str, (char *) name->hdl); strcat(str, "="); v = value2Chars(data.type, &data.value); strcat(str, v); free(v); CMRelease(name); }; return str; } static CMPIString *__oft_toString(CMPIObjectPath * cop, CMPIStatus * rc) { char str[4096] = { 0 }; pathToChars(cop, rc, str,0); return native_new_CMPIString(str, rc); } const char *getNameSpaceChars(CMPIObjectPath * cop) { struct native_cop * o = (struct native_cop *) cop; return o->namespace; } UtilList *getNameSpaceComponents(CMPIObjectPath * cop) { UtilList *ul=newList(); CMPIString *nss=__oft_getNameSpace(cop, NULL); int s=0,i,m; char nsc[256],*ns; if (nss && nss->hdl) { ns=(char*)nss->hdl; if (ns) for (s=i=0, m=strlen(ns); i<m; i++,s++) { if (ns[i]=='/') { nsc[s]=0; ul->ft->append(ul,strdup(nsc)); s=-1; } else nsc[s]=ns[i]; } nsc[s]=0; } if (s) ul->ft->append(ul,strdup(nsc)); CMRelease(nss); return ul; } void pathToXml(UtilStringBuffer *sb, CMPIObjectPath *cop) { int i,s,m,state=0; CMPIData data; CMPIString *name; for (i=0,s=__oft_getKeyCount(cop,NULL); i<s; i++) { data=__oft_getKeyAt(cop,i,&name,NULL); switch (state) { case 0: sb->ft->append3Chars(sb,"<KEYBINDING NAME=\"",(char*)name->hdl,"\">"); if (data.type==CMPI_ref) { CMPIObjectPath *ref=data.value.ref; sb->ft->appendChars(sb, "<VALUE.REFERENCE><INSTANCEPATH>"); CMPIString *hn=__oft_getHostName(ref, NULL);; sb->ft->append3Chars(sb,"<NAMESPACEPATH><HOST>",(char*)hn->hdl,"</HOST>"); CMRelease(hn); sb->ft->appendChars(sb, "<VALUE.REFERENCE><INSTANCEPATH><LOCALNAMESPACEPATH>"); CMPIString *nss=__oft_getNameSpace(ref, NULL); if (nss && nss->hdl) { char nsc[256]; char *ns=(char*)nss->hdl; if (ns) for (s=i=0, m=strlen(ns); i<m; i++,s++) { if (ns[i]=='/') { nsc[s]=0; sb->ft->append3Chars(sb,"<NAMESPACE NAME=\"",nsc,"\"></NAMESPACE>"); s=0; } else nsc[s]=ns[i]; } nsc[s]=0; if (s) sb->ft->append3Chars(sb,"<NAMESPACE NAME=\"",nsc,"\"></NAMESPACE>"); CMRelease(nss); } sb->ft->appendChars(sb,"</LOCALNAMESPACEPATH></NAMESPACEPATH>"); CMPIString *cn=__oft_getClassName(ref, NULL); sb->ft->append3Chars(sb,"<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">"); state=1; continue; } else { sb->ft->append5Chars(sb,"<KEYVALUE VALUETYPE=\"",keytype2Chars(data.type),"\">", value2Chars(data.type,&data.value),"</KEYVALUE>"); state=0; } break; case 1: if (data.type==CMPI_ref) { sb->ft->appendChars(sb,"</INSTANCENAME></INSTANCEPATH></VALUE.REFERENCE>"); i--; state=0; } else { sb->ft->append3Chars(sb,"<KEYBINDING NAME=\"",(char*)name->hdl,"\">"); sb->ft->append5Chars(sb,"<KEYVALUE VALUETYPE=\"",keytype2Chars(data.type),"\">", value2Chars(data.type,&data.value),"</KEYVALUE>"); } break; } sb->ft->appendChars(sb,"</KEYBINDING>\n"); } if (state==1) sb->ft->appendChars(sb,"</INSTANCENAME></INSTANCEPATH></VALUE.REFERENCE></KEYBINDING>"); } /****************************************************************************/ /*** Local Variables: ***/ /*** mode: C ***/ /*** c-basic-offset: 8 ***/ /*** End: ***/ --- NEW FILE: broker.c --- /*! \file broker.c \brief Native CMPI broker encapsulated functionality. This module implements a complete CMPI broker encapsulated function table (CMPIBrokerEncFT) natively. Thus, CMPI data types may be created remotely without the need to connect to the CIMOM. (C) Copyright IBM Corp. 2003 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://oss.software.ibm.com/developerworks/opensource/license-cpl.html \author Frank Scheffler $Revision: 1.1 $ */ #include "cmpidt.h" #include "cmpift.h" #include "cmpimacs.h" #include "tool.h" #include "native.h" #include "debug.h" static CMPIInstance * __beft_newInstance ( CMPIBroker * broker, CMPIObjectPath * cop, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIInstance.")); return native_new_CMPIInstance ( cop, rc ); } static CMPIObjectPath * __beft_newObjectPath ( CMPIBroker * broker, char * namespace, char * classname, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIObjectPath.")); return native_new_CMPIObjectPath ( namespace, classname, rc ); } static CMPIArgs * __beft_newArgs ( CMPIBroker * broker, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIArgs.")); return native_new_CMPIArgs ( rc ); } static CMPIString * __beft_newString ( CMPIBroker * broker, char * str, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIString.")); TRACE_INFO(("String: %s", str )); return native_new_CMPIString ( str, rc ); } static CMPIArray * __beft_newArray ( CMPIBroker * broker, CMPICount size, CMPIType type, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIArray.")); TRACE_INFO(("type: 0x%x\nsize: %d", type, size )); return native_new_CMPIArray ( size, type, rc ); } static CMPIDateTime * __beft_newDateTime ( CMPIBroker * broker, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIDateTime.")); return native_new_CMPIDateTime ( rc ); } static CMPIDateTime * __beft_newDateTimeFromBinary ( CMPIBroker * broker, CMPIUint64 time, CMPIBoolean interval, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIDateTime.")); TRACE_INFO(("time: %lld\ninterval: %d", time, interval )); return native_new_CMPIDateTime_fromBinary ( time, interval, rc ); } static CMPIDateTime * __beft_newDateTimeFromChars ( CMPIBroker * broker, char * string, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIDateTime.")); TRACE_INFO(("time: %s", string )); return native_new_CMPIDateTime_fromChars ( string, rc ); } static CMPISelectExp * __beft_newSelectExp ( CMPIBroker * broker, char * queryString, char * language, CMPIArray ** projection, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPISelectExp.")); return native_new_CMPISelectExp ( queryString, language, projection, rc ); } static CMPIBoolean __beft_classPathIsA ( CMPIBroker * broker, CMPIObjectPath * cop, char * type, CMPIStatus * rc ) { TRACE_CRITICAL(("This operation is not yet supported.")); if ( rc ) CMSetStatus ( rc, CMPI_RC_ERR_NOT_SUPPORTED ); return 0; } static CMPIString * __beft_toString ( CMPIBroker * broker, void * object, CMPIStatus * rc ) { TRACE_CRITICAL(("This operation is not yet supported.")); if ( rc ) CMSetStatus ( rc, CMPI_RC_ERR_NOT_SUPPORTED ); return NULL; } static CMPIBoolean __beft_isOfType ( CMPIBroker * broker, void * object, char * type, CMPIStatus * rc ) { char * t = * ( (char **) object ); TRACE_NORMAL(("Verifying encapsulated object type.")); if ( rc ) CMSetStatus ( rc, CMPI_RC_OK ); return ( strcmp ( t, type ) == 0 ); } static CMPIString * __beft_getType ( CMPIBroker * broker, void * object, CMPIStatus * rc ) { TRACE_NORMAL(("Returning encapsulated object type.")); return __beft_newString ( broker, *( (char **) object ), rc ); } /****************************************************************************/ CMPIBrokerEncFT native_brokerEncFT = { NATIVE_FT_VERSION, __beft_newInstance, __beft_newObjectPath, __beft_newArgs, __beft_newString, __beft_newArray, __beft_newDateTime, __beft_newDateTimeFromBinary, __beft_newDateTimeFromChars, __beft_newSelectExp, __beft_classPathIsA, __beft_toString, __beft_isOfType, __beft_getType }; /****************************************************************************/ /*** Local Variables: ***/ /*** mode: C ***/ /*** c-basic-offset: 8 ***/ /*** End: ***/ --- NEW FILE: rules --- %.dep: %.c $(CC) -MM $(CPPFLAGS) $< | sed 's!\($*\)\.o[ :]*!\1.o $@ : !g' > $@ LINK_LIB = $(LINK.c) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@ LINK_BIN = $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ --- NEW FILE: utilList.h --- /* * utilList.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Adrian Schuur <sc...@de...> * * Description: * * */ #ifndef UTILList_H #define UTILList_H struct _Util_List_FT; typedef struct _Util_List_FT Util_List_FT; struct _UtilList { void *hdl; Util_List_FT *ft; int mem_state; }; typedef struct _UtilList UtilList; struct _Util_List_FT { int version; void (*release) (UtilList * ul); UtilList *(*clone) (UtilList * ul); void (*clear) (UtilList * ul); unsigned long (*size) (UtilList * ul); int (*isEmpty) (UtilList * ul); int (*contains) (UtilList * ul, const void *elm); void (*append) (UtilList * ul, const void *elm); void (*prepend) (UtilList * ul, const void *elm); void (*add) (UtilList * ul, const void *elm); void *(*getFirst) (UtilList * ul); void *(*getLast) (UtilList * ul); void *(*getNext) (UtilList * ul); void *(*getPrevious) (UtilList * ul); void *(*getCurrent) (UtilList * ul); void *(*removeFirst) (UtilList * ul); void *(*removeLast) (UtilList * ul); void *(*removeCurrent) (UtilList * ul); void *(*removeThis) (UtilList * ul, void *elm); }; UtilList *newList(); #endif --- NEW FILE: genericlist.c --- /* * genericList.c * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Keith Pomakis <po...@po...> * Contributions: Adrian Schuur <sc...@de...> * * Description: * * list implementation. * */ /************************************************************************ ************************************************************************* ** ** ** Generic List Library ** ** ** ** by Keith Pomakis ** ** kpp...@je... ** ** ** ** Spring, 1994 ** ** ** ************************************************************************* ************************************************************************/ #include <stdio.h> #include <stdlib.h> #include "genericlist.h" #include "tool.h" //#include "mlog.h" #ifdef THINK_C #define malloc NewPtr #endif #define NEW(x) ((x *) emalloc(sizeof(x))) static void initialize_list(Generic_list * list); static void initialize_sorted_list(Generic_list * list, int (*lt) (void *a, void *b)); static void destroy_list(Generic_list * list); static void add_to_beginning(Generic_list list, void *pointer); static void add_to_end(Generic_list list, void *pointer); //static void add_to_list(Generic_list list, void *pointer); static void *remove_from_beginning(Generic_list list); static void *remove_from_end(Generic_list list); static void *remove_from_list(Generic_list list, void *pointer); static void remove_all(Generic_list list); //static void *peek_at_beginning(Generic_list list); //static void *peek_at_end(Generic_list list); static void *first_in_list(Generic_list list); static void *next_in_list(Generic_list list); static void *current_in_list(Generic_list list); static void *remove_current(Generic_list list); static void *previous_in_list(Generic_list list); static void *last_in_list(Generic_list list); static void reset_to_beginning(Generic_list list); //static void reset_to_end(Generic_list list); static int num_of_objects(const Generic_list list); static int is_empty(const Generic_list list); static int is_in_list(const Generic_list list, const void *pointer); static Generic_list copy_list(Generic_list list); /* static void perform_on_list(Generic_list list, void (*fn) (void *pointer, void *args),void *args); static void *first_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static void *next_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static void *previous_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static void *last_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static Generic_list all_such_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static void remove_all_such_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); */ static char *module = "generic_list"; static void *emalloc(unsigned int n); /****************************************************************************/ static void initialize_list(Generic_list * list) { list->info = NEW(Generic_list_info); list->info->pre_element.pointer = NULL; list->info->pre_element.previous = &list->info->pre_element; list->info->pre_element.next = &list->info->post_element; list->info->post_element.pointer = NULL; list->info->post_element.previous = &list->info->pre_element; list->info->post_element.next = &list->info->post_element; list->info->current = &list->info->pre_element; list->info->deleted_element.pointer = NULL; list->info->lt = NULL; list->info->num_of_elements = 0; } /****************************************************************************/ static void initialize_sorted_list(Generic_list * list, int (*lt) (void *a, void *b)) { initialize_list(list); list->info->lt = lt; } /****************************************************************************/ static void destroy_list(Generic_list * list) { remove_all(*list); free((void *) list->info); } /****************************************************************************/ static void add_to_beginning(Generic_list list, void *pointer) { Generic_list_element *element; if (!pointer) { // mlogf(M_ERROR,M_SHOW, "%s: NULL pointer passed 1\n", module); fprintf(stderr, "%s: NULL pointer passed 1\n", module); return; exit(EXIT_FAILURE); } element = NEW(Generic_list_element); element->next = list.info->pre_element.next; element->previous = &list.info->pre_element; element->pointer = pointer; list.info->pre_element.next->previous = element; list.info->pre_element.next = element; list.info->num_of_elements++; } /****************************************************************************/ static void add_to_end(Generic_list list, void *pointer) { Generic_list_element *element; if (!pointer) { // mlogf(M_ERROR,M_SHOW, "%s: NULL pointer passed 2\n", module); fprintf(stderr,"%s: NULL pointer passed 2\n", module); // abort(); return; exit(EXIT_FAILURE); } element = NEW(Generic_list_element); element->next = &list.info->post_element; element->previous = list.info->post_element.previous; element->pointer = pointer; list.info->post_element.previous->next = element; list.info->post_element.previous = element; list.info->num_of_elements++; } /****************************************************************************/ /* static void add_to_list(Generic_list list, void *pointer) { Generic_list_element *element, *new_element; if (list.info->lt) { if (!pointer) { mlogf(M_ERROR,M_SHOW, "%s: NULL pointer passed\n", module); exit(EXIT_FAILURE); } element = list.info->pre_element.next; while (element != &list.info->post_element && (*list.info->lt) (element->pointer, pointer)) element = element->next; new_element = NEW(Generic_list_element); new_element->next = element; new_element->previous = element->previous; new_element->pointer = pointer; element->previous->next = new_element; element->previous = new_element; list.info->num_of_elements++; } else add_to_end(list, pointer); } */ /****************************************************************************/ static void *remove_from_list(Generic_list list, void *pointer) { Generic_list_element *element; element = list.info->post_element.previous; while (element != &list.info->pre_element && element->pointer != pointer) element = element->previous; if (element == &list.info->pre_element) /* No such element was found. */ return NULL; if (element == list.info->current) { list.info->deleted_element.previous = element->previous; list.info->deleted_element.next = element->next; list.info->current = &list.info->deleted_element; } element->previous->next = element->next; element->next->previous = element->previous; free(element); list.info->num_of_elements--; return pointer; } /****************************************************************************/ static void *remove_from_beginning(Generic_list list) { Generic_list_element *element; void *pointer; if (list.info->num_of_elements == 0) return NULL; element = list.info->pre_element.next; if (element == list.info->current) list.info->current = &list.info->pre_element; pointer = element->pointer; list.info->pre_element.next = element->next; element->next->previous = &list.info->pre_element; free(element); list.info->num_of_elements--; return pointer; } /****************************************************************************/ static void *remove_from_end(Generic_list list) { Generic_list_element *element; void *pointer; if (list.info->num_of_elements == 0) return NULL; element = list.info->post_element.previous; if (element == list.info->current) list.info->current = &list.info->post_element; pointer = element->pointer; list.info->post_element.previous = element->previous; element->previous->next = &list.info->post_element; free(element); list.info->num_of_elements--; return pointer; } /****************************************************************************/ static void *remove_current(Generic_list list) { Generic_list_element *element; void *pointer; element = list.info->current; if (element->pointer == NULL) return NULL; list.info->deleted_element.previous = element->previous; list.info->deleted_element.next = element->next; list.info->current = &list.info->deleted_element; pointer = element->pointer; element->next->previous = element->previous; element->previous->next = element->next; free(element); list.info->num_of_elements--; return pointer; } /****************************************************************************/ static void remove_all(Generic_list list) { Generic_list_element *element; element = list.info->pre_element.next; while (element && element != &list.info->post_element) { element = element->next; if (element) free(element->previous); } list.info->pre_element.next = &list.info->post_element; list.info->post_element.previous = &list.info->pre_element; list.info->num_of_elements = 0; } /****************************************************************************/ /* static void *peek_at_beginning(Generic_list list) { return list.info->pre_element.next->pointer; } */ /****************************************************************************/ /* static void *peek_at_end(Generic_list list) { return list.info->post_element.previous->pointer; } */ /****************************************************************************/ static void *first_in_list(Generic_list list) { list.info->current = list.info->pre_element.next->next->previous; return list.info->current->pointer; } /****************************************************************************/ static void *current_in_list(Generic_list list) { return list.info->current->pointer; } /****************************************************************************/ static void *last_in_list(Generic_list list) { list.info->current = list.info->post_element.previous->previous->next; return list.info->current->pointer; } /****************************************************************************/ static void *next_in_list(Generic_list list) { list.info->current = list.info->current->next; return list.info->current->pointer; } /****************************************************************************/ static void *previous_in_list(Generic_list list) { list.info->current = list.info->current->previous; return list.info->current->pointer; } /****************************************************************************/ static void reset_to_beginning(Generic_list list) { list.info->current = &list.info->pre_element; } /****************************************************************************/ /* static void reset_to_end(Generic_list list) { list.info->current = &list.info->post_element; } */ /****************************************************************************/ static int num_of_objects(const Generic_list list) { return list.info->num_of_elements; } /****************************************************************************/ static int is_empty(const Generic_list list) { return (list.info->num_of_elements == 0); } /****************************************************************************/ static int is_in_list(const Generic_list list, const void *pointer) { Generic_list_element *element; element = list.info->pre_element.next; while (element != &list.info->post_element && element->pointer != pointer) element = element->next; return (element != &list.info->post_element); } /****************************************************************************/ static Generic_list copy_list(Generic_list list) { Generic_list list_copy; Generic_list_element *element; initialize_sorted_list(&list_copy, list.info->lt); element = list.info->pre_element.next; while (element != &list.info->post_element) { add_to_end(list_copy, element->pointer); element = element->next; } return list_copy; } /****************************************************************************/ /* static void perform_on_list(Generic_list list, void (*fn) (void *pointer, void *args), void *args) { Generic_list_element *element; element = list.info->pre_element.next; while (element != &list.info->post_element) { (*fn) (element->pointer, args); element = element->next; } } */ /****************************************************************************/ /* static void *first_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list_element *element; element = list.info->pre_element.next; while (element != &list.info->post_element && !(*fn) (element->pointer, args)) { element = element->next; } if (element->pointer) list.info->current = element; return element->pointer; } */ /****************************************************************************/ /* static void *next_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list_element *element; element = list.info->current->next; while (element != &list.info->post_element && !(*fn) (element->pointer, args)) { element = element->next; } if (element->pointer) list.info->current = element; return element->pointer; } */ /****************************************************************************/ /* static void *previous_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list_element *element; element = list.info->current->previous; while (element != &list.info->pre_element && !(*fn) (element->pointer, args)) { element = element->previous; } if (element->pointer) list.info->current = element; return element->pointer; } */ /****************************************************************************/ /* static void *last_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list_element *element; element = list.info->post_element.previous; while (element != &list.info->pre_element && !(*fn) (element->pointer, args)) { element = element->previous; } if (element->pointer) list.info->current = element; return element->pointer; } */ /****************************************************************************/ /* static Generic_list all_such_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list list_copy; Generic_list_element *element; initialize_sorted_list(&list_copy, list.info->lt); element = list.info->pre_element.next; while (element != &list.info->post_element) { if ((*fn) (element->pointer, args)) add_to_end(list_copy, element->pointer); element = element->next; } return list_copy; } */ /****************************************************************************/ /* static void remove_all_such_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { void *obj; reset_to_beginning(list); while ((obj = next_in_list(list))) if ((*fn) (obj, args)) remove_current(list); } */ /****************************************************************************/ /****************************************************************************/ /** **/ /** Internal functions **/ /** **/ /****************************************************************************/ /****************************************************************************/ static void *emalloc(unsigned int n) { void *ptr; ptr = (void *) malloc(n); if (ptr == NULL) { // mlogf(M_ERROR,M_SHOW, "%s: error allocating memory\n", module); fprintf(stderr, "%s: error allocating memory\n", module); exit(EXIT_FAILURE); } return ptr; } static void listRelease(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; destroy_list(&l); //memUnlinkEncObj(ul->mem_state); free(ul); } static UtilList *listClone(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; UtilList *nul = NEW(UtilList); *nul = *ul; nul->hdl = copy_list(l).info; return nul; } static void listClear(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; remove_all(l); } static unsigned long listSize(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return num_of_objects(l); } static int listIsEmpty(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return is_empty(l); } static int listContains(UtilList * ul, const void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; return is_in_list(l, elm); } static void listAppend(UtilList * ul, const void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; add_to_end(l, (void *) elm); } static void listPrepend(UtilList * ul, const void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; add_to_beginning(l, (void *) elm); } static void listAdd(UtilList * ul, const void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; add_to_beginning(l, (void *) elm); } static void *listGetFirst(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; reset_to_beginning(l); return first_in_list(l); } static void *listGetLast(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return last_in_list(l); } static void *listGetNext(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return next_in_list(l); } static void *listGetPrevious(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return previous_in_list(l); } static void *listGetCurrent(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return current_in_list(l); } static void *listRemoveFirst(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return remove_from_beginning(l); } static void *listRemoveLast(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return remove_from_end(l); } static void *listRemoveCurrent(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return remove_current(l); } static void *listRemoveThis(UtilList * ul, void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; return remove_from_list(l, elm); } Util_List_FT UtilList_ft = { 1, listRelease, listClone, listClear, listSize, listIsEmpty, listContains, listAppend, listPrepend, listAdd, listGetFirst, listGetLast, listGetNext, listGetPrevious, listGetCurrent, listRemoveFirst, listRemoveLast, listRemoveCurrent, listRemoveThis }; Util_List_FT *UtilListFT = &UtilList_ft; UtilList *newList() { UtilList ul,*tUl; int state; ul.ft = UtilListFT; initialize_list((Generic_list *) & ul.hdl); tUl=(UtilList*)(memAddEncObj(MEM_NOT_TRACKED, &ul, sizeof(ul),&state)); tUl->mem_state=state; return tUl; } --- NEW FILE: property.c --- /*! \file property.c \brief Native property implementation. This module implements a native property, which is not public to any provider programmer. It is used to implement various other data types natively, such as instances, object-paths and args. It provides means to maintain linked lists of named properties including functionality to add, remove, clone and release them. (C) Copyright IBM Corp. 2003 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://oss.software.ibm.com/developerworks/opensource/license-cpl.html \author Frank Scheffler $Revision: 1.1 $ */ #include <stdio.h> #include <string.h> #include "cmcidt.h" #include "cmcift.h" #include "cmcimacs.h" #include "tool.h" #include "native.h" //! Storage container for commonly needed data within native CMPI data types. /*! This structure is used to build linked lists of data containers as needed for various native data types. */ struct native_property { char * name; //!< Property identifier. CMPIType type; //!< Associated CMPIType. CMPIValueState state; //!< Current value state. CMPIValue value; //!< Current value. struct native_property * next; //!< Pointer to next property. }; /****************************************************************************/ static CMPIData __convert2CMPIData ( struct native_property * prop, CMPIString ** propname ) { CMPIData result; if ( prop != NULL ) { result.type = prop->type; result.state = prop->state; result.value = prop->value; if ( propname ) { *propname = native_new_CMPIString ( prop->name, NULL ); } } else { result.state = CMPI_nullValue; } return result; } /** * returns non-zero if already existant */ static int __addProperty ( struct native_property ** prop, int mm_add, const char * name, CMPIType type, CMPIValueState state, CMPIValue * value ) { CMPIValue v; if ( *prop == NULL ) { struct native_property * tmp = *prop = (struct native_property *) tool_mm_alloc ( mm_add, sizeof ( struct native_property ) ); tmp->name = strdup ( name ); if ( mm_add == TOOL_MM_ADD ) tool_mm_add ( tmp->name ); if ( type == CMPI_chars ) { type = CMPI_string; v.string = native_new_CMPIString ( (char *) value, NULL ); value = &v; } tmp->type = type; if ( type != CMPI_null ) { tmp->state = state; if ( mm_add == TOOL_MM_ADD ) { tmp->value = *value; } else { CMPIStatus rc; tmp->value = native_clone_CMPIValue ( type, value, &rc ); // what if clone() fails??? } } else tmp->state = CMPI_nullValue; return 0; } return ( strcmp ( (*prop)->name, name ) == 0 || __addProperty ( &( (*prop)->next ), mm_add, name, type, state, value ) ); } /** * returns -1 if non-existant */ static int __setProperty ( struct native_property * prop, int mm_add, const char * name, CMPIType type, CMPIValue * value ) { CMPIValue v; if ( prop == NULL ) { return -1; } if ( strcmp ( prop->name, name ) == 0 ) { CMPIStatus rc; if ( ! ( prop->state & CMPI_nullValue ) ) native_release_CMPIValue ( prop->type, &prop->value ); if ( type == CMPI_chars ) { type = CMPI_string; v.string = native_new_CMPIString ( (char *) value, NULL ); value = &v; } prop->type = type; if ( type != CMPI_null ) { prop->value = ( mm_add == TOOL_MM_ADD )? *value: native_clone_CMPIValue ( type, value, &rc ); // what if clone() fails ??? } else prop->state = CMPI_nullValue; return 0; } return __setProperty ( prop->next, mm_add, name, type, value); } static struct native_property * __getProperty ( struct native_property * prop, const char * name ) { if ( ! prop || ! name ) { return NULL; } return ( strcmp ( prop->name, name ) == 0 )? prop: __getProperty ( prop->next, name ); } static CMPIData __getDataProperty ( struct native_property * prop, const char * name, CMPIStatus * rc ) { struct native_property * p = __getProperty ( prop, name ); if ( rc ) CMSetStatus ( rc, ( p )? CMPI_RC_OK: CMPI_RC_ERR_NO_SUCH_PROPERTY ); return __convert2CMPIData ( p, NULL ); } static struct native_property * __getPropertyAt ( struct native_property * prop, unsigned int pos ) { if ( ! prop ) { return NULL; } return ( pos == 0 )? prop: __getPropertyAt ( prop->next, --pos ); } static CMPIData __getDataPropertyAt ( struct native_property * prop, unsigned int pos, CMPIString ** propname, CMPIStatus * rc ) { struct native_property * p = __getPropertyAt ( prop, pos ); if ( rc ) CMSetStatus ( rc, ( p )? CMPI_RC_OK: CMPI_RC_ERR_NO_SUCH_PROPERTY ); return __convert2CMPIData ( p, propname ); } static CMPICount __getPropertyCount ( struct native_property * prop, CMPIStatus * rc ) { CMPICount c = 0; if ( rc ) CMSetStatus ( rc, CMPI_RC_OK ); while ( prop != NULL ) { c++; prop = prop->next; } return c; } static void __release ( struct native_property * prop ) { for ( ; prop; prop = prop->next ) { tool_mm_add ( prop ); tool_mm_add ( prop->name ); native_release_CMPIValue ( prop->type, &prop->value ); } } static struct native_property * __clone ( struct native_property * prop, CMPIStatus * rc ) { struct native_property * result; CMPIStatus tmp; if ( prop == NULL ) { if ( rc ) CMSetStatus ( rc, CMPI_RC_OK ); return NULL; } result = (struct native_property * ) tool_mm_alloc ( TOOL_MM_NO_ADD, sizeof ( struct native_property ) ); result->name = strdup ( prop->name ); result->type = prop->type; result->state = prop->state; result->value = native_clone_CMPIValue ( prop->type, &prop->value, &tmp ); if ( tmp.rc != CMPI_RC_OK ) { result->state = CMPI_nullValue; } result->next = __clone ( prop->next, rc ); return result; } /** * Global function table to access native_property helper functions. */ struct native_propertyFT propertyFT = { __addProperty, __setProperty, __getDataProperty, __getDataPropertyAt, __getPropertyCount, __release, __clone }; /****************************************************************************/ /*** Local Variables: ***/ /*** mode: C ***/ /*** c-basic-offset: 8 ***/ /*** End: ***/ --- NEW FILE: native.h --- /*! \file native.h \brief Header file for the native encapsulated CMPI data type implementation. This file defines all the data types and functions necessary to use native encapsulated CMPI data objects. These are clones of the regular CMPI data types like CMPIObjectPath, CMPIInstance etc., however, they can be instantiated and manipulated without a full blown CIMOM. Instead, they use an autononmous CIMOM clone that provides all the functions to create these objects as defined by the CMPIBrokerEncFT. (C) Copyright IBM Corp. 2003 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://oss.software.ibm.com/developerworks/opensource/license-cpl.html \author Frank Scheffler $Revision: 1.1 $ */ #ifndef _REMOTE_CMPI_NATIVE_DATA_H #define _REMOTE_CMPI_NATIVE_DATA_H #define NATIVE_FT_VERSION 1 #include "cmcidt.h" #include "cmcift.h" #include "cmci.h" #include "cimXmlParser.h" struct native_instance { CMPIInstance instance; int mem_state; char * classname; char * namespace; int filtered; char ** property_list; char ** key_list; struct native_property * props; }; //! Forward declaration for anonymous struct. struct native_property; //! Function table for native_property handling functions. /*! This structure holds all the function pointers necessary to handle linked lists of native_property structs. \sa propertyFT in native.h */ struct native_propertyFT { //! Adds a new native_property to a list. int (* addProperty) ( struct native_property **, int, const char *, CMPIType, CMPIValueState, CMPIValue * ); //! Resets the values of an existing native_property, if existant. int (* setProperty) ( struct native_property *, int, const char *, CMPIType, CMPIValue * ); //! Looks up a specifix native_property in CMPIData format. CMPIData (* getDataProperty) ( struct native_property *, const char *, CMPIStatus * ); //! Extract an indexed native_property in CMPIData format. CMPIData (* getDataPropertyAt) ( struct native_property *, unsigned int, CMPIString **, CMPIStatus * ); //! Yields the number of native_property items in a list. CMPICount (* getPropertyCount) ( struct native_property *, CMPIStatus * ); //! Releases a complete list of native_property items. void (* release) ( struct native_property * ); //! Clones a complete list of native_property items. struct native_property * (* clone) ( struct native_property *, CMPIStatus * ); }; /****************************************************************************/ void native_release_CMPIValue ( CMPIType, CMPIValue * val ); CMPIValue native_clone_CMPIValue ( CMPIType, CMPIValue * val, CMPIStatus * ); CMPIString * native_new_CMPIString ( const char *, CMPIStatus * ); CMPIArray * native_new_CMPIArray ( CMPICount size, CMPIType type, CMPIStatus * ); void native_array_increase_size ( CMPIArray *, CMPICount ); CMPIEnumeration * native_new_CMPIEnumeration ( CMPIArray *, CMPIStatus * ); CMPIInstance * native_new_CMPIInstance ( CMPIObjectPath *, CMPIStatus * ); CMPIObjectPath * native_new_CMPIObjectPath ( const char *, const char *, CMPIStatus * ); CMPIArgs * native_new_CMPIArgs ( CMPIStatus * ); CMPIDateTime * native_new_CMPIDateTime ( CMPIStatus * ); CMPIDateTime * native_new_CMPIDateTime_fromBinary ( CMPIUint64, CMPIBoolean, CMPIStatus * ); CMPIDateTime * native_new_CMPIDateTime_fromChars ( const char *, CMPIStatus * ); struct xtokValueReference; CMPIValue str2CMPIValue(CMPIType type, char *val, struct xtokValueReference *ref); void setInstNsAndCn(CMPIInstance *ci, char *ns, char *cn); CMPIStatus simpleArrayAdd(CMPIArray * array, CMPIValue * val, CMPIType type); const char *getNameSpaceChars(CMPIObjectPath * cop); CMPIValue *getKeyValueTypePtr(char *type, char *value, struct xtokValueReference *ref, CMPIValue * val, CMPIType * typ); #define newCMPIString native_new_CMPIString #define newCMPIObjectPath native_new_CMPIObjectPath #define newCMPIInstance native_new_CMPIInstance #define newCMPIArray native_new_CMPIArray #define newCMPIEnumeration native_new_CMPIEnumeration /****************************************************************************/ struct native_propertyFT propertyFT; #endif /*** Local Variables: ***/ /*** mode: C ***/ /*** c-basic-offset: 8 ***/ /*** End: ***/ --- NEW FILE: cimXmlParser.h --- /* * cimXmlParser.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Adrian Schuur <sc...@de...> * * Description: * * CIM XML lexer for sfcb to be used in connection with cimXmlOps.y. * */ #ifndef XMLSCAN_H #define XMLSCAN_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "cmcidt.h" #include "cmcift.h" #include "cmcimacs.h" #include "native.h" typedef enum typeValRef { typeValRef_InstanceName, typeValRef_InstancePath, typevalRef_LocalInstancePath } TypeValRef; typedef enum typeProperty { typeProperty_Value, typeProperty_Reference, typeProperty_Array } TypeProperty; typedef struct xmlBuffer { char *base; char *last; char *cur; char eTagFound; int etag; char nulledChar; } XmlBuffer; typedef struct xmlElement { char *attr; } XmlElement; typedef struct xmlAttr { char *attr; } XmlAttr; typedef struct xtokNameSpace { char *ns; char *cns; // must be free'd } XtokNameSpace; typedef struct xtokMessage { char *id; } XtokMessage; typedef struct xtokValue { char *value; } XtokValue; typedef struct xtokValueArray { int max,next; char **values; } XtokValueArray; typedef struct xtokHost { char *host; } XtokHost; typedef struct xtokNameSpacePath { XtokHost host; char *nameSpacePath; } XtokNameSpacePath; struct xtokKeyBinding; struct xtokValueReference; typedef struct xtokKeyValue { char *valueType, *value; } XtokKeyValue; typedef struct xtokKeyBindings { int max, next; struct xtokKeyBinding *keyBindings; // must be free'd } XtokKeyBindings; typedef struct xtokInstanceName { char *className; XtokKeyBindings bindings; } XtokInstanceName; typedef struct xtokInstancePath { XtokNameSpacePath path; XtokInstanceName instanceName; int type; } XtokInstancePath; typedef struct xtokLocalInstancePath { char *path; XtokInstanceName instanceName; int type; } XtokLocalInstancePath; typedef struct xtokLocalClassPath { char *path; char *className; int type; } XtokLocalClassPath; typedef struct xtokValueReference { union { XtokInstancePath instancePath; XtokLocalInstancePath localInstancePath; XtokInstanceName instanceName; }; TypeValRef type; } XtokValueReference; typedef struct xtokKeyBinding { char *name, *value, *type; XtokValueReference ref; } XtokKeyBinding; typedef struct xtokQualifier { struct xtokQualifier *next; char *name; CMPIType type; char *value; char propagated, overridable, tosubclass, toinstance, translatable; } XtokQualifier; typedef struct xtokQualifiers { XtokQualifier *last, *first; // must be free'd } XtokQualifiers; typedef struct xtokPropertyData { union { char *value; XtokValueReference ref; XtokValueArray array; }; XtokQualifiers qualifiers; int null; } XtokPropertyData; typedef struct xtokProperty { struct xtokProperty *next; char *name; char *classOrigin; char propagated; char *referenceClass; CMPIType valueType; XtokPropertyData val; TypeProperty propType; } XtokProperty; typedef struct xtokProperties { XtokProperty *last, *first; // must be free'd } XtokProperties; typedef struct xtokInstance { char *className; XtokProperties properties; XtokQualifiers qualifiers; } XtokInstance; typedef struct xtokInstanceData { XtokProperties properties; XtokQualifiers qualifiers; } XtokInstanceData; typedef struct xtokNamedInstance { XtokInstanceName path; XtokInstance instance; } XtokNamedInstance; typedef struct xtokPropertyList { XtokValueArray list; } XtokPropertyList; typedef struct xtokParamValue { struct xtokParamValue *next; char *name; CMPIType type; union { XtokValue value; XtokValueReference valueRef; XtokValueArray valueArray; }; } XtokParamValue; typedef struct xtokParamValues { XtokParamValue *last, *first; // must be free'd } XtokParamValues; typedef struct xtokParam { struct xtokParam *next; XtokQualifiers qualifiers; XtokQualifier qualifier; int qPart; int pType; char *name; char *refClass; char *arraySize; CMPIType type; } XtokParam; typedef struct xtokParams { XtokParam *last, *first; // must be free'd } XtokParams; typedef struct xtokMethod { struct xtokMethod *next; XtokQualifiers qualifiers; XtokParams params; char *name; char *classOrigin; int propagated; CMPIType type; } XtokMethod; typedef struct xtokMethodData { XtokQualifiers qualifiers; XtokParams params; } XtokMethodData; typedef struct xtokMethods { XtokMethod *last, *first; // must be free'd } XtokMethods; typedef struct xtokClass { char *className; char *superClass; XtokProperties properties; XtokQualifiers qualifiers; XtokMethods methods; } XtokClass; typedef struct xtokErrorResp { char *code; char *description; } XtokErrorResp; #include <setjmp.h> typedef struct responseHdr { XmlBuffer *xmlBuffer; int rc; int opType; int simple; char *id; char *iMethod; int methodCall; void *cimRequest; unsigned long cimRequestLength; int errCode; char *description; CMPIArray *rvArray; } ResponseHdr; typedef struct parser_control { XmlBuffer *xmb; ResponseHdr respHdr; char *nameSpace; CMPIInstance *curInstance; CMPIObjectPath *curPath; } ParserControl; extern ResponseHdr scanCimXmlResponse(const char *xmlData, CMPIObjectPath *cop); extern void freeCimXmlResponse(ResponseHdr * hdr); #endif --- NEW FILE: setEnv --- export LD_LIBRARY_PATH=. ulimit -c unlimited --- NEW FILE: utilStringBuffer.c --- /* * utilStringBuffer.c * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENS... [truncated message content] |