socket/XmlBlasterConnectionUnparsed.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <socket/xmlBlasterSocket.h>
#include <socket/xmlBlasterZlib.h>
#include <XmlBlasterConnectionUnparsed.h>

Include dependency graph for XmlBlasterConnectionUnparsed.c:

Go to the source code of this file.

Defines

#define SOCKET_TCP   false

Functions

static int initConnection (XmlBlasterConnectionUnparsed *xb, XmlBlasterException *exception)
 Connects on TCP/IP level to xmlBlaster.
static int xmlBlasterInitQueue (XmlBlasterConnectionUnparsed *xb, QueueProperties *queueProperties, XmlBlasterException *exception)
 Set the queue properties.
static int getResponse (XmlBlasterConnectionUnparsed *xb, SocketDataHolder *responseSocketDataHolder, XmlBlasterException *exception, int udp)
 Parse the returned message from xmlBlaster.
static char * xmlBlasterConnect (XmlBlasterConnectionUnparsed *xb, char *qos, XmlBlasterException *exception)
 Connect to the server.
static int xmlBlasterDisconnect (XmlBlasterConnectionUnparsed *xb, char *qos, XmlBlasterException *exception)
 Disconnect from server.
static char * xmlBlasterPublish (XmlBlasterConnectionUnparsed *xb, MsgUnit *msgUnit, XmlBlasterException *exception)
 Publish a message to the server.
static QosArrxmlBlasterPublishArr (XmlBlasterConnectionUnparsed *xb, MsgUnitArr *msgUnitArr, XmlBlasterException *exception)
 Publish a message array in a bulk to the server.
static void xmlBlasterPublishOneway (XmlBlasterConnectionUnparsed *xb, MsgUnitArr *msgUnitArr, XmlBlasterException *exception)
 Publish oneway a message array in a bulk to the server without receiving an ACK.
static char * xmlBlasterSubscribe (XmlBlasterConnectionUnparsed *xb, char *key, char *qos, XmlBlasterException *exception)
 Subscribe a message.
static QosArrxmlBlasterUnSubscribe (XmlBlasterConnectionUnparsed *xb, char *key, char *qos, XmlBlasterException *exception)
 UnSubscribe a message from the server.
static QosArrxmlBlasterErase (XmlBlasterConnectionUnparsed *xb, char *key, char *qos, XmlBlasterException *exception)
 Erase a message from the server.
static MsgUnitArrxmlBlasterGet (XmlBlasterConnectionUnparsed *xb, char *key, char *qos, XmlBlasterException *exception)
 Get a message.
static char * xmlBlasterPing (XmlBlasterConnectionUnparsed *xb, char *qos, XmlBlasterException *exception)
 Ping the server.
static int isConnected (XmlBlasterConnectionUnparsed *xb)
static void xmlBlasterConnectionShutdown (XmlBlasterConnectionUnparsed *xb)
 Used internally only, does no disconnect, only cleanup of socket.
static ssize_t writenPlain (void *userP, int fd, char *ptr, size_t nbytes)
 Write uncompressed to socket (not thread safe).
static ssize_t writenCompressed (void *userP, int fd, char *ptr, size_t nbytes)
 Compress data and send to socket.
static ssize_t readnPlain (void *userP, int fd, char *ptr, size_t nbytes, XmlBlasterNumReadFunc fpNumRead, void *userP2)
 Write uncompressed to socket (not thread safe).
static ssize_t readnCompressed (void *userP, int fd, char *ptr, size_t nbytes, XmlBlasterNumReadFunc fpNumRead, void *userP2)
 Compress data and send to socket.
static int checkArgs (XmlBlasterConnectionUnparsed *xb, char *methodName, int checkIsConnected, XmlBlasterException *exception)
 Checks the given arguments to be valid.
XmlBlasterConnectionUnparsedgetXmlBlasterConnectionUnparsed (int argc, char **argv)
 Create a new instance to handle a synchronous connection to the server.
