summaryrefslogtreecommitdiffstats
path: root/include/sim.h
blob: f071bf1e770eabcb2b6cf871f1d91727ee8fd9a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/**
 * This file is part of samsung-ril.
 *
 * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr>
 *
 * samsung-ril is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * samsung-ril is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with samsung-ril.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef _SIM_H_
#define _SIM_H_

// Values from TS 11.11
#define SIM_COMMAND_READ_BINARY		0xB0
#define SIM_COMMAND_UPDATE_BINARY	0xD6
#define SIM_COMMAND_READ_RECORD		0xB2
#define SIM_COMMAND_UPDATE_RECORD	0xDC
#define SIM_COMMAND_SEEK		0xA2
#define SIM_COMMAND_GET_RESPONSE	0xC0

#define SIM_FILE_STRUCTURE_TRANSPARENT	0x00
#define SIM_FILE_STRUCTURE_LINEAR_FIXED	0x01
#define SIM_FILE_STRUCTURE_CYCLIC	0x03

#define SIM_FILE_TYPE_RFU		0x00
#define SIM_FILE_TYPE_MF		0x01
#define SIM_FILE_TYPE_DF		0x02
#define SIM_FILE_TYPE_EF		0x04

struct sim_file_id {
	unsigned short file_id;
	unsigned char type;
};

struct sim_file_id sim_file_ids[] = {
	{ 0x2F05, SIM_FILE_TYPE_EF },
	{ 0x2FE2, SIM_FILE_TYPE_EF },
	{ 0x3F00, SIM_FILE_TYPE_MF },
	{ 0x4F20, SIM_FILE_TYPE_EF },
	{ 0x5F3A, SIM_FILE_TYPE_DF },
	{ 0x6F05, SIM_FILE_TYPE_EF },
	{ 0x6F06, SIM_FILE_TYPE_EF },
	{ 0x6F07, SIM_FILE_TYPE_EF },
	{ 0x6F11, SIM_FILE_TYPE_EF },
	{ 0x6F13, SIM_FILE_TYPE_EF },
	{ 0x6F14, SIM_FILE_TYPE_EF },
	{ 0x6F15, SIM_FILE_TYPE_EF },
	{ 0x6F16, SIM_FILE_TYPE_EF },
	{ 0x6F17, SIM_FILE_TYPE_EF },
	{ 0x6F18, SIM_FILE_TYPE_EF },
	{ 0x6F38, SIM_FILE_TYPE_EF },
	{ 0x6F38, SIM_FILE_TYPE_EF },
	{ 0x6F3A, SIM_FILE_TYPE_EF },
	{ 0x6F40, SIM_FILE_TYPE_EF },
	{ 0x6F42, SIM_FILE_TYPE_EF },
	{ 0x6F45, SIM_FILE_TYPE_EF },
	{ 0x6F46, SIM_FILE_TYPE_EF },
	{ 0x6F48, SIM_FILE_TYPE_EF },
	{ 0x6F49, SIM_FILE_TYPE_EF },
	{ 0x6F4A, SIM_FILE_TYPE_EF },
	{ 0x6F4D, SIM_FILE_TYPE_EF },
	{ 0x6F50, SIM_FILE_TYPE_EF },
	{ 0x6F56, SIM_FILE_TYPE_EF },
	{ 0x6FAD, SIM_FILE_TYPE_EF },
	{ 0x6FAE, SIM_FILE_TYPE_EF },
	{ 0x6FB7, SIM_FILE_TYPE_EF },
	{ 0x6FC5, SIM_FILE_TYPE_EF },
	{ 0x6FC6, SIM_FILE_TYPE_EF },
	{ 0x6FC7, SIM_FILE_TYPE_EF },
	{ 0x6FC9, SIM_FILE_TYPE_EF },
	{ 0x6FCA, SIM_FILE_TYPE_EF },
	{ 0x6FCB, SIM_FILE_TYPE_EF },
	{ 0x6FCD, SIM_FILE_TYPE_EF },
	{ 0x7F10, SIM_FILE_TYPE_DF },
	{ 0x7F20, SIM_FILE_TYPE_DF },
};

int sim_file_ids_count = sizeof(sim_file_ids) / sizeof(sim_file_ids[0]);

struct sim_file_response {
	unsigned char rfu12[2];
	unsigned char file_size[2];
	unsigned char file_id[2];
	unsigned char file_type;
	unsigned char rfu3;
	unsigned char access_condition[3];
	unsigned char file_status;
	unsigned char file_length;
	unsigned char file_structure;
	unsigned char record_length;
} __attribute__((__packed__));

#endif