Main Page   Class Hierarchy   Compound List   File List   Compound Members  

tconn.h

00001 /*
00002  * Copyright (c) 1991-2006 TIBCO Software Inc.
00003  * All rights reserved.
00004  * For more information, please contact:
00005  * TIBCO Software Inc., Palo Alto, California, USA
00006  *
00007  * $Id: //dev/packages/tpsi/cpsi/dev/68/src/rtworks/tconn.h#1 $
00008  */
00009 
00010 #ifndef _T_CONN_HH_
00011 #define _T_CONN_HH_
00012 
00013 #include <rtworks/ipc.h>
00014 #include <rtworks/tcallbck.h>
00015 
00016 namespace SmartSockets {
00017 
00018   class T_IPCX_API TipcMsg;
00019   class T_IPCX_API TipcMt;
00020 
00027   class T_IPCX_API TipcConnException : public TipcException {
00028 
00029   public:
00033     TipcConnException () {};
00034 
00038     virtual ~TipcConnException () throw() {}
00039 
00040   };
00041 
00042 
00046   class T_IPCX_API TipcConnSearchSelector {
00047   public:
00048 
00055     typedef bool (TipcConnSearchSelector::* Handler)
00056     (
00057     const TipcConn & conn,
00058     const TipcMsg& msg
00059     ) ;
00060 
00061 
00062 
00063     TipcConnSearchSelector();
00064 
00069     void setHandler(Handler cbMethod);
00070 
00074     Handler getHandler();
00075 
00076 
00080     virtual ~TipcConnSearchSelector() throw();
00081 
00088     virtual bool onSearch
00089     (
00090     const TipcConn & conn,
00091     const TipcMsg& msg
00092     )  throw () ;
00093 
00094     static  T_BOOL T_ENTRY searchFuncDelegator
00095     (
00096     T_IPC_CONN connection,
00097     T_IPC_MSG  msg,
00098     T_PTR arg
00099     );
00100 
00101   private:
00102 
00103     Handler _cbMethod;
00104 
00105   };
00106 
00114   class T_IPCX_API TipcConn {
00115 
00116   protected:
00118     T_IPC_CONN _connection;
00119 
00120     bool _destroy_flag;
00121 
00126     TipcConn(bool do_nothing);
00127 
00128 
00140     static void T_ENTRY1 errorCbDelegator(T_IPC_CONN connection,
00141                                           T_IPC_CONN_ERROR_CB_DATA data,
00142                                           T_CB_ARG arg);
00143 
00144 
00156     static void T_ENTRY1 queueCbDelegator(T_IPC_CONN connection,
00157                                           T_IPC_CONN_QUEUE_CB_DATA data,
00158                                           T_CB_ARG arg);
00159 
00160 
00171     static void T_ENTRY1 messageCbDelegator(T_IPC_CONN connection,
00172                                             T_IPC_CONN_MSG_CB_DATA data,
00173                                             T_CB_ARG arg);
00174 
00175 
00186     static void T_ENTRY1 readCbDelegator(T_IPC_CONN connection,
00187                                          T_IPC_CONN_READ_CB_DATA data,
00188                                          T_CB_ARG arg);
00189 
00190 
00201     static void T_ENTRY1 encodeCbDelegator(T_IPC_CONN connection,
00202                                            T_IPC_CONN_ENCODE_CB_DATA data,
00203                                            T_CB_ARG arg);
00204 
00205 
00217     static void T_ENTRY1 decodeCbDelegator(T_IPC_CONN connection,
00218                                            T_IPC_CONN_DECODE_CB_DATA data,
00219                                            T_CB_ARG arg);
00220 
00221   public:
00229     TipcConn() throw (TipcException);
00230     TipcConn(T_IPC_CONN connection, bool destroy_flag=true)
00231     throw (TipcException);
00233 
00235     virtual ~TipcConn() throw();
00236 
00237 
00239     operator T_IPC_CONN() const throw()  { return _connection;}
00240 
00241     // The following methods will have TipcSrv equivalents
00242 
00249     virtual bool check(T_IO_CHECK_MODE check_mode, real8 timeout)
00250     throw (TipcException);
00251 
00256     virtual void flush() throw (TipcException);
00257 
00266     virtual int4 getAutoFlushSize() const throw (TipcException);
00267 
00268     virtual void setAutoFlushSize(int4 auto_flush_size)
00269     throw (TipcException);
00271 
00279     virtual long getBlockMode() const throw (TipcException);
00280 
00281     virtual void setBlockMode(bool block_mode)
00282     throw (TipcException);
00284 
00285 
00293     virtual real8 getTimeout(T_IPC_TIMEOUT timeout) const
00294     throw (TipcException);
00295 
00296     virtual void setTimeout(T_IPC_TIMEOUT timeout, real8  value)
00297     throw (TipcException);
00299 
00305     virtual sock getSocket() const throw (TipcException);
00306 
00312     virtual int4 getNumQueued() const throw (TipcException);
00313 
00319     virtual sock getXtSource() const throw (TipcException);
00320 
00325     virtual void keepAlive() throw (TipcException);
00326 
00332     virtual bool mainLoop(real8 timeout = T_TIMEOUT_FOREVER)
00333     throw (TipcException);
00334 
00341     virtual void insert(TipcMsg& msg, int4 pos)
00342     throw (TipcException);
00343 
00349     virtual void process(TipcMsg& msg) throw (TipcException);
00350 
00358     void read(real8 timeout) throw (TipcException);
00359 
00366     virtual void next(TipcMsg& msg, real8 timeout)
00367     throw (TipcException);
00368 
00369 
00377     virtual bool nextEx(TipcMsg& msg, real8 timeout)
00378     throw (TipcException);
00379 
00380 
00388     virtual void search(TipcMsg& msg, TipcConnSearchSelector* selObj,
00389                         real8 timeout) throw (TipcException);
00390 
00399     virtual void searchType(TipcMsg& msg, TipcMt& mt, real8 timeout)
00400     throw (TipcException);
00401 
00410     virtual void send(const TipcMsg& msg, bool rtserver_check=FALSE)
00411     throw (TipcException);
00412 
00421     virtual void sendRpc(TipcMsg& reply_msg, const TipcMsg& call_msg, real8 timeout)
00422     throw (TipcException);
00423 
00424 
00425 #if defined(T_OS_WINDOWS)
00426 
00427     /*
00428      * The Microsoft Visual C++ compilers (4.2 and 5.0, and maybe earlier ones),
00429      * have a bug that makes it impossible to use references as the last
00430      * non-variable argument in a varargs list.  So, for Windows, we're just
00431      * passing the TipcMt object by value (since it's not modified [really
00432      * ought to be const, cie la vie...]).  Once this bug is fixed, or if
00433      * you're using some other compiler, this ifdef can be removed.
00434      */
00435 
00443     virtual void     write(TipcMt mt, ...) throw (TipcException);
00444     virtual void     writeVa(TipcMt mt, va_list var_arg_list)
00445     throw (TipcException);
00447 #else
00448     void     write(TipcMt& mt, ...) throw (TipcException);
00449     void     writeVa(TipcMt& mt, va_list var_arg_list)
00450     throw (TipcException);
00451 
00452 #endif //T_OS_WINDOWS
00453 
00454 
00460     virtual void  print(T_OUT_FUNC func = (T_OUT_FUNC) TutOut) const
00461     throw (TipcException);
00462 
00463     // CALLBACKS
00473     virtual CallBack<MessageQueueCallBack> * queueCbCreate(const TipcMt& mt,
00474                                                            MessageQueueCallBack *,
00475                                                            void* arg = NULL)
00476     throw (TipcException);
00477 
00478 
00487     virtual CallBack <ErrorCallBack> * errorCbCreate(
00488                                                     ErrorCallBack * implementor,
00489                                                     void* arg = NULL)
00490     throw (TipcException);
00491 
00492 
00502     virtual CallBack <MessageCallBack> * encryptCbCreate(
00503                                                         const TipcMt & mt,
00504                                                         MessageCallBack * implementor,
00505                                                         void* arg = NULL)
00506     throw (TipcException);
00507 
00508 
00518     virtual CallBack <MessageCallBack> * decryptCbCreate(
00519                                                         const TipcMt & mt,
00520                                                         MessageCallBack * implementor,
00521                                                         void* arg = NULL)
00522     throw (TipcException);
00523 
00524 
00533     virtual CallBack <MessageCallBack> * defaultCbCreate(
00534                                                         MessageCallBack * implementor,
00535                                                         void* arg = NULL)
00536     throw (TipcException);
00537 
00538 
00548     virtual CallBack <MessageCallBack> * processCbCreate(
00549                                                         const TipcMt & mt,
00550                                                         MessageCallBack * implementor,
00551                                                         void* arg = NULL)
00552     throw (TipcException);
00553 
00554 
00564     virtual CallBack <MessageCallBack> * readCbCreate(
00565                                                      const TipcMt & mt,
00566                                                      MessageCallBack * implementor,
00567                                                      void* arg = NULL)
00568     throw (TipcException);
00569 
00570 
00580     virtual CallBack <MessageCallBack> * writeCbCreate(
00581                                                       const TipcMt & mt,
00582                                                       MessageCallBack * implementor,
00583                                                       void* arg = NULL)
00584     throw (TipcException);
00585 
00586 
00595     virtual CallBack <EncodeCallBack> * encodeCbCreate(
00596                                                       EncodeCallBack * implementor,
00597                                                       void* arg = NULL)
00598     throw (TipcException);
00599 
00600 
00609     virtual CallBack <DecodeCallBack> * decodeCbCreate(
00610                                                       DecodeCallBack * impleemntor,
00611                                                       void* arg = NULL)
00612     throw (TipcException);
00613 
00614 
00615     // ---------------------------------------------------------------------
00616     //  Starred methods have RTserver (TipcSrv*) overrides
00617     // ---------------------------------------------------------------------
00618 
00624     virtual const char * getPeerUniqueSubject() const throw (TipcException);
00625 
00631     virtual const char * getNode() const throw (TipcException);
00632 
00638     virtual const char * getUser() const throw (TipcException);
00639 
00645     virtual int4 getPid() const throw (TipcException);
00646 
00652     virtual const char * getArch() const throw (TipcException);
00653 
00659     virtual void lock() throw (TipcException);
00660 
00661     virtual void unlock() throw (TipcException);
00663 
00664     // -- GMD --
00665 
00670     virtual void gmdFileCreate() throw (TipcException);
00671 
00677     virtual void gmdFileDelete() throw (TipcException);
00678 
00684     virtual void gmdResend() throw (TipcException);
00685 
00692     virtual void gmdMsgDelete(TipcMsg& msg) throw (TipcException);
00693 
00699     virtual void gmdMsgResend(TipcMsg& msg) throw (TipcException);
00700 
00708     virtual uint4 getGmdMaxSize() const throw (TipcException);
00709     virtual void setGmdMaxSize(uint4 gmd_max_size)
00710     throw (TipcException);
00712 
00719     const char * getGmdDir() const
00720     throw (TipcException);
00721 
00728     virtual int4 getGmdNumPending() const throw (TipcException);
00729 
00743     virtual int4 trafficGetBytesRecv() const throw (TipcException);
00744 
00751     virtual int8 trafficGetBytesRecv8() const throw (TipcException);
00752 
00772     virtual int4 trafficGetBytesSent() const throw (TipcException);
00773 
00786     virtual int8 trafficGetBytesSent8() const throw (TipcException);
00787 
00801     virtual int4 trafficGetMsgsRecv() const throw (TipcException);
00802 
00809     virtual int8 trafficGetMsgsRecv8() const throw (TipcException);
00810 
00830     virtual int4 trafficGetMsgsSent() const throw (TipcException);
00831 
00844     virtual int8 trafficGetMsgsSent8() const throw (TipcException);
00845 
00852     virtual int4 bufferGetReadSize() const throw (TipcException);
00853 
00860     virtual int4 bufferGetWriteSize() const throw (TipcException);
00861   };
00862 
00863 
00873   class T_IPCX_API TipcConnServer : public TipcConn {
00874 
00875   public:
00884     TipcConnServer(const char * link_name) throw (TipcException);
00885     TipcConnServer(T_IPC_CONN connection, bool destroy_flag=TRUE)
00886     throw (TipcException);
00888 
00890     virtual ~TipcConnServer()  throw();
00891 
00899     virtual TipcConn *accept() throw (TipcException);
00900   };
00901 
00910   class T_IPCX_API TipcConnClient : public TipcConn {
00911 
00912   public:
00921     TipcConnClient() throw () {}
00922     TipcConnClient(const char * link_name) throw (TipcException);
00923     TipcConnClient(T_IPC_CONN connection, bool destroy_flag=true)
00924     throw (TipcException);
00926 
00928     virtual ~TipcConnClient() throw();
00929   };
00930 
00931 } // namespace SmartSockets
00932 #endif

Generated on Fri Jul 14 15:05:54 2006 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001