Lines Matching defs:context

674 static int hd_context_init(nghttp2_hd_context *context, nghttp2_mem *mem) {
676 context->mem = mem;
677 context->bad = 0;
678 context->hd_table_bufsize_max = NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE;
680 &context->hd_table,
681 context->hd_table_bufsize_max / NGHTTP2_HD_ENTRY_OVERHEAD, mem);
686 context->hd_table_bufsize = 0;
687 context->next_seq = 0;
692 static void hd_context_free(nghttp2_hd_context *context) {
693 hd_ringbuf_free(&context->hd_table, context->mem);
1100 static int add_hd_table_incremental(nghttp2_hd_context *context,
1108 mem = context->mem;
1111 while (context->hd_table_bufsize + room > context->hd_table_bufsize_max &&
1112 context->hd_table.len > 0) {
1114 size_t idx = context->hd_table.len - 1;
1115 nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, idx);
1117 context->hd_table_bufsize -=
1123 hd_ringbuf_pop_back(&context->hd_table);
1132 if (room > context->hd_table_bufsize_max) {
1145 rv = hd_ringbuf_push_front(&context->hd_table, new_ent, mem);
1154 new_ent->seq = context->next_seq++;
1161 context->hd_table_bufsize += room;
1196 static search_result search_hd_table(nghttp2_hd_context *context,
1217 (ssize_t)(context->next_seq - 1 - ent->seq + NGHTTP2_STATIC_TABLE_LENGTH);
1223 static void hd_context_shrink_table_size(nghttp2_hd_context *context,
1227 mem = context->mem;
1229 while (context->hd_table_bufsize > context->hd_table_bufsize_max &&
1230 context->hd_table.len > 0) {
1231 size_t idx = context->hd_table.len - 1;
1232 nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, idx);
1233 context->hd_table_bufsize -=
1235 hd_ringbuf_pop_back(&context->hd_table);
1294 #define INDEX_RANGE_VALID(context, idx) \
1295 ((idx) < (context)->hd_table.len + NGHTTP2_STATIC_TABLE_LENGTH)
1297 static size_t get_max_index(nghttp2_hd_context *context) {
1298 return context->hd_table.len + NGHTTP2_STATIC_TABLE_LENGTH;
1301 nghttp2_hd_nv nghttp2_hd_table_get(nghttp2_hd_context *context, size_t idx) {
1302 assert(INDEX_RANGE_VALID(context, idx));
1304 return hd_ringbuf_get(&context->hd_table, idx - NGHTTP2_STATIC_TABLE_LENGTH)
1315 static const nghttp2_nv *nghttp2_hd_table_get2(nghttp2_hd_context *context,
1317 assert(INDEX_RANGE_VALID(context, idx));
1319 return &hd_ringbuf_get(&context->hd_table,
2306 static const nghttp2_nv *hd_get_table_entry(nghttp2_hd_context *context,
2314 if (!INDEX_RANGE_VALID(context, idx)) {
2318 return nghttp2_hd_table_get2(context, idx);