thinking about the sim

Sébastien Lorquet squalyl at
Mon Jan 31 16:25:32 UTC 2011


I was walking through trac while I came across this file:

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'
-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?


More information about the baseband-devel mailing list