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 /**************************************************************************** 00025 00026 HttpUpdateSM.h 00027 00028 Description: 00029 An HttpSM sub class for support scheduled update functionality 00030 00031 00032 00033 ****************************************************************************/ 00034 00035 #ifndef _HTTP_SM_UPDATE_H_ 00036 #define _HTTP_SM_UPDATE_H_ 00037 00038 #include "P_EventSystem.h" 00039 #include "HttpSM.h" 00040 00041 #define HTTP_SCH_UPDATE_EVENT_WRITTEN (HTTP_SCH_UPDATE_EVENTS_START + 1) 00042 #define HTTP_SCH_UPDATE_EVENT_UPDATED (HTTP_SCH_UPDATE_EVENTS_START + 2) 00043 #define HTTP_SCH_UPDATE_EVENT_DELETED (HTTP_SCH_UPDATE_EVENTS_START + 3) 00044 #define HTTP_SCH_UPDATE_EVENT_NOT_CACHED (HTTP_SCH_UPDATE_EVENTS_START + 4) 00045 #define HTTP_SCH_UPDATE_EVENT_ERROR (HTTP_SCH_UPDATE_EVENTS_START + 5) 00046 #define HTTP_SCH_UPDATE_EVENT_NO_ACTION (HTTP_SCH_UPDATE_EVENTS_START + 6) 00047 00048 00049 class HttpUpdateSM:public HttpSM 00050 { 00051 00052 public: 00053 00054 HttpUpdateSM(); 00055 00056 static HttpUpdateSM *allocate(); 00057 void destroy(); 00058 00059 Action *start_scheduled_update(Continuation * cont, HTTPHdr * req); 00060 00061 // private: 00062 bool cb_occured; 00063 Continuation *cb_cont; 00064 Action cb_action; 00065 int cb_event; 00066 00067 protected: 00068 void handle_api_return(); 00069 void set_next_state(); 00070 int kill_this_async_hook(int event, void *data); 00071 00072 }; 00073 00074 inline HttpUpdateSM * 00075 HttpUpdateSM::allocate() 00076 { 00077 extern ClassAllocator<HttpUpdateSM> httpUpdateSMAllocator; 00078 return httpUpdateSMAllocator.alloc(); 00079 } 00080 00081 // Regression/Testing Routing 00082 void init_http_update_test(); 00083 00084 #endif