// EncodeMsg implements msgp.Encodable
773755
func (z *Archive) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 5
	// write "MetricDefinition"
	err = en.Append(0x85, 0xb0, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e)
	if err != nil {
		return
	}
	err = z.MetricDefinition.EncodeMsg(en)
	if err != nil {
		err = msgp.WrapError(err, "MetricDefinition")
		return
	}
	// write "SchemaId"
	err = en.Append(0xa8, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x64)
	if err != nil {
		return
	}
	err = en.WriteUint16(z.SchemaId)
	if err != nil {
		err = msgp.WrapError(err, "SchemaId")
		return
	}
	// write "AggId"
	err = en.Append(0xa5, 0x41, 0x67, 0x67, 0x49, 0x64)
	if err != nil {
		return
	}
	err = en.WriteUint16(z.AggId)
	if err != nil {
		err = msgp.WrapError(err, "AggId")
		return
	}
	// write "IrId"
	err = en.Append(0xa4, 0x49, 0x72, 0x49, 0x64)
	if err != nil {
		return
	}
	err = en.WriteUint16(z.IrId)
	if err != nil {
		err = msgp.WrapError(err, "IrId")
		return
	}
	// write "LastSave"
	err = en.Append(0xa8, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x61, 0x76, 0x65)
	if err != nil {
		return
	}
	err = en.WriteUint32(z.LastSave)
	if err != nil {
		err = msgp.WrapError(err, "LastSave")
		return
	}
	return
}
1195596
func (z *Event) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 5
	// write "id"
	err = en.Append(0x85, 0xa2, 0x69, 0x64)
	if err != nil {
		return
	}
	err = en.WriteInt(z.Id)
	if err != nil {
		return
	}
	// write "user"
	// map header, size 2
	// write "first"
	err = en.Append(0xa4, 0x75, 0x73, 0x65, 0x72, 0x82, 0xa5, 0x66, 0x69, 0x72, 0x73, 0x74)
	if err != nil {
		return
	}
	err = en.WriteString(z.User.First)
	if err != nil {
		return
	}
	// write "last"
	err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74)
	if err != nil {
		return
	}
	err = en.WriteString(z.User.Last)
	if err != nil {
		return
	}
	// write "flight"
	err = en.Append(0xa6, 0x66, 0x6c, 0x69, 0x67, 0x68, 0x74)
	if err != nil {
		return
	}
	err = en.WriteString(z.Flight)
	if err != nil {
		return
	}
	// write "pilot"
	err = en.Append(0xa5, 0x70, 0x69, 0x6c, 0x6f, 0x74)
	if err != nil {
		return
	}
	err = en.WriteArrayHeader(uint32(len(z.Pilot)))
	if err != nil {
		return
	}
	for za0001 := range z.Pilot {
		err = en.WriteString(z.Pilot[za0001])
		if err != nil {
			return
		}
	}
	// write "cancelled"
	err = en.Append(0xa9, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x64)
	if err != nil {
		return
	}
	err = en.WriteBool(z.Cancelled)
	if err != nil {
		return
	}
	return
}
879039
func (z *IterGen) DecodeMsg(dc *msgp.Reader) (err error) {
	var field []byte
	_ = field
	var zb0001 uint32
	zb0001, err = dc.ReadMapHeader()
	if err != nil {
		err = msgp.WrapError(err)
		return
	}
	for zb0001 > 0 {
		zb0001--
		field, err = dc.ReadMapKeyPtr()
		if err != nil {
			err = msgp.WrapError(err)
			return
		}
		switch msgp.UnsafeString(field) {
		case "T0":
			z.T0, err = dc.ReadUint32()
			if err != nil {
				err = msgp.WrapError(err, "T0")
				return
			}
		case "IntervalHint":
			z.IntervalHint, err = dc.ReadUint32()
			if err != nil {
				err = msgp.WrapError(err, "IntervalHint")
				return
			}
		case "B":
			z.B, err = dc.ReadBytes(z.B)
			if err != nil {
				err = msgp.WrapError(err, "B")
				return
			}
		default:
			err = dc.Skip()
			if err != nil {
				err = msgp.WrapError(err)
				return
			}
		}
	}
	return
}
153345
func (w *etmWriter) WriteMsg(b []byte) error {
	w.Lock()
	defer w.Unlock()

	// encrypt.
	buf := pool.Get(4 + len(b) + w.mac.Size())
	defer pool.Put(buf)
	data := buf[4 : 4+len(b)]
	w.str.XORKeyStream(data, b)

	// log.Debugf("ENC plaintext (%d): %s %v", len(b), b, b)
	// log.Debugf("ENC ciphertext (%d): %s %v", len(data), data, data)

	// then, mac.
	if _, err := w.mac.Write(data); err != nil {
		return err
	}

	// Sum appends.
	data = w.mac.Sum(data)
	w.mac.Reset()
	binary.BigEndian.PutUint32(buf[:4], uint32(len(data)))

	_, err := w.w.Write(buf)
	return err
}
53857
func (z IndexTagDelSeriesResp) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 1
	// write "Count"
	err = en.Append(0x81, 0xa5, 0x43, 0x6f, 0x75, 0x6e, 0x74)
	if err != nil {
		return
	}
	err = en.WriteInt(z.Count)
	if err != nil {
		err = msgp.WrapError(err, "Count")
		return
	}
	return
}
424447
func (z *MessageExt) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// array header, size 4
	o = append(o, 0x94)
	o = msgp.AppendString(o, z.Tag)
	o, err = msgp.AppendExtension(o, &z.Time)
	if err != nil {
		err = msgp.WrapError(err, "Time")
		return
	}
	o, err = msgp.AppendIntf(o, z.Record)
	if err != nil {
		err = msgp.WrapError(err, "Record")
		return
	}
	o = msgp.AppendMapHeader(o, uint32(len(z.Option)))
	for za0001, za0002 := range z.Option {
		o = msgp.AppendString(o, za0001)
		o = msgp.AppendString(o, za0002)
	}
	return
}
228255
func (z *GetDataResp) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 1
	// string "Series"
	o = append(o, 0x81, 0xa6, 0x53, 0x65, 0x72, 0x69, 0x65, 0x73)
	o = msgp.AppendArrayHeader(o, uint32(len(z.Series)))
	for za0001 := range z.Series {
		o, err = z.Series[za0001].MarshalMsg(o)
		if err != nil {
			err = msgp.WrapError(err, "Series", za0001)
			return
		}
	}
	return
}
558035
func (z *Key) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 3
	// string "u"
	o = append(o, 0x83, 0xa1, 0x75)
	o = msgp.AppendBytes(o, []byte(z.UUID))
	// string "v"
	o = append(o, 0xa1, 0x76)
	o, err = msgp.AppendIntf(o, z.Value)
	if err != nil {
		return
	}
	// string "p"
	o = append(o, 0xa1, 0x70)
	o = msgp.AppendBytes(o, z.Payload)
	return
}
366776
func (z MetricsDeleteResp) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 1
	// string "DeletedDefs"
	o = append(o, 0x81, 0xab, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x44, 0x65, 0x66, 0x73)
	o = msgp.AppendInt(o, z.DeletedDefs)
	return
}
1010286
func (e *Error) EncodeMsgpack(enc *msgpack.Encoder) error {
	var err error
	switch v := e.err.(type) {
	case *Error:
		err = enc.Encode(ErrorLocal)
		if err != nil {
			return err
		}
		err = enc.Encode(v)
		if err != nil {
			return err
		}
	case error:
		err = enc.Encode(ErrorGo)
		if err != nil {
			return err
		}
		err = enc.Encode(GoError(v.Error()))
		if err != nil {
			return err
		}
	default:
		panic("type not supported")
	}
	err = enc.Encode(e.args)
	if err != nil {
		return err
	}
	err = enc.Encode(e.pkg)
	if err != nil {
		return err
	}
	err = enc.Encode(e.file)
	if err != nil {
		return err
	}
	err = enc.Encode(e.line)
	if err != nil {
		return err
	}
	err = enc.Encode(e.debugInfo)
	if err != nil {
		return err
	}
	if e.next == nil {
		err = enc.Encode(NextIsNill)
		if err != nil {
			return err
		}
	} else {
		err = enc.Encode(Next)
		if err != nil {
			return err
		}
		err = enc.Encode(e.next)
		if err != nil {
			return err
		}
	}
	return nil
}
140917
func (z *MessageExt) EncodeMsg(en *msgp.Writer) (err error) {
	// array header, size 4
	err = en.Append(0x94)
	if err != nil {
		return
	}
	err = en.WriteString(z.Tag)
	if err != nil {
		err = msgp.WrapError(err, "Tag")
		return
	}
	err = en.WriteExtension(&z.Time)
	if err != nil {
		err = msgp.WrapError(err, "Time")
		return
	}
	err = en.WriteIntf(z.Record)
	if err != nil {
		err = msgp.WrapError(err, "Record")
		return
	}
	err = en.WriteMapHeader(uint32(len(z.Option)))
	if err != nil {
		err = msgp.WrapError(err, "Option")
		return
	}
	for za0001, za0002 := range z.Option {
		err = en.WriteString(za0001)
		if err != nil {
			err = msgp.WrapError(err, "Option")
			return
		}
		err = en.WriteString(za0002)
		if err != nil {
			err = msgp.WrapError(err, "Option", za0001)
			return
		}
	}
	return
}
1094911
func (r *ResponseReverter) WriteMsg(res *dns.Msg) error {
	res.Question[0] = r.original
	return r.ResponseWriter.WriteMsg(res)
}
706418
func (*MsgCodec) EncodeMsg(msg api.Message, msgID uint16) (data []byte, err error) {
	if msg == nil {
		return nil, errors.New("nil message passed in")
	}

	// try to recover panic which might possibly occur in struc.Pack call
	defer func() {
		if r := recover(); r != nil {
			var ok bool
			if err, ok = r.(error); !ok {
				err = fmt.Errorf("%v", r)
			}
			err = fmt.Errorf("panic occurred: %v", err)
		}
	}()

	var header interface{}

	// encode message header
	switch msg.GetMessageType() {
	case api.RequestMessage:
		header = &VppRequestHeader{VlMsgID: msgID}
	case api.ReplyMessage:
		header = &VppReplyHeader{VlMsgID: msgID}
	case api.EventMessage:
		header = &VppEventHeader{VlMsgID: msgID}
	default:
		header = &VppOtherHeader{VlMsgID: msgID}
	}

	buf := new(bytes.Buffer)

	// encode message header
	if err := struc.Pack(buf, header); err != nil {
		return nil, fmt.Errorf("failed to encode message header: %+v, error: %v", header, err)
	}

	// encode message content
	if reflect.TypeOf(msg).Elem().NumField() > 0 {
		if err := struc.Pack(buf, msg); err != nil {
			return nil, fmt.Errorf("failed to encode message data: %+v, error: %v", data, err)
		}
	}

	return buf.Bytes(), nil
}
982374
func (z ID) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	o = msgp.AppendBytes(o, []byte(z))
	return
}
540531
func (z *Weather) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 4
	// write "time"
	err = en.Append(0x84, 0xa4, 0x74, 0x69, 0x6d, 0x65)
	if err != nil {
		return
	}
	err = en.WriteTime(z.Time)
	if err != nil {
		return
	}
	// write "size"
	err = en.Append(0xa4, 0x73, 0x69, 0x7a, 0x65)
	if err != nil {
		return
	}
	err = en.WriteInt64(z.Size)
	if err != nil {
		return
	}
	// write "type"
	err = en.Append(0xa4, 0x74, 0x79, 0x70, 0x65)
	if err != nil {
		return
	}
	err = en.WriteString(z.Type)
	if err != nil {
		return
	}
	// write "details"
	err = en.Append(0xa7, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73)
	if err != nil {
		return
	}
	err = en.WriteBytes(z.Details)
	if err != nil {
		return
	}
	return
}
196480
func (z *IndexTagsResp) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 1
	// write "Tags"
	err = en.Append(0x81, 0xa4, 0x54, 0x61, 0x67, 0x73)
	if err != nil {
		return
	}
	err = en.WriteArrayHeader(uint32(len(z.Tags)))
	if err != nil {
		err = msgp.WrapError(err, "Tags")
		return
	}
	for za0001 := range z.Tags {
		err = en.WriteString(z.Tags[za0001])
		if err != nil {
			err = msgp.WrapError(err, "Tags", za0001)
			return
		}
	}
	return
}
886829
func (z AckResp) MarshalMsg(b []byte) (o []byte, err error) {
	o = msgp.Require(b, z.Msgsize())
	// map header, size 1
	// string "ack"
	o = append(o, 0x81, 0xa3, 0x61, 0x63, 0x6b)
	o = msgp.AppendString(o, z.Ack)
	return
}