/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.hardware.cas.native@1.0;

import android.hardware.cas@1.0::IDescramblerBase;
import android.hardware.cas@1.0::Status;

/**
 * IDescrambler is the native plugin API for descrambling operations.
 */

interface IDescrambler extends IDescramblerBase {
    /**
     * Descramble the data in a source SharedBuffer, described by an array of
     * SubSample structures.
     *
     * @param scramblingControl an enumeration indicating the key that the subsamples
     * were scrambled with.
     * @param subSamples an array of SubSample structures describing the number of
     * clear and scrambled bytes within each subsample.
     * @param srcBuffer the SharedBuffer containing the source scrambled data.
     * @param srcOffset the position where the source scrambled data starts at.
     * @param dstBuffer the DestinationBuffer to hold the descrambled data.
     * @param dstOffset the position where the descrambled data should start at.
     *
     * @return status the status of the call.
     * @return bytesWritten number of bytes that have been successfully descrambled.
     * @return detailedError a detailed message describing the error (if any).
     */
    descramble(ScramblingControl scramblingControl, vec<SubSample> subSamples,
        SharedBuffer srcBuffer, uint64_t srcOffset, DestinationBuffer dstBuffer, uint64_t dstOffset)
        generates(Status status, uint32_t bytesWritten, string detailedError);
};