void freeXmlBlasterConnectionUnparsed (XmlBlasterConnectionUnparsed **xb_)
 Free your instance after accessing xmlBlaster.
char * xmlBlasterConnectionUnparsedUsage ()
 Help usage.
static int sendData (XmlBlasterConnectionUnparsed *xb, char *methodName, enum XMLBLASTER_MSG_TYPE_ENUM msgType, char *data_, size_t dataLen_, SocketDataHolder *responseSocketDataHolder, XmlBlasterException *exception, int udp)
 Send a message over the socket to xmlBlaster.


Define Documentation

#define SOCKET_TCP   false

Definition at line 29 of file XmlBlasterConnectionUnparsed.c.

Referenced by xmlBlasterConnect(), xmlBlasterDisconnect(), xmlBlasterErase(), xmlBlasterGet(), xmlBlasterPing(), xmlBlasterPublish(), xmlBlasterPublishArr(), xmlBlasterSubscribe(), and xmlBlasterUnSubscribe().


Function Documentation

static int checkArgs ( XmlBlasterConnectionUnparsed xb,
char *  methodName,
int  checkIsConnected,
XmlBlasterException exception 
) [static]

Checks the given arguments to be valid.

Parameters:
methodName For logging
checkIsConnected If true does check the connection state as well
Returns:
false if the parameters are not usable, in this case 'exception' is filled with detail informations

Definition at line 1376 of file XmlBlasterConnectionUnparsed.c.

References ExceptionStruct::errorCode, getStackTrace(), XmlBlasterConnectionUnparsedStruct::isConnected, XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, ExceptionStruct::message, SNPRINTF, strncpy0(), XMLBLASTER_LOG_ERROR, XMLBLASTER_LOG_WARN, XMLBLASTEREXCEPTION_ERRORCODE_LEN, and XMLBLASTEREXCEPTION_MESSAGE_LEN.

Here is the call graph for this function:

void freeXmlBlasterConnectionUnparsed ( XmlBlasterConnectionUnparsed **  xmlBlasterAccess  ) 

Free your instance after accessing xmlBlaster.

After freeing *xmlBlasterAccess is set to null Call example: freeXmlBlasterConnectionUnparsed(&xa->connectionP);

Definition at line 105 of file XmlBlasterConnectionUnparsed.c.

References freeProperties(), XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, XmlBlasterConnectionUnparsedStruct::props, xmlBlaster_endZlibReader(), xmlBlaster_endZlibWriter(), XMLBLASTER_LOG_TRACE, xmlBlasterConnectionShutdown(), XmlBlasterConnectionUnparsedStruct::zlibReadBuf, and XmlBlasterConnectionUnparsedStruct::zlibWriteBuf.

Referenced by freeXmlBlasterAccessUnparsed(), getXmlBlasterConnectionUnparsed(), and initialize().

Here is the call graph for this function:

static int getResponse ( XmlBlasterConnectionUnparsed xb,
SocketDataHolder responseSocketDataHolder,
XmlBlasterException exception,
int  udp 
) [static]

Parse the returned message from xmlBlaster.

This method blocks until data arrives.
The responseSocketDataHolder holds all informations about the returned data from xmlBlaster, on error the exception struct is filled.

Parameters:
responseSocketDataHolder You need to free(responseSocketDataHolder->data) if return is 'true'.
exception Contains the exception thrown (on error only *exception->errorCode!=0)
Returns:
true if OK or on exception, false on EOF

Definition at line 782 of file XmlBlasterConnectionUnparsed.c.

References XmlBlasterConnectionUnparsedStruct::logLevel, parseSocketData(), XmlBlasterConnectionUnparsedStruct::readFromSocket, XmlBlasterConnectionUnparsedStruct::socketToXmlBlaster, and XMLBLASTER_LOG_DUMP.

Referenced by sendData().

Here is the call graph for this function:

XmlBlasterConnectionUnparsed* getXmlBlasterConnectionUnparsed ( int  argc,
char **  argv 
)

Create a new instance to handle a synchronous connection to the server.

