src/hpack/hcollections

Dynamic headers table

Types

Hpack = object
A circular queue. This is an implementaion of the dynamic header table. It can be efficiently reused. HpackBound ends may be out of bounds and need to be wrapped around. All functions here take care of that
HpackBound = object
  n*, v*: Slice[int32]
Header's name and value boundaries

Procs

func `$`(q: Hpack): string {....raises: [], tags: [], forbids: [].}
Use it for debugging purposes only. Use substr and cmp for anything else
func `==`(a, b: Hpack): bool {....raises: [], tags: [], forbids: [].}
func `[]`(q: Hpack; i: int): lent HpackBound {.inline, ...raises: [], tags: [],
    forbids: [].}
func add(q: var Hpack; n, v: openArray[byte]) {....raises: [], tags: [],
    forbids: [].}
Add a header name and value to the table. Evicts entries that no longer fit. Items are added and removed in FIFO order
func clear(q: var Hpack) {.inline, ...raises: [], tags: [], forbids: [].}
Efficiently clear the table
func clearLastResize(q: var Hpack) {....raises: [], tags: [], forbids: [].}
func cmpN(q: Hpack; i: int; s: openArray[byte]): bool {....raises: [], tags: [],
    forbids: [].}
func cmpV(q: Hpack; i: int; s: openArray[byte]): bool {....raises: [], tags: [],
    forbids: [].}
func finalSetSize(q: Hpack): int {....raises: [], tags: [], forbids: [].}
func hasResized(q: Hpack): bool {....raises: [], tags: [], forbids: [].}
func initDynHeaders(strsize: int): DynHeaders {....deprecated: "use initHpack",
    raises: [], tags: [], forbids: [].}
Deprecated: use initHpack
func initHBounds(n, v: Slice[int]): HBounds {....deprecated: "use initHpackBound",
    raises: [], tags: [], forbids: [].}
Deprecated: use initHpackBound
func initHpack(strsize: int): Hpack {.inline, ...raises: [], tags: [], forbids: [].}
Initialize a dynamic headers table. strsize is the max size in bytes of all headers put together.
func initHpackBound(n, v: Slice[int]): HpackBound {.inline, ...raises: [],
    tags: [], forbids: [].}
func len(q: Hpack): int {.inline, ...raises: [], tags: [], forbids: [].}
func minSetSize(q: Hpack): int {....raises: [], tags: [], forbids: [].}
func reset(q: var Hpack) {....deprecated, raises: [], tags: [], forbids: [].}
Deprecated
Deprecated, use clear() instead
func setSize(q: var Hpack; strsize: int) {....raises: [], tags: [], forbids: [].}
Resize the total headers max length. Evicts entries that don't fit anymore. Set to 0 to clear it.
func substr(q: Hpack; s: var seq[byte]; x: Slice[int32]) {....raises: [], tags: [],
    forbids: [].}

Iterators

iterator items(q: Hpack): lent HpackBound {.inline, ...raises: [], tags: [],
    forbids: [].}
iterator pairs(q: Hpack): (int, HpackBound) {.inline, ...raises: [], tags: [],
    forbids: [].}