src/sim.c File Reference

#include <ccid.h>
#include <sim.h>
#include "sim-internal.h"
Include dependency graph for sim.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define dprintf(...)   do {} while(0)

Functions

static void chv_byte (uint8_t b, const char *label)
static int set_df_fci (struct _sim *s, const uint8_t *fci, size_t fci_len)
static void access_nibble (uint8_t n, const char *label)
static int set_ef_fci (struct _sim *s, const uint8_t *fci, size_t fci_len)
static int set_fci (struct _sim *s, uint16_t id)
static int _sim_select (struct _sim *s, uint16_t id)
static const uint8_t * _sim_read_binary (struct _sim *s, size_t *len)
static const uint8_t * _sim_read_record (struct _sim *s, uint8_t rec, size_t *len)
static void read_iccid (struct _sim *s)
static void read_imsi (struct _sim *s)
int sim_sms_save (sim_t s, const char *fn)
int sim_sms_restore (sim_t s, const char *fn)
sim_t sim_new (chipcard_t cc)
void sim_free (sim_t s)

Define Documentation

#define dprintf ( ...   )     do {} while(0)

Definition at line 14 of file sim.c.

Referenced by access_nibble(), chv_byte(), set_df_fci(), set_ef_fci(), and set_fci().


Function Documentation

static const uint8_t* _sim_read_binary ( struct _sim s,
size_t *  len 
) [static]

Definition at line 200 of file sim.c.

References _apdu_read_binary(), ef_fci::e_size, _sim::s_ef_fci, _sim::s_xfr, and xfr_rx_data().

Referenced by read_iccid(), and read_imsi().

Here is the call graph for this function:

Here is the caller graph for this function:

static const uint8_t* _sim_read_record ( struct _sim s,
uint8_t  rec,
size_t *  len 
) [static]

Definition at line 208 of file sim.c.

References _apdu_read_record(), ef_fci::e_reclen, _sim::s_ef_fci, _sim::s_xfr, and xfr_rx_data().

Referenced by sim_sms_save().

Here is the call graph for this function:

Here is the caller graph for this function:

static int _sim_select ( struct _sim s,
uint16_t  id 
) [static]

Definition at line 192 of file sim.c.

References _apdu_select(), and set_fci().

Referenced by read_iccid(), read_imsi(), sim_new(), and sim_sms_save().

Here is the call graph for this function:

Here is the caller graph for this function:

static void access_nibble ( uint8_t  n,
const char *  label 
) [static]

Definition at line 75 of file sim.c.

References dprintf.

Referenced by set_ef_fci().

Here is the caller graph for this function:

static void chv_byte ( uint8_t  b,
const char *  label 
) [static]

Definition at line 17 of file sim.c.

References dprintf.

Referenced by set_df_fci().

Here is the caller graph for this function:

static void read_iccid ( struct _sim s  )  [static]

Definition at line 216 of file sim.c.

References _sim_read_binary(), _sim_select(), and SIM_EF_ICCID.

Referenced by sim_new().

Here is the call graph for this function:

Here is the caller graph for this function:

static void read_imsi ( struct _sim s  )  [static]

Definition at line 235 of file sim.c.

References _sim_read_binary(), _sim_select(), SIM_DF_GSM, and SIM_EF_IMSI.

Referenced by sim_new().

Here is the call graph for this function:

Here is the caller graph for this function:

static int set_df_fci ( struct _sim s,
const uint8_t *  fci,
size_t  fci_len 
) [static]

Definition at line 24 of file sim.c.

References chv_byte(), df_fci::d_free, df_fci::d_id, dprintf, df_gsm::g_chv, df_gsm::g_chv1, df_gsm::g_chv1u, df_gsm::g_chv2, df_gsm::g_chv2u, df_gsm::g_num_df, df_gsm::g_num_ef, hex_dump(), _sim::s_df, _sim::s_df_fci, _sim::s_df_gsm, _sim::s_ef_fci, and sys_be16.

Referenced by set_fci().

Here is the call graph for this function:

Here is the caller graph for this function:

static int set_ef_fci ( struct _sim s,
const uint8_t *  fci,
size_t  fci_len 
) [static]

Definition at line 100 of file sim.c.

References access_nibble(), dprintf, ef_fci::e_access, ef_fci::e_id, ef_fci::e_increase, ef_fci::e_reclen, ef_fci::e_size, ef_fci::e_status, ef_fci::e_struct, EF_CYCLIC, EF_FCI_MIN_OPT_LEN, EF_LINEAR, EF_TRANSPARENT, hex_dump(), _sim::s_df, _sim::s_ef, _sim::s_ef_fci, and sys_be16.

Referenced by set_fci().

Here is the call graph for this function:

Here is the caller graph for this function:

static int set_fci ( struct _sim s,
uint16_t  id 
) [static]

Definition at line 152 of file sim.c.

References dprintf, fci::f_id, _sim::s_df, _sim::s_ef, _sim::s_ef_fci, _sim::s_xfr, set_df_fci(), set_ef_fci(), SIM_FILE_INVALID, SIM_MF, SIM_TYPE_DF, SIM_TYPE_EF, SIM_TYPE_MASK, SIM_TYPE_ROOT_EF, sys_be16, and xfr_rx_data().

Referenced by _sim_select().

Here is the call graph for this function:

Here is the caller graph for this function:

void sim_free ( sim_t  s  ) 

Definition at line 347 of file sim.c.

References chipcard_slot_off(), _sim::s_cc, _sim::s_xfr, and xfr_free().

Referenced by found_cci().

Here is the call graph for this function:

Here is the caller graph for this function:

sim_t sim_new ( chipcard_t  cc  ) 

Definition at line 308 of file sim.c.

References _sim_select(), CHIPCARD_AUTO_VOLTAGE, chipcard_slot_on(), hex_dump(), read_iccid(), read_imsi(), _sim::s_cc, _sim::s_xfr, SIM_MF, xfr_alloc(), and xfr_free().

Referenced by found_cci().

Here is the call graph for this function:

Here is the caller graph for this function:

int sim_sms_restore ( sim_t  s,
const char *  fn 
)

Definition at line 288 of file sim.c.

References _sms_decode().

Here is the call graph for this function:

int sim_sms_save ( sim_t  s,
const char *  fn 
)

Definition at line 255 of file sim.c.

References _sim_read_record(), _sim_select(), ef_fci::e_reclen, ef_fci::e_size, _sim::s_ef_fci, SIM_DF_TELECOM, and SIM_EF_SMS.

Here is the call graph for this function:

Generated on Sun Jan 2 08:36:00 2011 for ccid-utils by  doxygen 1.6.3