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

P_CacheHttp.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 __CACHE_HTTP_H__
00025 #define __CACHE_HTTP_H__
00026 
00027 #include "P_CacheArray.h"
00028 #ifdef HTTP_CACHE
00029 #include "HTTP.h"
00030 #include "URL.h"
00031 
00032 
00033 typedef URL CacheURL;
00034 typedef HTTPHdr CacheHTTPHdr;
00035 typedef HTTPInfo CacheHTTPInfo;
00036 
00037 
00038 #define OFFSET_BITS 24
00039 enum
00040 {
00041   OWNER_NONE = 0,
00042   OWNER_CACHE = 1,
00043   OWNER_HTTP = 2
00044 };
00045 
00046 #else
00047 struct CacheHTTPInfo
00048 {
00049 };
00050 
00051 #endif //HTTP_CACHE
00052 
00053 struct vec_info
00054 {
00055   CacheHTTPInfo alternate;
00056 };
00057 
00058 struct CacheHTTPInfoVector
00059 {
00060   void *magic;
00061 
00062     CacheHTTPInfoVector();
00063    ~CacheHTTPInfoVector();
00064 
00065   int count()
00066   {
00067     return xcount;
00068   }
00069   int insert(CacheHTTPInfo * info, int id = -1);
00070   CacheHTTPInfo *get(int idx);
00071   void detach(int idx, CacheHTTPInfo * r);
00072   void remove(int idx, bool destroy);
00073   void clear(bool destroy = true);
00074   void reset()
00075   {
00076     xcount = 0;
00077     data.clear();
00078   }
00079   void print(char *buffer, size_t buf_size, bool temps = true);
00080 
00081   int marshal_length();
00082   int marshal(char *buf, int length);
00083   uint32_t get_handles(const char *buf, int length, RefCountObj * block_ptr = NULL);
00084   int unmarshal(const char *buf, int length, RefCountObj * block_ptr);
00085 
00086   CacheArray<vec_info> data;
00087   int xcount;
00088   Ptr<RefCountObj> vector_buf;
00089 };
00090 
00091 TS_INLINE CacheHTTPInfo *
00092 CacheHTTPInfoVector::get(int idx)
00093 {
00094   ink_assert(idx >= 0);
00095   ink_assert(idx < xcount);
00096   return &data[idx].alternate;
00097 }
00098 
00099 #endif /* __CACHE_HTTP_H__ */

Generated by  doxygen 1.7.1