📄 psa_sim.h
字号:
/*
+-----------------------------------------------------------------------------
| Project : GSM-PS (6147)
| Modul : PSA
+-----------------------------------------------------------------------------
| Copyright 2002 Texas Instruments Berlin, AG
| All rights reserved.
|
| This file is confidential and a trade secret of Texas
| Instruments Berlin, AG
| The receipt of or possession of this file does not convey
| any rights to reproduce or disclose its contents or to
| manufacture, use, or sell anything it may describe, in
| whole, or in part, without the specific written consent of
| Texas Instruments Berlin, AG.
+-----------------------------------------------------------------------------
| Purpose : Definitions for the protocol stack adapter
| Subscriber Identity Module ( SIM )
+-----------------------------------------------------------------------------
*/
#ifndef PSA_SIM_H
#define PSA_SIM_H
/*==== CONSTANTS ==================================================*/
#define PIN_LEN (8) /* PIN length in bytes */
#define MIN_PIN_LEN (4) /* Marcus: Issue 1589: 28/01/2003: Minimum PIN length in bytes */
#define PUK_LEN (8) /* PUK length in bytes */
#define ICC_LEN (10) /* chip card identifier length in bytes */
#define SRV_TAB_LEN MAX_SRV_TBL /* service table length in bytes */
#define CBM_ID_LEN (10) /* CBM id length in bytes */
#define DPER_KEY_LEN (16) /* de-pers. key length in bytes */
#define ACC_MAX (8) /* maximum number of simultanious
SIM access */
#define SRV_ALLOC_ACTIV (0x03) /* SIM service allocated and activated */
#define NO_ENTRY (-1) /* not a valid entry */
typedef enum
{
SRV_CHV1_Disable = 1,
SRV_ADN,
SRV_FDN,
SRV_SMS_Storage,
SRV_AOC,
SRV_CCP,
SRV_PLMN_Select,
SRV_RFU1,
SRV_MSISDN,
SRV_EXT1,
SRV_EXT2,
SRV_SMS_Parms,
SRV_LDN,
SRV_CBM_Ident,
SRV_GrpLvl1,
SRV_GrpLvl2,
SRV_SrvProvName,
SRV_SDN,
SRV_EXT3,
SRV_RFU2,
SRV_VCGS,
SRV_VBS,
SRV_EMLPP,
SRV_AutoEMLPP,
SRV_DtaDownlCB,
SRV_DtaDownlPP,
SRV_MnuSel,
SRV_CalCntrl,
SRV_ProActSIM,
SRV_CBMIdRnge,
SRV_BDN,
SRV_EXT4,
SRV_DePersCK,
SRV_CoOpNwL,
SRV_SMS_StatRep,
SRV_NwIndAlMS,
SRV_MOSMCtrlSIM,
SRV_GPRS,
SRV_RFU3,
SRV_RFU4,
SRV_USSDsupportInCC, /* service 41 */
SRV_PNN = 51,
SRV_OPL
} T_SIM_SRV;
typedef enum /* SIM status */
{
NO_VLD_SS = 0, /* not a valid SIM status */
SS_OK, /* SIM is OK */
SS_INV, /* SIM is invalid */
SS_BLKD, /* SIM is blocked */
SS_URCHB /* SIM is unreachable */
} T_SIM_SIMST;
typedef enum /* PIN status */
{
NO_VLD_PS = 0, /* not a valid PIN status */
PS_RDY, /* ready, no PIN is requested */
PS_PIN1, /* PIN 1 is requested */
PS_PIN2, /* PIN 2 is requested */
PS_PUK1, /* PUK 1 is requested */
PS_PUK2 /* PUK 2 is requested */
} T_SIM_PINST;
typedef enum /* PIN1 enable/disable status */
{
NO_VLD_PEDS = 0, /* not a valid PED status */
PEDS_ENA, /* PIN 1 enabled */
PEDS_DIS /* PIN 1 disabled */
} T_SIM_PEDST;
typedef enum /* SIM access type */
{
NO_VLD_ACT = 0, /* not a valid access type */
ACT_RD_DAT, /* read a datafield */
ACT_WR_DAT, /* write a datafield */
ACT_RD_REC, /* read a record */
ACT_WR_REC, /* write a record */
ACT_INC_DAT /* increment a datafield */
} T_SIM_ACTP;
typedef enum /* ciphering indication state */
{
CI_DONT_SHOW = 0, /* don't show CI, CI enabled */
CI_SHOW, /* show CI, CI enabled */
CI_DISABLED /* CI disabled */
} T_CI_STAT;
/*==== TYPES ======================================================*/
typedef struct SIMSetPrm
{
UBYTE actProc; /* activation procedure */
UBYTE STKprof[MAX_STK_PRF]; /* SIM toolkit profile */
UBYTE PINType; /* type of PIN */
CHAR curPIN[PIN_LEN]; /* current PIN */
CHAR newPIN[PIN_LEN]; /* new PIN */
CHAR unblkKey[PUK_LEN]; /* unblocking key */
} T_SIM_SET_PRM;
typedef struct SIMAccPrm
{
UBYTE ntryUsdFlg; /* flags entry usage */
UBYTE accType; /* type of access */
USHORT reqDataFld; /* requested datafield identifier */
USHORT dataOff; /* datafield offset */
UBYTE recNr; /* record number */
BOOL check_dataLen; /* has size of data to be checked against size of exch buffer ? */
UBYTE dataLen; /* data length */
UBYTE * exchData; /* points to exchange data buffer */
UBYTE recMax; /* maximum records */
USHORT errCode; /* error code */
void (*rplyCB)(SHORT aId); /* points to reply call-back */
} T_SIM_ACC_PRM;
typedef struct SIMTrnsAccPrm
{
UBYTE cmd; /* access command */
USHORT reqDataFld; /* requested datafield identifier */
UBYTE p1; /* parameter 1 */
UBYTE p2; /* parameter 2 */
UBYTE p3; /* parameter 3 */
UBYTE dataLen; /* data length in bytes */
UBYTE * transData; /* points to data buffer */
} T_SIM_TRNS_ACC_PRM;
typedef struct
{
UBYTE sw1; /* SIM result code 1 */
UBYTE sw2; /* SIM result code 2 */
UBYTE rspLen; /* length of response data */
UBYTE * rsp; /* ponter to response data */
} T_SIM_TRNS_RSP_PRM;
typedef struct
{
UBYTE dtiConn; /* connection qualifier */
UBYTE dtiUnit; /* dti connection unit */
UBYTE chnId; /* channel id */
UBYTE genRes; /* general result */
UBYTE addRes; /* additional result */
} T_SIM_SAT_CHN;
typedef struct
{
T_SIM_SAT_CHN sat_chn_prm;
void (*cb)(UBYTE dtiConn, UBYTE chnId);
} T_SIM_DTI_CH_PRM;
typedef struct
{
T_plmn plmn;
USHORT lac1;
USHORT lac2;
UBYTE pnn_rec_num;
}T_opl;
typedef struct
{
UBYTE num_rcd; /* Number of records in EFopl */
UBYTE opl_status; /* Status of OPL records retrieval */
T_opl opl_rcd[OPL_MAX_RECORDS];
} T_opl_field;//EONS
typedef struct SIMShrdParm
{
UBYTE owner; /* identifies the used set */
SHORT aId; /* access identifier */
T_SIM_SET_PRM setPrm[OWN_MAX]; /* possible sets */
T_SIM_ACC_PRM atb[ACC_MAX]; /* table of access parameter */
UBYTE PINStat; /* status of PIN requirement */
UBYTE pn1Cnt; /* PIN 1 counter */
UBYTE pn2Cnt; /* PIN 2 counter */
UBYTE pk1Cnt; /* PUK 1 counter */
UBYTE pk2Cnt; /* PUK 2 counter */
UBYTE pn1Stat; /* PIN 1 status */
UBYTE pn2Stat; /* PIN 2 status */
UBYTE crdPhs; /* phase of card */
UBYTE SIMStat; /* status of SIM card */
UBYTE PEDStat; /* PIN1 enable/disable status */
UBYTE crdFun; /* SIM card functionality */
UBYTE srvTab[SRV_TAB_LEN]; /* SIM service table */
T_imsi_field imsi; /* IMSI */
USHORT rslt; /* result of SIM operation */
UBYTE synCs; /* SIM synchronisation cause */
UBYTE ciStat; /* current ciphering indicator state */
UBYTE savedCiStat; /* saved ciphering indicator state */
int fuRef; /* Reference for File Update */
T_SIM_DTI_CH_PRM *sim_dti_chPrm; /* points to sim dti channel parameters */
T_opl_field opl_list; /* Operator PLMN list (for EONS) */
UBYTE sat_class_e_dti_id; /* DTI ID for SAT class E */
} T_SIM_SHRD_PRM;
typedef enum
{
ACI_INIT_TYPE_ALL = 0, /* init all parameters */
ACI_INIT_TYPE_SOFT_OFF /* init only parameters for soft power off */
} T_ACI_INIT_TYPE;
/*==== PROTOTYPES =================================================*/
EXTERN SHORT psaSIM_VerifyPIN ( void );
EXTERN SHORT psaSIM_ChangePIN ( void );
EXTERN SHORT psaSIM_DisablePIN ( void );
EXTERN SHORT psaSIM_EnablePIN ( void );
EXTERN SHORT psaSIM_UnblockCard ( void );
EXTERN void psaSIM_SyncSIM ( void );
EXTERN SHORT psaSIM_AccessSIMData ( void );
EXTERN SHORT psaSIM_ActivateSIM ( void );
EXTERN void psaSIM_Init ( T_ACI_INIT_TYPE init_type );
EXTERN void psaSIM_InitAtbNtry ( SHORT idx );
EXTERN void psaSIM_CloseAtb ( USHORT error );
EXTERN SHORT psaSIM_atbNewEntry ( void );
EXTERN SHORT psaSIM_atbFindDatFld ( USHORT datFld2Find,
UBYTE accType2Find,
UBYTE recNr2Find );
EXTERN CHAR* psaSIM_cnvrtIMSI2ASCII ( CHAR * imsiBuf );
EXTERN void psaSIM_decodeIMSI (UBYTE* imsi_field, UBYTE imsi_c_field, CHAR* imsi_asciiz);
EXTERN void psaSIM_encodeIMSI (CHAR* imsi_asciiz, UBYTE* imsi_c_field, UBYTE* imsi_field);
#ifdef TRACING
EXTERN void psaSIM_shrPrmDump ( void );
#endif /* TRACING */
EXTERN BOOL psaSIM_ChkSIMSrvSup ( UBYTE srvNr );
EXTERN SHORT psaSIM_TrnsSIMAccess ( T_SIM_TRNS_ACC_PRM * prm );
#ifdef SIM_TOOLKIT
EXTERN void psaSIM_SATChn ( T_SIM_SAT_CHN chnInf,
void (*cb)(UBYTE dtiConn, UBYTE chnId));
EXTERN void psaSIM_EvDatAvail ( BOOL evStat );
EXTERN void psaSIM_Dti_Req ( ULONG link_id );
#endif /* #ifdef SIM_TOOLKIT */
/*==== EXPORT =====================================================*/
#ifdef PSA_SIMF_C
GLOBAL T_SIM_SHRD_PRM simShrdPrm;
#else
EXTERN T_SIM_SHRD_PRM simShrdPrm;
#endif /* PSA_SIMF_C */
#endif /* PSA_SIM_H */
/*==== EOF =======================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -