Hello,
I was walking through trac while I came across this file: http://bb.osmocom.org/trac/browser/src/host/layer23/src/common/sim.c
I see here: 183 /* send APDU to card reader */ 184 static int sim_apdu_send(struct osmocom_ms *ms, uint8_t *data, uint16_t length) 185 { 186 LOGP(DSIM, LOGL_INFO, "sending APDU (class 0x%02x, ins 0x%02x)\n", 187 data[0], data[1]); 188 l1ctl_tx_sim_req(ms, data, length); 189 return 0; 190 }
ohoh, that's hardcoded.
If we would like to have a software SIM, a SIM in a card reader on the PC, or a real sim in the MS, I think this would this be the correct place to plug a modular sim implementation.
I mean something that looks like:
struct osmocom_sim_ops { int (*sim_apdu_init)(.....); int (*sim_apdu_fini)(.....); void (*sim_op_reset)(.....); void (*sim_apdu_send)(.....); void (*sim_response_callback)(.....); };
void ms_register_sim_driver(struct osmocom_ms *ms, struct osmocom_sim_ops *ops);
this could be a part of struct osmocom_ms.
I would be easy to have 3 implementations: -sim in the mobile, using the current calls 'l1ctl_tx_sim_req' 'l1ctl_tx_sim_conf' -sim in PCSC using pcsclite or winscard, and a command-line option to select the reader (by index, by name, or first reader with a card inside for simple setups) -virtual sim using pure software
What do you think about this?
Regards Sebastien