CallbackServerUnparsed.h File Reference

#include <util/msgUtil.h>
#include <util/Properties.h>
#include "socket/xmlBlasterSocket.h"

Include dependency graph for CallbackServerUnparsed.h:

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

Go to the source code of this file.

Data Structures

struct  ResponseListenerStruct
struct  CallbackServerUnparsedStruct
 This structure holds a complete callback server instance. More...
struct  ListenLoopArgsStruct
 Auxiliary struct for passing parameters to listening threads. More...

Defines

#define DEFAULT_CALLBACK_SERVER_PORT   7611
#define MAX_RESPONSE_LISTENER_SIZE   100

Typedefs

typedef CallbackServerUnparsedStruct CallbackServerUnparsed
typedef int(*) UseThisSocket (CallbackServerUnparsed *cb, int socketToUse, int socketToUseUdp)
 Use this function directly after creation of the callback server if you want to force to reuse the given socket for callbacks.
typedef int(*) InitCallbackServer (CallbackServerUnparsed *cb)
typedef int(*) IsListening (CallbackServerUnparsed *cb)
 
Returns:
true if the socket is open and waits for callback messages

typedef void(*) UpdateCbFp (MsgUnitArr *msg, void *userData, XmlBlasterException *xmlBlasterException, void *socketDataHolder)
 Here we asynchronously receive the callback from xmlBlaster.
typedef void(*) ShutdownCallbackServerRaw (CallbackServerUnparsed *cb)
typedef void(*) CallbackServerUnparsedSendResponse (CallbackServerUnparsed *cb, void *socketDataHolder, MsgUnitArr *msgUnitArr)
typedef void(*) CallbackServerUnparsedSendXmlBlasterException (CallbackServerUnparsed *cb, void *socketDataHolder, XmlBlasterException *exception)
typedef void(*) CallbackServerUnparsedDoRespond (int success, CallbackServerUnparsed *cb, void *socketDataHolder, MsgUnitArr *msgUnitArrP, XmlBlasterException *exception)
typedef void(*) ResponseFp (MsgRequestInfo *msgRequestInfoP, void *socketDataHolder)
typedef ResponseListenerStruct ResponseListener
typedef int(*) AddResponseListener (CallbackServerUnparsed *cb, MsgRequestInfo *msgRequestInfoP, ResponseFp responseEventFp)
typedef ResponseListener *(*) RemoveResponseListener (CallbackServerUnparsed *cb, const char *requestId)
typedef void(*) CallbackServerUnparsedLogging (void *logUserP, XMLBLASTER_LOG_LEVEL currLevel, XMLBLASTER_LOG_LEVEL level, const char *location, const char *fmt,...)
typedef ListenLoopArgsStruct ListenLoopArgs
 Auxiliary struct for passing parameters to listening threads.
typedef void *(*) cbFp (void *)
 Function pointer for pthread, the method to invoke on thread creation.

Functions

CallbackServerUnparsedgetCallbackServerUnparsed (int argc, const char *const *argv, UpdateCbFp updateCb, void *userData)
 Get a new instance of a callback server struct.
void freeCallbackServerUnparsed (CallbackServerUnparsed **callbackData)
 free() the CallbackServerUnparsed structure and sets *callbackData to 0 Call freeCallbackServerUnparsed(&cb);
const char * callbackServerRawUsage ()
 Help on configuration.


Define Documentation

#define DEFAULT_CALLBACK_SERVER_PORT   7611

Definition at line 29 of file CallbackServerUnparsed.h.

Referenced by getCallbackServerUnparsed().

#define MAX_RESPONSE_LISTENER_SIZE   100

Definition at line 81 of file CallbackServerUnparsed.h.

Referenced by addResponseListener(), getCallbackServerUnparsed(), getResponseListener(), handleMessage(), and removeResponseListener().


Typedef Documentation

typedef int( * ) AddResponseListener(CallbackServerUnparsed *cb, MsgRequestInfo *msgRequestInfoP, ResponseFp responseEventFp)

Definition at line 92 of file CallbackServerUnparsed.h.

typedef struct CallbackServerUnparsedStruct CallbackServerUnparsed

Definition at line 34 of file CallbackServerUnparsed.h.

typedef void( * ) CallbackServerUnparsedDoRespond(int success, CallbackServerUnparsed *cb, void *socketDataHolder, MsgUnitArr *msgUnitArrP, XmlBlasterException *exception)

Definition at line 79 of file CallbackServerUnparsed.h.

typedef void( * ) CallbackServerUnparsedLogging(void *logUserP, XMLBLASTER_LOG_LEVEL currLevel, XMLBLASTER_LOG_LEVEL level, const char *location, const char *fmt,...)

Definition at line 95 of file CallbackServerUnparsed.h.

