libosmosim  1.9.0
Osmocom SIM library
sim_int.h
Go to the documentation of this file.
1 
3 #ifndef _SIM_INT_H
4 
5 #include <osmocom/sim/sim.h>
6 
8 element_alloc(struct osim_decoded_data *dd, const char *name,
10 
11 struct osim_decoded_element *
12 element_alloc_sub(struct osim_decoded_element *ee, const char *name,
13  enum osim_element_type type, enum osim_element_repr repr);
14 
15 int default_decode(struct osim_decoded_data *dd,
16  const struct osim_file_desc *desc,
17  int len, uint8_t *data);
18 
19 void add_filedesc(struct osim_file_desc *root, const struct osim_file_desc *in, int num);
20 struct osim_file_desc *alloc_df(void *ctx, uint16_t fid, const char *name);
21 struct osim_file_desc *
23  uint16_t fid, const char *name,
24  const struct osim_file_desc *in, int num);
25 
26 struct osim_file_desc *
27 alloc_adf_with_ef(void *ctx, const uint8_t *adf_name, uint8_t adf_name_len,
28  const char *name, const struct osim_file_desc *in, int num);
29 
30 extern const struct osim_reader_ops pcsc_reader_ops;
31 
33 
34 struct osim_card_app_profile *osim_aprof_usim(void *ctx);
35 struct osim_card_app_profile *osim_aprof_isim(void *ctx);
36 struct osim_card_app_profile *osim_aprof_hpsim(void *ctx);
37 
38 #endif
osim_apdu_cmd_hdr::ins
uint8_t ins
INSTRUCTION byte.
Definition: sim.h:45
osim_reader_ops::card_close
int(* card_close)(struct osim_card_hdl *card)
Definition: sim.h:378
pcsc_reader_state::pioSendPci
const SCARD_IO_REQUEST * pioSendPci
Definition: reader_pcsc.c:47
osim_element_type
osim_element_type
Definition: sim.h:95
pcsc_get_atr
static int pcsc_get_atr(struct osim_card_hdl *card)
Definition: reader_pcsc.c:52
osim_reader_hdl::card
struct osim_card_hdl * card
current card, if any
Definition: sim.h:389
osim_reader_ops
Definition: sim.h:373
osim_card_hdl::atr_len
unsigned int atr_len
Definition: sim.h:423
msgb_apdu_sw
#define msgb_apdu_sw(__x)
Definition: sim.h:69
PCSC_ERROR
#define PCSC_ERROR(rv, text)
Definition: reader_pcsc.c:36
osim_proto
osim_proto
Definition: sim.h:362
pcsc_card_reset
static int pcsc_card_reset(struct osim_card_hdl *card, bool cold_reset)
Definition: reader_pcsc.c:155
osim_aprof_isim
struct osim_card_app_profile * osim_aprof_isim(void *ctx)
Definition: card_fs_isim.c:90
transceive_apdu_t0
static int transceive_apdu_t0(struct osim_card_hdl *st, struct msgb *amsg)
Definition: reader.c:52
OSIM_READER_DRV_PCSC
@ OSIM_READER_DRV_PCSC
Definition: sim.h:368
osim_card_app_profile
A card application (e.g.
Definition: sim.h:298
osim_reader_ops::card_open
struct osim_card_hdl *(* card_open)(struct osim_reader_hdl *rh, enum osim_proto proto)
Definition: sim.h:376
osim_card_close
int osim_card_close(struct osim_card_hdl *card)
Definition: reader.c:284
osim_reader_hdl
Definition: sim.h:382
osim_file_desc::fid
uint16_t fid
File Identifier.
Definition: sim.h:169
pcsc_card_open
static struct osim_card_hdl * pcsc_card_open(struct osim_reader_hdl *rh, enum osim_proto proto)
Definition: reader_pcsc.c:119
osim_chan_hdl::card
struct osim_card_hdl * card
card to which this channel belongs
Definition: sim.h:430
osim_decoded_data
Decoded data for a single file, consisting of all decoded elements.
Definition: sim.h:133
osim_card_hdl::apps
struct llist_head apps
list of applications found on card
Definition: sim.h:419
add_df_with_ef
struct osim_file_desc * add_df_with_ef(struct osim_file_desc *parent, uint16_t fid, const char *name, const struct osim_file_desc *in, int num)
Definition: core.c:139
msgb_apdu_h
#define msgb_apdu_h(__x)
pointer to the command header of the APDU
Definition: sim.h:71
default_decode
int default_decode(struct osim_decoded_data *dd, const struct osim_file_desc *desc, int len, uint8_t *data)
Definition: core.c:461
osim_decoded_element::type
enum osim_element_type type
Definition: sim.h:117
osim_apdu_cmd_hdr::p1
uint8_t p1
Parameter 1 byte.
Definition: sim.h:46
osim_app_profile_register
void osim_app_profile_register(struct osim_card_app_profile *aprof)
Register an application profile.
Definition: core.c:236
alloc_df
struct osim_file_desc * alloc_df(void *ctx, uint16_t fid, const char *name)
Definition: core.c:123
msgb_apdu_de
#define msgb_apdu_de(__x)
Definition: sim.h:74
pcsc_reader_ops
const struct osim_reader_ops pcsc_reader_ops
Definition: reader_pcsc.c:202
osim_decoded_element::name
const char * name
Definition: sim.h:119
APDU_CASE_1
@ APDU_CASE_1
command header, no command data field, no response data field
Definition: sim.h:25
get_sw
static int get_sw(struct msgb *resp)
Definition: reader.c:39
osim_apdu_cmd_hdr::p2
uint8_t p2
Parameter 2 byte.
Definition: sim.h:47
APDU_CASE_4E
@ APDU_CASE_4E
command header, command data field (extended), response data field (extended)
Definition: sim.h:31
osim_reader_hdl::proto_supported
uint32_t proto_supported
Definition: sim.h:386
osim_file_desc
Definition: sim.h:161
osim_apdu_cmd_hdr::p3
uint8_t p3
Parameter 3 byte, used for TPDU by T=0.
Definition: sim.h:48
APDU_CASE_4S
@ APDU_CASE_4S
command header, command data field (short), response data field (short)
Definition: sim.h:30
osim_aprof_usim
struct osim_card_app_profile * osim_aprof_usim(void *ctx)
Definition: card_fs_usim.c:412
sw
uint16_t sw
status word, composed of SW1 and SW2 bytes
Definition: sim.h:5
osim_reader_open
struct osim_reader_hdl * osim_reader_open(enum osim_reader_driver driver, int idx, const char *name, void *ctx)
Definition: reader.c:234
APDU_CASE_2E
@ APDU_CASE_2E
command header, no command data field, response data field (extended)
Definition: sim.h:27
osim_reader_ops::card_reset
int(* card_reset)(struct osim_card_hdl *card, bool cold_reset)
Definition: sim.h:377
add_filedesc
void add_filedesc(struct osim_file_desc *root, const struct osim_file_desc *in, int num)
Definition: core.c:113
pcsc_reader_state
Definition: reader_pcsc.c:43
APDU_CASE_2S
@ APDU_CASE_2S
command header, no command data field, response data field (short)
Definition: sim.h:26
osim_chan_hdl
Definition: sim.h:426
osim_card_hdl
Definition: sim.h:405
osim_reader_driver
osim_reader_driver
Definition: sim.h:367
osim_decoded_element
A single decoded element inside a file.
Definition: sim.h:114
osim_element_repr
osim_element_repr
Definition: sim.h:107
pcsc_reader_state::dwActiveProtocol
DWORD dwActiveProtocol
Definition: reader_pcsc.c:46
pcsc_reader_ops
const struct osim_reader_ops pcsc_reader_ops
Definition: reader_pcsc.c:202
osim_card_hdl::proto
enum osim_proto proto
card protocol
Definition: sim.h:413
pcsc_transceive
static int pcsc_transceive(struct osim_reader_hdl *rh, struct msgb *msg)
Definition: reader_pcsc.c:184
pcsc_reader_open
static struct osim_reader_hdl * pcsc_reader_open(int num, const char *id, void *ctx)
Definition: reader_pcsc.c:73
osim_card_hdl::channels
struct llist_head channels
list of channels for this card
Definition: sim.h:416
osim_reader_ops::reader_open
struct osim_reader_hdl *(* reader_open)(int idx, const char *name, void *ctx)
Definition: sim.h:375
sim.h
osim_card_hdl::reader
struct osim_reader_hdl * reader
reader through which card is accessed
Definition: sim.h:409
pcsc_reader_state::pioRecvPci
SCARD_IO_REQUEST pioRecvPci
Definition: reader_pcsc.c:48
OSIM_PROTO_T0
@ OSIM_PROTO_T0
Definition: sim.h:363
osim_reader_hdl::ops
const struct osim_reader_ops * ops
Definition: sim.h:385
APDU_CASE_3S
@ APDU_CASE_3S
command header, command data field (short), no response data field
Definition: sim.h:28
osim_aprof_hpsim
struct osim_card_app_profile * osim_aprof_hpsim(void *ctx)
Definition: card_fs_hpsim.c:55
osim_reader_hdl::priv
void * priv
Definition: sim.h:387
element_alloc_sub
struct osim_decoded_element * element_alloc_sub(struct osim_decoded_element *ee, const char *name, enum osim_element_type type, enum osim_element_repr repr)
Definition: core.c:98
pcsc_reader_state::hContext
SCARDCONTEXT hContext
Definition: reader_pcsc.c:44
osim_card_open
struct osim_card_hdl * osim_card_open(struct osim_reader_hdl *rh, enum osim_proto proto)
Definition: reader.c:261
osim_reader_ops::name
const char * name
Definition: sim.h:374
pcsc_reader_state::name
char * name
Definition: reader_pcsc.c:49
APDU_CASE_3E
@ APDU_CASE_3E
command header, command data field (extended), no response data field
Definition: sim.h:29
msgb_apdu_case
#define msgb_apdu_case(__x)
status word from msgb->cb
Definition: sim.h:66
pcsc_card_close
static int pcsc_card_close(struct osim_card_hdl *card)
Definition: reader_pcsc.c:170
pcsc_reader_state::hCard
SCARDHANDLE hCard
Definition: reader_pcsc.c:45
osim_card_reset
int osim_card_reset(struct osim_card_hdl *card, bool cold_reset)
Definition: reader.c:277
osim_file_desc::parent
struct osim_file_desc * parent
parent DF
Definition: sim.h:164
osim_chan_hdl::list
struct llist_head list
linked to card->channels
Definition: sim.h:428
osim_card_hdl::atr
uint8_t atr[OSIM_MAX_ATR_LEN]
ATR (Answer To Reset) of the card.
Definition: sim.h:422
osim_apdu_cmd_hdr
APDU/TPDU command header.
Definition: sim.h:43
element_alloc
struct osim_decoded_element * element_alloc(struct osim_decoded_data *dd, const char *name, enum osim_element_type type, enum osim_element_repr repr)
Definition: core.c:83
msgb_apdu_le
#define msgb_apdu_le(__x)
Definition: sim.h:68
msgb_apdu_dc
#define msgb_apdu_dc(__x)
Definition: sim.h:73
msgb_apdu_lc
#define msgb_apdu_lc(__x)
Definition: sim.h:67
sim_int.h
alloc_adf_with_ef
struct osim_file_desc * alloc_adf_with_ef(void *ctx, const uint8_t *adf_name, uint8_t adf_name_len, const char *name, const struct osim_file_desc *in, int num)
Definition: core.c:156
osim_transceive_apdu
int osim_transceive_apdu(struct osim_chan_hdl *st, struct msgb *amsg)
Definition: reader.c:224
osim_reader_ops::transceive
int(* transceive)(struct osim_reader_hdl *rh, struct msgb *msg)
Definition: sim.h:379