1 /** @file 2 3 Declarations for the RemapPlugins class. 4 5 @section license License 6 7 Licensed to the Apache Software Foundation (ASF) under one 8 or more contributor license agreements. See the NOTICE file 9 distributed with this work for additional information 10 regarding copyright ownership. The ASF licenses this file 11 to you under the Apache License, Version 2.0 (the 12 "License"); you may not use this file except in compliance 13 with the License. You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 23 */ 24 25 #pragma once 26 27 #include "tscore/ink_platform.h" 28 #include "I_EventSystem.h" 29 #include "RemapProcessor.h" 30 #include "RemapPluginInfo.h" 31 #include "HttpTransact.h" 32 #include "ReverseProxy.h" 33 34 /** 35 * A class that represents a queue of plugins to run 36 **/ 37 struct RemapPlugins : public Continuation { 38 RemapPlugins() = default; RemapPluginsRemapPlugins39 RemapPlugins(HttpTransact::State *s, URL *u, HTTPHdr *h, host_hdr_info *hi) 40 : _s(s), _request_url(u), _request_header(h), _hh_ptr(hi) 41 { 42 } 43 44 // Some basic setters 45 void setStateRemapPlugins46 setState(HttpTransact::State *state) 47 { 48 _s = state; 49 } 50 void setRequestUrlRemapPlugins51 setRequestUrl(URL *u) 52 { 53 _request_url = u; 54 } 55 void setRequestHeaderRemapPlugins56 setRequestHeader(HTTPHdr *h) 57 { 58 _request_header = h; 59 } 60 void setHostHeaderInfoRemapPlugins61 setHostHeaderInfo(host_hdr_info *h) 62 { 63 _hh_ptr = h; 64 } 65 66 int run_remap(int event, Event *e); 67 bool run_single_remap(); 68 TSRemapStatus run_plugin(RemapPluginInst *plugin); 69 70 Action action; 71 72 private: 73 unsigned _cur = 0; 74 unsigned _rewritten = 0; 75 HttpTransact::State *_s = nullptr; 76 URL *_request_url = nullptr; 77 HTTPHdr *_request_header = nullptr; 78 host_hdr_info *_hh_ptr = nullptr; 79 }; 80