This is usually the first call of a client.

Returns:
NULL if bootstrapping failed. If not NULL you need to free() it when you are done usually by calling freeXmlBlasterConnectionUnparsed().

Definition at line 58 of file XmlBlasterConnectionUnparsed.c.

References XmlBlasterConnectionUnparsedStruct::argc, XmlBlasterConnectionUnparsedStruct::argv, XmlBlasterConnectionUnparsedStruct::connect, createProperties(), XmlBlasterConnectionUnparsedStruct::disconnect, XmlBlasterConnectionUnparsedStruct::erase, freeXmlBlasterConnectionUnparsed(), XmlBlasterConnectionUnparsedStruct::get, PropertiesStruct::getString, initConnection(), XmlBlasterConnectionUnparsedStruct::initConnection, XmlBlasterConnectionUnparsedStruct::initQueue, isConnected(), XmlBlasterConnectionUnparsedStruct::isConnected, XmlBlasterConnectionUnparsedStruct::isInitialized, XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, parseLogLevel(), XmlBlasterConnectionUnparsedStruct::ping, XmlBlasterConnectionUnparsedStruct::postSendEvent, XmlBlasterConnectionUnparsedStruct::postSendEvent_userP, XmlBlasterConnectionUnparsedStruct::preSendEvent, XmlBlasterConnectionUnparsedStruct::preSendEvent_userP, XmlBlasterConnectionUnparsedStruct::props, XmlBlasterConnectionUnparsedStruct::publish, XmlBlasterConnectionUnparsedStruct::publishArr, XmlBlasterConnectionUnparsedStruct::publishOneway, XmlBlasterConnectionUnparsedStruct::queueP, XmlBlasterConnectionUnparsedStruct::readFromSocket, XmlBlasterReadFromSocketFuncHolder::readFromSocketFuncP, XmlBlasterConnectionUnparsedStruct::requestId, XmlBlasterConnectionUnparsedStruct::secretSessionId, XmlBlasterConnectionUnparsedStruct::shutdown, XmlBlasterConnectionUnparsedStruct::socketToXmlBlaster, XmlBlasterConnectionUnparsedStruct::socketToXmlBlasterUdp, XmlBlasterConnectionUnparsedStruct::subscribe, XmlBlasterConnectionUnparsedStruct::unSubscribe, XmlBlasterReadFromSocketFuncHolder::userP, XmlBlasterWriteToSocketFuncHolder::userP, XmlBlasterConnectionUnparsedStruct::useUdpForOneway, XmlBlasterConnectionUnparsedStruct::writeToSocket, XmlBlasterWriteToSocketFuncHolder::writeToSocketFuncP, xmlBlasterConnect(), xmlBlasterConnectionShutdown(), xmlBlasterDefaultLogging(), xmlBlasterDisconnect(), xmlBlasterErase(), xmlBlasterGet(), xmlBlasterInitQueue(), xmlBlasterPing(), xmlBlasterPublish(), xmlBlasterPublishArr(), xmlBlasterPublishOneway(), xmlBlasterSubscribe(), xmlBlasterUnSubscribe(), XmlBlasterConnectionUnparsedStruct::zlibReadBuf, and XmlBlasterConnectionUnparsedStruct::zlibWriteBuf.

Here is the call graph for this function:

static int initConnection ( XmlBlasterConnectionUnparsed xb,
XmlBlasterException exception 
) [static]

Connects on TCP/IP level to xmlBlaster.

Returns:
true If the low level TCP/IP connect to xmlBlaster succeeded

Definition at line 131 of file XmlBlasterConnectionUnparsed.c.

