func (l *packetList) InsertBefore(a, e *packet) {
	b := packetElementMapper{}.linkerFor(a).Prev()
	packetElementMapper{}.linkerFor(e).SetNext(a)
	packetElementMapper{}.linkerFor(e).SetPrev(b)
	packetElementMapper{}.linkerFor(a).SetPrev(e)
	if b != nil {
		packetElementMapper{}.linkerFor(b).SetNext(e)
	} else {
		l.head = e
	}
}
InsertBefore inserts e before a.
package packet
type packetElementMapper struct{}
func (packetElementMapper) linkerFor(elem *packet) *packet { return elem }
type packetList struct {
	head *packet
	tail *packet
}
func (l *packetList) Reset() {
	l.head = nil
	l.tail = nil
}
func (l *packetList) Empty() bool {
	return l.head == nil
}
func (l *packetList) Front() *packet {
	return l.head
}
func (l *packetList) Back() *packet {
	return l.tail
}
func (l *packetList) PushFront(e *packet) {
	packetElementMapper{}.linkerFor(e).SetNext(l.head)
	packetElementMapper{}.linkerFor(e).SetPrev(nil)
	if l.head != nil {
		packetElementMapper{}.linkerFor(l.head).SetPrev(e)
	} else {
		l.tail = e
	}
	l.head = e
}
func (l *packetList) PushBack(e *packet) {
	packetElementMapper{}.linkerFor(e).SetNext(nil)
	packetElementMapper{}.linkerFor(e).SetPrev(l.tail)
	if l.tail != nil {
		packetElementMapper{}.linkerFor(l.tail).SetNext(e)
	} else {
		l.head = e
	}
	l.tail = e
}
func (l *packetList) PushBackList(m *packetList) {
	if l.head == nil {
		l.head = m.head
		l.tail = m.tail
	} else if m.head != nil {
		packetElementMapper{}.linkerFor(l.tail).SetNext(m.head)
		packetElementMapper{}.linkerFor(m.head).SetPrev(l.tail)
		l.tail = m.tail
	}
	m.head = nil
	m.tail = nil
}
func (l *packetList) InsertAfter(b, e *packet) {
	a := packetElementMapper{}.linkerFor(b).Next()
	packetElementMapper{}.linkerFor(e).SetNext(a)
	packetElementMapper{}.linkerFor(e).SetPrev(b)
	packetElementMapper{}.linkerFor(b).SetNext(e)
	if a != nil {
		packetElementMapper{}.linkerFor(a).SetPrev(e)
	} else {
		l.tail = e
	}
}