socket/XmlBlasterUnmanagedCE.c File Reference

#include <string.h>
#include <stdio.h>
#include <XmlBlasterUnmanagedCE.h>
#include <stdarg.h>
#include <locale.h>

Include dependency graph for XmlBlasterUnmanagedCE.c:

Go to the source code of this file.

Defines

#define XBFORCE_EXTERNC

Functions

static void myLogger (void *logUserP, XMLBLASTER_LOG_LEVEL currLevel, XMLBLASTER_LOG_LEVEL level, char *location, char *fmt,...)
void xmlBlasterUnmanagedCERegisterLogger (struct XmlBlasterAccessUnparsed *xa, XmlBlasterUnmanagedCELoggerFp logger)
static void callbackProgressListener (void *userP, size_t currBytesRead, size_t nbytes)
 Access the read socket progress.
void xmlBlasterUnmanagedCERegisterProgressListener (struct XmlBlasterAccessUnparsed *xa, XmlBlasterUnmanagedCECallbackProgressListenerFp csharpProgressListenerFp)
 Called by managed C# code to register for progress notifications.
char * xmlBlasterUnmanagedCEMalloc (int32_t size)
 malloc size bytes
void xmlBlasterUnmanagedCEFree (char *p)
 Frees the malloced pointer.
void xmlBlasterUnmanagedCEFreePP (char **pp)
 Frees the content of the malloced pointer It is a hack as i don't know how to free the IntPtr which arrived as ** and was allocated on (*ppStruct) for example in unSubscribe(): So we call this function similar as the unSubscribe() .
static void convert (XmlBlasterException *in, XmlBlasterUnmanagedCEException *out)
 Allocates the members of XmlBlasterUnmanagedCEException You need to free it after usage.
void xmlBlasterUnmanagedCEExceptionFree (XmlBlasterUnmanagedCEException *ex)
static int interceptUpdate (MsgUnitArr *msgUnitArr, void *userData, XmlBlasterException *exception)
 We intercept the callbacks here and convert it to a more simple form to be easy transferable to C# (Csharp).
XmlBlasterAccessUnparsedgetXmlBlasterAccessUnparsedUnmanagedCE (int argc, char **argv)
void freeXmlBlasterAccessUnparsedUnmanagedCE (XmlBlasterAccessUnparsed *xmlBlasterAccess)
int xmlBlasterUnmanagedCEInitialize (struct XmlBlasterAccessUnparsed *xa, XmlBlasterUnmanagedCEUpdateFp update, XmlBlasterUnmanagedCEException *exception)
char * xmlBlasterUnmanagedCEConnect (struct XmlBlasterAccessUnparsed *xa, char *qos, XmlBlasterUnmanagedCEUpdateFp update, XmlBlasterUnmanagedCEException *exception)
 Your qos is freed.
int xmlBlasterUnmanagedCEDisconnect (struct XmlBlasterAccessUnparsed *xa, char *qos, XmlBlasterUnmanagedCEException *exception)
 Your qos is freed.
char * xmlBlasterUnmanagedCEPublish (struct XmlBlasterAccessUnparsed *xa, MsgUnitUnmanagedCEpublish *msgUnitUnmanaged, XmlBlasterUnmanagedCEException *exception)
QosArrxmlBlasterUnmanagedCEPublishArr (struct XmlBlasterAccessUnparsed *xa, MsgUnitArr *msgUnitArr, XmlBlasterUnmanagedCEException *exception)
void xmlBlasterUnmanagedCEPublishOneway (struct XmlBlasterAccessUnparsed *xa, void *msgUnitArr, int length, XmlBlasterUnmanagedCEException *exception)
char * xmlBlasterUnmanagedCESubscribe (struct XmlBlasterAccessUnparsed *xa, char *key, char *qos, XmlBlasterUnmanagedCEException *exception)
 Your key and qos is freed.
void xmlBlasterUnmanagedCEUnSubscribe (struct XmlBlasterAccessUnparsed *xa, char *key, char *qos, XmlBlasterUnmanagedCEException *exception, uint32_t *pSize, XmlBlasterUnmanagedCEStringArr **ppStruct)
void xmlBlasterUnmanagedCEErase (struct XmlBlasterAccessUnparsed *xa, char *key, char *qos, XmlBlasterUnmanagedCEException *exception, uint32_t *pSize, XmlBlasterUnmanagedCEStringArr **ppStruct)
void xmlBlasterUnmanagedCEGet (struct XmlBlasterAccessUnparsed *xa, char *key, char *qos, XmlBlasterUnmanagedCEException *exception, uint32_t *pSize, MsgUnitUnmanagedCEget **ppStruct)
char * xmlBlasterUnmanagedCEPing (struct XmlBlasterAccessUnparsed *xa, char *qos, XmlBlasterUnmanagedCEException *exception)
int xmlBlasterUnmanagedCEIsConnected (struct XmlBlasterAccessUnparsed *xa)
char * xmlBlasterUnmanagedCEUsage ()
char * xmlBlasterUnmanagedCEVersion ()
char * getXmlBlasterEmei ()
 You need to add cellcore.lib for compilation (WINCE).