References XmlBlasterZlibReadBuffers::debug, XmlBlasterZlibWriteBuffers::debug, ExceptionStruct::errorCode, PropertiesStruct::getBool, gethostbyname_re(), PropertiesStruct::getInt, PropertiesStruct::getString, XmlBlasterConnectionUnparsedStruct::isInitialized, XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, MAX_ERRNO_LEN, ExceptionStruct::message, XmlBlasterConnectionUnparsedStruct::props, XmlBlasterConnectionUnparsedStruct::readFromSocket, XmlBlasterReadFromSocketFuncHolder::readFromSocketFuncP, readnCompressed(), readnPlain(), XmlBlasterConnectionUnparsedStruct::secretSessionId, SNPRINTF, XmlBlasterConnectionUnparsedStruct::socketToXmlBlaster, XmlBlasterConnectionUnparsedStruct::socketToXmlBlasterUdp, strncpy0(), XmlBlasterConnectionUnparsedStruct::useUdpForOneway, writenCompressed(), writenPlain(), XmlBlasterConnectionUnparsedStruct::writeToSocket, XmlBlasterWriteToSocketFuncHolder::writeToSocketFuncP, xb_strerror(), xmlBlaster_initZlibReader(), xmlBlaster_initZlibWriter(), XMLBLASTER_LOG_DUMP, XMLBLASTER_LOG_ERROR, XMLBLASTER_LOG_INFO, XMLBLASTER_LOG_TRACE, XMLBLASTER_LOG_WARN, XMLBLASTEREXCEPTION_ERRORCODE_LEN, XMLBLASTEREXCEPTION_MESSAGE_LEN, XmlBlasterConnectionUnparsedStruct::zlibReadBuf, and XmlBlasterConnectionUnparsedStruct::zlibWriteBuf.

Referenced by getXmlBlasterConnectionUnparsed(), and xmlBlasterConnect().

Here is the call graph for this function:

static int isConnected ( XmlBlasterConnectionUnparsed xb  )  [static]

Definition at line 509 of file XmlBlasterConnectionUnparsed.c.

References XmlBlasterConnectionUnparsedStruct::socketToXmlBlaster.

static ssize_t readnCompressed ( void *  userP,
int  fd,
char *  ptr,
size_t  nbytes,
XmlBlasterNumReadFunc  fpNumRead,
void *  userP2 
) [static]

Compress data and send to socket.

Definition at line 1363 of file XmlBlasterConnectionUnparsed.c.

References XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, XMLBLASTER_LOG_TRACE, xmlBlaster_readnCompressed(), and XmlBlasterConnectionUnparsedStruct::zlibReadBuf.

Here is the call graph for this function:

static ssize_t readnPlain ( void *  xb,
int  fd,
char *  ptr,
size_t  nbytes,
XmlBlasterNumReadFunc  fpNumRead,
void *  userP2 
) [static]

Write uncompressed to socket (not thread safe).

Definition at line 1354 of file XmlBlasterConnectionUnparsed.c.

References XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, readn(), and XMLBLASTER_LOG_TRACE.

Here is the call graph for this function:

static int sendData ( XmlBlasterConnectionUnparsed xb,
char *  methodName,
enum XMLBLASTER_MSG_TYPE_ENUM  msgType,
char *  data_,
size_t  dataLen_,
SocketDataHolder responseSocketDataHolder,
XmlBlasterException exception,
int  udp 
) [static]

Send a message over the socket to xmlBlaster.

Parameters:
xb The this pointer
methodName The name of the remote method to invoke e.g. "connect"
msgType The type of message: INVOKE, RESPONSE, EXCEPTION
data The message payload to send, we take a clone so you can do with it what you want
dataLen The length of data in bytes
responseSocketDataHolder The returned data, you need to free it with free(response->data) if we returned true. Supply NULL for oneway messages.
exception The exception struct, exception->errorCode is filled on exception. You need to supply it.
udp Whether to use UDP or TCP. Supply true for UDP.
Returns:
true if OK and response is filled (if not oneway or exception or response itself)
false on error and exception is filled

Definition at line 581 of file XmlBlasterConnectionUnparsed.c.

