code: func (*MsgCodec) DecodeMsg(data []byte, msg api.Message) error {
  	if msg == nil {
  		return errors.New("nil message passed in")
  	}
  
  	var header interface{}
  
  	// check which header is expected
  	switch msg.GetMessageType() {
  	case api.RequestMessage:
  		header = new(VppRequestHeader)
  	case api.ReplyMessage:
  		header = new(VppReplyHeader)
  	case api.EventMessage:
  		header = new(VppEventHeader)
  	default:
  		header = new(VppOtherHeader)
  	}
  
  	buf := bytes.NewReader(data)
  
  	// decode message header
  	if err := struc.Unpack(buf, header); err != nil {
  		return fmt.Errorf("failed to decode message header: %+v, error: %v", header, err)
  	}
  
  	// decode message content
  	if err := struc.Unpack(buf, msg); err != nil {
  		return fmt.Errorf("failed to decode message data: %+v, error: %v", data, err)
  	}
  
  	return nil
  }
docs: // DecodeMsg decodes binary-encoded data of a message into provided `Message` structure.