blob: 45ef70c9c2c3f6e5b2261f2ea230f159b29957b9 [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
Harald Weltef0614df2018-08-16 14:45:23 +0200134-- BANKD->SERVER: SIM Bank connects to central server
Harald Welte3aa901d2018-08-13 18:32:36 +0200135ConnectBankReq ::= 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
Harald Weltef0614df2018-08-16 14:45:23 +0200150-- CLIENT->SERVER or CLIENT->BANKD
Harald Welte3aa901d2018-08-13 18:32:36 +0200151ConnectClientReq ::= SEQUENCE {
Harald Weltef0614df2018-08-16 14:45:23 +0200152 -- identity of the client that is connecting to the server/bankd
Harald Welte3aa901d2018-08-13 18:32:36 +0200153 identity ComponentIdentity,
Harald Welte371d0262018-08-16 15:23:58 +0200154 clientSlot ClientSlot OPTIONAL, -- old identity, if any
Harald Welte3aa901d2018-08-13 18:32:36 +0200155 ...
156}
157ConnectClientRes ::= SEQUENCE {
Harald Weltef0614df2018-08-16 14:45:23 +0200158 -- identity of the bankd/server to which the client is connecting
Harald Welte3aa901d2018-08-13 18:32:36 +0200159 identity ComponentIdentity,
160 result ResultCode,
161 ...
162}
163
Harald Weltef0614df2018-08-16 14:45:23 +0200164-- SERVER->BANKD: create a mapping between a given Bank:Slot <-> Client:Slot
Harald Welte3aa901d2018-08-13 18:32:36 +0200165CreateMappingReq ::= SEQUENCE {
166 client ClientSlot,
167 bank BankSlot,
168 ...
169}
170CreateMappingRes ::= SEQUENCE {
171 result ResultCode,
172 ...
173}
174
Harald Weltef0614df2018-08-16 14:45:23 +0200175-- SERVER->BANKD: remove a mapping between a given Bank:Slot <-> Client:Slot
Harald Welte3aa901d2018-08-13 18:32:36 +0200176RemoveMappingReq ::= SEQUENCE {
177 client ClientSlot,
178 bank BankSlot,
179 ...
180}
181RemoveMappingRes ::= SEQUENCE {
182 result ResultCode,
183 ...
184}
185
Harald Weltef0614df2018-08-16 14:45:23 +0200186-- SERVER->CLIENT: set configuration (client ID and BANK IP/Port)
Harald Welte3aa901d2018-08-13 18:32:36 +0200187ConfigClientReq ::= SEQUENCE {
188 -- server-allocated assignment of a client ID
Harald Welte371d0262018-08-16 15:23:58 +0200189 clientSlot ClientSlot,
Harald Welte3aa901d2018-08-13 18:32:36 +0200190 -- bank to which the client shall connect
191 bankd IpPort,
192 ...
193}
194ConfigClientRes ::= SEQUENCE {
195 result ResultCode,
196 ...
197}
198
Harald Weltef0614df2018-08-16 14:45:23 +0200199-- BANKD->CLIENT: configure the ATR which the card emulator (client) shall send to the modem
Harald Welte3aa901d2018-08-13 18:32:36 +0200200SetAtrReq ::= SEQUENCE {
201 slot ClientSlot,
202 atr ATR,
203 ...
204}
205SetAtrRes ::= SEQUENCE {
206 result ResultCode,
207 ...
208}
209
Harald Weltef0614df2018-08-16 14:45:23 +0200210-- CLIENT->BANKD: TPDU in Modem -> Card direction
Harald Welte3aa901d2018-08-13 18:32:36 +0200211TpduModemToCard ::= SEQUENCE {
212 -- we include fully-qualified bank and client slots for easier debugging
213 fromClientSlot ClientSlot,
214 toBankSlot BankSlot,
215 flags TpduFlags,
216 data OCTET STRING,
217 ...
218}
219
Harald Weltef0614df2018-08-16 14:45:23 +0200220-- BANKD->CLIENT: TPDU in Card -> Modem direction
Harald Welte3aa901d2018-08-13 18:32:36 +0200221TpduCardToModem ::= SEQUENCE {
222 -- we include fully-qualified bank and client slots for easier debugging
223 fromBankSlot BankSlot,
224 toClientSlot ClientSlot,
225 flags TpduFlags,
226 data OCTET STRING,
227 ...
228}
229
Harald Weltef0614df2018-08-16 14:45:23 +0200230-- CLIENT->BANKD: indciation about the current status of a client (modem side)
Harald Welte3aa901d2018-08-13 18:32:36 +0200231ClientSlotStatusInd ::= SEQUENCE {
232 fromClientSlot ClientSlot,
233 toBankSlot BankSlot,
234 slotPhysStatus SlotPhysStatus,
235 ...
236}
237
Harald Weltef0614df2018-08-16 14:45:23 +0200238-- BANKD->CLIENT: indciation about the current status of a bank (modem side)
Harald Welte3aa901d2018-08-13 18:32:36 +0200239BankSlotStatusInd ::= SEQUENCE {
240 fromBankSlot BankSlot,
241 toClientSlot ClientSlot,
242 slotPhysStatus SlotPhysStatus,
243 ...
244}
245
246----------------------------------------------------------------------
247-- PDU
248----------------------------------------------------------------------
249
250RsproPDUchoice ::= CHOICE {
251 -- configuration + management
252 connectBankReq [0] ConnectBankReq,
253 connectBankRes [1] ConnectBankRes,
254 connectClientReq [2] ConnectClientReq,
255 connectClientRes [3] ConnectClientRes,
256 createMappingReq [4] CreateMappingReq,
257 createMappingRes [5] CreateMappingRes,
258 removeMappingReq [6] RemoveMappingReq,
259 removeMappingRes [7] RemoveMappingRes,
260 configClientReq [8] ConfigClientReq,
261 configClientRes [9] ConfigClientRes,
262 -- APDUs etc.
263 setAtrReq [10] SetAtrReq,
264 setAtrRes [11] SetAtrRes,
265 tpduModemToCard [12] TpduModemToCard,
266 tpduCardToModem [13] TpduCardToModem,
267 clientSlotStatusInd [14] ClientSlotStatusInd,
268 bankSlotStatusInd [15] BankSlotStatusInd,
269 ...
270}
271
272RsproPDU ::= SEQUENCE {
Harald Welte293478c2018-09-24 14:49:41 +0200273 version [0] INTEGER(0..32),
Harald Welte3aa901d2018-08-13 18:32:36 +0200274 tag [1] OperationTag,
275 msg [2] RsproPDUchoice
276}
277
278END