• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

LogCollationHostSM.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #ifndef LOG_COLLATION_HOST_SM_H
00025 #define LOG_COLLATION_HOST_SM_H
00026 
00027 //-------------------------------------------------------------------------
00028 // includes
00029 //-------------------------------------------------------------------------
00030 
00031 #include "P_EventSystem.h"
00032 #include "LogCollationBase.h"
00033 
00034 //-------------------------------------------------------------------------
00035 // pre-declarations
00036 //-------------------------------------------------------------------------
00037 
00038 struct LogBufferHeader;
00039 
00040 //-------------------------------------------------------------------------
00041 // LogCollationHostSM
00042 //-------------------------------------------------------------------------
00043 
00044 class LogCollationHostSM:public LogCollationBase, public Continuation
00045 {
00046 
00047 public:
00048 
00049   LogCollationHostSM(NetVConnection * client_vc);
00050 
00051   // handlers
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   // host states
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   // read states
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   // helper for read states
00090   void read_partial(VIO * vio);
00091 
00092   // iocore stuff
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   // read_state stuff
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   // client info
00106   int m_client_ip;
00107   int m_client_port;
00108 
00109   // debugging
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

Generated by  doxygen 1.7.1