Data Structures | Defines | Enumerations | Functions

HdrHeap.h File Reference

A brief file description. More...

#include "Ptr.h"
#include "ink_defs.h"
#include "ink_assert.h"
#include "Arena.h"
#include "HdrToken.h"
Include dependency graph for HdrHeap.h:
This graph shows which files directly or indirectly include this file:

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 HdrHeapnew_HdrHeap (int size=HDR_HEAP_DEFAULT_SIZE)
void hdr_heap_test ()

Detailed Description

A brief file description.

License

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 Documentation

#define CHECK_STR (   str,
  len,
  _heaps,
  _num_heaps 
)
Value:
{ \
   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 
)
Value:
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 
)
Value:
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 
)
Value:
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 
)
Value:
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 
)
Value:
{ \
   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))
#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 
)
Value:
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 
)
Value:
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))
#define STR_HEAP_HDR_SIZE   sizeof(HdrStrHeap)

Enumeration Type Documentation

anonymous enum
Enumerator:
HDR_HEAP_OBJ_EMPTY 
HDR_HEAP_OBJ_RAW 
HDR_HEAP_OBJ_URL 
HDR_HEAP_OBJ_HTTP_HEADER 
HDR_HEAP_OBJ_MIME_HEADER 
HDR_HEAP_OBJ_FIELD_BLOCK 
HDR_HEAP_OBJ_FIELD_STANDALONE 
HDR_HEAP_OBJ_FIELD_SDK_HANDLE 
HDR_HEAP_OBJ_MAGIC 

Definition at line 63 of file HdrHeap.h.

anonymous enum
Enumerator:
HDR_BUF_MAGIC_ALIVE 
HDR_BUF_MAGIC_MARSHALED 
HDR_BUF_MAGIC_DEAD 
HDR_BUF_MAGIC_CORRUPT 

Definition at line 133 of file HdrHeap.h.


Function Documentation

void hdr_heap_test (  ) 
inkcoreapi HdrHeap* new_HdrHeap ( int  size = HDR_HEAP_DEFAULT_SIZE  ) 
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 
)
void obj_init_header ( HdrHeapObjImpl obj,
uint32_t  type,
uint32_t  nbytes,
uint32_t  obj_flags 
) [inline]
int obj_is_aligned ( HdrHeapObjImpl obj  )  [inline]