00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _T_MESSAGE_TYPE_HH_
00011 #define _T_MESSAGE_TYPE_HH_
00012
00013 #include <rtworks/ipc.h>
00014 #include <rtworks/tex.h>
00015
00016
00017 namespace SmartSockets {
00018
00019 class T_IPCX_API TipcSrv;
00020 class T_IPCX_API TipcMsg;
00021
00028 class T_IPCX_API TipcMtException : public TipcException {
00029
00030 public:
00034 TipcMtException () {}
00035
00039 virtual ~TipcMtException () throw() {}
00040
00041 };
00042
00043
00044 class T_IPCX_API TipcMt;
00045
00049 class T_IPCX_API TipcMtTraverser {
00050 public:
00057 typedef bool (TipcMtTraverser::* Handler) (const char* name, TipcMt& mt);
00058
00062 TipcMtTraverser();
00063
00067 void setHandler(Handler cbMethod);
00068
00072 Handler getHandler();
00073
00077 virtual ~TipcMtTraverser() throw();
00078
00085 virtual bool onTraverse (const char* name, TipcMt& mt)throw () ;
00086
00087 static T_PTR T_ENTRY traverseFuncDelegator
00088 (
00089 T_STR name,
00090 T_IPC_MT mt,
00091 T_PTR arg
00092 );
00093
00094 private:
00095
00096 Handler _cbMethod;
00097
00098
00099 };
00100
00107 class T_IPCX_API TipcMtEncrypt {
00108 public:
00123 typedef void (TipcMtEncrypt::* Handler) (void*& data, int4& dataSize,
00124 const void* key, int4 keySize);
00125
00129 TipcMtEncrypt();
00130
00136 void setEncryptHandler(Handler encryptMethod) ;
00140 Handler getEncryptHandler();
00141
00148 void setDecryptHandler(Handler decryptMethod);
00149
00153 Handler getDecryptHandler();
00154
00155
00159 virtual ~TipcMtEncrypt() throw();
00160
00171 virtual void encrypt(void*& data, int4& dataSize, const void* key, int4 keySize)
00172 throw (TipcException);
00173
00184 virtual void decrypt(void*& data, int4& dataSize, const void* key, int4 keySize)
00185 throw (TipcException);
00186
00187
00188
00189 static void T_ENTRY encryptFuncDelegator
00190 (
00191 T_BUF buf ,
00192 T_PTR key,
00193 T_INT4 key_size,
00194 T_PTR arg
00195 );
00196
00197 static void T_ENTRY decryptFuncDelegator
00198 (
00199 T_BUF buf ,
00200 T_PTR key,
00201 T_INT4 key_size,
00202 T_PTR arg
00203 );
00204
00205 private:
00206
00207 Handler _encryptMethod;
00208 Handler _decryptMethod;
00209
00210
00211 };
00212
00213
00214
00232 class T_IPCX_API TipcMt {
00233
00235
00236
00237 friend class TipcConn;
00238 friend class TipcSrv;
00240 private:
00241 T_IPC_MT _mt;
00242
00243
00244 public:
00245
00246
00252 TipcMt(T_IPC_MT mt) throw ();
00253
00261 TipcMt(const char * name) throw (TipcException);
00262
00270 TipcMt(int4 num) throw (TipcException);
00271
00272
00276 TipcMt(const TipcMt& mt) throw (TipcException);
00277
00283 virtual ~TipcMt() throw();
00284
00316 static TipcMt create(const char * name, int4 num, const char * grammar) throw (TipcException);
00317
00329 static TipcMt lookup(const char * name) throw (TipcException);
00330
00340 static void traverse(TipcMtTraverser* travObj)
00341 throw (TipcException);
00342
00343
00344
00358 static TipcMt lookup(int4 num) throw (TipcException);
00359
00360
00365 static void destroy(TipcMt& mt) throw (TipcException);
00366
00367
00372 operator T_IPC_MT() const throw() { return _mt;}
00373
00382 void print(T_OUT_FUNC func =(T_OUT_FUNC)::TutOut) const
00383 throw (TipcException);
00384
00385
00386
00435 const char * getGrammar() const throw (TipcException);
00436
00445 const char * getName() const throw (TipcException);
00446
00447
00448
00457 int4 getNum() const throw (TipcException);
00458
00459
00480 int2 getPriority() const throw (TipcException);
00481 void setPriority(int2 priority) throw (TipcException);
00482 void setPriorityUnknown()throw (TipcException);
00484
00485
00486
00502 int4 getUserProp() const throw (TipcException);
00503 void setUserProp(int4 user_prop) throw (TipcException);
00505
00506
00507
00508
00524 bool getCompression() const throw (TipcException);
00525 void setCompression(bool compression) throw (TipcException);
00527
00528
00529
00530
00536 T_IPC_DELIVERY_MODE getDeliveryMode() const throw (TipcException);
00537
00538 void setDeliveryMode(T_IPC_DELIVERY_MODE delivery_mode)
00539 throw (TipcException);
00540
00542
00543
00544
00550 T_IPC_LB_MODE getLbMode() const throw (TipcException);
00551 void setLbMode(T_IPC_LB_MODE lb_mode) throw (TipcException);
00552
00554
00555
00598 real8 getDeliveryTimeout() const throw (TipcException);
00599
00600 void setDeliveryTimeout(real8 delivery_timeout)
00601 throw (TipcException);
00602
00604
00605
00606
00615 bool getHeaderStrEncode() const throw (TipcException);
00616
00617
00618 void setHeaderStrEncode(bool header_encode)
00619 throw (TipcException);
00620
00622
00623
00636 void setKey(const void* keyValue, int4 size) throw (TipcException);
00637
00649 void setEncryptObj(TipcMtEncrypt* encryptObj = NULL)
00650 throw (TipcException);
00651
00652
00657 TipcMtEncrypt* getDecryptObj() const
00658 throw (TipcException);
00659
00671 void setDecryptObj(TipcMtEncrypt* decryptObj = NULL)
00672 throw (TipcException);
00673
00674
00675
00680 TipcMtEncrypt* getEncryptObj() const
00681 throw (TipcException);
00682
00683 };
00684
00685 }
00686
00687 #endif //_T_MESSAGE_TYPE_HH_