Back to index

nordugrid-arc-nox  1.1.0~rc6
MCCTCP.h
Go to the documentation of this file.
00001 #ifndef __ARC_MCCTCP_H__
00002 #define __ARC_MCCTCP_H__
00003 
00004 #include <arc/message/MCC.h>
00005 #include <arc/message/PayloadStream.h>
00006 #include "PayloadTCPSocket.h"
00007 
00008 namespace Arc {
00009 
00011 
00015   class MCC_TCP : public MCC {
00016   public:
00017     MCC_TCP(Config *cfg);
00018   protected:
00019     static Logger logger;
00020     friend class PayloadTCPSocket;
00021   };
00022 
00040 class MCC_TCP_Service: public MCC_TCP
00041 {
00042     friend class mcc_tcp_exec_t;
00043     private:
00044         class mcc_tcp_exec_t {
00045             public:
00046                 MCC_TCP_Service* obj;
00047                 int handle;
00048                 /* pthread_t thread; */
00049                 int id;
00050                 bool no_delay;
00051                 int timeout;
00052                 mcc_tcp_exec_t(MCC_TCP_Service* o,int h,int t, bool nd = false);
00053                 operator bool(void) { return (handle != -1); };
00054         };
00055         class mcc_tcp_handle_t {
00056             public:
00057                 int handle;
00058                 bool no_delay;
00059                 int timeout;
00060                 mcc_tcp_handle_t(int h, int t, bool nd = false):handle(h),no_delay(nd),timeout(t) { };
00061                 operator int(void) { return handle; };
00062         };
00063         std::list<mcc_tcp_handle_t> handles_; 
00064         std::list<mcc_tcp_exec_t> executers_; 
00065         int max_executers_;
00066         bool max_executers_drop_;
00067         /* pthread_t listen_th_; ** thread listening for incoming connections */
00068         Glib::Mutex lock_; 
00069         Glib::Cond cond_;
00070         static void listener(void *); 
00071         static void executer(void *); 
00072     public:
00073         MCC_TCP_Service(Config *cfg);
00074         virtual ~MCC_TCP_Service(void);
00075         virtual MCC_Status process(Message&,Message&);
00076 };
00077 
00084 class MCC_TCP_Client: public MCC_TCP
00085 {
00086     private:
00089         PayloadTCPSocket* s_;
00090     public:
00091         MCC_TCP_Client(Config *cfg);
00092         virtual ~MCC_TCP_Client(void);
00093         virtual MCC_Status process(Message&,Message&);
00094 };
00095 
00096 } // namespace Arc
00097 
00098 #endif /* __ARC_MCCTCP_H__ */