blob: 8e4f2663f7b34a58190040f5ce46d796e91b8f78 [file] [log] [blame]
Harald Welte3aa901d2018-08-13 18:32:36 +02001----------------------------------------------------------------------
2-- RSPRO - Remote SIM Protocol, part of Osmocom Remote SIM Suite
3-- (C) 2018 by Harald Welte <laforge@gnumonks.org>
4----------------------------------------------------------------------
5
6RSPRO {} DEFINITIONS
7
8IMPLICIT TAGS
9
10::=
11
12BEGIN
13
14EXPORTS
15 RsproPDU
16;
17
18----------------------------------------------------------------------
19-- Elementary Data Types
20----------------------------------------------------------------------
21
22-- Some random ID the requestor can chose and which the client echos back in a response.
23-- This allows multiple outstanding commands in flight and matching of responses to requests.
24OperationTag ::= INTEGER(0..2147483647)
25
26-- Unique identifier of a given SIM bank
27BankId ::= INTEGER(0..1023)
28
29-- Unique identifier of a given client (modem)
30ClientId ::= INTEGER(0..1023)
31
32ComponentType ::= ENUMERATED {
33 -- client: Modems / Phones
34 remsimClient (0),
35 -- server: Coordination
36 remsimServer (1),
37 -- bank daemon: SIM cards
38 remsimBankd (2)
39}
40ComponentName ::= IA5String (SIZE (1..32))
41ComponentIdentity ::= SEQUENCE {
42 type ComponentType,
43 name ComponentName,
44 software [0] ComponentName,
45 swVersion [1] ComponentName,
46 hwManufacturer [2] ComponentName OPTIONAL,
47 hwModel [3] ComponentName OPTIONAL,
48 hwSerialNr [4] ComponentName OPTIONAL,
49 hwVersion [5] ComponentName OPTIONAL,
50 fwVersion [6] ComponentName OPTIONAL,
51 ...
52}
53
54-- IP address / port details
55Ipv4Address ::= OCTET STRING (SIZE (4))
56Ipv6Address ::= OCTET STRING (SIZE (16))
57IpAddress ::= CHOICE {
58 ipv4 [0] Ipv4Address,
59 ipv6 [1] Ipv6Address
60}
61PortNumber ::= INTEGER (0..65535)
62IpPort ::= SEQUENCE {
63 ip IpAddress,
64 port PortNumber
65}
66
67-- Result of a given operation
68ResultCode ::= ENUMERATED {
69 ok (0),
70 -- client / bank / slot ID not accepted
71 illegalClientId (1),
72 illegalBankId (2),
73 illegalSlotId (3),
74
75 -- no card is present in given slot
76 cardNotPresent (100),
77 -- card is present but unresponsive in given slot
78 cardUnresponsive (101),
79 -- unrecoverable transmission errors detected
80 cardTransmissionError (102),
81 ...
82}
83
84-- Slot number within a SIM bank or a client.
85SlotNumber ::= INTEGER(0..1023)
86
87-- Slot identity on client (modem) side
88ClientSlot ::= SEQUENCE {
89 clientId ClientId,
90 slotNr SlotNumber,
91 ...
92}
93
94-- Slot identity on SIM bank side
95BankSlot ::= SEQUENCE {
96 bankId BankId,
97 slotNr SlotNumber,
98 ...
99}
100
101ATR ::= OCTET STRING (SIZE (1..55))
102
103-- flags related to a TPDU in either of the two directions
104TpduFlags ::= SEQUENCE {
105 -- indicates a TPDU header is present in this message
106 tpduHeaderPresent BOOLEAN,
107 -- indicates last part of transmission in this direction
108 finalPart BOOLEAN,
109 -- indicates a PB is present and we should continue with TX
110 procByteContinueTx BOOLEAN,
111 -- indicates a PB is present and we should continue with RX
112 procByteContinueRx BOOLEAN,
113 ...
114}
115
116--- physical state of a given slot
117SlotPhysStatus ::= SEQUENCE {
118 -- is RST activated by the modem?
119 resetActive [0] BOOLEAN,
120 -- is VCC applied by the modem?
121 vccPresent [1] BOOLEAN OPTIONAL,
122 -- is CLK applied by the modem?
123 clkActive [2] BOOLEAN OPTIONAL, -- not all hardware supports this
124 -- is card presence signalled to the modem?
125 cardPresent [3] BOOLEAN OPTIONAL,
126 ...
127}
128
129----------------------------------------------------------------------
130-- Messages
131----------------------------------------------------------------------
132
133
134-- SIM Bank connects to central server
135ConnectBankReq ::= SEQUENCE {
136 -- identity of the bank that is connecting to the server
137 identity ComponentIdentity,
138 -- bank number, pre-configured on bank side
139 bankId BankId,
140 numberOfSlots SlotNumber,
141 ...
142}
143ConnectBankRes ::= SEQUENCE {
144 -- identity of the server to which the bank is connecting
145 identity ComponentIdentity,
146 result ResultCode,
147 ...
148}
149
150ConnectClientReq ::= SEQUENCE {
151 -- identity of the bank that is connecting to the server
152 identity ComponentIdentity,
153 ...
154}
155ConnectClientRes ::= SEQUENCE {
156 -- identity of the bnak to which the client is connecting
157 identity ComponentIdentity,
158 result ResultCode,
159 ...
160}
161
162-- create a mapping between a given Bank:Slot <-> Client:Slot
163CreateMappingReq ::= SEQUENCE {
164 client ClientSlot,
165 bank BankSlot,
166 ...
167}
168CreateMappingRes ::= SEQUENCE {
169 result ResultCode,
170 ...
171}
172
173-- remove a mapping between a given Bank:Slot <-> Client:Slot
174RemoveMappingReq ::= SEQUENCE {
175 client ClientSlot,
176 bank BankSlot,
177 ...
178}
179RemoveMappingRes ::= SEQUENCE {
180 result ResultCode,
181 ...
182}
183
184ConfigClientReq ::= SEQUENCE {
185 -- server-allocated assignment of a client ID
186 clientId ClientId,
187 -- bank to which the client shall connect
188 bankd IpPort,
189 ...
190}
191ConfigClientRes ::= SEQUENCE {
192 result ResultCode,
193 ...
194}
195
196-- configure the ATR which the card emulator (client) shall send to the modem
197SetAtrReq ::= SEQUENCE {
198 slot ClientSlot,
199 atr ATR,
200 ...
201}
202SetAtrRes ::= SEQUENCE {
203 result ResultCode,
204 ...
205}
206
207-- TPDU in Modem -> Card direction
208TpduModemToCard ::= SEQUENCE {
209 -- we include fully-qualified bank and client slots for easier debugging
210 fromClientSlot ClientSlot,
211 toBankSlot BankSlot,
212 flags TpduFlags,
213 data OCTET STRING,
214 ...
215}
216
217-- TPDU in Card -> Modem direction
218TpduCardToModem ::= SEQUENCE {
219 -- we include fully-qualified bank and client slots for easier debugging
220 fromBankSlot BankSlot,
221 toClientSlot ClientSlot,
222 flags TpduFlags,
223 data OCTET STRING,
224 ...
225}
226
227-- indciation about the current status of a client (modem side)
228ClientSlotStatusInd ::= SEQUENCE {
229 fromClientSlot ClientSlot,
230 toBankSlot BankSlot,
231 slotPhysStatus SlotPhysStatus,
232 ...
233}
234
235-- indciation about the current status of a bank (modem side)
236BankSlotStatusInd ::= SEQUENCE {
237 fromBankSlot BankSlot,
238 toClientSlot ClientSlot,
239 slotPhysStatus SlotPhysStatus,
240 ...
241}
242
243----------------------------------------------------------------------
244-- PDU
245----------------------------------------------------------------------
246
247RsproPDUchoice ::= CHOICE {
248 -- configuration + management
249 connectBankReq [0] ConnectBankReq,
250 connectBankRes [1] ConnectBankRes,
251 connectClientReq [2] ConnectClientReq,
252 connectClientRes [3] ConnectClientRes,
253 createMappingReq [4] CreateMappingReq,
254 createMappingRes [5] CreateMappingRes,
255 removeMappingReq [6] RemoveMappingReq,
256 removeMappingRes [7] RemoveMappingRes,
257 configClientReq [8] ConfigClientReq,
258 configClientRes [9] ConfigClientRes,
259 -- APDUs etc.
260 setAtrReq [10] SetAtrReq,
261 setAtrRes [11] SetAtrRes,
262 tpduModemToCard [12] TpduModemToCard,
263 tpduCardToModem [13] TpduCardToModem,
264 clientSlotStatusInd [14] ClientSlotStatusInd,
265 bankSlotStatusInd [15] BankSlotStatusInd,
266 ...
267}
268
269RsproPDU ::= SEQUENCE {
270 version [0] INTEGER(0..32) DEFAULT 1,
271 tag [1] OperationTag,
272 msg [2] RsproPDUchoice
273}
274
275END