version 1.2, 2015/04/20 18:10:36
|
version 1.3, 2015/04/20 18:20:37
|
|
|
#include "config.h" | #include "config.h" |
#include <string.h> | #include <string.h> |
#include <common.h> | #include <common.h> |
//#include <base/messages.h> |
|
#include <base/batch.h> | #include <base/batch.h> |
#include <base/strings.h> |
#include <pal/strings.h> |
|
#include <base/messages.h> |
| |
#if defined(_MSC_VER) | #if defined(_MSC_VER) |
/* warning C4204: nonstandard extension used : non-constant aggregate initializer */ | /* warning C4204: nonstandard extension used : non-constant aggregate initializer */ |
|
|
WSBUF_FAULT_NOT_UNDERSTOOD, | WSBUF_FAULT_NOT_UNDERSTOOD, |
WSBUF_FAULT_DESTINATION_UNREACHABLE, | WSBUF_FAULT_DESTINATION_UNREACHABLE, |
WSBUF_FAULT_ACCESS_DENIED, | WSBUF_FAULT_ACCESS_DENIED, |
WSBUF_FAULT_ENCODING_LIMIT |
WSBUF_FAULT_ENCODING_LIMIT, |
|
WSBUF_FAULT_INVALID_EXPIRATION_TIME, |
|
WSBUF_FAULT_UNSUPPORTED_EXPIRATION_TIME, |
|
WSBUF_FAULT_TIMED_OUT, |
|
WSBUF_FAULT_INVALID_MESSAGE_INFORMATION_HEADER, |
|
WSBUF_FAULT_INVALID_HEARTBEAT, |
|
WSBUF_FAULT_ACTION_NOT_SUPPORTED, |
|
WSBUF_FAULT_CONNECTION_RETRY_NOT_SUPPORTED, |
|
WSBUF_FAULT_BOOKMARK_INVALID_FORMAT |
} | } |
WSBUF_FAULT_CODE; | WSBUF_FAULT_CODE; |
| |
|
|
| |
MI_Result __WSBuf_AddLit( | MI_Result __WSBuf_AddLit( |
WSBuf* buf, | WSBuf* buf, |
const MI_Char* str, |
const ZChar* str, |
|
MI_Uint32 size); |
|
|
|
MI_Result WSBuf_AddVerbatim( |
|
WSBuf* buf, |
|
const void* data, |
|
MI_Uint32 size); |
|
|
|
MI_Result WSBuf_AddStartTag( |
|
WSBuf* buf, |
|
const ZChar* tag, |
|
MI_Uint32 size); |
|
|
|
MI_Result WSBuf_AddEndTag( |
|
WSBuf* buf, |
|
const ZChar* tag, |
MI_Uint32 size); | MI_Uint32 size); |
| |
#if defined(WSBUF_DISABLE_INLINING) | #if defined(WSBUF_DISABLE_INLINING) |
MI_Result WSBuf_AddLit( | MI_Result WSBuf_AddLit( |
WSBuf* buf, | WSBuf* buf, |
const MI_Char* str, |
const ZChar* str, |
MI_Uint32 size); | MI_Uint32 size); |
| |
MI_Result WSBuf_AddLit1( | MI_Result WSBuf_AddLit1( |
WSBuf* buf, | WSBuf* buf, |
MI_Char c1); |
ZChar c1); |
| |
MI_Result WSBuf_AddLit2( | MI_Result WSBuf_AddLit2( |
WSBuf* buf, | WSBuf* buf, |
MI_Char c1, |
ZChar c1, |
MI_Char c2); |
ZChar c2); |
| |
MI_Result WSBuf_AddLit3( | MI_Result WSBuf_AddLit3( |
WSBuf* buf, | WSBuf* buf, |
MI_Char c1, |
ZChar c1, |
MI_Char c2, |
ZChar c2, |
MI_Char c3); |
ZChar c3); |
| |
MI_Result WSBuf_AddLit4( | MI_Result WSBuf_AddLit4( |
WSBuf* buf, | WSBuf* buf, |
MI_Char c1, |
ZChar c1, |
MI_Char c2, |
ZChar c2, |
MI_Char c3, |
ZChar c3, |
MI_Char c4); |
ZChar c4); |
MI_Result WSBuf_AddStringNoEncoding( | MI_Result WSBuf_AddStringNoEncoding( |
WSBuf* buf, | WSBuf* buf, |
const MI_Char* str); |
const ZChar* str); |
#else | #else |
# include "wsbufinline.h" | # include "wsbufinline.h" |
#endif | #endif |
| |
MI_Result WSBuf_AddString( | MI_Result WSBuf_AddString( |
WSBuf* buf, | WSBuf* buf, |
const MI_Char* str); |
const ZChar* str); |
| |
#if (MI_CHAR_TYPE == 1) |
#if defined(CONFIG_ENABLE_WCHAR) |
#define WSBuf_AddCharStringNoEncoding WSBuf_AddStringNoEncoding |
|
#define WSBuf_AddCharLit WSBuf_AddLit |
|
#else |
|
/* */ |
|
MI_Result WSBuf_AddCharStringNoEncoding( | MI_Result WSBuf_AddCharStringNoEncoding( |
WSBuf* buf, | WSBuf* buf, |
const char* str); | const char* str); |
|
|
MI_Result WSBuf_AddCharLit( | MI_Result WSBuf_AddCharLit( |
WSBuf* buf, | WSBuf* buf, |
const char* str, | const char* str, |
MI_Uint32 size); | MI_Uint32 size); |
|
#else |
|
# define WSBuf_AddCharStringNoEncoding WSBuf_AddStringNoEncoding |
|
# define WSBuf_AddCharLit WSBuf_AddLit |
#endif | #endif |
| |
MI_Result WSBuf_AddUint32( | MI_Result WSBuf_AddUint32( |
|
|
OK, FAILED (out of memory) | OK, FAILED (out of memory) |
*/ | */ |
MI_Result WSBuf_InstanceToBuf( | MI_Result WSBuf_InstanceToBuf( |
|
UserAgent userAgent, |
const MI_Instance* instance, | const MI_Instance* instance, |
MI_Boolean (*filterProperty)(const MI_Char* name, void* data), |
MI_Boolean (*filterProperty)(const ZChar* name, void* data), |
void* filterPropertyData, | void* filterPropertyData, |
const MI_ClassDecl* castToClassDecl, | const MI_ClassDecl* castToClassDecl, |
Batch* batch, | Batch* batch, |
|
|
void** ptrOut, | void** ptrOut, |
MI_Uint32* sizeOut); | MI_Uint32* sizeOut); |
| |
|
MI_Result WSBuf_ClassToBuf(_In_ const MI_Class *classObject, |
|
MI_Uint32 flags, |
|
Batch* batch, |
|
void** ptrOut, |
|
MI_Uint32* sizeOut); |
|
|
/* Utility */ | /* Utility */ |
#define WS_MSG_ID_SIZE 42 | #define WS_MSG_ID_SIZE 42 |
| |
void WSBuf_GenerateMessageID( | void WSBuf_GenerateMessageID( |
MI_Char msgID[WS_MSG_ID_SIZE]); |
_Pre_writable_size_(WS_MSG_ID_SIZE) ZChar msgID[WS_MSG_ID_SIZE]); |
| |
/* Maps CIMM error to the most relevant WS fault; | /* Maps CIMM error to the most relevant WS fault; |
Retuns description of CIM error (can be used as fault description) */ | Retuns description of CIM error (can be used as fault description) */ |
WSBUF_FAULT_CODE WSBuf_CIMErrorToWSFault( | WSBUF_FAULT_CODE WSBuf_CIMErrorToWSFault( |
MI_Uint32 cimErrorCode, | MI_Uint32 cimErrorCode, |
const MI_Char** description ); |
const ZChar** description ); |
| |
/* Helper function to create a fault repsonse */ | /* Helper function to create a fault repsonse */ |
Page* WSBuf_CreateFaultResponsePage( | Page* WSBuf_CreateFaultResponsePage( |
WSBUF_FAULT_CODE faultCode, | WSBUF_FAULT_CODE faultCode, |
const char* notUnderstoodTag, |
const ZChar* notUnderstoodTag, |
const char* requestMessageID, |
const ZChar* requestMessageID, |
const MI_Char* descriptionText); |
const PostResultMsg* message); |
| |
Page* WSBuf_CreateReleaseResponsePage( | Page* WSBuf_CreateReleaseResponsePage( |
const char* requestMessageID); |
const ZChar* requestMessageID); |
| |
/* Creates soap header with provided action. | /* Creates soap header with provided action. |
Funciotn leaves header open so extra header fields can be added */ | Funciotn leaves header open so extra header fields can be added */ |
MI_Result WSBuf_CreateSoapResponseHeader( | MI_Result WSBuf_CreateSoapResponseHeader( |
WSBuf *buf, | WSBuf *buf, |
const MI_Char* action, |
const ZChar* action, |
MI_Uint32 actionSize, | MI_Uint32 actionSize, |
const char* relatesTo); |
const ZChar* relatesTo); |
| |
#define LIT(str) str,(sizeof(str)/sizeof(str[0])-1) | #define LIT(str) str,(sizeof(str)/sizeof(str[0])-1) |
| |
|
INLINE ZChar* PageData(Page* page) |
|
{ |
|
return (ZChar*)(page + 1); |
|
} |
|
|
|
INLINE ZChar* BufData(WSBuf* buf) |
|
{ |
|
return PageData(buf->page); |
|
} |
|
|
END_EXTERNC | END_EXTERNC |
| |
#endif /* _omi_wsman_wsbuf_h */ | #endif /* _omi_wsman_wsbuf_h */ |
|
|