⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serialization.c

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 C
📖 第 1 页 / 共 3 页
字号:
		TRACE_CRITICAL(("failed to serialize classname."));		return -1;	}	tmp = __serialize_CMPIString ( fd, namespace );	if ( tmp < 0 ) {		TRACE_CRITICAL(("failed to serialize namespace."));		return -1;	}	out += tmp;	tmp = __serialize_UINT32 ( fd, key_count );	if ( tmp < 0 ) {		TRACE_CRITICAL(("failed to serialize keycount."));		return -1;	}	out += tmp;	for ( i = 0; i < key_count; i++ ) {		CMPIString * keyName;		CMPIData data = CMGetKeyAt ( cop, i, &keyName, NULL );		TRACE_INFO(("key(%d):\nname: %s\ntype: 0x%x\nstate: 0x%x.",			    i, CMGetCharsPtr ( keyName, NULL ),			    data.type, data.state ));		out += __serialize_CMPIString ( fd, keyName );		out += __serialize_CMPIData ( fd, data );	}	TRACE_VERBOSE(("leaving function."));	return out;}static CMPIObjectPath * __deserialize_CMPIObjectPath ( int fd,						       CONST CMPIBroker * broker ){	char * namespace, * classname;	CMPIObjectPath * cop;	unsigned int i;	CMPIString * tmp;	TRACE_VERBOSE(("entered function."));	if ( __deserialized_NULL ( fd ) ) return NULL;	TRACE_NORMAL(("deserializing non-NULL CMPIObjectPath."));	tmp = __deserialize_CMPIString ( fd, broker );	classname = CMGetCharsPtr ( tmp, NULL );	TRACE_INFO(("classname: %s.", classname));	tmp = __deserialize_CMPIString ( fd, broker );	namespace = CMGetCharsPtr ( tmp, NULL );	TRACE_INFO(("namespace: %s.", namespace));	cop = CMNewObjectPath ( broker, namespace, classname, NULL );	i = __deserialize_UINT32 ( fd );	TRACE_INFO(("key count: %d", i ));	while ( i-- ) {		CMPIString * keyName = __deserialize_CMPIString ( fd, broker );		CMPIData data        = __deserialize_CMPIData ( fd, broker );		TRACE_INFO(("key:\nname: %s\ntype: 0x%x\nstate: 0x%x",			    CMGetCharsPtr ( keyName, NULL ), data.type, data.state ));		CMAddKey ( cop,			   CMGetCharsPtr ( keyName, NULL ),			   &data.value,			   data.type );	}	TRACE_VERBOSE(("leaving function."));	return cop;}static ssize_t __serialize_CMPIArray ( int fd, CONST CMPIArray * array ){	CMPICount i, size;	CMPIType type;	ssize_t out, tmp;	TRACE_VERBOSE(("entered function."));	if ( __serialized_NULL ( fd, array ) ) {	   return 0;	}	TRACE_NORMAL(("serializing non-NULL CMPIArray."));	size = CMGetArrayCount ( array, NULL );	out =__serialize_UINT16 ( fd, size );	if ( out < 0 ) return -1;	TRACE_INFO(("element count: %d", size ));	type = CMGetArrayType ( array, NULL );	out += tmp = __serialize_CMPIType ( fd, type );	if ( tmp < 0 ) return -1;	TRACE_INFO(("element type: 0x%x", type ));	for ( i = 0; i < size; i++ ) {		CMPIData data = CMGetArrayElementAt ( array, i, NULL);		out += __serialize_CMPIData ( fd, data );	}	TRACE_VERBOSE(("leaving function."));	return out;}static CMPIArray * __deserialize_CMPIArray ( int fd, CONST CMPIBroker * broker ){	CMPIArray * a;	CMPICount size, i;	CMPIType type;	TRACE_VERBOSE(("entered function.")); //("int $3");	if ( __deserialized_NULL ( fd ) ) return NULL;	TRACE_NORMAL(("deserializing non-NULL CMPIArray."));	size = __deserialize_UINT16 ( fd );	TRACE_INFO(("element count: %d", size ));	type = __deserialize_CMPIType ( fd );	TRACE_INFO(("element type: 0x%x", type ));	a = CMNewArray ( broker, size, type, NULL );	for ( i = 0; i < size; i++ ) {		CMPIData data = __deserialize_CMPIData ( fd, broker );		if ( data.state & CMPI_nullValue ) {			CMSetArrayElementAt ( a, i, NULL, CMPI_null );			TRACE_INFO(("added NULL value."));		} else {			CMSetArrayElementAt ( a, i, &data.value, data.type );			TRACE_INFO(("added non-NULL value."));		}	}	TRACE_VERBOSE(("leaving function."));	return a;}static ssize_t __serialize_CMPIInstance ( int fd, CONST CMPIInstance * inst ){	ssize_t out, tmp;	CMPIObjectPath * cop;	unsigned int props, i;	TRACE_VERBOSE(("entered function."));	if ( __serialized_NULL ( fd, inst ) ) return 0;	TRACE_NORMAL(("serializing non-NULL CMPIInstance."));	cop   = CMGetObjectPath ( inst, NULL );	props = CMGetPropertyCount ( inst, NULL );	out = __serialize_CMPIObjectPath ( fd, cop );	if ( out < 0 ) return -1;	if ( ( tmp =__serialize_UINT16 ( fd, props ) ) < 0 ) return -1;	out += tmp;	TRACE_INFO(("property count: %d", props ));	for ( i = 0; i < props; i++ ) {		CMPIString * propName;		CMPIData data = CMGetPropertyAt ( inst,						  i,						  &propName,						  NULL );		TRACE_INFO(("property(%d)\nname: %s\n"			    "type: 0x%x\nstate: 0x%x.",			    i, CMGetCharsPtr ( propName, NULL ),			    data.type, data.state ));		out += __serialize_CMPIString ( fd, propName );		out += __serialize_CMPIData ( fd, data );	}	TRACE_VERBOSE(("leaving function."));	return out;}static CMPIInstance * __deserialize_CMPIInstance ( int fd,						   CONST CMPIBroker * broker ){	CMPIObjectPath * cop;	CMPIInstance * inst;	unsigned int i;	TRACE_VERBOSE(("entered function."));	if ( __deserialized_NULL ( fd ) ) return NULL;	TRACE_NORMAL(("deserializing non-NULL CMPIInstance."));	cop = __deserialize_CMPIObjectPath ( fd, broker );	inst = CMNewInstance ( broker, cop, NULL );	i = __deserialize_UINT16 ( fd );	while ( i-- ) {		CMPIString * propName =			__deserialize_CMPIString ( fd, broker );//			if (nativeSide==0 && strcasecmp((char*)propName->hdl,"operationalstatus")==0)//			    asm("int $3");		CMPIData data =			__deserialize_CMPIData ( fd, broker );		TRACE_INFO(("property:\nname: %s\ntype: 0x%x\nstate: 0x%x",			    CMGetCharsPtr ( propName, NULL ), data.type, data.state));		CMSetProperty ( inst,				CMGetCharsPtr ( propName, NULL ),				&data.value,				data.type );	}	TRACE_VERBOSE(("leaving function."));	return inst;}static ssize_t __serialize_CMPISelectExp ( int fd, CONST CMPISelectExp * sexp,                                                   CMPIUint32 ctx_id){    if (__serialized_NULL (fd, sexp) )    {         return 0;}    return __serialize_UINT32 (fd,                        create_indicationObject (                           (CMPISelectExp*)sexp,                           ctx_id,                           PEGASUS_INDICATION_OBJECT_TYPE_CMPI_SELECT_EXP) );}static CMPISelectExp * __deserialize_CMPISelectExp ( int fd,                                                     CONST CMPIBroker *broker,                                                     CONST CMPIUint32 ctx_id){    if (__deserialized_NULL (fd) ){	return NULL;}   return  (CMPISelectExp*) get_indicationObject (__deserialize_UINT32 (fd), ctx_id);}static ssize_t __serialize_CMPIDateTime ( int fd, CMPIDateTime * dt ){	CMPIUint64 msecs;	CMPIBoolean i;	ssize_t out, tmp;	TRACE_VERBOSE(("entered function."));	if ( __serialized_NULL ( fd, dt ) ) return 0;	TRACE_NORMAL(("serializing non-NULL CMPIDateTime."));	msecs = CMGetBinaryFormat ( dt, NULL );	i = CMIsInterval ( dt, NULL );#if defined CMPI_PLATFORM_WIN32_IX86_MSVC	TRACE_INFO(("msecs: %I64d, interval: %d", msecs, i ));#else	TRACE_INFO(("msecs: %lld, interval: %d", msecs, i ));#endif	out = __serialize_UINT64 ( fd, msecs );	if ( out < 0 ) return -1;	tmp = __serialize_UINT8 ( fd, i );	if ( tmp < 0 ) return -1;	TRACE_VERBOSE(("leaving function."));	return ( out + tmp );}static CMPIDateTime * __deserialize_CMPIDateTime ( int fd,						   CONST CMPIBroker * broker ){	CMPIUint64 msecs;	CMPIBoolean i;	TRACE_VERBOSE(("entered function."));	if ( __deserialized_NULL ( fd ) ) return NULL;	TRACE_NORMAL(("deserializing non-NULL CMPIDateTime."));	msecs = __deserialize_UINT64 ( fd );	i     = __deserialize_UINT8 ( fd );#if defined CMPI_PLATFORM_WIN32_IX86_MSVC	TRACE_INFO(("msecs: %I64d, interval: %d", msecs, i ));#else	TRACE_INFO(("msecs: %lld, interval: %d", msecs, i ));#endif	TRACE_VERBOSE(("leaving function."));	return CMNewDateTimeFromBinary ( broker, msecs, i, NULL );}#ifdef CMPI_VER_200static ssize_t __serialize_CMPIError ( int fd, CMPIError * err ){	CMPIUint64 msecs;	CMPIBoolean i;	ssize_t out, tmp;	TRACE_VERBOSE(("entered function."));	if ( __serialized_NULL ( fd, err ) ) return 0;	TRACE_NORMAL(("serializing non-NULL CMPIError."));	TRACE_VERBOSE(("leaving function."));	return ( 0 );}static CMPIError * __deserialize_CMPIError ( int fd,						   CONST CMPIBroker * broker ){	CMPIError* nerr;	TRACE_VERBOSE(("entered function."));	if ( __deserialized_NULL ( fd ) ) return NULL;	TRACE_NORMAL(("deserializing non-NULL CMPIError."));	return nerr;}static ssize_t __serialize_CMPIErrorSeverity ( int fd, CMPIErrorSeverity sev ){return 0;}static CMPIErrorSeverity __deserialize_CMPIErrorSeverity ( int fd, CONST CMPIBroker * broker ){CMPIErrorSeverity sev;return sev;}static ssize_t __serialize_CMPIErrorProbableCause ( int fd, CMPIErrorProbableCause pc ){return 0;}static CMPIErrorProbableCause __deserialize_CMPIErrorProbableCause ( int fd, CONST CMPIBroker * broker ){CMPIErrorProbableCause pc;return pc;}static ssize_t __serialize_CMPIrc ( int fd, CMPIrc cimStatusCode ){return 0;}static CMPIrc __deserialize_CMPIrc ( int fd, CONST CMPIBroker * broker ){CMPIrc cimStatusCode;return cimStatusCode;}static ssize_t __serialize_CMPIMsgFileHandle ( int fd, CMPIMsgFileHandle msgFileHandle ){    return (__serialize_UINT32 ( fd, (CMPIUint32)msgFileHandle ));}static CMPIMsgFileHandle __deserialize_CMPIMsgFileHandle ( int fd, CONST CMPIBroker * broker ){    return ((CMPIMsgFileHandle)__deserialize_UINT32 ( fd ));}#endif /* CMPI_VER_200 *//****************************************************************************//*** Local Variables:  ***//*** mode: C           ***//*** c-basic-offset: 8 ***//*** End:              ***/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -