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_HOST_SM_H
00025 #define LOG_COLLATION_HOST_SM_H
00026
00027
00028
00029
00030
00031 #include "P_EventSystem.h"
00032 #include "LogCollationBase.h"
00033
00034
00035
00036
00037
00038 struct LogBufferHeader;
00039
00040
00041
00042
00043
00044 class LogCollationHostSM:public LogCollationBase, public Continuation
00045 {
00046
00047 public:
00048
00049 LogCollationHostSM(NetVConnection * client_vc);
00050
00051
00052 int host_handler(int event, void *data);
00053 int read_handler(int event, void *data);
00054
00055 private:
00056
00057 enum HostState
00058 {
00059 LOG_COLL_HOST_NULL,
00060 LOG_COLL_HOST_AUTH,
00061 LOG_COLL_HOST_DONE,
00062 LOG_COLL_HOST_INIT,
00063 LOG_COLL_HOST_RECV
00064 };
00065
00066 enum ReadState
00067 {
00068 LOG_COLL_READ_NULL,
00069 LOG_COLL_READ_BODY,
00070 LOG_COLL_READ_HDR
00071 };
00072
00073 private:
00074
00075
00076 int host_init(int event, void *data);
00077 int host_auth(int event, void *data);
00078 int host_recv(int event, void *data);
00079 int host_done(int event, void *data);
00080 HostState m_host_state;
00081
00082
00083 int read_hdr(int event, VIO * vio);
00084 int read_body(int event, VIO * vio);
00085 int read_done(int event, void *data);
00086 int read_start();
00087 ReadState m_read_state;
00088
00089
00090 void read_partial(VIO * vio);
00091
00092
00093 NetVConnection *m_client_vc;
00094 VIO *m_client_vio;
00095 MIOBuffer *m_client_buffer;
00096 IOBufferReader *m_client_reader;
00097 Event *m_pending_event;
00098
00099
00100 NetMsgHeader m_net_msg_header;
00101 char *m_read_buffer;
00102 int64_t m_read_bytes_wanted;
00103 int64_t m_read_bytes_received;
00104
00105
00106 int m_client_ip;
00107 int m_client_port;
00108
00109
00110 static int ID;
00111 int m_id;
00112
00113 };
00114
00115 typedef int (LogCollationHostSM::*LogCollationHostSMHandler) (int, void *);
00116
00117 #endif // LOG_COLLATION_HOST_SM_H