util/msgUtil.h File Reference

#include <util/helper.h>

Include dependency graph for msgUtil.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  MsgUnit
 Holds a message All member pointers are allocated with malloc(), you need to free() them Needs to be consistent with MsgUnitUnmanaged declaration in C# (for P/Invoke). More...
struct  MsgUnitStructArr
 Holds an array of Messages. More...
struct  QosStructArr
 Holds an array of QoS XML strings returned by unSubscribe() and erase(). More...
struct  MsgRequestInfoStruct
 Used to transport information back to callback functions. More...

Defines

#define MAX_ERRNO_LEN   256
#define XMLBLASTER_MAX_USAGE_LEN   2048
#define MAX_REQUESTID_LEN   256
#define MAX_SECRETSESSIONID_LEN   256
#define MAX_SESSIONID_LEN   256
#define MAX_METHODNAME_LEN   20
#define XMLBLASTER_CONNECT   "connect"
#define XMLBLASTER_DISCONNECT   "disconnect"
#define XMLBLASTER_PING   "ping"
#define XMLBLASTER_UPDATE   "update"
#define XMLBLASTER_UPDATE_ONEWAY   "updateOneway"
#define XMLBLASTER_PUBLISH   "publish"
#define XMLBLASTER_PUBLISH_ONEWAY   "publishOneway"
#define XMLBLASTER_GET   "get"
#define XMLBLASTER_SUBSCRIBE   "subscribe"
#define XMLBLASTER_UNSUBSCRIBE   "unSubscribe"
#define XMLBLASTER_ERASE   "erase"
#define XMLBLASTEREXCEPTION_ERRORCODE_LEN   EXCEPTIONSTRUCT_ERRORCODE_LEN
#define XMLBLASTEREXCEPTION_MESSAGE_LEN   EXCEPTIONSTRUCT_MESSAGE_LEN

Typedefs

typedef BlobHolder XmlBlasterBlob
 Holds arbitrary raw data and its length, see helper.h.
typedef MsgUnitStructArr MsgUnitArr
 Holds an array of Messages.
typedef QosStructArr QosArr
 Holds an array of QoS XML strings returned by unSubscribe() and erase().
typedef MsgRequestInfoStruct MsgRequestInfo
 Used to transport information back to callback functions.
typedef ExceptionStruct XmlBlasterException

Functions

void initializeXmlBlasterException (XmlBlasterException *xmlBlasterException)
 Should be called on any xmlBlasterException before using it.
const char * getXmlBlasterVersion (void)
 
Returns:
e.g.

void xmlBlasterFree (char *p)
 Frees the pointer with free().
void freeMsgUnitData (MsgUnit *msgUnit)
 Does not free the msgUnit itself.
void freeMsgUnit (MsgUnit *msgUnit)
 Frees everything.
void freeMsgUnitArr (MsgUnitArr *msgUnitArr)
 Frees everything inside MsgUnitArr and the struct MsgUnitArr itself.
void freeMsgUnitArrInternal (MsgUnitArr *msgUnitArr)
 Frees everything inside MsgUnitArr but NOT the struct MsgUnitArr itself.
void freeQosArr (QosArr *qosArr)
 Frees everything inside QosArr and the struct QosArr itself.
char * messageUnitToXml (MsgUnit *msg)
 NOTE: You need to free the returned pointer with xmlBlasterFree() or directly with free()!
char * messageUnitToXmlLimited (MsgUnit *msg, int maxContentDumpLen)
 NOTE: You need to free the returned pointer with xmlBlasterFree() or directly with free()!
hostent * gethostbyname_re (const char *host, struct hostent *hostbuf, char **tmphstbuf, size_t *hstbuflen, char errP[256])


Define Documentation

#define MAX_ERRNO_LEN   256

Definition at line 18 of file msgUtil.h.

Referenced by createCallbackServer(), and initConnection().

#define MAX_METHODNAME_LEN   20

Definition at line 25 of file msgUtil.h.

Referenced by encodeSocketMessage(), handleMessage(), parseSocketData(), and sendData().

#define MAX_REQUESTID_LEN   256

Definition at line 20 of file msgUtil.h.

Referenced by handleMessage(), parseSocketData(), and sendData().

#define MAX_SECRETSESSIONID_LEN   256

Definition at line 21 of file msgUtil.h.

Referenced by xmlBlasterConnect().

#define MAX_SESSIONID_LEN   256

Definition at line 22 of file msgUtil.h.

Referenced by encodeSocketMessage(), and parseSocketData().

#define XMLBLASTER_CONNECT   "connect"

Definition at line 26 of file msgUtil.h.

Referenced by sendData(), and xmlBlasterConnect().

#define XMLBLASTER_DISCONNECT   "disconnect"

Definition at line 27 of file msgUtil.h.

Referenced by xmlBlasterDisconnect().

#define XMLBLASTER_ERASE   "erase"

Definition at line 36 of file msgUtil.h.

Referenced by xmlBlasterErase().

#define XMLBLASTER_GET   "get"

Definition at line 33 of file msgUtil.h.

Referenced by xmlBlasterGet().

#define XMLBLASTER_MAX_USAGE_LEN   2048

Definition at line 19 of file msgUtil.h.

Referenced by main(), xmlBlasterAccessUnparsedUsage(), xmlBlasterUnmanagedCEUsage(), and xmlBlasterUnmanagedUsage().

#define XMLBLASTER_PING   "ping"

Definition at line 28 of file msgUtil.h.

Referenced by xmlBlasterPing().

#define XMLBLASTER_PUBLISH   "publish"

Definition at line 31 of file msgUtil.h.

Referenced by xmlBlasterPublish(), and xmlBlasterPublishArr().

#define XMLBLASTER_PUBLISH_ONEWAY   "publishOneway"

Definition at line 32 of file msgUtil.h.

Referenced by xbl_isOneway(), and xmlBlasterPublishOneway().

#define XMLBLASTER_SUBSCRIBE   "subscribe"

Definition at line 34 of file msgUtil.h.

Referenced by xmlBlasterSubscribe().

#define XMLBLASTER_UNSUBSCRIBE   "unSubscribe"

Definition at line 35 of file msgUtil.h.

Referenced by xmlBlasterUnSubscribe().

#define XMLBLASTER_UPDATE   "update"

Definition at line 29 of file msgUtil.h.

#define XMLBLASTER_UPDATE_ONEWAY   "updateOneway"

Definition at line 30 of file msgUtil.h.

Referenced by sendResponseOrException().

#define XMLBLASTEREXCEPTION_ERRORCODE_LEN   EXCEPTIONSTRUCT_ERRORCODE_LEN

Definition at line 96 of file msgUtil.h.

Referenced by checkArgs(), convertToXmlBlasterException(), handleMessage(), initConnection(), initialize(), interceptUpdate(), mutexUnlock(), myUpdate(), parseSocketData(), postSendEvent(), preSendEvent(), sendData(), xmlBlasterConnect(), xmlBlasterErase(), xmlBlasterGet(), xmlBlasterInitQueue(), xmlBlasterSubscribe(), and xmlBlasterUnSubscribe().

#define XMLBLASTEREXCEPTION_MESSAGE_LEN   EXCEPTIONSTRUCT_MESSAGE_LEN

Definition at line 97 of file msgUtil.h.

Referenced by checkArgs(), convertToXmlBlasterException(), createCallbackServer(), handleMessage(), initConnection(), initialize(), interceptUpdate(), mutexUnlock(), myUpdate(), postSendEvent(), preSendEvent(), sendData(), xmlBlasterConnect(), xmlBlasterErase(), xmlBlasterGet(), xmlBlasterInitQueue(), xmlBlasterSubscribe(), and xmlBlasterUnSubscribe().


Typedef Documentation

typedef struct MsgRequestInfoStruct MsgRequestInfo

Used to transport information back to callback functions.

typedef struct MsgUnitStructArr MsgUnitArr

Holds an array of Messages.

typedef struct QosStructArr QosArr

Holds an array of QoS XML strings returned by unSubscribe() and erase().

typedef BlobHolder XmlBlasterBlob

Holds arbitrary raw data and its length, see helper.h.

Definition at line 41 of file msgUtil.h.

typedef ExceptionStruct XmlBlasterException

Definition at line 98 of file msgUtil.h.


Function Documentation

void freeMsgUnit ( MsgUnit msgUnit  ) 

Frees everything.

Definition at line 150 of file msgUtil.c.

References freeMsgUnitData().

Here is the call graph for this function:

void freeMsgUnitArr ( MsgUnitArr msgUnitArr  ) 

Frees everything inside MsgUnitArr and the struct MsgUnitArr itself.

Parameters:
msgUnitArr The struct to free, passing NULL is OK

Definition at line 99 of file msgUtil.c.

References freeMsgUnitArrInternal().

Referenced by main(), parseQosArr(), sendResponseOrException(), xmlBlasterUnmanagedCEGet(), and xmlBlasterUnmanagedGet().

Here is the call graph for this function:

void freeMsgUnitArrInternal ( MsgUnitArr msgUnitArr  ) 

Frees everything inside MsgUnitArr but NOT the struct MsgUnitArr itself.

Parameters:
msgUnitArr The struct internals to free, passing NULL is OK

Definition at line 110 of file msgUtil.c.

References freeMsgUnitData(), MsgUnitStructArr::len, and MsgUnitStructArr::msgUnitArr.

Referenced by freeMsgUnitArr(), and main().

Here is the call graph for this function:

void freeMsgUnitData ( MsgUnit msgUnit  ) 

Does not free the msgUnit itself.

Definition at line 124 of file msgUtil.c.

References MsgUnit::content, MsgUnit::contentLen, MsgUnit::key, MsgUnit::qos, and MsgUnit::responseQos.

Referenced by freeMsgUnit(), freeMsgUnitArrInternal(), main(), myUpdate(), xmlBlasterUnmanagedCEPublish(), and xmlBlasterUnmanagedCEPublishOneway().

void freeQosArr ( QosArr qosArr  ) 

Frees everything inside QosArr and the struct QosArr itself.

Parameters:
qosArr The struct to free, passing NULL is OK

Definition at line 83 of file msgUtil.c.

References QosStructArr::len, and QosStructArr::qosArr.

Referenced by main(), xmlBlasterUnmanagedCEErase(), xmlBlasterUnmanagedCEUnSubscribe(), xmlBlasterUnmanagedErase(), and xmlBlasterUnmanagedUnSubscribe().

struct hostent* gethostbyname_re ( const char *  host,
struct hostent *  hostbuf,
char **  tmphstbuf,
size_t *  hstbuflen,
char  errP[256] 
) [read]

const char* getXmlBlasterVersion ( void   ) 

Returns:
e.g.

"0.848 #1207M"

Definition at line 47 of file msgUtil.c.

Referenced by main(), and xmlBlasterUnmanagedCEVersion().

void initializeXmlBlasterException ( XmlBlasterException xmlBlasterException  ) 

Should be called on any xmlBlasterException before using it.

Definition at line 207 of file msgUtil.c.

References ExceptionStruct::errorCode, ExceptionStruct::message, and ExceptionStruct::remote.

Referenced by checkArgs(), handleMessage(), sendData(), xmlBlasterUnmanagedCEErase(), xmlBlasterUnmanagedCEUnSubscribe(), xmlBlasterUnmanagedErase(), and xmlBlasterUnmanagedUnSubscribe().

char* messageUnitToXml ( MsgUnit msg  ) 

NOTE: You need to free the returned pointer with xmlBlasterFree() or directly with free()!

Returns:
A ASCII XML formatted message or NULL if out of memory

Definition at line 199 of file msgUtil.c.

References messageUnitToXmlLimited().

Referenced by myUpdate().

Here is the call graph for this function:

char* messageUnitToXmlLimited ( MsgUnit msg,
int  maxContentDumpLen 
)

NOTE: You need to free the returned pointer with xmlBlasterFree() or directly with free()!

Parameters:
msg The message
maxContentDumpLen for -1 get the complete content, else limit the content to the given number of bytes
Returns:
A ASCII XML formatted message or NULL if out of memory

Definition at line 165 of file msgUtil.c.

References MsgUnit::content, MsgUnit::contentLen, MsgUnit::key, MsgUnit::qos, SNPRINTF, strcatAlloc(), strcpyAlloc(), strFromBlobAlloc(), and strncpy0().

Referenced by main(), messageUnitToXml(), and myUpdate().

Here is the call graph for this function:

void xmlBlasterFree ( char *  p  ) 

Frees the pointer with free().

Users of this library can use xmlBlasterFree() instead of free(). This can be helpful on Windows and if this client library is a DLL and compiled with /MT but the client code is not (or vice versa). In such a case the executable uses different runtime libraries with different instances of malloc/free. On UNIX we don't need this function but it doesn't harm either.

Definition at line 72 of file msgUtil.c.

Referenced by interceptUpdate(), main(), myUpdate(), xmlBlasterUnmanagedCEConnect(), xmlBlasterUnmanagedCEDisconnect(), xmlBlasterUnmanagedCEErase(), xmlBlasterUnmanagedCEExceptionFree(), xmlBlasterUnmanagedCEFree(), xmlBlasterUnmanagedCEFreePP(), xmlBlasterUnmanagedCEGet(), xmlBlasterUnmanagedCEPing(), xmlBlasterUnmanagedCESubscribe(), and xmlBlasterUnmanagedCEUnSubscribe().