A brief file description. More...
#include "Ptr.h"
#include "ink_defs.h"
#include "ink_assert.h"
#include "Arena.h"
#include "HdrToken.h"
Go to the source code of this file.
Data Structures | |
struct | HdrHeapObjImpl |
struct | StrHeapDesc |
class | HdrStrHeap |
class | HdrHeap |
struct | HdrHeap::HeapGuard |
Struct to prevent garbage collection on heaps. More... | |
struct | MarshalXlate |
struct | HeapCheck |
struct | HdrHeapSDKHandle |
Defines | |
#define | HDR_PTR_SIZE (sizeof(uint64_t)) |
#define | HDR_PTR_ALIGNMENT_MASK ((HDR_PTR_SIZE) - 1L) |
#define | ROUND(x, l) (((x) + ((l) - 1L)) & ~((l) - 1L)) |
#define | HDR_BUF_RONLY_HEAPS 3 |
#define | HDR_HEAP_DEFAULT_SIZE 2048 |
#define | HDR_STR_HEAP_DEFAULT_SIZE 2048 |
#define | HDR_MAX_ALLOC_SIZE (HDR_HEAP_DEFAULT_SIZE - sizeof(HdrHeap)) |
#define | HDR_HEAP_HDR_SIZE ROUND(sizeof(HdrHeap), HDR_PTR_SIZE) |
#define | STR_HEAP_HDR_SIZE sizeof(HdrStrHeap) |
#define | HDR_MARSHAL_STR(ptr, table, nentries) |
#define | HDR_MARSHAL_STR_1(ptr, table) |
#define | HDR_MARSHAL_PTR(ptr, type, table, nentries) |
#define | HDR_MARSHAL_PTR_1(ptr, type, table) |
#define | HDR_UNMARSHAL_STR(ptr, offset) |
#define | HDR_UNMARSHAL_PTR(ptr, type, offset) |
#define | HDR_MOVE_STR(str, len) |
#define | CHECK_STR(str, len, _heaps, _num_heaps) |
Enumerations | |
enum | { HDR_HEAP_OBJ_EMPTY = 0, HDR_HEAP_OBJ_RAW = 1, HDR_HEAP_OBJ_URL = 2, HDR_HEAP_OBJ_HTTP_HEADER = 3, HDR_HEAP_OBJ_MIME_HEADER = 4, HDR_HEAP_OBJ_FIELD_BLOCK = 5, HDR_HEAP_OBJ_FIELD_STANDALONE = 6, HDR_HEAP_OBJ_FIELD_SDK_HANDLE = 7, HDR_HEAP_OBJ_MAGIC = 0x0FEEB1E0 } |
enum | { HDR_BUF_MAGIC_ALIVE = 0xabcdfeed, HDR_BUF_MAGIC_MARSHALED = 0xdcbafeed, HDR_BUF_MAGIC_DEAD = 0xabcddead, HDR_BUF_MAGIC_CORRUPT = 0xbadbadcc } |
Functions | |
void | obj_describe (HdrHeapObjImpl *obj, bool recurse) |
int | obj_is_aligned (HdrHeapObjImpl *obj) |
void | obj_clear_data (HdrHeapObjImpl *obj) |
void | obj_copy_data (HdrHeapObjImpl *s_obj, HdrHeapObjImpl *d_obj) |
void | obj_copy (HdrHeapObjImpl *s_obj, char *d_addr) |
void | obj_init_header (HdrHeapObjImpl *obj, uint32_t type, uint32_t nbytes, uint32_t obj_flags) |
inkcoreapi HdrHeap * | new_HdrHeap (int size=HDR_HEAP_DEFAULT_SIZE) |
void | hdr_heap_test () |
A brief file description.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file HdrHeap.h.
#define CHECK_STR | ( | str, | ||
len, | ||||
_heaps, | ||||
_num_heaps | ||||
) |
{ \ if (str) { \ int found = 0; \ for (int i = 0; i < _num_heaps; i++) { \ if (str >= _heaps[i].start && \ str + len <= heaps[i].end) { \ found = 1; \ } \ } \ ink_release_assert(found); \ } \ }
Definition at line 428 of file HdrHeap.h.
Referenced by URLImpl::check_strings(), MIMEFieldBlockImpl::check_strings(), and HTTPHdrImpl::check_strings().
#define HDR_BUF_RONLY_HEAPS 3 |
Definition at line 54 of file HdrHeap.h.
Referenced by HdrHeap::attach_str_heap().
#define HDR_HEAP_DEFAULT_SIZE 2048 |
Definition at line 56 of file HdrHeap.h.
Referenced by HdrHeap::destroy(), and new_HdrHeap().
#define HDR_HEAP_HDR_SIZE ROUND(sizeof(HdrHeap), HDR_PTR_SIZE) |
Definition at line 60 of file HdrHeap.h.
Referenced by HdrHeap::check_marshalled().
#define HDR_MARSHAL_PTR | ( | ptr, | ||
type, | ||||
table, | ||||
nentries | ||||
) |
if (ptr) { \ int found = 0; \ for (int i = 0; i < nentries; i++) { \ if ((char*) ptr >= table[i].start && \ (char*) ptr <= table[i].end) { \ ptr = (type *) (((char*)ptr) - (uintptr_t) table[i].offset); \ found = 1; \ break; \ } \ } \ ink_assert(found); \ if (found == 0) { \ return -1; \ } \ }
Definition at line 370 of file HdrHeap.h.
Referenced by MIMEHdrImpl::marshal(), MIMEFieldBlockImpl::marshal(), and HTTPHdrImpl::marshal().
#define HDR_MARSHAL_PTR_1 | ( | ptr, | ||
type, | ||||
table | ||||
) |
if (ptr) { \ int found = 0; \ if ((char*) ptr >= table[0].start && \ (char*) ptr <= table[0].end) { \ ptr = (type *) (((char*)ptr) - (uintptr_t) table[0].offset); \ found = 1; \ } \ ink_assert(found); \ if (found == 0) { \ return -1; \ } \ }
Definition at line 387 of file HdrHeap.h.
Referenced by MIMEFieldBlockImpl::marshal().
#define HDR_MARSHAL_STR | ( | ptr, | ||
table, | ||||
nentries | ||||
) |
if (ptr) { \ int found = 0; \ for (int i = 0; i < nentries; i++) { \ if (ptr >= table[i].start && \ ptr <= table[i].end) { \ ptr = (((char*)ptr) - (uintptr_t) table[i].offset); \ found = 1; \ break; \ } \ } \ ink_assert(found); \ if (found == 0) { \ return -1; \ } \ }
Definition at line 336 of file HdrHeap.h.
Referenced by URLImpl::marshal(), MIMEFieldBlockImpl::marshal(), and HTTPHdrImpl::marshal().
#define HDR_MARSHAL_STR_1 | ( | ptr, | ||
table | ||||
) |
if (ptr) { \ int found = 0; \ if (ptr >= table[0].start && \ ptr <= table[0].end) { \ ptr = (((char*)ptr) - (uintptr_t) table[0].offset); \ found = 1; \ } \ ink_assert(found); \ if (found == 0) { \ return -1; \ } \ }
Definition at line 354 of file HdrHeap.h.
Referenced by MIMEFieldBlockImpl::marshal().
#define HDR_MAX_ALLOC_SIZE (HDR_HEAP_DEFAULT_SIZE - sizeof(HdrHeap)) |
Definition at line 59 of file HdrHeap.h.
Referenced by HdrHeap::allocate_obj().
#define HDR_MOVE_STR | ( | str, | ||
len | ||||
) |
{ \ if (str) { \ char* new_str = new_heap->allocate(len); \ if(new_str) \ memcpy(new_str, str, len); \ str = new_str; \ } \ }
Definition at line 416 of file HdrHeap.h.
Referenced by URLImpl::move_strings(), MIMEFieldBlockImpl::move_strings(), and HTTPHdrImpl::move_strings().
#define HDR_PTR_ALIGNMENT_MASK ((HDR_PTR_SIZE) - 1L) |
Definition at line 46 of file HdrHeap.h.
Referenced by agg_copy(), HdrHeap::marshal(), and obj_is_aligned().
#define HDR_PTR_SIZE (sizeof(uint64_t)) |
Definition at line 45 of file HdrHeap.h.
Referenced by HdrHeap::allocate_obj(), CoreUtils::load_http_hdr(), loop_over_heap_objs(), HdrHeap::marshal(), HdrHeap::marshal_length(), cache_bc::HTTPInfo_v21::marshalled_length(), and HdrHeap::unmarshal().
#define HDR_STR_HEAP_DEFAULT_SIZE 2048 |
Definition at line 57 of file HdrHeap.h.
Referenced by HdrStrHeap::free(), and new_HdrStrHeap().
#define HDR_UNMARSHAL_PTR | ( | ptr, | ||
type, | ||||
offset | ||||
) |
if (ptr) { \ ptr = (type *) (((char*)ptr) + offset); \ }
Definition at line 409 of file HdrHeap.h.
Referenced by MIMEHdrImpl::unmarshal(), MIMEFieldBlockImpl::unmarshal(), and HTTPHdrImpl::unmarshal().
#define HDR_UNMARSHAL_STR | ( | ptr, | ||
offset | ||||
) |
if (ptr) { \ ptr = ((char*)ptr) + offset; \ }
Definition at line 404 of file HdrHeap.h.
Referenced by URLImpl::unmarshal(), MIMEFieldBlockImpl::unmarshal(), and HTTPHdrImpl::unmarshal().
#define ROUND | ( | x, | ||
l | ||||
) | (((x) + ((l) - 1L)) & ~((l) - 1L)) |
Definition at line 48 of file HdrHeap.h.
Referenced by HdrHeap::allocate_obj(), cache_bc::HTTPInfo_v21::copy_and_upgrade_unmarshalled_to_v23(), CoreUtils::load_http_hdr(), loop_over_heap_objs(), HdrHeap::marshal(), HdrHeap::marshal_length(), cache_bc::HTTPInfo_v21::marshalled_length(), new_HdrStrHeap(), and HdrHeap::unmarshal().
#define STR_HEAP_HDR_SIZE sizeof(HdrStrHeap) |
Definition at line 61 of file HdrHeap.h.
Referenced by HdrHeap::allocate_str(), HdrStrHeap::contains(), HdrStrHeap::expand(), and HdrHeap::inherit_string_heaps().
anonymous enum |
anonymous enum |
void hdr_heap_test | ( | ) |
inkcoreapi HdrHeap* new_HdrHeap | ( | int | size = HDR_HEAP_DEFAULT_SIZE |
) |
Definition at line 116 of file HdrHeap.cc.
References ats_malloc(), HDR_HEAP_DEFAULT_SIZE, hdrHeapAllocator, HdrHeap::init(), HdrHeap::m_size, this_ethread(), and THREAD_ALLOC.
Referenced by HdrHeap::allocate_obj(), MIMEHdr::copy(), HTTPHdr::copy(), URL::create(), MIMEHdr::create(), HTTPHdr::create(), HdrHeap_Coalesce(), MIMEHdr::parse(), and TSMBufferCreate().
void obj_clear_data | ( | HdrHeapObjImpl * | obj | ) | [inline] |
Definition at line 96 of file HdrHeap.h.
References HdrHeapObjImpl::m_length.
Referenced by url_clear(), and url_create().
void obj_copy | ( | HdrHeapObjImpl * | s_obj, | |
char * | d_addr | |||
) | [inline] |
Definition at line 117 of file HdrHeap.h.
References HdrHeapObjImpl::m_length, and memcpy.
void obj_copy_data | ( | HdrHeapObjImpl * | s_obj, | |
HdrHeapObjImpl * | d_obj | |||
) | [inline] |
Definition at line 104 of file HdrHeap.h.
References ink_assert, HdrHeapObjImpl::m_length, HdrHeapObjImpl::m_type, and memcpy.
Referenced by url_copy_onto().
void obj_describe | ( | HdrHeapObjImpl * | obj, | |
bool | recurse | |||
) |
Definition at line 52 of file HdrHeap.cc.
References Debug, HDR_HEAP_OBJ_EMPTY, HDR_HEAP_OBJ_FIELD_BLOCK, HDR_HEAP_OBJ_HTTP_HEADER, HDR_HEAP_OBJ_MIME_HEADER, HDR_HEAP_OBJ_RAW, HDR_HEAP_OBJ_URL, http_hdr_describe(), HdrHeapObjImpl::m_length, HdrHeapObjImpl::m_obj_flags, HdrHeapObjImpl::m_type, mime_field_block_describe(), mime_hdr_describe(), and url_describe().
Referenced by HttpTransact::EndRemapRequest(), HttpTransact::HandleRequest(), http_hdr_describe(), mime_hdr_describe(), and HttpTransact::StartRemapRequest().
void obj_init_header | ( | HdrHeapObjImpl * | obj, | |
uint32_t | type, | |||
uint32_t | nbytes, | |||
uint32_t | obj_flags | |||
) | [inline] |
Definition at line 123 of file HdrHeap.h.
References HdrHeapObjImpl::m_length, HdrHeapObjImpl::m_obj_flags, and HdrHeapObjImpl::m_type.
Referenced by HdrHeap::allocate_obj(), mime_hdr_init(), and sdk_alloc_field_handle().
int obj_is_aligned | ( | HdrHeapObjImpl * | obj | ) | [inline] |
Definition at line 90 of file HdrHeap.h.
References HDR_PTR_ALIGNMENT_MASK.
Referenced by HdrHeap::allocate_obj(), CoreUtils::load_http_hdr(), HdrHeap::marshal(), and HdrHeap::unmarshal().