References MsgRequestInfoStruct::blob, blobcpyAlloc(), blobDump(), convertToXmlBlasterException(), BlobHolder::data, BlobHolder::dataLen, encodeSocketMessage(), ExceptionStruct::errorCode, freeBlobDump(), freeBlobHolderContent(), getResponse(), initializeXmlBlasterException(), XmlBlasterConnectionUnparsedStruct::isConnected, XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, MAX_METHODNAME_LEN, MAX_REQUESTID_LEN, ExceptionStruct::message, MsgRequestInfoStruct::methodName, MSG_TYPE_EXCEPTION, XmlBlasterConnectionUnparsedStruct::postSendEvent, XmlBlasterConnectionUnparsedStruct::preSendEvent, XmlBlasterConnectionUnparsedStruct::preSendEvent_userP, XmlBlasterConnectionUnparsedStruct::requestId, MsgRequestInfoStruct::requestIdStr, MsgRequestInfoStruct::responseType, MsgRequestInfoStruct::rollback, XmlBlasterConnectionUnparsedStruct::secretSessionId, SNPRINTF, XmlBlasterConnectionUnparsedStruct::socketToXmlBlaster, XmlBlasterConnectionUnparsedStruct::socketToXmlBlasterUdp, strncpy0(), XmlBlasterWriteToSocketFuncHolder::userP, XmlBlasterConnectionUnparsedStruct::writeToSocket, XmlBlasterWriteToSocketFuncHolder::writeToSocketFuncP, MsgRequestInfoStruct::xa, xbl_isOneway(), XMLBLASTER_CONNECT, XMLBLASTER_LOG_DUMP, XMLBLASTER_LOG_ERROR, XMLBLASTER_LOG_TRACE, XMLBLASTER_LOG_WARN, XMLBLASTER_SOCKET_VERSION, xmlBlasterConnectionShutdown(), XMLBLASTEREXCEPTION_ERRORCODE_LEN, and XMLBLASTEREXCEPTION_MESSAGE_LEN.

Referenced by xmlBlasterConnect(), xmlBlasterDisconnect(), xmlBlasterErase(), xmlBlasterGet(), xmlBlasterPing(), xmlBlasterPublish(), xmlBlasterPublishArr(), xmlBlasterPublishOneway(), xmlBlasterSubscribe(), and xmlBlasterUnSubscribe().

Here is the call graph for this function:

static ssize_t writenCompressed ( void *  xb,
int  fd,
char *  ptr,
size_t  nbytes 
) [static]

Compress data and send to socket.

Definition at line 1345 of file XmlBlasterConnectionUnparsed.c.

References XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, XMLBLASTER_LOG_TRACE, xmlBlaster_writenCompressed(), and XmlBlasterConnectionUnparsedStruct::zlibWriteBuf.

Here is the call graph for this function:

static ssize_t writenPlain ( void *  xb,
int  fd,
char *  ptr,
size_t  nbytes 
) [static]

Write uncompressed to socket (not thread safe).

Definition at line 1336 of file XmlBlasterConnectionUnparsed.c.

References XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, writen(), and XMLBLASTER_LOG_TRACE.

Here is the call graph for this function:

static char * xmlBlasterConnect ( XmlBlasterConnectionUnparsed xb,
char *  qos,
XmlBlasterException exception 
) [static]

Connect to the server.

Parameters:
qos The QoS to connect
The exception struct, exception->errorCode is filled on exception
Returns:
The raw ConnectReturnQos XML string returned from xmlBlaster, only NULL if an exception is thrown. You need to free() it

The ConnectReturnQos raw xml string, you need to free() it

See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.connect.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 799 of file XmlBlasterConnectionUnparsed.c.

References SocketDataHolder::blob, BlobHolder::data, BlobHolder::dataLen, ExceptionStruct::errorCode, freeBlobHolderContent(), initConnection(), XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, MAX_SECRETSESSIONID_LEN, ExceptionStruct::message, MSG_TYPE_INVOKE, XmlBlasterConnectionUnparsedStruct::secretSessionId, sendData(), SNPRINTF, SOCKET_TCP, strFromBlobAlloc(), strncpy0(), XMLBLASTER_CONNECT, XMLBLASTER_LOG_TRACE, XMLBLASTEREXCEPTION_ERRORCODE_LEN, and XMLBLASTEREXCEPTION_MESSAGE_LEN.