Variables

static int freeIt = 1


Define Documentation

#define XBFORCE_EXTERNC

Definition at line 22 of file XmlBlasterUnmanagedCE.c.


Function Documentation

static void callbackProgressListener ( void *  userP,
size_t  currBytesRead,
size_t  nbytes 
) [static]

Access the read socket progress.

You need to register this function pointer if you want to see the progress of huge messages on slow connections.

Definition at line 115 of file XmlBlasterUnmanagedCE.c.

Referenced by main(), and xmlBlasterUnmanagedCERegisterProgressListener().

static void convert ( XmlBlasterException in,
XmlBlasterUnmanagedCEException out 
) [static]

Allocates the members of XmlBlasterUnmanagedCEException You need to free it after usage.

Definition at line 186 of file XmlBlasterUnmanagedCE.c.

References XmlBlasterUnmanagedCEException::errorCode, ExceptionStruct::errorCode, ExceptionStruct::message, XmlBlasterUnmanagedCEException::message, ExceptionStruct::remote, XmlBlasterUnmanagedCEException::remote, and strcpyAlloc().

Here is the call graph for this function:

void freeXmlBlasterAccessUnparsedUnmanagedCE ( XmlBlasterAccessUnparsed xmlBlasterAccess  ) 

Definition at line 293 of file XmlBlasterUnmanagedCE.c.

References XmlBlasterAccessUnparsed::argc, XmlBlasterAccessUnparsed::argv, and freeXmlBlasterAccessUnparsed().

Here is the call graph for this function:

XmlBlasterAccessUnparsed* getXmlBlasterAccessUnparsedUnmanagedCE ( int  argc,
char **  argv 
)

Definition at line 278 of file XmlBlasterUnmanagedCE.c.

References getXmlBlasterAccessUnparsed(), and strcpyAlloc().

Here is the call graph for this function:

char* getXmlBlasterEmei (  ) 

You need to add cellcore.lib for compilation (WINCE).

TODO: Not yet tested: What is inside the lineGeneralInfo.dwSerialNumberOffset?? TODO: Needs security model?

Returns:
malloced string with IMEI, you need to free it

Definition at line 572 of file XmlBlasterUnmanagedCE.c.

static int interceptUpdate ( MsgUnitArr msgUnitArr,
void *  userData,
XmlBlasterException exception 
) [static]

We intercept the callbacks here and convert it to a more simple form to be easy transferable to C# (Csharp).

Definition at line 211 of file XmlBlasterUnmanagedCE.c.

References ExceptionStruct::errorCode, XmlBlasterUnmanagedCEException::errorCode, EXCEPTIONSTRUCT_ERRORCODE_LEN, EXCEPTIONSTRUCT_MESSAGE_LEN, MsgUnitStructArr::isOneway, MsgUnitStructArr::len, XmlBlasterAccessUnparsed::log, XmlBlasterAccessUnparsed::logLevel, XmlBlasterAccessUnparsed::logUserP, ExceptionStruct::message, XmlBlasterUnmanagedCEException::message, MsgUnitStructArr::msgUnitArr, ExceptionStruct::remote, XmlBlasterUnmanagedCEException::remote, MsgUnit::responseQos, MsgUnitStructArr::secretSessionId, strcpyAlloc(), strncpy0(), XmlBlasterAccessUnparsed::userFp, XMLBLASTER_C_bool, XMLBLASTER_LOG_TRACE, XMLBLASTER_LOG_WARN, and xmlBlasterUnmanagedCEExceptionFree().

Here is the call graph for this function:

static void myLogger ( void *  logUserP,
XMLBLASTER_LOG_LEVEL  currLevel,
XMLBLASTER_LOG_LEVEL  level,
char *  location,
char *  fmt,
  ... 
) [static]

Definition at line 38 of file XmlBlasterUnmanagedCE.c.

References VSNPRINTF.

Referenced by main(), and xmlBlasterUnmanagedCERegisterLogger().

char* xmlBlasterUnmanagedCEConnect ( struct XmlBlasterAccessUnparsed xa,
char *  qos,
XmlBlasterUnmanagedCEUpdateFp  update,
XmlBlasterUnmanagedCEException exception 
)

Your qos is freed.

Definition at line 316 of file XmlBlasterUnmanagedCE.c.

