comparison src/g23m-aci/aci/psa_sim.h @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : PSA
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : Definitions for the protocol stack adapter
18 | Subscriber Identity Module ( SIM )
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef PSA_SIM_H
23 #define PSA_SIM_H
24
25 /*==== CONSTANTS ==================================================*/
26 #define PIN_LEN (8) /* PIN length in bytes */
27 #define MIN_PIN_LEN (4) /* Marcus: Issue 1589: 28/01/2003: Minimum PIN length in bytes */
28 #define PUK_LEN (8) /* PUK length in bytes */
29 #define ICC_LEN (10) /* chip card identifier length in bytes */
30 #define SRV_TAB_LEN MAX_SRV_TBL /* service table length in bytes */
31 #define CBM_ID_LEN (10) /* CBM id length in bytes */
32 #define DPER_KEY_LEN (16) /* de-pers. key length in bytes */
33 #define ACC_MAX (8) /* maximum number of simultanious
34 SIM access */
35 #define SRV_ALLOC_ACTIV (0x03) /* SIM service allocated and activated */
36
37 #define NO_ENTRY (-1) /* not a valid entry */
38
39 /* Masking for SIM service table: */
40 #define NO_ALLOCATED 0
41 #define ALLOCATED_AND_DEACTIVATED 2
42 #define ALLOCATED_AND_ACTIVATED 3
43
44 /* CPHS_CSP PLMN mode bit*/
45 #define CPHS_CSP_PLMN_MODE_BIT_OFF 0x00
46 #define CPHS_CSP_PLMN_MODE_BIT_ON 0X01
47
48 #define UBYTES_PER_PLMN 3
49
50 typedef enum
51 {
52 SRV_CHV1_Disable = 1, /* #1 CHV1 disable function */
53 SRV_ADN, /* #2 Abbreviated Dialling Numbers (ADN) */
54 SRV_FDN, /* #3 Fixed Dialling Numbers (FDN) */
55 SRV_SMS_Storage, /* #4 Short Message Storage (SMS) */
56 SRV_AOC, /* #5 Advice of Charge (AoC) */
57 SRV_CCP, /* #6 Capability Configuration Parameters (CCP) */
58 SRV_PLMN_Select, /* #7 PLMN selector */
59 SRV_RFU1, /* #8 RFU */
60 SRV_MSISDN, /* #9 MSISDN */
61 SRV_EXT1, /* #10 Extension1 */
62 SRV_EXT2, /* #11 Extension2 */
63 SRV_SMS_Parms, /* #12 SMS Parameters */
64 SRV_LDN, /* #13 Last Number Dialled (LND) */
65 SRV_CBM_Ident, /* #14 Cell Broadcast Message Identifier */
66 SRV_GrpLvl1, /* #15 Group Identifier Level 1 */
67 SRV_GrpLvl2, /* #16 Group Identifier Level 2 */
68 SRV_SrvProvName, /* #17 Service Provider Name */
69 SRV_SDN, /* #18 Service Dialling Numbers (SDN) */
70 SRV_EXT3, /* #19 Extension3 */
71 SRV_RFU2, /* #20 RFU */
72 SRV_VCGS, /* #21 VGCS Group Identifier List (EFVGCS and EFVGCSS) */
73 SRV_VBS, /* #22 VBS Group Identifier List (EFVBS and EFVBSS) */
74 SRV_EMLPP, /* #23 enhanced Multi Level Precedence and Pre emption Service */
75 SRV_AutoEMLPP, /* #24 Automatic Answer for eMLPP */
76 SRV_DtaDownlCB, /* #25 Data download via SMS CB */
77 SRV_DtaDownlPP, /* #26 Data download via SMS PP */
78 SRV_MnuSel, /* #27 Menu selection */
79 SRV_CalCntrl, /* #28 Call control */
80 SRV_ProActSIM, /* #29 Proactive SIM */
81 SRV_CBMIdRnge, /* #30 Cell Broadcast Message Identifier Ranges */
82 SRV_BDN, /* #31 Barred Dialling Numbers (BDN) */
83 SRV_EXT4, /* #32 Extension4 */
84 SRV_DePersCK, /* #33 De personalization Control Keys */
85 SRV_CoOpNwL, /* #34 Co operative Network List */
86 SRV_SMS_StatRep, /* #35 Short Message Status Reports */
87 SRV_NwIndAlMS, /* #36 Network's indication of alerting in the MS */
88 SRV_MOSMCtrlSIM, /* #37 Mobile Originated Short Message control by SIM */
89 SRV_GPRS, /* #38 GPRS */
90 SRV_RFU3, /* #39 Image (IMG) */
91 SRV_RFU4, /* #40 SoLSA (Support of Local Service Area) */
92 SRV_USSDsupportInCC, /* #41 USSD string data object supported in Call Control */
93 SRV_No_42, /* #42 RUN AT COMMAND command */
94 SRV_No_43, /* #43 User controlled PLMN Selector with Access Technology */
95 SRV_No_44, /* #44 Operator controlled PLMN Selector with Access Technology */
96 SRV_No_45, /* #45 HPLMN Selector with Access Technology */
97 SRV_No_46, /* #46 CPBCCH Information */
98 SRV_No_47, /* #47 Investigation Scan */
99 SRV_No_48, /* #48 Extended Capability Configuration Parameters */
100 SRV_No_49, /* #49 MExE */
101 SRV_No_50, /* #50 RPLMN last used Access Technology */
102 SRV_PNN, /* #51 PLMN Network Name */
103 SRV_OPL, /* #52 Operator PLMN List */
104 SRV_No_53, /* #53 Mailbox Dialling Numbers */
105 SRV_No_54, /* #54 Message Waiting Indication Status */
106 SRV_No_55, /* #55 Call Forwarding Indication Status */
107 SRV_No_56, /* #56 Service Provider Display Information */
108 SRV_No_57, /* #57 Multimedia Messaging Service (MMS) */
109 SRV_No_58, /* #58 Extension 8 */
110 SRV_No_59 /* #59 MMS User Connectivity Parameters */
111 } T_SIM_SRV;
112
113 typedef enum /* SIM status */
114 {
115 NO_VLD_SS = 0, /* not a valid SIM status */
116 SS_OK, /* SIM is OK */
117 SS_INV, /* SIM is invalid */
118 SS_BLKD, /* SIM is blocked */
119 SS_URCHB /* SIM is unreachable */
120 } T_SIM_SIMST;
121
122 typedef enum /* PIN status */
123 {
124 NO_VLD_PS = 0, /* not a valid PIN status */
125 PS_RDY, /* ready, no PIN is requested */
126 PS_PIN1, /* PIN 1 is requested */
127 PS_PIN2, /* PIN 2 is requested */
128 PS_PUK1, /* PUK 1 is requested */
129 PS_PUK2 /* PUK 2 is requested */
130
131 } T_SIM_PINST;
132
133 typedef enum /* PIN1 enable/disable status */
134 {
135 NO_VLD_PEDS = 0, /* not a valid PED status */
136 PEDS_ENA, /* PIN 1 enabled */
137 PEDS_DIS /* PIN 1 disabled */
138
139 } T_SIM_PEDST;
140
141 typedef enum /* SIM access type */
142 {
143 NO_VLD_ACT = 0, /* not a valid access type */
144 ACT_RD_DAT, /* read a datafield */
145 ACT_WR_DAT, /* write a datafield */
146 ACT_RD_REC, /* read a record */
147 ACT_WR_REC, /* write a record */
148 ACT_INC_DAT /* increment a datafield */
149
150 } T_SIM_ACTP;
151
152 /*==== TYPES ======================================================*/
153 typedef struct SIMSetPrm
154 {
155 UBYTE actProc; /* activation procedure */
156 UBYTE STKprof[MAX_STK_PRF]; /* SIM toolkit profile */
157 UBYTE PINType; /* type of PIN */
158 CHAR curPIN[PIN_LEN]; /* current PIN */
159 CHAR newPIN[PIN_LEN]; /* new PIN */
160 CHAR unblkKey[PUK_LEN]; /* unblocking key */
161 /*
162 ** This flag is the customisation flag, introuduced for the Cust1 MMI. It is defaulted to 0, and is
163 ** changed by the AT%CUST=n command. If the %CUST command is not received, the ACI and
164 ** other afffected entities will continue to behave as normal
165 */
166 UBYTE cust_mode;
167 /*
168 ** This flag is the STK Call or Short Message Control flag, introuduced for the Cust1 MMI.
169 ** It is defaulted to 1, and is changed by the AT%SATCC=n command. If the %SATCC command is not received,
170 ** the ACI entity will continue to behave as normal. If CC or SM Control By SIM is disabled it will be re-enabled
171 ** automatically, on receipt of a Terminal Response from the MMI.
172 */
173 UBYTE sat_cc_mode;
174 #ifdef FF_DUAL_SIM
175 UBYTE SIM_Selected; /* stores the currently selected SIM number*/
176 #endif /*FF_DUAL_SIM*/
177 } T_SIM_SET_PRM;
178
179 typedef struct SIMAccPrm
180 {
181 UBYTE ntryUsdFlg; /* flags entry usage */
182 UBYTE accType; /* type of access */
183 BOOL v_path_info; /* Indicates whether path_info variable has valid values */
184 T_path_info path_info; /* Contains the whole path to the EF */
185 USHORT reqDataFld; /* requested datafield identifier */
186 USHORT dataOff; /* datafield offset */
187 UBYTE recNr; /* record number */
188 BOOL check_dataLen; /* has size of data to be checked against size of exch buffer ? */
189 UBYTE dataLen; /* data length */
190 UBYTE * exchData; /* points to exchange data buffer */
191 UBYTE recMax; /* maximum records */
192 USHORT errCode; /* error code */
193 void (*rplyCB)(SHORT aId); /* points to reply call-back */
194 } T_SIM_ACC_PRM;
195
196 typedef struct SIMTrnsAccPrm
197 {
198 UBYTE cmd; /* access command */
199 USHORT reqDataFld; /* requested datafield identifier */
200 UBYTE p1; /* parameter 1 */
201 UBYTE p2; /* parameter 2 */
202 UBYTE p3; /* parameter 3 */
203 USHORT dataLen; /* data length in bytes */
204 UBYTE * transData; /* points to data buffer */
205 } T_SIM_TRNS_ACC_PRM;
206
207 typedef struct
208 {
209 UBYTE sw1; /* SIM result code 1 */
210 UBYTE sw2; /* SIM result code 2 */
211 USHORT rspLen; /* length of response data */
212 UBYTE * rsp; /* ponter to response data */
213 } T_SIM_TRNS_RSP_PRM;
214
215 #ifdef FF_SAT_E
216 typedef struct
217 {
218 UBYTE dtiConn; /* dti connection qualifier */
219 UBYTE dtiUnit; /* dti connection unit */
220 UBYTE chnId; /* move to sat_bip_chn channel id */
221 UBYTE bipConn; /* bip connection qualifier */
222 UBYTE genRes; /* general result */
223 UBYTE addRes; /* additional result */
224 } T_SIM_SAT_CHN;
225
226 #endif /* FF_SAT_E */
227
228 #ifdef FF_SAT_E
229 typedef struct
230 {
231 T_SIM_SAT_CHN sat_chn_prm;
232 void (*dti_cb)(UBYTE dtiConn, UBYTE chnId); /* holds callback for DTI estb */
233 void (*bip_cb)(UBYTE bipConn, UBYTE chnId);/* holds callback for BIP estb */
234 } T_SIM_DTI_CH_PRM;
235
236 #endif /* F_SAT_E */
237
238
239 typedef struct
240 {
241 UBYTE plmn[UBYTES_PER_PLMN]; /* Packed PLMN as stored on the SIM */
242 UBYTE pnn_rec_num;
243 USHORT lac1;
244 USHORT lac2;
245 } T_opl;
246
247 typedef struct
248 {
249 UBYTE num_rcd; /* Number of records in EFopl */
250 BOOL opl_status; /* Status of OPL records retrieval */
251 T_opl opl_rcd[OPL_MAX_RECORDS];
252 } T_opl_field;//EONS
253
254 /*
255 * Compare this with the similiar struct T_pnn_name in psa_mm.h
256 */
257 typedef struct
258 {
259 UBYTE v_plmn; /* valid flag */
260 UBYTE long_len; /* length of operator long name */
261 UBYTE long_ext_dcs; /* octet 3 of IEI */
262 UBYTE long_name [MAX_LONG_OPER_LEN-1];/* long name for operator, no '\0' */
263 UBYTE shrt_len; /* length of operator short name */
264 UBYTE shrt_ext_dcs; /* octet 3 of IEI */
265 UBYTE shrt_name [MAX_SHRT_OPER_LEN-1];/* short name for operator, no '\0' */
266 } T_pnn;
267
268 typedef struct
269 {
270 UBYTE num_rcd;
271 BOOL pnn_status;
272 T_pnn pnn_rcd[PNN_MAX_RECORDS];
273 } T_pnn_field;
274
275 typedef struct
276 {
277 UBYTE len; /* length of atr */
278 UBYTE data[MAX_SIM_ATR]; /* atr data */
279 } T_SIM_ATR;
280
281 typedef struct SIMShrdParm
282 {
283 T_OWN owner; /* identifies the used set */
284 SHORT aId; /* access identifier */
285 T_SIM_SET_PRM setPrm[OWN_SRC_MAX]; /* possible sets */
286 T_SIM_ACC_PRM atb[ACC_MAX]; /* table of access parameter */
287 #ifdef FF_DUAL_SIM
288 UBYTE SIM_Powered_on; /* stores the currently powered SIM number*/
289 UBYTE SIM_Selection; /* flag to indicate if SIM selection is taking place*/
290 #endif /*FF_DUAL_SIM*/
291 UBYTE PINStat; /* status of PIN requirement */
292 UBYTE pn1Cnt; /* PIN 1 counter */
293 UBYTE pn2Cnt; /* PIN 2 counter */
294 UBYTE pk1Cnt; /* PUK 1 counter */
295 UBYTE pk2Cnt; /* PUK 2 counter */
296 UBYTE pn1Stat; /* PIN 1 status */
297 UBYTE pn2Stat; /* PIN 2 status */
298 UBYTE PINQuery; /* CPIN? when CFUN=0 */
299 UBYTE crdPhs; /* phase of card */
300 UBYTE SIMStat; /* status of SIM card */
301 UBYTE PEDStat; /* PIN1 enable/disable status */
302 UBYTE crdFun; /* SIM card functionality */
303 UBYTE srvTab[SRV_TAB_LEN]; /* SIM service table */
304 T_imsi_field imsi; /* IMSI */
305 UBYTE PLMN_Mode_Bit; /* PLMN mode bit in EF_CSP */
306 UBYTE mnc_len; /* length of MNC in IMSI (2 or 3 digits)*/
307 USHORT rslt; /* result of SIM operation */
308 UBYTE synCs; /* SIM synchronisation cause */
309 BOOL ciSIMEnabled; /* current ciphering indicator state */
310 int fuRef; /* Reference for File Update */
311 BOOL imei_blocked;
312 #ifdef FF_SAT_E
313 T_SIM_DTI_CH_PRM *sim_dti_chPrm; /* points to sim dti channel parameters */
314 #endif /* FF_SAT_E */
315 T_opl_field opl_list; /* Operator PLMN list (for EONS) */
316 T_pnn_field pnn_list; /* Operator PNN list (for EONS) */
317 UBYTE sat_class_e_dti_id; /* DTI ID for SAT class E */
318 T_SIM_ATR atr; /* Answer to Reset */
319 UBYTE overall_cust_mode; /* Overall Cust Mode, this is set when the SIM is initially activated,
320 it is incumbent on the system that once set, every ACI channel
321 will use the same customisation mode */
322 T_ACI_SIMEF_MODE SIMEFMode[CMD_SRC_MAX]; /* SIMEF mode for each command source */
323 T_ACI_CLASS classFDN; /* FDN classtype during SIM_ACTIVATE_REQ / SIM_ACTIVATE_CNF */
324 T_ACI_PB_STAT pb_stat; /* SIM phonebook status */
325 } T_SIM_SHRD_PRM;
326
327
328
329 typedef enum
330 {
331 ACI_INIT_TYPE_ALL = 0, /* init all parameters */
332 ACI_INIT_TYPE_SOFT_OFF /* init only parameters for soft power off */
333 } T_ACI_INIT_TYPE;
334
335
336 /*==== PROTOTYPES =================================================*/
337
338 EXTERN BOOL psaSIM_hasCustModeBeenSet(void);
339
340 EXTERN SHORT psaSIM_VerifyPIN ( void );
341 EXTERN SHORT psaSIM_ChangePIN ( void );
342 EXTERN SHORT psaSIM_DisablePIN ( void );
343 EXTERN SHORT psaSIM_EnablePIN ( void );
344 EXTERN SHORT psaSIM_UnblockCard ( void );
345 EXTERN void psaSIM_SyncSIM ( void );
346 EXTERN SHORT psaSIM_AccessSIMData ( void );
347 #ifdef FF_DUAL_SIM
348 EXTERN SHORT psaSIM_SelectSIM ( void );
349 #endif /*FF_DUAL_SIM*/
350 EXTERN SHORT psaSIM_ActivateSIM ( void );
351 EXTERN void psaSIM_Init ( T_ACI_INIT_TYPE init_type );
352 EXTERN void psaSIM_InitAtbNtry ( SHORT idx );
353 EXTERN void psaSIM_CloseAtb ( USHORT error );
354 EXTERN SHORT psaSIM_atbNewEntry ( void );
355 EXTERN CHAR* psaSIM_cnvrtIMSI2ASCII ( CHAR * imsiBuf );
356 EXTERN void psaSIM_decodeIMSI (UBYTE* imsi_field, UBYTE imsi_c_field, CHAR* imsi_asciiz);
357 EXTERN void psaSIM_encodeIMSI (CHAR* imsi_asciiz, UBYTE* imsi_c_field, UBYTE* imsi_field);
358 #ifdef SIM_PERS_OTA
359 EXTERN void aci_slock_ota_init();
360 #endif
361
362
363 #ifdef TRACING
364 EXTERN void psaSIM_shrPrmDump ( void );
365 #endif /* TRACING */
366
367 EXTERN BOOL psaSIM_ChkSIMSrvSup ( UBYTE srvNr );
368
369 EXTERN SHORT psaSIM_TrnsSIMAccess ( T_SIM_TRNS_ACC_PRM * prm );
370
371 #ifdef FF_SAT_E
372 EXTERN void psaSIM_SATBIPChn ( T_SIM_SAT_CHN chnInf,
373 void (*cb)(UBYTE bipConn, UBYTE chnId));
374 EXTERN void psaSIM_SATChn ( T_SIM_SAT_CHN chnInf,
375 void (*cb)(UBYTE dtiConn, UBYTE chnId));
376 EXTERN void psaSIM_EvDatAvail ( BOOL evStat );
377 EXTERN void psaSIM_Bip_Req ( void );
378 EXTERN void psaSIM_Bip_Config_Req ( );
379 EXTERN void psaSIM_Dti_Req ( ULONG link_id );
380 #endif /* #ifdef FF_SAT_E */
381
382 /*==== EXPORT =====================================================*/
383
384 #ifdef PSA_SIMF_C
385
386 GLOBAL T_SIM_SHRD_PRM simShrdPrm;
387
388 #else
389
390 EXTERN T_SIM_SHRD_PRM simShrdPrm;
391
392 #endif /* PSA_SIMF_C */
393
394
395
396 #endif /* PSA_SIM_H */
397
398
399 #ifdef CPHS_C
400 UBYTE cphs_mb_ext_record_num[4] ;
401 #else
402 EXTERN UBYTE cphs_mb_ext_record_num[4] ;
403 #endif
404
405
406 /*==== EOF =======================================================*/