Here is the call graph for this function:

static void xmlBlasterConnectionShutdown ( XmlBlasterConnectionUnparsed xb  )  [static]

Used internally only, does no disconnect, only cleanup of socket.

Definition at line 545 of file XmlBlasterConnectionUnparsed.c.

References closeSocket(), XmlBlasterConnectionUnparsedStruct::isConnected, XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, XmlBlasterConnectionUnparsedStruct::socketToXmlBlaster, XmlBlasterConnectionUnparsedStruct::socketToXmlBlasterUdp, and XMLBLASTER_LOG_TRACE.

Referenced by freeXmlBlasterConnectionUnparsed(), getXmlBlasterConnectionUnparsed(), sendData(), and xmlBlasterDisconnect().

Here is the call graph for this function:

char* xmlBlasterConnectionUnparsedUsage (  ) 

Help usage.

Definition at line 514 of file XmlBlasterConnectionUnparsed.c.

References strncat0(), and strncpy0().

Referenced by xmlBlasterAccessUnparsedUsage().

Here is the call graph for this function:

static int xmlBlasterDisconnect ( XmlBlasterConnectionUnparsed xb,
char *  qos,
XmlBlasterException exception 
) [static]

Disconnect from server.

Parameters:
qos The QoS to disconnect
The exception struct, exception->errorCode is filled on exception
Returns:
false on exception
See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.disconnect.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 858 of file XmlBlasterConnectionUnparsed.c.

References SocketDataHolder::blob, checkArgs(), freeBlobHolderContent(), MSG_TYPE_INVOKE, XmlBlasterConnectionUnparsedStruct::secretSessionId, sendData(), SOCKET_TCP, XMLBLASTER_DISCONNECT, and xmlBlasterConnectionShutdown().

Here is the call graph for this function:

static QosArr * xmlBlasterErase ( XmlBlasterConnectionUnparsed xb,
char *  key,
char *  qos,
XmlBlasterException exception 
) [static]

Erase a message from the server.

Returns:
A struct holding the raw QoS XML strings returned from xmlBlaster, only NULL if an exception is thrown. You need to freeQosArr() it
See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.erase.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 1197 of file XmlBlasterConnectionUnparsed.c.

References SocketDataHolder::blob, checkArgs(), BlobHolder::data, BlobHolder::dataLen, ExceptionStruct::errorCode, freeBlobHolderContent(), QosStructArr::len, XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, ExceptionStruct::message, MSG_TYPE_INVOKE, parseQosArr(), QosStructArr::qosArr, sendData(), SNPRINTF, SOCKET_TCP, strncpy0(), XMLBLASTER_ERASE, XMLBLASTER_LOG_TRACE, XMLBLASTEREXCEPTION_ERRORCODE_LEN, and XMLBLASTEREXCEPTION_MESSAGE_LEN.

Here is the call graph for this function:

static MsgUnitArr * xmlBlasterGet ( XmlBlasterConnectionUnparsed xb,
char *  key,
char *  qos,
XmlBlasterException exception 
) [static]

Get a message.

See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.get.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Returns:
NULL on error, please check exception in such a case, you need to call freeMsgUnitArr(msgUnitArr); after usage.

Definition at line 1286 of file XmlBlasterConnectionUnparsed.c.

References SocketDataHolder::blob, BlobHolder::data, BlobHolder::dataLen, ExceptionStruct::errorCode, freeBlobHolderContent(), MsgUnitStructArr::len, XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, ExceptionStruct::message, MSG_TYPE_INVOKE, parseMsgUnitArr(), sendData(), SNPRINTF, SOCKET_TCP, strncpy0(), XMLBLASTER_GET, XMLBLASTER_LOG_TRACE, XMLBLASTEREXCEPTION_ERRORCODE_LEN, and XMLBLASTEREXCEPTION_MESSAGE_LEN.

Here is the call graph for this function:

static int xmlBlasterInitQueue ( XmlBlasterConnectionUnparsed xb,
QueueProperties queueProperties,
XmlBlasterException exception 
) [static]

Set the queue properties.

Example:

   QueueProperties queueProperties;
   strncpy0(queueProperties.dbName, "xmlBlasterClient.db", QUEUE_DBNAME_MAX);
   strncpy0(queueProperties.nodeId, "clientJoe1081594557415", QUEUE_ID_MAX);
   strncpy0(queueProperties.queueName, "connection_clientJoe", QUEUE_ID_MAX);
   strncpy0(queueProperties.tablePrefix, "XB_", QUEUE_PREFIX_MAX);
   queueProperties.maxNumOfEntries = 10000000L;
   queueProperties.maxNumOfBytes = 1000000000LL;
 
 
Parameters:
queueProperties The queue configuration, if 0 or parts of it are empty it will be initialized by environment settings
Returns:
true on success
Exceptions:
exception if already initialized or if initialization fails

Definition at line 449 of file XmlBlasterConnectionUnparsed.c.

References checkArgs(), createQueue(), QueueProperties::dbName, embedException(), ExceptionStruct::errorCode, PropertiesStruct::getInt, PropertiesStruct::getInt64, PropertiesStruct::getString, XmlBlasterConnectionUnparsedStruct::log, QueueProperties::logFp, QueueProperties::logLevel, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, QueueProperties::maxNumOfBytes, QueueProperties::maxNumOfEntries, ExceptionStruct::message, XmlBlasterConnectionUnparsedStruct::props, QUEUE_DBNAME_MAX, QUEUE_ID_MAX, QUEUE_PREFIX_MAX, QueueProperties::queueName, XmlBlasterConnectionUnparsedStruct::queueP, SNPRINTF, strncpy0(), QueueProperties::tablePrefix, I_QueueStruct::userObject, QueueProperties::userObject, XMLBLASTER_LOG_ERROR, XMLBLASTER_LOG_WARN, XMLBLASTEREXCEPTION_ERRORCODE_LEN, and XMLBLASTEREXCEPTION_MESSAGE_LEN.

Referenced by getXmlBlasterConnectionUnparsed().

Here is the call graph for this function:

static char * xmlBlasterPing ( XmlBlasterConnectionUnparsed xb,
char *  qos,
XmlBlasterException exception 
) [static]

Ping the server.

Parameters:
qos The QoS or 0
exception *errorCode!=0 on failure
Returns:
The ping return QoS raw xml string, you need to free() it or 0 on failure (in which case *exception.errorCode!='')
See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 1259 of file XmlBlasterConnectionUnparsed.c.

References SocketDataHolder::blob, checkArgs(), BlobHolder::data, BlobHolder::dataLen, freeBlobHolderContent(), XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, MSG_TYPE_INVOKE, sendData(), SOCKET_TCP, strFromBlobAlloc(), XMLBLASTER_LOG_TRACE, and XMLBLASTER_PING.

Here is the call graph for this function:

static char * xmlBlasterPublish ( XmlBlasterConnectionUnparsed xb,
MsgUnit msgUnit,
XmlBlasterException exception 
) [static]

Publish a message to the server.

Returns:
The raw XML string returned from xmlBlaster, only NULL if an exception is thrown You need to free() it
See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.publish.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 967 of file XmlBlasterConnectionUnparsed.c.

References SocketDataHolder::blob, checkArgs(), BlobHolder::data, BlobHolder::dataLen, encodeMsgUnit(), ExceptionStruct::errorCode, freeBlobHolderContent(), XmlBlasterConnectionUnparsedStruct::logLevel, MSG_TYPE_INVOKE, MsgUnit::qos, MsgUnit::responseQos, sendData(), SOCKET_TCP, strFromBlobAlloc(), XMLBLASTER_LOG_DUMP, and XMLBLASTER_PUBLISH.

Here is the call graph for this function:

