Initial refactoring merge
[platform/core/telephony/libtcore.git] / include / common / tel_sim.h
1 /*
2  * tel-headers
3  *
4  * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
5  * Copyright (c) 2013 Intel Corporation. All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef __TEL_SIM_H__
21 #define __TEL_SIM_H__
22
23 #include <tel_if.h>
24
25 /**
26 *  @addtogroup TAPI_SIM
27 *  @{
28 *
29 *  @file tel_sim.h
30 *  @brief TAPI sim Interface
31 */
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38 #define TELEPHONY_SIM_INTERFACE                 TELEPHONY_SERVICE".Sim"
39
40 #define TEL_SIM_ICCID_LEN_MAX                   20      /**< Maximum ICCID Length */
41 #define TEL_SIM_MSIN_LEN_MAX                    10      /**< Mobile Station Identification Number max length */
42 #define TEL_SIM_MCC_MNC_LEN_MAX                 3       /**< MCC/MNC max length */
43
44 #define TEL_SIM_PLMN_LEN_MAX                    6       /**< PLMN max length */
45 #define TEL_SIM_SPN_LEN_MAX                     16      /**< Service Provider Name max length */
46
47 #define TEL_SIM_ECC_NUMBER_LEN_MAX              6       /**< Emergency code max length */
48 #define TEL_SIM_ECC_LIST_MAX                    16      /**< Emergency list max items */
49 #define TEL_SIM_ECC_TEXT_MAX                    255     /**< Emergency alpha identifier max length */
50
51 #define TEL_SIM_EXT_RECORD_CNT_MAX 15  /** EXT record count max length */
52 #define TEL_SIM_OPL_PNN_RECORD_CNT_MAX 5 /* OPL PNN record count max  */
53 #define TEL_SIM_NW_FULL_NAME_LEN_MAX 40 /* Full name length max */
54 #define TEL_SIM_MBDN_NUM_LEN_MAX                20      /**< Max length of the Number supported*/
55 #define TEL_SIM_ALPHA_ID_LEN_MAX                241     /**< Max length of the Alpha ID supported*/
56
57 #define TEL_SIM_MSP_CNT_MAX                     4       /**< The Profile Identity shall be between 1and 4 as defined in TS 23.097 for MSP.*/
58
59 #define TEL_SIM_AUTH_MAX_REQ_DATA_LEN           16      /**< Authentication code max length */
60 #define TEL_SIM_AUTH_MAX_RESP_DATA_LEN          16      /**< Authentication response data max length */
61
62 #define TEL_SIM_APDU_LEN_MAX                    261     /**< APDU max command length */
63 #define TEL_SIM_APDU_RESP_LEN_MAX               258     /**< APDU max response length */
64 #define TEL_SIM_ATR_LEN_MAX                     33      /**< Answer to Reset data max length */
65
66 #define TEL_SIM_MAILBOX_TYPE_MAX                5       /**< Mailbox type count */
67 #define TEL_SIM_CALL_FORWARDING_TYPE_MAX                5       /** Call forwarding type count */
68
69 /**
70  * @enum TelSimResult
71  * Response (Return) values.
72  */
73 typedef enum {
74         TEL_SIM_RESULT_SUCCESS, /**< Operation completed successfully */
75         TEL_SIM_RESULT_FAILURE, /**< Operation Failed */
76         TEL_SIM_RESULT_INVALID_PARAMETER, /**< Invalid input parameters */
77         TEL_SIM_RESULT_MEMORY_FAILURE, /**< Memory allocation failed */
78         TEL_SIM_RESULT_OPERATION_NOT_SUPPORTED, /**< Operation not supported */
79
80         TEL_SIM_RESULT_CARD_ERROR,  /**< SIM card error - Permanently blocked and general errors   */
81         TEL_SIM_RESULT_ACCESS_CONDITION_NOT_SATISFIED, /**< SIM Incompatible pin operation that is in case when invalid SIM command is given or incorrect parameters are supplied to the SIM. */
82         TEL_SIM_RESULT_INCOMPATIBLE_PIN_OPERATION, /**< SIM PIN  Incorrect password */
83         TEL_SIM_RESULT_INCORRECT_PASSWORD, /**< SIM Incorrect password */
84         TEL_SIM_RESULT_PIN_REQUIRED, /**< PIN Required */
85         TEL_SIM_RESULT_PUK_REQUIRED, /**< PUK Required */
86         TEL_SIM_RESULT_PERM_BLOCKED, /**< Permanent block SIM */
87         TEL_SIM_RESULT_SQN_FAILURE, /**< status - SQN(SeQuenceNumber) failure */
88         TEL_SIM_RESULT_OPERATION_NOT_PERMITTED  /**< Operation not permitted */
89 } TelSimResult;
90
91 /**
92  * @enum TelSimCardType
93  * This enumeration defines the card type.
94  */
95 typedef enum {
96         TEL_SIM_CARD_TYPE_UNKNOWN,      /**< Unknown card */
97         TEL_SIM_CARD_TYPE_GSM,          /**< 2G SIM(GSM) card */
98         TEL_SIM_CARD_TYPE_USIM,         /**< 3G USIM card */
99         TEL_SIM_CARD_TYPE_RUIM,         /**< CDMA based card */
100         TEL_SIM_CARD_TYPE_ISIM          /**< IMS based card */
101 } TelSimCardType;
102
103 typedef enum {
104         TEL_SIM_MWIS_NONE = 0x00, /**< MWIS none*/
105         TEL_SIM_MWIS_VOICE = 0x01, /**< MWIS voice*/
106         TEL_SIM_MWIS_FAX = 0x02, /**< MWIS FAX*/
107         TEL_SIM_MWIS_EMAIL = 0x04, /**< MWIS email*/
108         TEL_SIM_MWIS_OTHER = 0x08, /**< MWIS other*/
109         TEL_SIM_MWIS_VIDEO = 0x10, /**< MWIS video*/
110         TEL_SIM_MWIS_RFU = 0xff /**< MWIS RFU*/
111 } TelSimMwisMask;
112
113 /** * @enum TelSimFacilityStatus
114  * This enumeration defines the pin status.
115  */
116 typedef enum {
117         TEL_SIM_FACILITY_STATUS_UNKNOWN = -1, /**< SIM facility UNKNOWN status*/
118         TEL_SIM_FACILITY_STATUS_DISABLED, /**< SIM facility DISABLED status*/
119         TEL_SIM_FACILITY_STATUS_ENABLED /**< SIM facility ENABLED status*/
120 } TelSimFacilityStatus;
121
122 /**
123  * @enum TelSimPinType
124  * This enumeration defines the pin type.
125  */
126 typedef enum {
127         TEL_SIM_PIN_TYPE_PIN1, /**< PIN 1 code */
128         TEL_SIM_PIN_TYPE_PIN2 /**< PIN 2 code */
129 } TelSimPinType;
130
131 /**
132  * @enum TelSimPukType
133  * This enumeration defines the puk type.
134  */
135 typedef enum {
136         TEL_SIM_PUK_TYPE_PUK1, /**< PUK 1 code */
137         TEL_SIM_PUK_TYPE_PUK2 /**< PUK 2 code */
138 } TelSimPukType;
139
140 /**
141  * @enum TelSimEccEmergencyServiceInfo
142  * This enumeration defines the emergency service type.
143  */
144 typedef enum {
145         TEL_SIM_ECC_ESC_DEFAULT =               0x00, /**< DEFAULT */
146         TEL_SIM_ECC_ESC_POLICE =                0x01, /**< Police */
147         TEL_SIM_ECC_ESC_AMBULANCE =             0x02, /**< Ambulance */
148         TEL_SIM_ECC_ESC_FIREBRIGADE =           0x04, /**< Fire brigade */
149         TEL_SIM_ECC_ESC_MARINEGUARD =           0x08, /**< Marine guard */
150         TEL_SIM_ECC_ESC_MOUNTAINRESCUE =        0x10, /**< Mountain rescue */
151         TEL_SIM_ECC_ESC_MANUAL_ECALL =          0x20, /**< Manual Emergency call */
152         TEL_SIM_ECC_ESC_AUTO_ECALL =            0x40 /**< Automatic Emergency call */
153 } TelSimEccEmergencyServiceInfo;
154
155 /**
156  * @enum TelSimLanguagePreferenceCode
157  * This enumeration defines the language indication code.
158  */
159 typedef enum {
160         TEL_SIM_LP_GERMAN =             0x00, /**< German */
161         TEL_SIM_LP_ENGLISH =            0x01, /**< English */
162         TEL_SIM_LP_ITALIAN =            0x02, /**< Italian */
163         TEL_SIM_LP_FRENCH =             0x03, /**< French */
164         TEL_SIM_LP_SPANISH =            0x04, /**< Spanish */
165         TEL_SIM_LP_DUTCH =              0x05, /**< Dutch */
166         TEL_SIM_LP_SWEDISH =            0x06, /**< Swedish */
167         TEL_SIM_LP_DANISH =             0x07, /**< Danish */
168         TEL_SIM_LP_PORTUGUESE =         0x08, /**< Portuguese */
169         TEL_SIM_LP_FINNISH =            0x09, /**< Finnish */
170         TEL_SIM_LP_NORWEGIAN =          0x0A, /**< Norwegian */
171         TEL_SIM_LP_GREEK =              0x0B, /**< Greek */
172         TEL_SIM_LP_TURKISH =            0x0C, /**< Turkish */
173         TEL_SIM_LP_HUNGARIAN =          0x0D, /**< Hungarian */
174         TEL_SIM_LP_POLISH =             0x0E, /**< Polish */
175         TEL_SIM_LP_KOREAN =             0x0F, /**< Korean */
176         TEL_SIM_LP_CHINESE =            0x10, /**< Chinese */
177         TEL_SIM_LP_RUSSIAN =            0x11, /**< Russian */
178         TEL_SIM_LP_JAPANESE =           0x12, /**< Japanese */
179         TEL_SIM_LP_LANG_UNSPECIFIED =   0xFF /**< Unspecified */
180 } TelSimLanguagePreferenceCode;
181
182 /**
183  * @enum TelSimCardStatus
184  * This enumeration defines the SIM card status
185  */
186 typedef enum {
187         TEL_SIM_STATUS_UNKNOWN,                         /**<  Unknown status. It can be initial status **/
188         TEL_SIM_STATUS_CARD_ERROR,                      /**<  Bad card / On the fly SIM gone bad **/
189         TEL_SIM_STATUS_SIM_CARD_POWEROFF,       /**<  SIM Card Powered OFF **/
190         TEL_SIM_STATUS_CARD_NOT_PRESENT,        /**<  Card not present **/
191         TEL_SIM_STATUS_SIM_INITIALIZING,                /**<  SIM is Initializing state **/
192         TEL_SIM_STATUS_SIM_INIT_COMPLETED,      /**<  SIM Initialization COMPLETE **/
193         TEL_SIM_STATUS_SIM_PIN_REQUIRED,        /**<  PIN  required state **/
194         TEL_SIM_STATUS_SIM_PUK_REQUIRED,        /**<  PUK  required state **/
195         TEL_SIM_STATUS_CARD_BLOCKED,            /**<  PIN/PUK blocked(permanently blocked - All the attempts for PIN/PUK failed) **/
196         TEL_SIM_STATUS_SIM_NCK_REQUIRED,        /**<  Network Control Key required state **/
197         TEL_SIM_STATUS_SIM_NSCK_REQUIRED,       /**<  Network Subset Control Key required state **/
198         TEL_SIM_STATUS_SIM_SPCK_REQUIRED,       /**<  Service Provider Control Key required state **/
199         TEL_SIM_STATUS_SIM_CCK_REQUIRED,        /**<  Corporate Control Key required state **/
200         TEL_SIM_STATUS_CARD_REMOVED,            /**<  Card removed **/
201         TEL_SIM_STATUS_SIM_LOCK_REQUIRED        /**<  PH-SIM (phone-SIM) locked state **/
202 } TelSimCardStatus;
203
204 /**
205  * @enum TelSimCardChangeStatus
206  * This enumeration defines whether SIM card is changed or not
207  */
208 typedef enum {
209         TEL_SIM_CHANGE_STATUS_UNKNOWN, /**< Unknown */
210         TEL_SIM_CHANGE_STATUS_SAME, /**< SIM card is same */
211         TEL_SIM_CHANGE_STATUS_CHANGED /**< SIM card is changed */
212 } TelSimCardChangeStatus;
213
214 /**
215  * @enum TelSimRefreshCommandType
216  * This enumeration defines the SIM card status
217  */
218 typedef enum {
219         TEL_SIM_REFRESH_CMD_INIT_AND_FULL_FCN           = 0x00, /**<    command qualifier for REFRESH SIM INIT AND FULL FILE CHANGE_NOTIFICATION                */
220         TEL_SIM_REFRESH_CMD_FCN                                         = 0x01, /**<    command qualifier for REFRESH FILE CHANGE NOTIFICATION          */
221         TEL_SIM_REFRESH_CMD_INIT_AND_FCN                        = 0x02, /**<    command qualifier for REFRESH SIM INIT AND FILE CHANGE NOTIFICATION             */
222         TEL_SIM_REFRESH_CMD_INIT                                        = 0x03, /**<    command qualifier for REFRESH SIM INIT          */
223         TEL_SIM_REFRESH_CMD_RESET                                       = 0x04, /**<    command qualifier for REFRESH SIM RESET         */
224         TEL_SIM_REFRESH_CMD_3G_APPLICATION_RESET        = 0x05, /**<    command qualifier for REFRESH 3G APPLICATION RESET              */
225         TEL_SIM_REFRESH_CMD_3G_SESSION_RESET            = 0x06, /**<    command qualifier for REFRESH 3G SESSION RESET          */
226         TEL_SIM_REFRESH_CMD_UNSPECIFIED                         = 0xFF  /**<    command qualifier for REFRESH RESERVED          */
227 }TelSimRefreshCommandType;
228
229 /**
230  * @enum TelSimMailboxType
231  * This enum gives mailbox type.
232  */
233 typedef enum {
234         TEL_SIM_MAILBOX_VOICE,  /**< Mailbox identifier voice */
235         TEL_SIM_MAILBOX_FAX,    /**< Mailbox identifier fax */
236         TEL_SIM_MAILBOX_EMAIL,  /**< Mailbox identifier email */
237         TEL_SIM_MAILBOX_OTHER,  /**< Mailbox identifier other */
238         TEL_SIM_MAILBOX_VIDEO   /**< Mailbox identifier video */
239 } TelSimMailboxType;
240
241 /**
242  * @enum TelSimCallForwardingType
243  * This enum gives Call forwarding type.
244  */
245 typedef enum {
246         TEL_SIM_CALL_FORWARDING_VOICE,  /**< Call forwarding identifier voice */
247         TEL_SIM_CALL_FORWARDING_FAX,    /**< Call forwarding identifier fax */
248         TEL_SIM_CALL_FORWARDING_EMAIL,  /**< Call forwarding identifier email */
249         TEL_SIM_CALL_FORWARDING_OTHER,  /**< Call forwarding identifier other */
250         TEL_SIM_CALL_FORWARDING_VIDEO   /**< Call forwarding identifier video */
251 } TelSimCallForwardingType;
252
253 /**
254  * @enum TelSimAuthenticationType
255  * This is used for Authentication Procedure by using SIM.
256  */
257 typedef enum {
258         TEL_SIM_AUTH_GSM, /**< GSM Authentication */
259         TEL_SIM_AUTH_GSM_CTX, /**< GSM CTX Authentication */
260         TEL_SIM_AUTH_3G_CTX, /**< 3G CTX Authentication */
261         TEL_SIM_AUTH_GBA, /**< GBA Authentication */
262         TEL_SIM_AUTH_GBA_NAF, /**< GBA NAF Authentication */
263         TEL_SIM_AUTH_IMS_AKA /**< IMS Authentication */
264 } TelSimAuthenticationType;
265
266 /**
267  * @enum TelSimLockType
268  *      This structure gives security lock type enum values
269  */
270 typedef enum {
271         TEL_SIM_LOCK_PS,
272         /**< PH-SIM (phone-SIM) locked.Lock Phone to SIM/UICC card
273          *      (MT asks password when other than current SIM/UICC card inserted;
274          *      MT may remember certain amount of previously used cards thus not
275          *      requiring password when they are inserted
276          */
277         TEL_SIM_LOCK_PF,
278         /**< PH-FSIM (phone-first-SIM) Lock Phone to the very
279          *      First inserted SIM/UICC card(MT asks password when other than the
280          *      first SIM/UICC card is inserted
281          */
282         TEL_SIM_LOCK_SC,
283          /**< SIM Lock (PIN, PIN2, PUK, PUK2) Lock SIM/UICC card ( SIM asks
284          *      password in ME power-up and when this command is issued */
285         TEL_SIM_LOCK_FD,
286         /**< FDN - SIM card or active application in the UICC (GSM or USIM)
287          *      fixed dialing memory feature */
288         TEL_SIM_LOCK_PN, /**< Network Personalization */
289         TEL_SIM_LOCK_PU, /**< Network subset Personalization */
290         TEL_SIM_LOCK_PP, /**< Service Provider Personalization */
291         TEL_SIM_LOCK_PC, /**< Corporate Personalization */
292 } TelSimLockType;
293
294 /**
295  * @enum TelSimLockStatus
296  * This structure gives security lock key information enum values
297  */
298 typedef enum {
299         TEL_SIM_LOCK_KEY_NOT_NEED,      /**< key not need */
300         TEL_SIM_LOCK_KEY_PIN,           /**< PIN required */
301         TEL_SIM_LOCK_KEY_PUK,           /**< PUK required */
302         TEL_SIM_LOCK_KEY_PIN2,          /**< PIN2 required */
303         TEL_SIM_LOCK_KEY_PUK2,          /**< PUK2 required */
304         TEL_SIM_LOCK_PERM_BLOCKED       /**< Permanent block SIM */
305 } TelSimLockStatus;
306
307 /**
308  * @enum TelSimSpnDispCondition
309  * This enumeration defines Service Provider Name display condition type.
310  */
311 typedef enum
312 {
313         TEL_SIM_DISP_INVALID, /**< Invalid display condition */
314         TEL_SIM_DISP_SPN, /**< SPN display condition */
315         TEL_SIM_DISP_PLMN, /**< PLMN display condition */
316         TEL_SIM_DISP_SPN_PLMN /**< SPN/PLMN display condition */
317 } TelSimSpnDispCondition;
318
319 /**
320  * This data structure defines plmn informations
321  */
322 typedef struct {
323         unsigned int index;     /**< Plmn list index */
324         char *plmn;             /**< numeric operator name (MCCMNC) */
325 } TelSimSpPlmn;
326
327 /**
328  * This data structure defines plmn list
329  */
330 typedef struct {
331         unsigned int count;     /**< Number of service provider plmns in the list */
332         TelSimSpPlmn *list;     /**< service provider plmns list */
333 } TelSimSpPlmnList;
334
335 /**
336  * This data structure defines the status of sim initialization
337  */
338 typedef struct {
339         TelSimCardStatus status; /**< Sim card status */
340         TelSimCardChangeStatus change_status; /**< Sim card change status */
341 } TelSimCardStatusInfo;
342
343 /**
344  * This data structure defines the data for the Imsi information.
345  */
346 typedef struct {
347         char mcc[TEL_SIM_MCC_MNC_LEN_MAX + 1];  /**< mobile country code 3 digits*/
348         char mnc[TEL_SIM_MCC_MNC_LEN_MAX + 1];  /**< mobile network code 2 or 3 digits*/
349         char msin[TEL_SIM_MSIN_LEN_MAX + 1];    /**< Mobile Station Identification Number */
350 } TelSimImsiInfo;
351
352 /**
353  * This data structure defines the data for the SIM ECC information.
354  */
355 typedef struct {
356         char number[TEL_SIM_ECC_NUMBER_LEN_MAX + 1];    /**< Emergency Call Code. null termination used*/
357         char name[TEL_SIM_ECC_TEXT_MAX + 1];            /**< Alpha identifier */
358         TelSimEccEmergencyServiceInfo category;         /**< ECC emergency service information */
359 } TelSimEcc;
360
361 /**
362  * This data structure defines the data for the SIM ECC lists.
363  */
364 typedef struct {
365         unsigned int count; /**< Total count for ECC list */
366         TelSimEcc list[TEL_SIM_ECC_LIST_MAX];   /**< List of emergency numbers */
367 } TelSimEccList;
368
369 typedef struct {
370         int ext_len;
371         char ext[TEL_SIM_EXT_RECORD_CNT_MAX + 1];
372         unsigned short next_record;
373 } TelSimExt;
374
375 typedef struct {
376         unsigned char plmn[6+1];
377         unsigned short lac_from;
378         unsigned short lac_to;
379         unsigned char rec_identifier;
380 } TelSimOpl;
381
382 typedef struct {
383         int opl_count;
384         TelSimOpl list[TEL_SIM_OPL_PNN_RECORD_CNT_MAX];
385 } TelSimOplList;
386
387 typedef struct {
388         unsigned char full_name[TEL_SIM_NW_FULL_NAME_LEN_MAX + 1];
389         unsigned char short_name[TEL_SIM_NW_FULL_NAME_LEN_MAX + 1];
390 } TelSimPnn;
391
392 typedef struct {
393         int pnn_count;
394         TelSimPnn list[TEL_SIM_OPL_PNN_RECORD_CNT_MAX];
395 } TelSimPnnList;
396
397 typedef struct {
398         unsigned char profile_id;               /**< Profile Identity of the subscriber profile*/
399         TelSimMailboxType mb_type;      /**< Mailbox type */
400         unsigned int alpha_id_len; /**< Mailbox Alpha Identifier length */
401         char alpha_id[TEL_SIM_ALPHA_ID_LEN_MAX]; /**< Mailbox Alpha Identifier */
402         char number[TEL_SIM_MBDN_NUM_LEN_MAX]; /**< Dialing Number/SSC String */
403 } TelSimMailBoxNumber;
404
405 /**
406  * This data structure defines the data for the Mailbox lists.
407  */
408 typedef struct {
409         unsigned int alpha_id_max_len;          /**< Alpha id max length in SIM */
410         unsigned int count;                                     /**< Number of mailbox count*/
411         TelSimMailBoxNumber list[TEL_SIM_MSP_CNT_MAX * TEL_SIM_MAILBOX_TYPE_MAX]; /**< Mailbox list info */
412 } TelSimMailboxList;
413
414 /**
415  * This data structure defines the data for the Call Forwarding.
416  */
417 typedef struct {
418         unsigned char profile_id;       /**< Profile Identity of the subscriber profile*/
419         gboolean indication[TEL_SIM_CALL_FORWARDING_TYPE_MAX]; /**< 0: voice , 1 : fax, 2 : email, 3:other, 4 :video */
420 } TelSimCfis;
421
422 /**
423  * This data structure defines the data for the Call Forwarding lists.
424  */
425 typedef struct {
426         unsigned int profile_count; /**< Call forwarding list count in SIM */
427         TelSimCfis cf[TEL_SIM_MSP_CNT_MAX]; /**< Call forwarding list info in SIM */
428 } TelSimCfisList;
429
430 /**
431  * This data structure defines indication status for the Message Waiting.
432  */
433  typedef struct {
434         gboolean indication; /**< indication status for the Message Waiting */
435         unsigned char count; /**< indication count for the Message Waiting */
436 } TelSimMsgWaitingIndicator;
437
438 /**
439  * This data structure defines the data for the Message Waiting.
440  */
441 typedef struct {
442         unsigned char profile_id; /**< Profile Identity of the subscriber profile */
443         gboolean count_valid; /**< whether count is valid or not (in case of cphs, count is not valid) */
444         TelSimMsgWaitingIndicator msg_waiting[TEL_SIM_MAILBOX_TYPE_MAX]; /**< 0: voice , 1 : fax, 2 : email, 3:other, 4 :video */
445 } TelSimMwis;
446
447 /**
448  * This data structure defines the data for the Message Waiting lists.
449  */
450 typedef struct {
451         unsigned int profile_count; /**< Message waiting list count in SIM */
452         TelSimMwis mw[TEL_SIM_MSP_CNT_MAX]; /**< Message waiting list info in SIM */
453 } TelSimMwisList;
454
455 /**
456  * This data structure defines the data for the MSISDN.
457  */
458 typedef struct {
459         char *alpha_id; /**< MSISDN Alpha Identifier. If not exist, Null string will be returned */
460         char *num;  /**< MSISDN number. If not exist, Null string will be returned*/
461 } TelSimSubscriberInfo;
462
463 /**
464  * This data structure defines the data for the MSISDN lists.
465  */
466 typedef struct {
467         unsigned int count; /**< MSISDN list count in SIM */
468         TelSimSubscriberInfo *list; /**< MSISDN list info in SIM */
469 } TelSimMsisdnList;
470
471 /**
472  * This data structure defines the data for the SPN.
473  */
474 typedef struct {
475         TelSimSpnDispCondition display_condition;       /**< display condition */
476         char spn[TEL_SIM_SPN_LEN_MAX + 1];              /**< SPN */
477 } TelSimSpn;
478
479 /**
480  * This data structure defines the data for the CPHS Network Name.
481  */
482 typedef struct {
483         char *full_name; /**< Short Network Operator Name */
484         char *short_name; /**< Long Network Operator Name */
485 }TelSimCphsNetName;
486
487 typedef struct {
488         TelSimResult result;
489         union {
490                 TelSimEccList ecc;
491                 TelSimLanguagePreferenceCode language;
492                 char iccid[TEL_SIM_ICCID_LEN_MAX + 1];
493                 TelSimMailboxList mb;
494                 TelSimCfisList cf;
495                 TelSimMwisList mw;
496                 TelSimMsisdnList msisdn_list;
497                 TelSimSpn spn;
498                 TelSimOplList opl;
499                 TelSimPnnList pnn;
500                 TelSimSpPlmnList spdi;
501                 TelSimCphsNetName cphs_net;
502         } data;
503 } TelSimFileResult;
504
505 typedef struct {
506         /*      '00' - no mailbox dialing number associated with message waiting indication group type.
507          'xx' - record number in EFMBDN associated with message waiting indication group type.
508          */
509         int voice_index;        /**< voice mailbox identifier*/
510         int fax_index;  /**< FAX mailbox identifier*/
511         int email_index;        /**< email mailbox identifier*/
512         int other_index;        /**< other mailbox identifier*/
513         int video_index;        /**< video mailbox identifier*/
514 } TelSimMbi;
515
516 /**
517  *This is used for authentication request procedure.
518  */
519 typedef struct {
520         TelSimAuthenticationType auth_type;             /**< Authentication type */
521         unsigned int rand_length;                       /**< the length of RAND */
522         unsigned int autn_length;                       /**< the length of AUTN. it is not used in case of GSM AUTH */
523         char rand_data[TEL_SIM_AUTH_MAX_REQ_DATA_LEN];  /**< RAND data */
524         char autn_data[TEL_SIM_AUTH_MAX_REQ_DATA_LEN];  /**< AUTN data. it is not used in case of GSM AUTH */
525 } TelSimAuthenticationData;
526
527 /**
528  * @enum TelSimAuthenticationResult
529  * This is used to get detailed result for Authentication Procedure.
530  */
531 typedef enum {
532         TEL_SIM_AUTH_NO_ERROR = 0x00, /**< ISIM no error */
533         TEL_SIM_AUTH_CANNOT_PERFORM, /**< status - can't perform authentication */
534         TEL_SIM_AUTH_SKIP_RESPONSE, /**< status - skip authentication response */
535         TEL_SIM_AUTH_MAK_CODE_FAILURE, /**< status - MAK(Multiple Activation Key) code failure */
536         TEL_SIM_AUTH_SQN_FAILURE, /**< status - SQN(SeQuenceNumber) failure */
537         TEL_SIM_AUTH_SYNCH_FAILURE, /**< status - synch failure */
538         TEL_SIM_AUTH_UNSUPPORTED_CONTEXT, /**< status - unsupported context */
539         TEL_SIM_AUTH_UNSPECIFIED /**< Unspecified error */
540 } TelSimAuthenticationResult;
541
542 /**
543  * This is used for result data of authentication.
544  */
545 typedef struct {
546         TelSimAuthenticationType auth_type;                             /**< authentication type */
547         TelSimAuthenticationResult detailed_result;             /**<Detailed result for authentication procedure*/
548         unsigned int resp_length;                                       /**< response length. IMS and 3G case, it stands for RES_AUTS. GSM case, it stands for SRES. */
549         char resp_data[TEL_SIM_AUTH_MAX_RESP_DATA_LEN];                 /**< response data. IMS and 3G case, it stands for RES_AUTS. GSM case, it stands for SRES. */
550         unsigned int authentication_key_length;                         /**< the length of authentication key, Kc*/
551         char authentication_key[TEL_SIM_AUTH_MAX_RESP_DATA_LEN];        /**< the data of of authentication key, Kc*/
552         unsigned int cipher_length;                                     /**< the length of cipher key length */
553         char cipher_data[TEL_SIM_AUTH_MAX_RESP_DATA_LEN];               /**< cipher key */
554         unsigned int integrity_length;                                  /**< the length of integrity key length */
555         char integrity_data[TEL_SIM_AUTH_MAX_RESP_DATA_LEN];            /**< integrity key */
556 } TelSimAuthenticationResponse;
557
558 /**
559  * @enum TelSimPowerState
560  * This enumeration defines the power state of SIM.
561  */
562 typedef enum {
563         TEL_SIM_POWER_OFF = 0x00, /**< OFF */
564         TEL_SIM_POWER_ON = 0x01, /**< ON */
565         TEL_SIM_POWER_UNSPECIFIED = 0xFF /**< Unspecified */
566 } TelSimPowerState;
567
568 /**
569  * This is used to verify PIN code.
570  */
571 typedef struct {
572         TelSimPinType pin_type; /**< Specifies the PIN type */
573         char *pw;               /**< Pin password*/
574 } TelSimSecPinPw;
575
576 /**
577  * This is used to verify PUK code.
578  */
579 typedef struct {
580         TelSimPukType puk_type; /**< Specifies the PUK type */
581         char *puk_pw;           /**< Puk password */
582         char *new_pin_pw;       /**< New corresponding pin password */
583 } TelSimSecPukPw;
584
585 /**
586  * This is used to change PIN code .
587  */
588 typedef struct {
589         TelSimPinType pin_type; /**< Specifies the PIN type */
590         char *old_pw;           /**< Current password */
591         char *new_pw;           /**< New pin password */
592 } TelSimSecChangePinPw;
593
594 /**
595  * This is used to PIN code verification.
596  */
597 typedef struct {
598         TelSimPinType pin_type;         /**< Specifies the PIN type */
599         unsigned int retry_count;       /**< Number of attempts remaining for PIN verification */
600 } TelSimSecPinResult;
601
602 /**
603  * This is used to PUK code verification.
604  */
605 typedef struct {
606         TelSimPukType puk_type;         /**< Specifies the PUK type */
607         unsigned int retry_count;       /**< Number of attempts remaining for PUK verification */
608 } TelSimSecPukResult;
609
610 /**
611  * This structure is used to enable/disable facility
612  */
613 typedef struct {
614         TelSimLockType lock_type;       /**< Facility type */
615         char *pw;                       /**< password */
616 } TelSimFacilityPw;
617
618 /**
619  * This structure is used to PIN/PUK verification
620  */
621 typedef struct {
622         TelSimLockType type;            /**< Specifies the PIN or PUK type.*/
623         unsigned int retry_count;       /**< Number of attempts remaining for PIN/PUK verification.*/
624 } TelSimFacilityResult;
625
626 /**
627  * This structure is used to enable/disable facility
628  */
629 typedef struct {
630         TelSimLockType type; /**< Security lock type */
631         TelSimFacilityStatus f_status; /**< Lock status (enable/disable) */
632 }TelSimFacilityInfo;
633
634 /**
635  *
636  * This structure is used to get information about LOCK_TYPE
637  */
638 typedef struct {
639         TelSimLockType lock_type;       /**< Lock type */
640         TelSimLockStatus lock_status;   /**< Lock key */
641         unsigned int retry_count;       /**< retry counts */
642 } TelSimLockInfo;
643
644 /**
645  * This data structure defines the data for the apdu command.
646  */
647 typedef struct {
648         unsigned int apdu_len; /**<  SIM APDU length */
649         unsigned char apdu[TEL_SIM_APDU_LEN_MAX]; /**<  SIM APDU data */
650 } TelSimApdu;
651
652 /**
653  * This data structure defines the data for the Response of sending apdu.
654  */
655 typedef struct {
656         unsigned int apdu_resp_len; /**< Response apdu data length */
657         unsigned char apdu_resp[TEL_SIM_APDU_RESP_LEN_MAX]; /**< Response apdu data */
658 } TelSimApduResp;
659
660 /**
661  * This data structure defines the data for the Response of ATR request.
662  */
663 typedef struct {
664         unsigned int atr_len; /**<  SIM ATR data length */
665         unsigned char atr[TEL_SIM_ATR_LEN_MAX]; /**<  SIM ATR data */
666 } TelSimAtr;
667
668 /**
669  *  \defgroup TAPI_EVENT TAPI Event IDs
670  *  @{
671  */
672
673 /**
674  *  \defgroup TEL_EVENT_SIM SIM Event IDs
675  *  @{
676  */
677
678 /**
679  *  @hideinitializer
680  *  @brief SIM status
681  *  @section subscription Event Subscription
682  *  @details Event can be subscribed with event id TEL_NOTI_SIM_STATUS
683  *  @sa tapi_register_event_id
684  *  @section handling Event Handling
685  *  @details TAPI will invoke the registered callback (\ref TapiEvtCb) and return the following data:
686  *  @retval handle #TelHandle used for registering the event
687  *  @retval evt_id TEL_NOTI_SIM_STATUS
688  *  @retval data \ref TelSimCardStatus
689  *  @retval user_data user data passed while registering the event
690  */
691 #define TEL_NOTI_SIM_STATUS                             TELEPHONY_SIM_INTERFACE":card_status"
692
693 /** @}*/
694 /** @}*/
695
696 #ifdef __cplusplus
697 }
698 #endif
699
700 /**
701  * @}
702  */
703 #endif /* __TEL_SIM_H__ */