00001 /*---------------------------------------------------------------------------- 00002 Name: XmlBlasterUnmanaged.h 00003 Project: xmlBlaster.org 00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file 00005 Comment: Provides simplified access methods to xmlBlaster client C library 00006 to be usable as .net unmanaged DLL (called by C#) on e.g. Windows XP 00007 Author: "Marcel Ruff" <xmlBlaster@marcelruff.info> 00008 Date: 07/2006 00009 See: http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.html 00010 -----------------------------------------------------------------------------*/ 00011 #ifndef _XmlBlasterUnmanaged_H 00012 #define _XmlBlasterUnmanaged_H 00013 00014 /* 00015 To access this .dll as unmanaged code from C#, the C-API must be simplified, 00016 for example fixed size arrays like "char errorCode[256]" are tricky. 00017 We implement here a simple wrapper around XmlBlasterAccessUnparsed.h 00018 This code is called from xmlBlaster/src/csharp/NativeC.cs 00019 See: http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.csharp.html 00020 */ 00021 00022 00023 #ifdef __cplusplus 00024 #ifndef XMLBLASTER_C_COMPILE_AS_CPP /* 'g++ -DXMLBLASTER_C_COMPILE_AS_CPP ...' allows to compile the lib as C++ code */ 00025 extern "C" { 00026 #endif 00027 #endif 00028 00029 #include <XmlBlasterAccessUnparsed.h> 00030 00031 #ifndef WINCE 00032 00036 typedef struct XmlBlasterUnmanagedException { 00037 uint32_t remote; 00038 char *errorCode; 00039 char *message; 00040 } XmlBlasterUnmanagedException; 00041 00045 typedef struct XmlBlasterUnmanagedStringArr { 00046 const char *str; 00047 } XmlBlasterUnmanagedStringArr; 00048 00049 00050 typedef const char * (*XmlBlasterUnmanagedUpdateFp)(const char *cbSessionId, const char *key, char *contentStr, int32_t contentLen, const char *qos, XmlBlasterUnmanagedException *xmlBlasterException); 00051 00052 Dll_Export extern XmlBlasterAccessUnparsed *getXmlBlasterAccessUnparsedUnmanaged(int argc, const char* const* argv); 00053 Dll_Export void freeXmlBlasterAccessUnparsedUnmanaged(XmlBlasterAccessUnparsed *xmlBlasterAccess); 00054 00055 Dll_Export extern char *xmlBlasterUnmanagedConnect(struct XmlBlasterAccessUnparsed *xa, const char * const qos, XmlBlasterUnmanagedUpdateFp update, XmlBlasterUnmanagedException *exception); 00056 Dll_Export extern bool xmlBlasterUnmanagedInitialize(struct XmlBlasterAccessUnparsed *xa, XmlBlasterUnmanagedUpdateFp update, XmlBlasterUnmanagedException *exception); 00057 Dll_Export extern bool xmlBlasterUnmanagedDisconnect(struct XmlBlasterAccessUnparsed *xa, const char * qos, XmlBlasterUnmanagedException *exception); 00058 Dll_Export extern char *xmlBlasterUnmanagedPublish(struct XmlBlasterAccessUnparsed *xa, MsgUnit *msgUnit, XmlBlasterUnmanagedException *exception); 00059 Dll_Export extern QosArr *xmlBlasterUnmanagedPublishArr(struct XmlBlasterAccessUnparsed *xa, MsgUnitArr *msgUnitArr, XmlBlasterUnmanagedException *exception); 00060 Dll_Export extern void xmlBlasterUnmanagedPublishOneway(struct XmlBlasterAccessUnparsed *xa, MsgUnit *msgUnitArr, int length, XmlBlasterUnmanagedException *exception); 00061 Dll_Export extern char *xmlBlasterUnmanagedSubscribe(struct XmlBlasterAccessUnparsed *xa, const char * const key, const char * qos, XmlBlasterUnmanagedException *exception); 00062 Dll_Export extern void xmlBlasterUnmanagedUnSubscribe(struct XmlBlasterAccessUnparsed *xa, const char * const key, const char * qos, XmlBlasterUnmanagedException *exception, uint32_t* pSize, XmlBlasterUnmanagedStringArr** ppStruct); 00063 Dll_Export extern void xmlBlasterUnmanagedErase(struct XmlBlasterAccessUnparsed *xa, const char * const key, const char * qos, XmlBlasterUnmanagedException *exception, uint32_t* pSize, XmlBlasterUnmanagedStringArr** ppStruct); 00064 Dll_Export extern void xmlBlasterUnmanagedGet(struct XmlBlasterAccessUnparsed *xa, const char * const key, const char * qos, XmlBlasterUnmanagedException *exception, uint32_t* pSize, MsgUnit** ppStruct); 00065 Dll_Export extern char *xmlBlasterUnmanagedPing(struct XmlBlasterAccessUnparsed *xa, const char * const qos, XmlBlasterUnmanagedException *exception); 00066 Dll_Export extern bool xmlBlasterUnmanagedIsConnected(struct XmlBlasterAccessUnparsed *xa); 00067 Dll_Export extern const char *xmlBlasterUnmanagedUsage(); 00068 00069 00070 #ifdef __cplusplus 00071 #ifndef XMLBLASTER_C_COMPILE_AS_CPP 00072 } 00073 #endif 00074 #endif 00075 00076 #endif 00077 #endif /* _XmlBlasterUnmanaged_H */ 00078