1fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/* 2fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Copyright (C) 2010 The Android Open Source Project 3fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 4fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Licensed under the Apache License, Version 2.0 (the "License"); 5fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * you may not use this file except in compliance with the License. 6fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * You may obtain a copy of the License at 7fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 8fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * http://www.apache.org/licenses/LICENSE-2.0 9fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 10fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Unless required by applicable law or agreed to in writing, software 11fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * distributed under the License is distributed on an "AS IS" BASIS, 12fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * See the License for the specific language governing permissions and 14fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * limitations under the License. 15fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 16fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 17fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifndef __FWDLOCKCONV_H__ 18fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#define __FWDLOCKCONV_H__ 19fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 20fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifdef __cplusplus 21fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheraextern "C" { 22fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif 23fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 24fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#include <sys/types.h> 25fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 26fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 27fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * The size of the data and header signatures combined. The signatures are adjacent to each other in 28fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * the produced output file. 29fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 30fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#define FWD_LOCK_SIGNATURES_SIZE (2 * 20) 31fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 32fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 33fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Data type for the output from FwdLockConv_ConvertData. 34fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 35fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheratypedef struct FwdLockConv_ConvertData_Output { 36fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The converted data. 37fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera void *pBuffer; 38fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 39fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The size of the converted data. 40fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera size_t numBytes; 41fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 42fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The file position where the error occurred, in the case of a syntax error. 43fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off64_t errorPos; 44fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera} FwdLockConv_ConvertData_Output_t; 45fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 46fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 47fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Data type for the output from FwdLockConv_CloseSession. 48fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 49fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheratypedef struct FwdLockConv_CloseSession_Output { 50fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The final set of signatures. 51fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera unsigned char signatures[FWD_LOCK_SIGNATURES_SIZE]; 52fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 53fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The offset in the produced output file where the signatures are located. 54fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off64_t fileOffset; 55fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 56fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The file position where the error occurred, in the case of a syntax error. 57fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off64_t errorPos; 58fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera} FwdLockConv_CloseSession_Output_t; 59fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 60fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 61fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Data type for the output from the conversion process. 62fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 63fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheratypedef union FwdLockConv_Output { 64fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_ConvertData_Output_t fromConvertData; 65fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_CloseSession_Output_t fromCloseSession; 66fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera} FwdLockConv_Output_t; 67fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 68fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 69fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Data type for the Posix-style read function used by the converter in pull mode. 70fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 71fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] fileDesc The file descriptor of a file opened for reading. 72fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[out] pBuffer A reference to the buffer that should receive the read data. 73fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] numBytes The number of bytes to read. 74fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 75fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return The number of bytes read. 76fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval -1 Failure. 77fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 78fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheratypedef ssize_t FwdLockConv_ReadFunc_t(int fileDesc, void *pBuffer, size_t numBytes); 79fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 80fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 81fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Data type for the Posix-style write function used by the converter in pull mode. 82fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 83fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] fileDesc The file descriptor of a file opened for writing. 84fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] pBuffer A reference to the buffer containing the data to be written. 85fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] numBytes The number of bytes to write. 86fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 87fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return The number of bytes written. 88fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval -1 Failure. 89fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 90fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheratypedef ssize_t FwdLockConv_WriteFunc_t(int fileDesc, const void *pBuffer, size_t numBytes); 91fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 92fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 93fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Data type for the Posix-style lseek function used by the converter in pull mode. 94fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 95fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] fileDesc The file descriptor of a file opened for writing. 96fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] offset The offset with which to update the file position. 97fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] whence One of SEEK_SET, SEEK_CUR, and SEEK_END. 98fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 99fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return The new file position. 100fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval ((off64_t)-1) Failure. 101fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 102fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheratypedef off64_t FwdLockConv_LSeekFunc_t(int fileDesc, off64_t offset, int whence); 103fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 104fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 105fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * The status codes returned by the converter functions. 106fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 107fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbeheratypedef enum FwdLockConv_Status { 108fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The operation was successful. 109fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_OK = 0, 110fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 111fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// An actual argument to the function is invalid (a program error on the caller's part). 112fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_InvalidArgument = 1, 113fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 114fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// There is not enough free dynamic memory to complete the operation. 115fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_OutOfMemory = 2, 116fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 117fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// An error occurred while opening the input file. 118fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_FileNotFound = 3, 119fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 120fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// An error occurred while creating the output file. 121fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_FileCreationFailed = 4, 122fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 123fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// An error occurred while reading from the input file. 124fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_FileReadError = 5, 125fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 126fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// An error occurred while writing to the output file. 127fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_FileWriteError = 6, 128fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 129fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// An error occurred while seeking to a new file position within the output file. 130fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_FileSeekError = 7, 131fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 132fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The input file is not a syntactically correct OMA DRM v1 Forward Lock file. 133fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_SyntaxError = 8, 134fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 135fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// Support for this DRM file format has been disabled in the current product configuration. 136fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_UnsupportedFileFormat = 9, 137fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 138fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The content transfer encoding is not one of "binary", "base64", "7bit", or "8bit" 139fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// (case-insensitive). 140fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_UnsupportedContentTransferEncoding = 10, 141fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 142fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The generation of a random number failed. 143fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_RandomNumberGenerationFailed = 11, 144fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 145fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// Key encryption failed. 146fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_KeyEncryptionFailed = 12, 147fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 148fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// The calculation of a keyed hash for integrity protection failed. 149fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_IntegrityProtectionFailed = 13, 150fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 151fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// There are too many ongoing sessions for another one to be opened. 152fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_TooManySessions = 14, 153fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 154fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera /// An unexpected error occurred. 155fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Status_ProgramError = 15 156fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera} FwdLockConv_Status_t; 157fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 158fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 159fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Opens a session for converting an OMA DRM v1 Forward Lock file to the internal Forward Lock file 160fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * format. 161fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 162fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[out] pSessionId The session ID. 163fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[out] pOutput The output from the conversion process (initialized). 164fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 165fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return A status code. 166fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_OK 167fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_InvalidArgument 168fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_TooManySessions 169fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 170fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraFwdLockConv_Status_t FwdLockConv_OpenSession(int *pSessionId, FwdLockConv_Output_t *pOutput); 171fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 172fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 173fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Supplies the converter with data to convert. The caller is expected to write the converted data 174fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * to file. Can be called an arbitrary number of times. 175fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 176fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] sessionId The session ID. 177fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] pBuffer A reference to a buffer containing the data to convert. 178fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] numBytes The number of bytes to convert. 179fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in,out] pOutput The output from the conversion process (allocated/reallocated). 180fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 181fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return A status code. 182fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_OK 183fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_InvalidArgument 184fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_OutOfMemory 185fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_SyntaxError 186fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_UnsupportedFileFormat 187fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_UnsupportedContentTransferEncoding 188fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_RandomNumberGenerationFailed 189fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_KeyEncryptionFailed 190fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_DataEncryptionFailed 191fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 192fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraFwdLockConv_Status_t FwdLockConv_ConvertData(int sessionId, 193fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera const void *pBuffer, 194fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera size_t numBytes, 195fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_Output_t *pOutput); 196fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 197fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 198fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Closes a session for converting an OMA DRM v1 Forward Lock file to the internal Forward Lock 199fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * file format. The caller must update the produced output file at the indicated file offset with 200fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * the final set of signatures. 201fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 202fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] sessionId The session ID. 203fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in,out] pOutput The output from the conversion process (deallocated and overwritten). 204fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 205fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return A status code. 206fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_OK 207fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_InvalidArgument 208fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_OutOfMemory 209fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_IntegrityProtectionFailed 210fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 211fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraFwdLockConv_Status_t FwdLockConv_CloseSession(int sessionId, FwdLockConv_Output_t *pOutput); 212fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 213fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera/** 214fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * Converts an open OMA DRM v1 Forward Lock file to the internal Forward Lock file format in pull 215fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * mode. 216fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 217fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] inputFileDesc The file descriptor of the open input file. 218fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] fpReadFunc A reference to a read function that can operate on the open input file. 219fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] outputFileDesc The file descriptor of the open output file. 220fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] fpWriteFunc A reference to a write function that can operate on the open output file. 221fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[in] fpLSeekFunc A reference to an lseek function that can operate on the open output file. 222fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @param[out] pErrorPos 223fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * The file position where the error occurred, in the case of a syntax error. May be NULL. 224fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * 225fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @return A status code. 226fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_OK 227fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_InvalidArgument 228fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_OutOfMemory 229fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_FileReadError 230fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_FileWriteError 231fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_FileSeekError 232fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_SyntaxError 233fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_UnsupportedFileFormat 234fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_UnsupportedContentTransferEncoding 235fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_RandomNumberGenerationFailed 236fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_KeyEncryptionFailed 237fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_DataEncryptionFailed 238fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_IntegrityProtectionFailed 239fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera * @retval FwdLockConv_Status_TooManySessions 240fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera */ 241fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat DalbeheraFwdLockConv_Status_t FwdLockConv_ConvertOpenFile(int inputFileDesc, 242fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_ReadFunc_t *fpReadFunc, 243fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera int outputFileDesc, 244fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_WriteFunc_t *fpWriteFunc, 245fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera FwdLockConv_LSeekFunc_t *fpLSeekFunc, 246fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera off64_t *pErrorPos); 247fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 248fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#ifdef __cplusplus 249fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera} 250fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif 251fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera 252fdd65a0fc7df2c878cc601e4c0f4021cb264f051Pravat Dalbehera#endif // __FWDLOCKCONV_H__ 253