00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _terimber_aiomsgfactory_h_
00029 #define _terimber_aiomsgfactory_h_
00030
00031 #include "ostypes.h"
00032 #include "log.h"
00033
00035 #define MSG_EMPTY_ID 0x80000001
00037 #define MSG_ERROR_ID 0x80000002
00038
00041 class msg_t
00042 {
00043 public:
00044 ub4_t msgid;
00045 ub4_t majver;
00046 ub4_t minver;
00047 ub4_t priority;
00048 ub8_t timeout;
00049 };
00050
00051
00052 class msg_port;
00053
00056 class msg_callback_notify
00057 {
00058 public:
00063 virtual
00064 bool
00065 incoming_callback( msg_t* msg,
00066 msg_t* reply
00067 ) = 0;
00071 virtual
00072 bool
00073 async_callback( msg_t* reply,
00074 const guid_t& ident
00075 ) = 0;
00076 };
00077
00078 class terimber_aiomsg : public terimber_log_helper
00079 {
00080 public:
00082 virtual ~terimber_aiomsg() {}
00083
00085 virtual
00086 bool
00087 init( const char* info,
00088 const char* ini_key
00089 ) = 0;
00090
00092 virtual
00093 bool
00094 init( const void* buffer,
00095 size_t len
00096 ) = 0;
00097
00099 virtual
00100 bool
00101 uninit() = 0;
00102
00106 virtual
00107 bool
00108 start( msg_callback_notify* callback,
00109 size_t additional_thread_count
00110 ) = 0;
00112 virtual
00113 bool
00114 stop() = 0;
00115
00117 virtual
00118 const char*
00119 get_port_error() const = 0;
00120
00122 virtual
00123 const guid_t&
00124 get_port_address() const = 0;
00125
00130 virtual
00131 msg_t*
00132 construct( size_t size
00133 ) = 0;
00136 virtual
00137 bool
00138 resize( msg_t* msg,
00139 size_t size
00140 ) = 0;
00142 virtual
00143 bool
00144 destroy( msg_t* msg
00145 ) = 0;
00146
00148
00150 virtual
00151 size_t
00152 get_size( const msg_t* msg
00153 ) const = 0;
00154
00156 virtual
00157 bool
00158 write_buffer(msg_t* msg,
00159 size_t offset,
00160 const void* buf,
00161 size_t len
00162 ) = 0;
00164 virtual
00165 const void*
00166 get_buffer( const msg_t* msg
00167 ) const = 0;
00168
00170 virtual
00171 bool
00172 set_receiver(msg_t* msg,
00173 const guid_t& receiver
00174 ) = 0;
00176 virtual
00177 bool
00178 get_sender( const msg_t* msg,
00179 guid_t& sender
00180 ) const = 0;
00181
00186 virtual
00187 bool
00188 send( bool copy,
00189
00190 msg_t* msg,
00191 msg_t** reply
00192 ) = 0;
00193
00199 virtual
00200 guid_t
00201 send_async(bool copy,
00202
00203 msg_t* msg
00204 ) = 0;
00205
00209 virtual
00210 bool
00211 post( bool copy,
00212 msg_t* msg
00213
00214 ) = 0;
00215
00230 virtual
00231 bool
00232 add_connection(const char* xml_description
00233 ) = 0;
00234
00255 virtual
00256 bool
00257 add_listener(const char* xml_description
00258 ) = 0;
00259
00261 virtual
00262 bool
00263 remove_connection(const guid_t& address
00264 ) = 0;
00265
00267 virtual
00268 bool
00269 remove_listener(const char* type
00270 ) = 0;
00271
00273 virtual
00274 void
00275 doxray() = 0;
00276 };
00277
00280 class aiomsgfactory
00281 {
00282 public:
00284 aiomsgfactory();
00286 ~aiomsgfactory();
00288 terimber_aiomsg*
00289 get_aiomsg( terimber_log* log
00290 );
00291 };
00292
00293 #endif
00294