00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _T_SERVER_HH_
00011 #define _T_SERVER_HH_
00012
00013 #include <rtworks/ipc.h>
00014 #include <rtworks/types.h>
00015 #include <rtworks/tex.h>
00016 #include <rtworks/tconn.h>
00017 #include <rtworks/tcallbck.h>
00018
00019
00020 namespace SmartSockets {
00021
00028 class T_IPCX_API TipcSrvException : public TipcException {
00029
00030 public:
00034 TipcSrvException () {}
00035
00039 virtual ~TipcSrvException () throw() {}
00040 };
00041
00045 class T_IPCX_API TipcSrvSubjTraverser {
00046 public:
00047
00053 typedef bool (TipcSrvSubjTraverser::* Handler)
00054 (
00055 const char* subjectName
00056 ) ;
00057
00058
00059
00060 TipcSrvSubjTraverser();
00061
00066 void setHandler(Handler cbMethod);
00067
00071 Handler getHandler();
00072
00073
00077 virtual ~TipcSrvSubjTraverser() throw();
00078
00084 virtual bool onTraverse
00085 (
00086 const char* subjectName
00087 )
00088 throw () ;
00089
00090 static T_PTR T_ENTRY traverseFuncDelegator
00091 (
00092 T_STR subj,
00093 T_STR dummy,
00094 T_PTR arg
00095 );
00096
00097 private:
00098
00099 Handler _cbMethod;
00100
00101 };
00102
00114 class T_IPCX_API TipcSrv : public TipcConnClient {
00115
00116 private:
00117 T_IPC_SRV _srv;
00118
00119 protected:
00131 static void T_ENTRY1 subjectCbDelegator(T_IPC_CONN connection,
00132 T_IPC_SRV_SUBJECT_CB_DATA data,
00133 T_CB_ARG arg);
00134
00146 static void T_ENTRY1 openCbDelegator(T_IPC_SRV connection,
00147 T_IPC_SRV_OPEN_CB_DATA data,
00148 T_CB_ARG arg);
00149
00150
00162 static void T_ENTRY1 closeCbDelegator(T_IPC_SRV connection,
00163 T_IPC_SRV_CLOSE_CB_DATA data,
00164 T_CB_ARG arg);
00165
00166 public:
00167
00230 TipcSrv(const char * unique_subject,
00231 const char * server_names,
00232 const char * project = (const char*) T_NULL,
00233 const char * subject_prefix = (const char*) T_NULL)
00234 throw (TipcException);
00235
00278 TipcSrv(const char * name) throw (TipcException);
00279
00287 TipcSrv (T_IPC_SRV srv,bool destroyFlag = false) throw (TipcException);
00288
00294 operator T_IPC_CONN() throw (TipcException);
00295
00300 operator T_IPC_SRV () const throw (TipcException);
00301
00302
00325 void close(T_IPC_SRV_CONN_STATUS close_status = T_IPC_SRV_CONN_NONE)
00326 throw (TipcException);
00327
00329 virtual ~TipcSrv() throw();
00330
00342 void open(T_IPC_SRV_CONN_STATUS create_status = T_IPC_SRV_CONN_FULL)
00343 throw (TipcException);
00344
00358 virtual bool check(T_IO_CHECK_MODE check_mode, real8 timeout)
00359 throw (TipcException);
00360
00369 virtual void flush() throw (TipcException);
00370
00371
00380 virtual int4 getAutoFlushSize() const throw (TipcException);
00381
00392 virtual void setAutoFlushSize(int4 auto_flush_size)
00393 throw (TipcException);
00394
00406 virtual int4 trafficGetBytesRecv() const throw (TipcException);
00407
00414 virtual int8 trafficGetBytesRecv8() const throw (TipcException);
00415
00433 virtual int4 trafficGetBytesSent() const throw (TipcException);
00434
00447 virtual int8 trafficGetBytesSent8() const throw (TipcException);
00448
00460 virtual int4 trafficGetMsgsRecv() const throw (TipcException);
00461
00468 virtual int8 trafficGetMsgsRecv8() const throw (TipcException);
00469
00487 virtual int4 trafficGetMsgsSent() const throw (TipcException);
00488
00501 virtual int8 trafficGetMsgsSent8() const throw (TipcException);
00502
00509 virtual int4 bufferGetReadSize() const throw (TipcException);
00510
00517 virtual int4 bufferGetWriteSize() const throw (TipcException);
00518
00549 virtual real8 getTimeout(T_IPC_TIMEOUT timeout) const
00550 throw (TipcException);
00582 virtual void setTimeout(T_IPC_TIMEOUT timeout, real8 value)
00583 throw (TipcException);
00584
00593 virtual sock getSocket() const throw (TipcException);
00594
00604 virtual int4 getNumQueued() const throw (TipcException);
00605
00619 virtual sock getXtSource() const throw (TipcException);
00620
00630 virtual void setUsernamePassword(const char * username,
00631 const char * password)
00632 throw (TipcException);
00633
00649 virtual void keepAlive() throw (TipcException);
00650
00666 virtual bool mainLoop(real8 timeout)
00667 throw (TipcException);
00668
00678 virtual void insert(TipcMsg& msg, int4 pos = T_IPC_POS_PRIORITY)
00679 throw (TipcException);
00680
00681
00692 virtual void next(TipcMsg& msg, real8 timeout)
00693 throw (TipcException);
00694
00704 virtual bool nextEx(TipcMsg& msg, real8 timeout)
00705 throw (TipcException);
00706
00707
00730 virtual void process(TipcMsg& msg) throw (TipcException);
00731
00803 virtual void search(TipcMsg& msg, TipcConnSearchSelector* selObj,
00804 real8 timeout)
00805 throw (TipcException);
00806
00822 virtual void searchType(TipcMsg& msg, TipcMt& mt,
00823 real8 timeout)
00824 throw (TipcException);
00825
00826
00851 virtual void read(real8 timeout)
00852 throw (TipcException);
00853
00894 virtual void send(const TipcMsg& msg,
00895 bool check_server_msg_send=true)
00896 throw (TipcException);
00897
00962 virtual void sendRpc(TipcMsg& reply_msg,const TipcMsg& call_msg,
00963 real8 timeout = T_TIMEOUT_FOREVER)
00964 throw (TipcException);
00965
01025 void write(const char * dest, TipcMt& mt,
01026 bool check_server_msg_send, ...)
01027 throw (TipcException);
01028
01029 void writeVa(const char * dest, TipcMt& mt,
01030 bool check_server_msg_send,
01031 va_list var_arg_list) throw (TipcException);
01033
01042 virtual void print(T_OUT_FUNC func = (T_OUT_FUNC) TutOut) const
01043 throw (TipcException);
01044
01050 virtual const char * getPeerUniqueSubject() const
01051 throw (TipcException);
01052
01058 virtual const char* getNode() const throw (TipcException);
01059
01065 virtual const char* getUser() const throw (TipcException);
01066
01072 virtual int4 getPid() const throw (TipcException);
01073
01084 virtual const char* getArch() const throw (TipcException);
01085
01097 virtual T_IPC_SRV_CONN_STATUS getStatus() const
01098 throw (TipcException);
01099
01110 virtual void lock() throw (TipcException);
01111
01119 virtual void unlock() throw (TipcException);
01120
01135 virtual int4 getGmdNumPending() const throw (TipcException);
01136
01151 bool getSubscribe(const char * subject) throw (TipcException);
01152
01168 void setSubscribe(const char * subject, bool recv_status = true)
01169 throw (TipcException);
01170
01225 void traverseSubscribe(TipcSrvSubjTraverser* travObj)
01226 throw (TipcException);
01227
01262 static void logAddMt(T_IPC_MT_LOG_TYPE log_type,
01263 TipcMt& mt) throw (TipcException);
01264
01265
01300 static void logRemoveMt(T_IPC_MT_LOG_TYPE log_type,
01301 TipcMt& mt) throw (TipcException);
01302
01303
01322 void setSubscribeStd(bool subscribe_status = true)
01323 throw (TipcException);
01324
01325
01335 bool getSubscribeLb(const char * subject, bool *lb_status_return)
01336 throw (TipcException);
01337
01346 void setSubscribeLb(const char * subject, bool subject_status = true,
01347 bool lb_status = true) throw (TipcException);
01348
01390 void subjectLbInit(const char *subject) throw (TipcException);
01391
01400 virtual void gmdFileCreate() throw (TipcException);
01401
01428 virtual void gmdFileDelete() throw (TipcException);
01429
01440 virtual void gmdResend() throw (TipcException);
01441
01461 virtual void gmdMsgDelete(TipcMsg& msg) throw (TipcException);
01462
01490 virtual uint4 getGmdMaxSize() const throw (TipcException);
01491
01519 virtual void setGmdMaxSize(uint4 gmd_max_size) throw (TipcException);
01520
01547 void gmdMsgServerDelete(TipcMsg& msg) throw (TipcException);
01548
01591 void gmdMsgStatus(TipcMsg& msg) throw (TipcException);
01592
01599 void subjectGmdInit(const char * subject) throw (TipcException);
01600
01606 void setProject(const char* project)
01607 throw (TipcException);
01608
01609
01615 const char* getProject() throw (TipcException);
01616
01624 void setServerNames(const char* server_names)
01625 throw (TipcException);
01626
01632 void setServerNamesList(T_STR_LIST server_names_list)
01633 throw (TipcException);
01634
01640 T_STR_LIST getServerNamesList()
01641 throw (TipcException);
01642
01648 void setDefaultSubjectPrefix(const char* default_subject_prefix)
01649 throw (TipcException);
01650
01656 const char* getDefaultSubjectPrefix()
01657 throw (TipcException);
01658
01664 void setUniqueSubject(const char * unique_subject)
01665 throw (TipcException);
01666
01672 const char* getUniqueSubject()
01673 throw (TipcException);
01674
01675
01701 void setSubscribeCache(const char * subj_name, bool status, int4 flags)
01702 throw (TipcException);
01703
01716 void setCredentials(int4 auth_policy_id, void * auth_data,
01717 int4 auth_data_len) throw (TipcException);
01718
01796 virtual CallBack<MessageQueueCallBack> * queueCbCreate(
01797 const TipcMt& mt,
01798 MessageQueueCallBack * implementor,
01799 void* arg = NULL)
01800 throw (TipcException);
01801
01802
01872 virtual CallBack <ConnectionCallBack> * openCbCreate(
01873 ConnectionCallBack * implementor,
01874 void* arg = NULL)
01875 throw (TipcException);
01876
01877
01947 virtual CallBack <ConnectionCallBack> * closeCbCreate(
01948 ConnectionCallBack * implementor,
01949 void* arg = NULL)
01950 throw (TipcException);
01951
01952
02023 virtual CallBack <ErrorCallBack> * errorCbCreate(
02024 ErrorCallBack * implementor,
02025 void* arg = NULL)
02026 throw (TipcException);
02027
02028
02113 virtual CallBack <MessageCallBack> * encryptCbCreate(
02114 const TipcMt & mt,
02115 MessageCallBack * implementor,
02116 void* arg = NULL)
02117 throw (TipcException);
02118
02119
02198 virtual CallBack <MessageCallBack> * decryptCbCreate(
02199 const TipcMt & mt,
02200 MessageCallBack * implementor,
02201 void* arg = NULL)
02202 throw (TipcException);
02203
02204
02297 virtual CallBack <MessageCallBack> * defaultCbCreate(
02298 MessageCallBack * implementor,
02299 void* arg = NULL)
02300 throw (TipcException);
02301
02302
02321 virtual CallBack <MessageCallBack> * processCbCreate(
02322 const TipcMt & mt,
02323 MessageCallBack * implementor,
02324 void* arg = NULL)
02325 throw (TipcException);
02326
02327
02402 virtual CallBack <MessageCallBack> * readCbCreate(
02403 const TipcMt & mt,
02404 MessageCallBack * implementor,
02405 void* arg = NULL)
02406 throw (TipcException);
02407
02481 virtual CallBack <MessageCallBack> * writeCbCreate(
02482 const TipcMt & mt,
02483 MessageCallBack * implementor,
02484 void* arg = NULL)
02485 throw (TipcException);
02486
02487
02510 virtual CallBack <MessageCallBack> * subjectCbCreate(
02511 const char * subject,
02512 const TipcMt & mt,
02513 MessageCallBack * implementor,
02514 void* arg = NULL)
02515 throw (TipcException);
02516
02517 };
02518
02519 }
02520
02521 #endif //_T_SERVER_HH_