/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */

#ifndef __ES_H__
#define __ES_H__

#include <estypes.h>

#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)

ESError ES_ImportTicket(const u8* ticket, const u8* certList, u32 numCerts, 
        const u8* crlList, u32 numCrls, ESTransferType source);
ESError ES_ImportTitleInit(const ESTitleId titleId, const u8* tmd, 
        const u8* certList, u32 numCerst, const u8* crlList, u32 numCrls, 
        ESTransferType source);
s32     ES_ImportContentBegin(ESTitleId titleId, ESContentId cid);
ESError ES_ImportContentData(s32 fd, const u8* inBuf, u32 inBufSize);
ESError ES_ImportContentEnd(s32 fd);
ESError ES_ImportTitleDone();

ESError ES_ImportDataBegin(const u8* certList, u32 numCerts, 
        const u8* crlList, u32 numCrls);
ESError ES_ImportDataData(const u8* inBuf, u8* outBuf, u32 size);
ESError ES_ImportDataEnd(const u8* sig);

ESError ES_GetExportCertSize(u32* size);
ESError ES_ExportCerts(u8* certList);
ESError ES_GetExportCrlSize(u32* size);
ESError ES_ExportCrls(u8* crlList);

ESError ES_ExportTitleInit(ESTitleId titleId, ESDeviceId deviceId, 
        ESTicketId ticketId, const u8* certList, u32 numCerts, 
        const u8* crlList, u32 numCrls, ESTransferType dest, 
        u8* ticket, u8* tmd);
s32     ES_ExportContentBegin(ESTitleId titleId, ESContentId cid);
ESError ES_ExportContentData(s32 fd, u8* outBuf, u32 size);
ESError ES_ExportContentEnd(s32 fd);
ESError ES_ExportTitleDone();

ESError ES_ExportDataBegin(const u8* certList, u32 numCerts, 
        const u8* crlList, u32 numCrls);
ESError ES_ExportDataData(const u8* inBuf, u8* outBuf, u32 size);
ESError ES_ExportDataEnd(u8* sig);

ESError ES_LaunchTitle(ESTitleId titleId);
s32     ES_OpenContentFile(ESTitleId titleId, ESContentId contentId);
ESError ES_ReadContentFile(s32 fd, u8* buf, u32 size);
ESError ES_LoadContentFile(s32 fd, u32 addr);
ESError ES_CloseContentFile(s32 fd);

ESError ES_ListOwnedTitles(ESTitleId* titleIds, u32* numTitles);
ESError ES_ListCardTitles(ESTitleId* titleIds, u32* numTitles);
ESError ES_ListCardContents(const ESTitleId titleId, ESContentId* cids, 
        u32* numContents);
ESError ES_ParseTicket(const ESTitleId titleId, const ESDeviceId deviceId, 
        const ESTicketId ticketId, ESTicketView* ticketView);
ESError ES_ParseTmd(const ESTitleId titleId, ESTmdViewHeader* tmdViewHead, 
        ESCmdView* cmdViewList);
ESError ES_GetConsumption(const ESTicketId ticketId, ESCc* ccList, u32* numCcs);

#endif

#endif /*__ES_H__*/