References XmlBlasterAccessUnparsed::connect, convert(), freeIt, interceptUpdate(), XmlBlasterAccessUnparsed::userFp, and xmlBlasterFree().

Here is the call graph for this function:

int xmlBlasterUnmanagedCEDisconnect ( struct XmlBlasterAccessUnparsed xa,
char *  qos,
XmlBlasterUnmanagedCEException exception 
)

Your qos is freed.

Definition at line 332 of file XmlBlasterUnmanagedCE.c.

References convert(), XmlBlasterAccessUnparsed::disconnect, freeIt, and xmlBlasterFree().

Here is the call graph for this function:

void xmlBlasterUnmanagedCEErase ( struct XmlBlasterAccessUnparsed xa,
char *  key,
char *  qos,
XmlBlasterUnmanagedCEException exception,
uint32_t *  pSize,
XmlBlasterUnmanagedCEStringArr **  ppStruct 
)

Definition at line 417 of file XmlBlasterUnmanagedCE.c.

References convert(), XmlBlasterAccessUnparsed::erase, ExceptionStruct::errorCode, freeIt, freeQosArr(), initializeXmlBlasterException(), QosStructArr::len, QosStructArr::qosArr, XmlBlasterUnmanagedCEStringArr::str, strcpyAlloc(), and xmlBlasterFree().

Here is the call graph for this function:

void xmlBlasterUnmanagedCEExceptionFree ( XmlBlasterUnmanagedCEException ex  ) 

Definition at line 197 of file XmlBlasterUnmanagedCE.c.

References XmlBlasterUnmanagedCEException::errorCode, XmlBlasterUnmanagedCEException::message, XmlBlasterUnmanagedCEException::remote, and xmlBlasterFree().

Referenced by interceptUpdate().

Here is the call graph for this function:

void xmlBlasterUnmanagedCEFree ( char *  p  ) 

Frees the malloced pointer.

Parameters:
p Can be null

Definition at line 160 of file XmlBlasterUnmanagedCE.c.

References xmlBlasterFree().

Here is the call graph for this function:

void xmlBlasterUnmanagedCEFreePP ( char **  pp  ) 

Frees the content of the malloced pointer It is a hack as i don't know how to free the IntPtr which arrived as ** and was allocated on (*ppStruct) for example in unSubscribe(): So we call this function similar as the unSubscribe() .

..

Parameters:
pp Can be null

Definition at line 172 of file XmlBlasterUnmanagedCE.c.

References xmlBlasterFree().

Here is the call graph for this function:

void xmlBlasterUnmanagedCEGet ( struct XmlBlasterAccessUnparsed xa,
char *  key,
char *  qos,
XmlBlasterUnmanagedCEException exception,
uint32_t *  pSize,
MsgUnitUnmanagedCEget **  ppStruct 
)

Definition at line 450 of file XmlBlasterUnmanagedCE.c.

References MsgUnit::content, MsgUnit::contentLen, convert(), ExceptionStruct::errorCode, freeIt, freeMsgUnitArr(), XmlBlasterAccessUnparsed::get, MsgUnit::key, MsgUnitStructArr::len, MsgUnitStructArr::msgUnitArr, MsgUnit::qos, MsgUnit::responseQos, strcpyAlloc(), and xmlBlasterFree().

Here is the call graph for this function:

int xmlBlasterUnmanagedCEInitialize ( struct XmlBlasterAccessUnparsed xa,
XmlBlasterUnmanagedCEUpdateFp  update,
XmlBlasterUnmanagedCEException exception 
)

Definition at line 303 of file XmlBlasterUnmanagedCE.c.

References convert(), XmlBlasterAccessUnparsed::initialize, interceptUpdate(), and XmlBlasterAccessUnparsed::userFp.

Here is the call graph for this function:

int xmlBlasterUnmanagedCEIsConnected ( struct XmlBlasterAccessUnparsed xa  ) 

Definition at line 511 of file XmlBlasterUnmanagedCE.c.

References XmlBlasterAccessUnparsed::isConnected.

char* xmlBlasterUnmanagedCEMalloc ( int32_t  size  ) 

malloc size bytes

Parameters:
size > 0
Returns:
p the allocated pointer

Definition at line 149 of file XmlBlasterUnmanagedCE.c.

char* xmlBlasterUnmanagedCEPing ( struct XmlBlasterAccessUnparsed xa,
char *  qos,
XmlBlasterUnmanagedCEException exception 
)

Definition at line 503 of file XmlBlasterUnmanagedCE.c.

References convert(), freeIt, XmlBlasterAccessUnparsed::ping, and xmlBlasterFree().

Here is the call graph for this function:

char* xmlBlasterUnmanagedCEPublish ( struct XmlBlasterAccessUnparsed xa,
MsgUnitUnmanagedCEpublish msgUnitUnmanaged,
XmlBlasterUnmanagedCEException exception 
)

Definition at line 341 of file XmlBlasterUnmanagedCE.c.

References convert(), freeIt, freeMsgUnitData(), and XmlBlasterAccessUnparsed::publish.

Here is the call graph for this function:

QosArr* xmlBlasterUnmanagedCEPublishArr ( struct XmlBlasterAccessUnparsed xa,
MsgUnitArr msgUnitArr,
XmlBlasterUnmanagedCEException exception 
)

Definition at line 350 of file XmlBlasterUnmanagedCE.c.

References convert(), and XmlBlasterAccessUnparsed::publishArr.

Here is the call graph for this function:

void xmlBlasterUnmanagedCEPublishOneway ( struct XmlBlasterAccessUnparsed xa,
void *  msgUnitArr,
int  length,
XmlBlasterUnmanagedCEException exception 
)

Definition at line 357 of file XmlBlasterUnmanagedCE.c.

References convert(), freeIt, freeMsgUnitData(), MsgUnitStructArr::isOneway, MsgUnitStructArr::len, MsgUnitStructArr::msgUnitArr, XmlBlasterAccessUnparsed::publishOneway, and MsgUnitStructArr::secretSessionId.

Here is the call graph for this function:

void xmlBlasterUnmanagedCERegisterLogger ( struct XmlBlasterAccessUnparsed xa,
XmlBlasterUnmanagedCELoggerFp  logger 
)

Definition at line 91 of file XmlBlasterUnmanagedCE.c.

References XmlBlasterAccessUnparsed::log, XmlBlasterAccessUnparsed::logUserP, and myLogger().

Here is the call graph for this function:

void xmlBlasterUnmanagedCERegisterProgressListener ( struct XmlBlasterAccessUnparsed xa,
XmlBlasterUnmanagedCECallbackProgressListenerFp  csharpProgressListenerFp 
)

Called by managed C# code to register for progress notifications.

Definition at line 128 of file XmlBlasterUnmanagedCE.c.

References XmlBlasterAccessUnparsed::callbackP, callbackProgressListener(), XmlBlasterReadFromSocketFuncHolder::numReadFuncP, XmlBlasterReadFromSocketFuncHolder::numReadUserP, and CallbackServerUnparsedStruct::readFromSocket.

Here is the call graph for this function:

char* xmlBlasterUnmanagedCESubscribe ( struct XmlBlasterAccessUnparsed xa,
char *  key,
char *  qos,
XmlBlasterUnmanagedCEException exception 
)

Your key and qos is freed.

Definition at line 379 of file XmlBlasterUnmanagedCE.c.

References convert(), freeIt, XmlBlasterAccessUnparsed::subscribe, and xmlBlasterFree().

Here is the call graph for this function:

void xmlBlasterUnmanagedCEUnSubscribe ( struct XmlBlasterAccessUnparsed xa,
char *  key,
char *  qos,
XmlBlasterUnmanagedCEException exception,
uint32_t *  pSize,
XmlBlasterUnmanagedCEStringArr **  ppStruct 
)

Definition at line 388 of file XmlBlasterUnmanagedCE.c.

References convert(), ExceptionStruct::errorCode, freeIt, freeQosArr(), initializeXmlBlasterException(), QosStructArr::len, QosStructArr::qosArr, XmlBlasterUnmanagedCEStringArr::str, strcpyAlloc(), XmlBlasterAccessUnparsed::unSubscribe, and xmlBlasterFree().

Here is the call graph for this function:

char* xmlBlasterUnmanagedCEUsage (  ) 

Definition at line 515 of file XmlBlasterUnmanagedCE.c.

References XMLBLASTER_MAX_USAGE_LEN, and xmlBlasterAccessUnparsedUsage().

Here is the call graph for this function:

char* xmlBlasterUnmanagedCEVersion (  ) 

Definition at line 520 of file XmlBlasterUnmanagedCE.c.

References getXmlBlasterVersion(), and strcpyAlloc().

Here is the call graph for this function:


Variable Documentation

int freeIt = 1 [static]

Definition at line 25 of file XmlBlasterUnmanagedCE.c.

Referenced by xmlBlasterUnmanagedCEConnect(), xmlBlasterUnmanagedCEDisconnect(), xmlBlasterUnmanagedCEErase(), xmlBlasterUnmanagedCEGet(), xmlBlasterUnmanagedCEPing(), xmlBlasterUnmanagedCEPublish(), xmlBlasterUnmanagedCEPublishOneway(), xmlBlasterUnmanagedCESubscribe(), and xmlBlasterUnmanagedCEUnSubscribe().