static QosArr * xmlBlasterPublishArr ( XmlBlasterConnectionUnparsed xb,
MsgUnitArr msgUnitArr,
XmlBlasterException exception 
) [static]

Publish a message array in a bulk to the server.

Returns:
The raw XML string array returned from xmlBlaster, only NULL if an exception is thrown You need to free() it
See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.publish.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 1009 of file XmlBlasterConnectionUnparsed.c.

References checkArgs(), BlobHolder::data, BlobHolder::dataLen, encodeMsgUnitArr(), MsgUnitStructArr::len, XmlBlasterConnectionUnparsedStruct::logLevel, MSG_TYPE_INVOKE, MsgUnitStructArr::msgUnitArr, MsgUnit::responseQos, sendData(), SOCKET_TCP, XMLBLASTER_LOG_DUMP, and XMLBLASTER_PUBLISH.

Here is the call graph for this function:

static void xmlBlasterPublishOneway ( XmlBlasterConnectionUnparsed xb,
MsgUnitArr msgUnitArr,
XmlBlasterException exception 
) [static]

Publish oneway a message array in a bulk to the server without receiving an ACK.

See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.publish.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 1040 of file XmlBlasterConnectionUnparsed.c.

References checkArgs(), BlobHolder::data, BlobHolder::dataLen, encodeMsgUnitArr(), MsgUnitStructArr::len, XmlBlasterConnectionUnparsedStruct::logLevel, MSG_TYPE_INVOKE, MsgUnitStructArr::msgUnitArr, MsgUnit::responseQos, sendData(), XmlBlasterConnectionUnparsedStruct::useUdpForOneway, XMLBLASTER_LOG_DUMP, and XMLBLASTER_PUBLISH_ONEWAY.

Here is the call graph for this function:

static char * xmlBlasterSubscribe ( XmlBlasterConnectionUnparsed xb,
char *  key,
char *  qos,
XmlBlasterException exception 
) [static]

Subscribe a message.

Returns:
The raw XML string returned from xmlBlaster, only NULL if an exception is thrown You need to free() it
See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.subscribe.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 1079 of file XmlBlasterConnectionUnparsed.c.

References SocketDataHolder::blob, checkArgs(), BlobHolder::data, BlobHolder::dataLen, ExceptionStruct::errorCode, freeBlobHolderContent(), XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, ExceptionStruct::message, MSG_TYPE_INVOKE, sendData(), SNPRINTF, SOCKET_TCP, strFromBlobAlloc(), strncpy0(), XMLBLASTER_LOG_TRACE, XMLBLASTER_SUBSCRIBE, XMLBLASTEREXCEPTION_ERRORCODE_LEN, and XMLBLASTEREXCEPTION_MESSAGE_LEN.

Here is the call graph for this function:

static QosArr * xmlBlasterUnSubscribe ( XmlBlasterConnectionUnparsed xb,
char *  key,
char *  qos,
XmlBlasterException exception 
) [static]

UnSubscribe a message from the server.

Returns:
The raw QoS XML strings returned from xmlBlaster, only NULL if an exception is thrown You need to free it with freeQosArr() after usage
See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.unSubscribe.html

http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.socket.html

Definition at line 1135 of file XmlBlasterConnectionUnparsed.c.

References SocketDataHolder::blob, checkArgs(), BlobHolder::data, BlobHolder::dataLen, ExceptionStruct::errorCode, freeBlobHolderContent(), QosStructArr::len, XmlBlasterConnectionUnparsedStruct::log, XmlBlasterConnectionUnparsedStruct::logLevel, XmlBlasterConnectionUnparsedStruct::logUserP, ExceptionStruct::message, MSG_TYPE_INVOKE, parseQosArr(), QosStructArr::qosArr, sendData(), SNPRINTF, SOCKET_TCP, strncpy0(), XMLBLASTER_LOG_TRACE, XMLBLASTER_UNSUBSCRIBE, XMLBLASTEREXCEPTION_ERRORCODE_LEN, and XMLBLASTEREXCEPTION_MESSAGE_LEN.

Here is the call graph for this function: