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

Transform.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_H__
00025 #define __TRANSFORM_H__
00026 
00027 #include "P_EventSystem.h"
00028 #include "HTTP.h"
00029 #include "InkAPIInternal.h"
00030 
00031 #define TRANSFORM_READ_READY   (TRANSFORM_EVENTS_START + 0)
00032 
00033 typedef struct _RangeRecord
00034 {
00035   _RangeRecord() :
00036   _start(-1), _end(-1), _done_byte(-1)
00037   { }
00038 
00039   int64_t _start;
00040   int64_t _end;
00041   int64_t _done_byte;
00042 } RangeRecord;
00043 
00044 class TransformProcessor
00045 {
00046 public:
00047   void start();
00048 
00049 public:
00050   VConnection * open(Continuation * cont, APIHook * hooks);
00051   INKVConnInternal *null_transform(ProxyMutex * mutex);
00052   INKVConnInternal *range_transform(ProxyMutex * mutex, RangeRecord * ranges, int, HTTPHdr *, const char * content_type, int content_type_len, int64_t content_length);
00053 };
00054 
00055 #ifdef TS_HAS_TESTS
00056 class TransformTest
00057 {
00058 public:
00059   static void run();
00060 };
00061 #endif
00062 
00063 /** A protocol class.
00064     This provides transform VC specific methods for external access
00065     without exposing internals or requiring extra includes.
00066 */
00067 class TransformVCChain : public VConnection
00068 {
00069  protected:
00070   /// Required constructor
00071   TransformVCChain(ProxyMutex* m);
00072  public:
00073   /** Compute the backlog.  This is the amount of data ready to read
00074       for each element of the chain.  If @a limit is non-negative then
00075       the method will return as soon as the computed backlog is at
00076       least that large. This provides for more efficient checking if
00077       the caller is interested only in whether the backlog is at least
00078       @a limit. The default is to accurately compute the backlog.
00079   */
00080   virtual uint64_t backlog(
00081                            uint64_t limit = UINT64_MAX ///< Maximum value of interest
00082                           ) = 0;
00083 };
00084 
00085 inline
00086 TransformVCChain::TransformVCChain(ProxyMutex* m)
00087                  : VConnection(m)
00088 {
00089 }
00090 
00091 ///////////////////////////////////////////////////////////////////
00092 /// RangeTransform implementation
00093 /// handling Range requests from clients
00094 ///////////////////////////////////////////////////////////////////
00095 
00096 /*-------------------------------------------------------------------------
00097   -------------------------------------------------------------------------*/
00098 
00099 inline static int
00100 num_chars_for_int(int64_t i)
00101 {
00102   int k = 1;
00103 
00104   if (i < 0)
00105     return 0;
00106 
00107   while ((i /= 10) != 0)
00108     ++k;
00109 
00110   return k;
00111 }
00112 
00113 extern TransformProcessor transformProcessor;
00114 
00115 
00116 #endif /* __TRANSFORM_H__ */
00117 

Generated by  doxygen 1.7.1