Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #ifndef LOG_COLLATION_CLIENT_SM_H
00025 #define LOG_COLLATION_CLIENT_SM_H
00026 
00027 
00028 
00029 
00030 #include "P_HostDB.h"
00031 #include "P_Net.h"
00032 #include "LogCollationBase.h"
00033 
00034 
00035 
00036 
00037 
00038 class LogBuffer;
00039 class LogHost;
00040 
00041 
00042 
00043 
00044 
00045 class LogCollationClientSM:public LogCollationBase, public Continuation
00046 {
00047 
00048 public:
00049 
00050   LogCollationClientSM(LogHost * log_host);
00051   ~LogCollationClientSM();
00052 
00053   int client_handler(int event, void *data);
00054 
00055   
00056   int send(LogBuffer * log_buffer);
00057 
00058 private:
00059 
00060   enum ClientState
00061   {
00062     LOG_COLL_CLIENT_AUTH,
00063     LOG_COLL_CLIENT_DNS,
00064     LOG_COLL_CLIENT_DONE,
00065     LOG_COLL_CLIENT_FAIL,
00066     LOG_COLL_CLIENT_IDLE,
00067     LOG_COLL_CLIENT_INIT,
00068     LOG_COLL_CLIENT_OPEN,
00069     LOG_COLL_CLIENT_SEND
00070   };
00071 
00072   enum ClientFlowControl
00073   {
00074     LOG_COLL_FLOW_ALLOW,
00075     LOG_COLL_FLOW_DENY
00076   };
00077 
00078 private:
00079 
00080   
00081   int client_auth(int event, VIO * vio);
00082   int client_dns(int event, HostDBInfo * hostdb_info);
00083   int client_done(int event, void *data);
00084   int client_fail(int event, void *data);
00085   int client_idle(int event, void *data);
00086   int client_init(int event, void *data);
00087   int client_open(int event, NetVConnection * net_vc);
00088   int client_send(int event, VIO * vio);
00089   ClientState m_client_state;
00090 
00091   
00092   void flush_to_orphan();
00093 
00094   
00095   NetVConnection *m_host_vc;
00096   VIO *m_host_vio;
00097   MIOBuffer *m_auth_buffer;
00098   IOBufferReader *m_auth_reader;
00099   MIOBuffer *m_send_buffer;
00100   IOBufferReader *m_send_reader;
00101   Action *m_pending_action;
00102   Event *m_pending_event;
00103 
00104   
00105   VIO *m_abort_vio;
00106   MIOBuffer *m_abort_buffer;
00107   bool m_host_is_up;
00108 
00109   
00110   LogBufferList *m_buffer_send_list;
00111   LogBuffer *m_buffer_in_iocore;
00112   ClientFlowControl m_flow;
00113 
00114   
00115   LogHost *m_log_host;
00116 
00117   
00118   static int ID;
00119   int m_id;
00120 
00121 };
00122 
00123 typedef int (LogCollationClientSM::*LogCollationClientSMHandler) (int, void *);
00124 
00125 #endif // LOG_COLLATION_CLIENT_SM_H