func (dt *dynamicTable) add(f HeaderField) {
	dt.ents = append(dt.ents, f)
	dt.size += f.size()
	dt.evict()
}
TODO: change dynamicTable to be a struct with a slice and a size int field,
per http://http2.github.io/http2-spec/compression.html#rfc.section.4.1:


Then make add increment the size. maybe the max size should move from Decoder to
dynamicTable and add should return an ok bool if there was enough space.

Later we'll need a remove operation on dynamicTable.
package hpack
import (
	"bytes"
	"errors"
	"fmt"
)
type DecodingError struct {
	Err error
}
func (de DecodingError) Error() string {
	return fmt.Sprintf("decoding error: %v", de.Err)
}
type InvalidIndexError int
func (e InvalidIndexError) Error() string {
	return fmt.Sprintf("invalid indexed representation index %d", int(e))
}
type HeaderField struct {
	Name, Value string
	Sensitive bool
}
func (hf HeaderField) String() string {
	var suffix string
	if hf.Sensitive {
		suffix = " (sensitive)"
	}
	return fmt.Sprintf("header field %q = %q%s", hf.Name, hf.Value, suffix)
}
func (hf *HeaderField) size() uint32 {
	return uint32(len(hf.Name) + len(hf.Value) + 32)
}
type Decoder struct {
	dynTab dynamicTable
	emit   func(f HeaderField)
	emitEnabled bool  
	maxStrLen   int   
	buf []byte  
	saveBuf bytes.Buffer
}
func NewDecoder(maxDynamicTableSize uint32, emitFunc func(f HeaderField)) *Decoder {
	d := &Decoder{
		emit:        emitFunc,
		emitEnabled: true,
	}
	d.dynTab.allowedMaxSize = maxDynamicTableSize
	d.dynTab.setMaxSize(maxDynamicTableSize)
	return d
}
var ErrStringLength = errors.New("hpack: string too long")
func (d *Decoder) SetMaxStringLength(n int) {
	d.maxStrLen = n
}
func (d *Decoder) SetEmitFunc(emitFunc func(f HeaderField)) {
	d.emit = emitFunc
}
func (d *Decoder) SetEmitEnabled(v bool) { d.emitEnabled = v }
func (d *Decoder) EmitEnabled() bool { return d.emitEnabled }
func (d *Decoder) SetMaxDynamicTableSize(v uint32) {
	d.dynTab.setMaxSize(v)
}
func (d *Decoder) SetAllowedMaxDynamicTableSize(v uint32) {
	d.dynTab.allowedMaxSize = v
}
type dynamicTable struct {
	ents           []HeaderField
	size           uint32
	maxSize        uint32  
	allowedMaxSize uint32  
}
func (dt *dynamicTable) setMaxSize(v uint32) {
	dt.maxSize = v
	dt.evict()
}