blob: b5308875b0fe0a5176ee93736e2aa8190c29df04 [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,
154 ...
155}
156ConnectClientRes ::= SEQUENCE {
Harald Weltef0614df2018-08-16 14:45:23 +0200157 -- identity of the bankd/server to which the client is connecting
Harald Welte3aa901d2018-08-13 18:32:36 +0200158 identity ComponentIdentity,
159 result ResultCode,
160 ...
161}
162
Harald Weltef0614df2018-08-16 14:45:23 +0200163-- SERVER->BANKD: create a mapping between a given Bank:Slot <-> Client:Slot
Harald Welte3aa901d2018-08-13 18:32:36 +0200164CreateMappingReq ::= SEQUENCE {
165 client ClientSlot,
166 bank BankSlot,
167 ...
168}
169CreateMappingRes ::= SEQUENCE {
170 result ResultCode,
171 ...
172}
173
Harald Weltef0614df2018-08-16 14:45:23 +0200174-- SERVER->BANKD: remove a mapping between a given Bank:Slot <-> Client:Slot
Harald Welte3aa901d2018-08-13 18:32:36 +0200175RemoveMappingReq ::= SEQUENCE {
176 client ClientSlot,
177 bank BankSlot,
178 ...
179}
180RemoveMappingRes ::= SEQUENCE {
181 result ResultCode,
182 ...
183}
184
Harald Weltef0614df2018-08-16 14:45:23 +0200185-- SERVER->CLIENT: set configuration (client ID and BANK IP/Port)
Harald Welte3aa901d2018-08-13 18:32:36 +0200186ConfigClientReq ::= SEQUENCE {
187 -- server-allocated assignment of a client ID
188 clientId ClientId,
189 -- bank to which the client shall connect
190 bankd IpPort,
191 ...
192}
193ConfigClientRes ::= SEQUENCE {
194 result ResultCode,
195 ...
196}
197
Harald Weltef0614df2018-08-16 14:45:23 +0200198-- BANKD->CLIENT: configure the ATR which the card emulator (client) shall send to the modem
Harald Welte3aa901d2018-08-13 18:32:36 +0200199SetAtrReq ::= SEQUENCE {
200 slot ClientSlot,
201 atr ATR,
202 ...
203}
204SetAtrRes ::= SEQUENCE {
205 result ResultCode,
206 ...
207}
208
Harald Weltef0614df2018-08-16 14:45:23 +0200209-- CLIENT->BANKD: TPDU in Modem -> Card direction
Harald Welte3aa901d2018-08-13 18:32:36 +0200210TpduModemToCard ::= SEQUENCE {
211 -- we include fully-qualified bank and client slots for easier debugging
212 fromClientSlot ClientSlot,
213 toBankSlot BankSlot,
214 flags TpduFlags,
215 data OCTET STRING,
216 ...
217}
218
Harald Weltef0614df2018-08-16 14:45:23 +0200219-- BANKD->CLIENT: TPDU in Card -> Modem direction
Harald Welte3aa901d2018-08-13 18:32:36 +0200220TpduCardToModem ::= SEQUENCE {
221 -- we include fully-qualified bank and client slots for easier debugging
222 fromBankSlot BankSlot,
223 toClientSlot ClientSlot,
224 flags TpduFlags,
225 data OCTET STRING,
226 ...
227}
228
Harald Weltef0614df2018-08-16 14:45:23 +0200229-- CLIENT->BANKD: indciation about the current status of a client (modem side)
Harald Welte3aa901d2018-08-13 18:32:36 +0200230ClientSlotStatusInd ::= SEQUENCE {
231 fromClientSlot ClientSlot,
232 toBankSlot BankSlot,
233 slotPhysStatus SlotPhysStatus,
234 ...
235}
236
Harald Weltef0614df2018-08-16 14:45:23 +0200237-- BANKD->CLIENT: indciation about the current status of a bank (modem side)
Harald Welte3aa901d2018-08-13 18:32:36 +0200238BankSlotStatusInd ::= SEQUENCE {
239 fromBankSlot BankSlot,
240 toClientSlot ClientSlot,
241 slotPhysStatus SlotPhysStatus,
242 ...
243}
244
245----------------------------------------------------------------------
246-- PDU
247----------------------------------------------------------------------
248
249RsproPDUchoice ::= CHOICE {
250 -- configuration + management
251 connectBankReq [0] ConnectBankReq,
252 connectBankRes [1] ConnectBankRes,
253 connectClientReq [2] ConnectClientReq,
254 connectClientRes [3] ConnectClientRes,
255 createMappingReq [4] CreateMappingReq,
256 createMappingRes [5] CreateMappingRes,
257 removeMappingReq [6] RemoveMappingReq,
258 removeMappingRes [7] RemoveMappingRes,
259 configClientReq [8] ConfigClientReq,
260 configClientRes [9] ConfigClientRes,
261 -- APDUs etc.
262 setAtrReq [10] SetAtrReq,
263 setAtrRes [11] SetAtrRes,
264 tpduModemToCard [12] TpduModemToCard,
265 tpduCardToModem [13] TpduCardToModem,
266 clientSlotStatusInd [14] ClientSlotStatusInd,
267 bankSlotStatusInd [15] BankSlotStatusInd,
268 ...
269}
270
271RsproPDU ::= SEQUENCE {
272 version [0] INTEGER(0..32) DEFAULT 1,
273 tag [1] OperationTag,
274 msg [2] RsproPDUchoice
275}
276
277END