Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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