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

TransformInternal.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 __TRANSFORM_INTERNAL_H__
00025 #define __TRANSFORM_INTERNAL_H__
00026 
00027 
00028 #include "HttpSM.h"
00029 #include "MIME.h"
00030 #include "Transform.h"
00031 #include "P_EventSystem.h"
00032 
00033 
00034 class TransformVConnection;
00035 
00036 
00037 class TransformTerminus:public VConnection
00038 {
00039 public:
00040   TransformTerminus(TransformVConnection * tvc);
00041 
00042   int handle_event(int event, void *edata);
00043 
00044   VIO *do_io_read(Continuation * c, int64_t nbytes, MIOBuffer * buf);
00045   VIO *do_io_write(Continuation * c, int64_t nbytes, IOBufferReader * buf, bool owner = false);
00046   void do_io_close(int lerrno = -1);
00047   void do_io_shutdown(ShutdownHowTo_t howto);
00048 
00049   void reenable(VIO * vio);
00050 
00051 public:
00052   TransformVConnection * m_tvc;
00053   VIO m_read_vio;
00054   VIO m_write_vio;
00055   volatile int m_event_count;
00056   volatile int m_deletable;
00057   volatile int m_closed;
00058   int m_called_user;
00059 };
00060 
00061 
00062 class TransformVConnection:public TransformVCChain
00063 {
00064 public:
00065   TransformVConnection(Continuation * cont, APIHook * hooks);
00066   ~TransformVConnection();
00067 
00068   int handle_event(int event, void *edata);
00069 
00070   VIO *do_io_read(Continuation * c, int64_t nbytes, MIOBuffer * buf);
00071   VIO *do_io_write(Continuation * c, int64_t nbytes, IOBufferReader * buf, bool owner = false);
00072   void do_io_close(int lerrno = -1);
00073   void do_io_shutdown(ShutdownHowTo_t howto);
00074 
00075   void reenable(VIO * vio);
00076 
00077   /** Compute the backlog.
00078       @return The actual backlog, or a value at least @a limit.
00079   */
00080   virtual uint64_t backlog(uint64_t limit = UINT64_MAX);
00081 
00082 public:
00083   VConnection * m_transform;
00084   Continuation *m_cont;
00085   TransformTerminus m_terminus;
00086   volatile int m_closed;
00087 };
00088 
00089 
00090 class TransformControl:public Continuation
00091 {
00092 public:
00093   TransformControl();
00094 
00095   int handle_event(int event, void *edata);
00096 
00097 public:
00098   APIHooks m_hooks;
00099   VConnection *m_tvc;
00100   IOBufferReader *m_read_buf;
00101   MIOBuffer *m_write_buf;
00102 };
00103 
00104 
00105 class NullTransform:public INKVConnInternal
00106 {
00107 public:
00108   NullTransform(ProxyMutex * mutex);
00109   ~NullTransform();
00110 
00111   int handle_event(int event, void *edata);
00112 
00113 public:
00114   MIOBuffer * m_output_buf;
00115   IOBufferReader *m_output_reader;
00116   VIO *m_output_vio;
00117 };
00118 
00119 
00120 class RangeTransform:public INKVConnInternal
00121 {
00122 public:
00123   RangeTransform(ProxyMutex * mutex, RangeRecord * ranges, int num_fields, HTTPHdr *transform_resp, const char * content_type, int content_type_len, int64_t content_length);
00124   ~RangeTransform();
00125 
00126   // void parse_range_and_compare();
00127   int handle_event(int event, void *edata);
00128 
00129   void transform_to_range();
00130   void add_boundary(bool end);
00131   void add_sub_header(int index);
00132   void change_response_header();
00133   void calculate_output_cl();
00134 
00135 public:
00136   MIOBuffer * m_output_buf;
00137   IOBufferReader *m_output_reader;
00138   
00139   
00140   // MIMEField *m_range_field;
00141   HTTPHdr *m_transform_resp;
00142   VIO *m_output_vio;
00143   int64_t m_range_content_length;
00144   int m_num_chars_for_cl;
00145   int m_num_range_fields;
00146   int m_current_range;
00147   const char *m_content_type;
00148   int m_content_type_len;
00149   RangeRecord *m_ranges;
00150   int64_t m_output_cl;
00151   int64_t m_done;
00152   
00153 };
00154 
00155 #define PREFETCH
00156 #ifdef PREFETCH
00157 class PrefetchProcessor
00158 {
00159 public:
00160   void start();
00161 };
00162 
00163 extern PrefetchProcessor prefetchProcessor;
00164 #endif //PREFETCH
00165 
00166 #endif /* __TRANSFORM_INTERNAL_H__ */

Generated by  doxygen 1.7.1