comparison src/g23m-aci/aci/phb_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 : MMI-Framework (8417)
4 | Modul : PSA_PHB
5 +-----------------------------------------------------------------------------
6 | Copyright 2005 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 SIM phonebook management block
18 | The functions of this block are aware about SIM data structures,
19 | they are not responsible for communication with the SIM itself.
20 |
21 | Details can be found in the design document
22 | "Phone Book Re-Architecture
23 +-----------------------------------------------------------------------------
24 */
25
26 #ifndef PHB_SIM_H
27 #define PHB_SIM_H
28
29 #include "db.h"
30 /*
31 * Constants
32 */
33 #define PHB_MAX_TAG_LEN 20 /* Arbitrary, old phonebook, nobody complained */
34
35 /*
36 * 04.08 clause 9.3.23.2 Called Party BCD allows for a
37 * PHB_PACKED_NUM_LEN of 40 as biggest definition which
38 * still could make any sense, but we have also to consider
39 * ACI's MAX_PHB_NUM_LEN in aci_cmh.h, therefore a definition
40 * of PHB_PACKED_NUM_LEN with size 20 makes more sense.
41 * With this, an ADN entry plus exatly one EXT1 record is filled.
42 */
43 #define PHB_PACKED_NUM_LEN 20 /* See MAX_PHB_NUM_LEN in aci_cmh.h */
44
45 #define PHB_PACKED_SUB_LEN 22 /* 11.11 clause 10.5.10, chained 2 EXT records */
46 #define ECC_NUM_LEN 3
47 #define FFS_PHB_DIR "/phb_db"
48
49 //#define SIM_ICI 0x6f80 /* Release 1999 LRN, LMN */
50 #define FFS_LRN 0xFF00 /* Structure of SIM_OCI, for LRN, arbitrary unique value */
51 #define FFS_LMN 0xFF01 /* Structure of SIM_OCI, for LMN, arbitrary unique value */
52 #define FFS_EXT_LRN 0xFF02 /* Structure of EXT5 for LRN, arbitrary unique value */
53 #define FFS_EXT_LMN 0xFF03 /* Structure of EXT5 for LMN, arbitrary unique value */
54 #define SIM_OCI 0x6f81 /* Release 1999 LDN */
55 // 0x6f4e is for the SIM EXT4, so we to assign another value for EXT5 here
56 //#define SIM_EXT5 0x6f4e /* Release 1999 EXT5 */
57 #define SIM_EXT5 0x6f55 /* Arbitrary EXT5 value for EF_ICI/EF_OCI */
58
59 #define NAME_IDX 1
60 #define NUMBER_IDX 2
61
62 /* ECC Phonebook Structure */
63 typedef struct
64 {
65 USHORT phy_idx; /* physical record number */
66 UBYTE number[ECC_NUM_LEN]; /* Dialing number/SSC string */
67 } T_PHB_ECC_RECORD;
68
69 /* Type of phonebook */
70 typedef enum
71 {
72 INVALID_PHB = -1, /* Invalid Phonebook Type. */
73 ECC = 0, /* Emergency call numbers */ /* SIM => EF_ECC */
74 ADN, /* Abbreviated dialing number */ /* SIM => EF_ADN */
75 FDN, /* Fixed dialing number */ /* SIM => EF_FDN */
76 BDN, /* Barred dialing number */ /* SIM => EF_BDN */
77 LDN, /* Last dialing number */ /* FFS => "/pcm/LDN" (old phb) */
78 LRN, /* Last received number */ /* FFS => "/pcm/LRN" (old phb) */
79 SDN, /* Service dialing number */ /* SIM => "EF_SDN" */
80 LMN, /* last missed number */ /* FFS => "/pcm/LMN" (old phb) */
81 UPN, /* User person number */ /* SIM => EF_MSISDN */
82 ME, /* ME phonebook, flash based */ /* FFS => to be defined */
83 ADN_ME, /* ADN and ME phonebook merged */
84 MAX_PHONEBOOK
85 } T_PHB_TYPE;
86
87 /* Type of extension */
88 typedef enum
89 {
90 INVALID_EXT = -1,
91 EXT1, /* ADN, LDN phonebook Extention */
92 EXT2, /* FDN phonebook Extention */
93 EXT3,
94 EXT4,
95 EXT5, /* Release 1999+ for EF_ICI, EF_OCI */
96 EXT_LRN, /* Extension for LRN */
97 EXT_LMN, /* Extension for LMN */
98 MAX_PHB_EXT
99 } T_EXT_TYPE;
100
101 /* Phonebook result codes. Note: Not every result code occurs within the
102 * SIM block of the phonebook (e.g. PHB_EXCT) */
103 typedef enum
104 {
105 PHB_FAIL = -1, /* execution of command failed */
106 PHB_LOCKED, /* needed elementary file locked */
107 PHB_OK, /* execution of command completed */
108 PHB_FULL, /* Phonebook is full */
109 PHB_EXCT, /* execution (writing to SIM) is running */
110 PHB_INVALID_IDX, /* invalid index requested */
111 PHB_TAG_EXCEEDED, /* entry is too long to fit on SIM */
112 PHB_EMPTY_RECORD, /* attempted to read a free record */
113 PHB_EXT_FULL /* Phonebook Extension is full */
114 } T_PHB_RETURN;
115
116
117 /* Phonebook entry match criteria */ // ### Is this PHB_SIM?
118 typedef enum
119 {
120 PHB_MATCH_GE, /* Match entry if greater or equal */
121 PHB_MATCH_PARTIAL /* Match entry if exact partial match */
122 } T_PHB_MATCH;
123
124
125 /* File locking type */
126 typedef enum
127 {
128 PHB_UNLOCKED = 0, /* Elementary file not locked */
129 PHB_W_LOCK = 1, /* Elementary file locked for writing */
130 PHB_R_LOCK = 2, /* Elementary file locked for reading */
131 PHB_RW_LOCK = 3 /* Elementary file locked */
132 } T_PHB_LOCK;
133
134
135 /*
136 * Type definitions
137 */
138
139 /* Phonebook time */
140 typedef struct
141 {
142 UBYTE year;
143 UBYTE month;
144 UBYTE day;
145 UBYTE hour;
146 UBYTE minute;
147 UBYTE second;
148 UBYTE time_zone; /* 0xff means not present */
149 ULONG duration; /* 0 means not answered, */
150 /* 0xFFFFFFFF not present */
151 } T_PHB_TIME;
152
153
154 /* Phonebook record */
155 typedef struct
156 {
157 USHORT phy_recno; /* physical record number */
158 UBYTE tag_len; /* Length of Alpha identifier */
159 UBYTE tag[PHB_MAX_TAG_LEN]; /* Alpha identifier */
160 UBYTE len; /* Length of BCD number/SSC contents */
161 UBYTE ton_npi; /* TON and NPI */
162 UBYTE number[PHB_PACKED_NUM_LEN]; /* Dialing number/SSC string */
163 UBYTE subaddr[PHB_PACKED_SUB_LEN];
164 UBYTE cc_id; /* Capability/Configuration identifier */
165 UBYTE v_time; /* Valid flag */
166 T_PHB_TIME time; /* Time of phone call */
167 UBYTE v_line; /* Valid flag */
168 UBYTE line; /* MC line call was made/received upon */
169 } T_PHB_RECORD;
170
171
172 /*
173 * Function prototypes
174 */
175
176 EXTERN void pb_sim_init (void);
177 EXTERN void pb_sim_exit (void);
178 EXTERN T_PHB_RETURN pb_sim_set_ecc (UBYTE ecc_len,
179 const UBYTE *sim_ecc);
180 EXTERN T_PHB_RETURN pb_sim_create_ef (USHORT ef,
181 USHORT record_size,
182 USHORT records);
183 EXTERN T_PHB_RETURN pb_sim_write_ef (USHORT ef,
184 USHORT phy_recno,
185 USHORT entry_size,
186 const UBYTE *buffer,
187 BOOL *changed,
188 USHORT *ext_record_ef,
189 UBYTE *ext_record_no);
190
191 EXTERN T_PHB_RETURN pb_sim_open (const T_imsi_field *imsi_field,
192 BOOL *changed);
193 EXTERN T_PHB_RETURN pb_sim_read_ef (USHORT ef,
194 USHORT phy_recno,
195 USHORT *entry_size,
196 UBYTE *buffer);
197 EXTERN T_PHB_RETURN pb_sim_remove_ef (USHORT ef);
198 EXTERN T_PHB_RETURN pb_sim_build_index (T_PHB_TYPE type);
199 EXTERN T_PHB_RETURN pb_sim_flush_data (void);
200 EXTERN T_PHB_RETURN pb_sim_add_record (T_PHB_TYPE type,
201 USHORT phy_recno,
202 const T_PHB_RECORD *entry,
203 T_DB_CHANGED *rec_affected);
204 EXTERN T_PHB_RETURN pb_sim_del_record (T_PHB_TYPE type,
205 USHORT phy_recno,
206 T_DB_CHANGED *rec_affected);
207 EXTERN T_PHB_RETURN pb_sim_read_record (T_PHB_TYPE type,
208 USHORT phy_recno,
209 T_PHB_RECORD *entry);
210 EXTERN T_PHB_RETURN pb_sim_read_alpha_num_record (T_PHB_TYPE type,
211 USHORT order_num,
212 T_PHB_RECORD *entry,
213 UBYTE sort_index);
214 EXTERN T_PHB_RETURN pb_sim_search_name (T_PHB_TYPE type,
215 T_PHB_MATCH match,
216 const T_ACI_PB_TEXT *search_tag,
217 SHORT *order_num);
218 EXTERN T_PHB_RETURN pb_sim_search_number (T_PHB_TYPE type,
219 const UBYTE *number,
220 SHORT *order_num);
221 EXTERN T_PHB_RETURN pb_sim_read_sizes (T_PHB_TYPE type, /* IN */
222 SHORT *max_rcd, /* OUT */
223 SHORT *used_rcd, /* OUT */
224 UBYTE *tag_len, /* OUT */
225 SHORT *max_ext, /* OUT */
226 SHORT *used_ext);/* OUT */
227 EXTERN int pb_sim_get_entry_len (const UBYTE *pb_tag,
228 UBYTE max_pb_len);
229 EXTERN int pb_sim_find_free_record (T_PHB_TYPE type);
230
231 EXTERN int pb_sim_find_free_ext_record ();
232
233 EXTERN void pb_sim_update_ext_bitmap(UBYTE rec_num, BOOL flag);
234
235 EXTERN int pb_sim_cmpWild ( const char *s1,
236 const char *s2,
237 size_t cmp_len );
238
239 EXTERN void pb_update_cphs_mb_ext_record(void);
240
241 #endif /* #ifndef PHB_SIM_H */