00001 /** @file 00002 00003 Declarations for the RemapPlugins class. 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 * Remap plugins class 00026 **/ 00027 00028 #if !defined (_REMAPPLUGINS_h_) 00029 #define _REMAPPLUGINS_h_ 00030 00031 #include "libts.h" 00032 #include "I_EventSystem.h" 00033 #include "RemapProcessor.h" 00034 #include "api/ts/ts.h" 00035 #include "api/ts/remap.h" 00036 #include "RemapPluginInfo.h" 00037 #include "HttpTransact.h" 00038 #include "ReverseProxy.h" 00039 00040 /** 00041 * A class that represents a queue of plugins to run 00042 **/ 00043 struct RemapPlugins: public Continuation 00044 { 00045 RemapPlugins() 00046 : _cur(0) 00047 { } 00048 00049 RemapPlugins(HttpTransact::State* s, URL* u, HTTPHdr* h, host_hdr_info* hi) 00050 : _cur(0), _s(s), _request_url(u), _request_header(h), _hh_ptr(hi) 00051 { } 00052 00053 ~RemapPlugins() { _cur = 0; } 00054 00055 // Some basic setters 00056 void setState(HttpTransact::State* state) { _s = state; } 00057 void setRequestUrl(URL* u) { _request_url = u; } 00058 void setRequestHeader(HTTPHdr* h) { _request_header = h; } 00059 void setHostHeaderInfo(host_hdr_info* h) { _hh_ptr = h; } 00060 00061 int run_remap(int event, Event* e); 00062 int run_single_remap(); 00063 TSRemapStatus run_plugin(remap_plugin_info* plugin); 00064 00065 Action action; 00066 00067 private: 00068 unsigned int _cur; 00069 HttpTransact::State * _s; 00070 URL *_request_url; 00071 HTTPHdr *_request_header; 00072 host_hdr_info *_hh_ptr; 00073 }; 00074 00075 #endif