typedef void( * ) CallbackServerUnparsedSendResponse(CallbackServerUnparsed *cb, void *socketDataHolder, MsgUnitArr *msgUnitArr)

Definition at line 77 of file CallbackServerUnparsed.h.

typedef void( * ) CallbackServerUnparsedSendXmlBlasterException(CallbackServerUnparsed *cb, void *socketDataHolder, XmlBlasterException *exception)

Definition at line 78 of file CallbackServerUnparsed.h.

typedef void*(*) cbFp(void *)

Function pointer for pthread, the method to invoke on thread creation.

Definition at line 187 of file CallbackServerUnparsed.h.

typedef int(* ) InitCallbackServer(CallbackServerUnparsed *cb)

Definition at line 50 of file CallbackServerUnparsed.h.

typedef int(* ) IsListening(CallbackServerUnparsed *cb)

Returns:
true if the socket is open and waits for callback messages

Definition at line 55 of file CallbackServerUnparsed.h.

typedef struct ListenLoopArgsStruct ListenLoopArgs

Auxiliary struct for passing parameters to listening threads.

typedef ResponseListener*( * ) RemoveResponseListener(CallbackServerUnparsed *cb, const char *requestId)

Definition at line 93 of file CallbackServerUnparsed.h.

typedef void(* ) ResponseFp(MsgRequestInfo *msgRequestInfoP, void *socketDataHolder)

Definition at line 83 of file CallbackServerUnparsed.h.

typedef struct ResponseListenerStruct ResponseListener

typedef void(* ) ShutdownCallbackServerRaw(CallbackServerUnparsed *cb)

Definition at line 75 of file CallbackServerUnparsed.h.

typedef void(*) UpdateCbFp(MsgUnitArr *msg, void *userData, XmlBlasterException *xmlBlasterException, void *socketDataHolder)

Here we asynchronously receive the callback from xmlBlaster.

NOTE: After this call the memory of MsgUnitArr is freed immediately by CallbackServerUnparsed So you need to take a copy of all message members if needed out of the scope of this function.

Parameters:
msgUnitArr The messages from the server, use MgsUnit::responseQos to transport the return value
userData An optional pointer from the client with client specific data which is delivered back
xmlBlasterException This points on a valid XmlBlasterException struct, so you only need to fill errorCode with strcpy() and the returned pointer is ignored and the exception is thrown to xmlBlaster.
socketDataHolder SocketDataHolder containing socket specific informations, please handle as readonly
Returns:
Return true if everything is OK Return false if you want to throw an exception, please fill xmlBlasterException in such a case. If false and *xmlBlasterException.errorCode==0 we don't send a return message (useful for update dispatcher thread to do it later)
See also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.update.html

Definition at line 73 of file CallbackServerUnparsed.h.

typedef int(* ) UseThisSocket(CallbackServerUnparsed *cb, int socketToUse, int socketToUseUdp)

Use this function directly after creation of the callback server if you want to force to reuse the given socket for callbacks.

Parameters:
socketToUse Usually pass -1 so that we establish a callback server, else pass an opened socket (e.g. from XmlBlasterConnectionUnparsed->socketToXmlBlaster)
socketToUseUdp Usually pass -1 so that we establish a callback server, else pass an opened socket (e.g. from XmlBlasterConnectionUnparsed->socketToXmlBlaster)
Returns:
true on success

Definition at line 48 of file CallbackServerUnparsed.h.


Function Documentation

const char* callbackServerRawUsage (  ) 

Help on configuration.

Definition at line 758 of file CallbackServerUnparsed.c.

Referenced by xmlBlasterAccessUnparsedUsage().

void freeCallbackServerUnparsed ( CallbackServerUnparsed **  callbackData  ) 

free() the CallbackServerUnparsed structure and sets *callbackData to 0 Call freeCallbackServerUnparsed(&cb);

Definition at line 127 of file CallbackServerUnparsed.c.

References freeProperties(), CallbackServerUnparsedStruct::props, and shutdownCallbackServer().

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

Here is the call graph for this function:

CallbackServerUnparsed* getCallbackServerUnparsed ( int  argc,
const char *const *  argv,
UpdateCbFp  updateCb,
void *  userData 
)

Get a new instance of a callback server struct.

This is usually the first call of a client, you need to call runCallbackServer() on the returned pointer to establish a listener.

Parameters:
argc Number of command line arguments
argv The command line arguments
updateCb The function pointer on your update() function which handles the received messages Please read the documentation of UpdateCbFp above.
userData An optional pointer from the client with client specific data which is delivered back with the updateCb() function
Returns:
NULL if allocation or bootstrapping failed. If not NULL you need to free() it when you are done usually by calling freeXmlBlasterConnectionUnparsed().

Referenced by initialize().