//******************************************************************************
//  [PTX-804改修履歴]
//		PTX804 Ver0.04	2005.03.02 OTS N.Kamimura
//			- 001		ヘッダファイル追加
//			- 002		AEECLSID_UIMPRIV_GIDの定義をファイルから取り込む
//			- 003		gProtectedRIDList/gCardConnectionProtectInfoを.cへ移動
//******************************************************************************
#ifndef __ICARD_CONN_CHECK_AID__
#define __ICARD_CONN_CHECK_AID__

#ifdef FEATURE_ENABLE_ICARDCONNECTION_FILTER

// [PTX804-V004-001] OTS N.Kamimura [S]
// include の追加
#include "AEE.h"
#include "AEECard.h"
// [PTX804-V004-001] OTS N.Kamimura [E]

typedef struct CardConnectionProtectInfo CardConnectionProtectInfo;

struct CardConnectionProtectInfo
{
	AEECLSID nGID;            /* BREW Applications' Group ID */
	byte * pProtectedRIDs;  /* Protected card application's RIDs */
};

/* Note : OEMs should specify the valid GID, which indicates the special
   prvilege to access all UIM applications.
   Using 0x0000FFFF means PRIV_SYSTEM. */
// [PTX804-V004-002] OTS N.Kamimura [S]
// ファイルからデータを取り込むように変更
//#define AEECLSID_UIMPRIV_GID   0x0000FFFF
#include "UIMPRIV_GID.BID"
// [PTX804-V004-002] OTS N.Kamimura [E]

/*====================================================
 gProtecetdRIDList

 The list of RIDs to be protected. The end of the
 list MUST contain five 00s.

 OEMs can freely add and remove the RIDs so that
 OEMs can protect any desired RIDs.

 The applications which have the RIDs listed here
 cannot be selected from normal applications.
 Applications which wants to select these RIDs should
 declare dependency to AEECLSID_UIMPRIV_GID in their
 MIF. The ClassID should be defined by operators or
 OEMs.

====================================================*/
// [PTX804-V004-003] OTS N.Kamimura [S]
// oemcard_checkaid.cファイルへ移動
//const byte gProtectedRIDList[][5]=
//{
//	{0xa0, 0x00, 0x00, 0x00, 0x09}, /* ETSI */
//	{0xa0, 0x00, 0x00, 0x00, 0x63}, /* WIM */
//	{0xa0, 0x00, 0x00, 0x01, 0x51}, /* GP */
//	{0x00, 0x00, 0x00, 0x00, 0x00}  /* End of List - five 00s.*/
//};
//
//const CardConnectionProtectInfo gCardConnectionProtectInfo =
//{
//	AEECLSID_UIMPRIV_GID,
//	(byte *)gProtectedRIDList,
//};
// [PTX804-V004-003] OTS N.Kamimura [E]

boolean OEMCardConnection_CheckAID(ICardConnection * po, byte * pAPDUData);

#define UIM_RID_EQ(ps, pd)   (((byte *)(ps))[4] == ((byte *)(pd))[4] && ((byte *)(ps))[3] == ((byte *)(pd))[3] \
                            && ((byte *)(ps))[2] == ((byte *)(pd))[2] && ((byte *)(ps))[1] == ((byte *)(pd))[1] && ((byte *)(ps))[0] == ((byte *)(pd))[0])

#endif /* FEATURE_ENABLE_ICARDCONNECTION_FILTER */

#endif /* __ICARD_CONN_CHECK_AID__ */