Loading...
Searching...
No Matches
reader.c File Reference

Card reader abstraction for libosmosim. More...

`#include <errno.h>`
`#include <stdint.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <stdio.h>`
`#include <netinet/in.h>`
`#include <osmocom/core/msgb.h>`
`#include <osmocom/sim/sim.h>`
`#include "config.h"`
`#include "sim_int.h"`

## Functions

static int | get_sw (struct msgb *resp)
static int | transceive_apdu_t0 (struct osim_card_hdl *st, struct msgb *amsg)
int | osim_transceive_apdu (struct osim_chan_hdl *st, struct msgb *amsg)
struct osim_reader_hdl * | osim_reader_open (enum osim_reader_driver driver, int idx, const char *name, void *ctx)
struct osim_card_hdl * | osim_card_open (struct osim_reader_hdl *rh, enum osim_proto proto)
int | osim_card_reset (struct osim_card_hdl *card, bool cold_reset)
int | osim_card_close (struct osim_card_hdl *card)

## Detailed Description

Card reader abstraction for libosmosim.

## Function Documentation

## get_sw()

int get_sw | ( | struct msgb * | resp | ) |

static

References msgb_apdu_le.

Referenced by transceive_apdu_t0().

## osim_card_close()

int osim_card_close | ( | struct osim_card_hdl * | card | ) |

References osim_reader_hdl::card, osim_reader_ops::card_close, osim_reader_hdl::ops, and osim_card_hdl::reader.

## osim_card_open()

struct osim_card_hdl * osim_card_open | ( | struct osim_reader_hdl * | rh,
|  | enum osim_proto | proto )

References osim_reader_ops::card_open, osim_reader_hdl::ops, osim_card_hdl::proto, and osim_reader_hdl::proto_supported.

## osim_card_reset()

int osim_card_reset | ( | struct osim_card_hdl * | card,
|  | bool | cold_reset )

References osim_reader_hdl::card, osim_reader_ops::card_reset, osim_reader_hdl::ops, and osim_card_hdl::reader.

## osim_reader_open()

struct osim_reader_hdl * osim_reader_open | ( | enum osim_reader_driver | driver,
|  | int | idx,
|  | const char * | name,
|  | void * | ctx )

References osim_reader_hdl::ops, OSIM_PROTO_T0, OSIM_READER_DRV_PCSC, pcsc_reader_ops, osim_reader_hdl::proto_supported, and osim_reader_ops::reader_open.

## osim_transceive_apdu()

int osim_transceive_apdu | ( | struct osim_chan_hdl * | st,
|  | struct msgb * | amsg )

References osim_chan_hdl::card, OSIM_PROTO_T0, osim_card_hdl::proto, and transceive_apdu_t0().

## transceive_apdu_t0()

int transceive_apdu_t0 | ( | struct osim_card_hdl * | st,
|  | struct msgb * | amsg )

static

References APDU_CASE_1, APDU_CASE_2E, APDU_CASE_2S, APDU_CASE_3E, APDU_CASE_3S, APDU_CASE_4E, APDU_CASE_4S, get_sw(), osim_apdu_cmd_hdr::ins, msgb_apdu_case, msgb_apdu_dc, msgb_apdu_de, msgb_apdu_h, msgb_apdu_lc, msgb_apdu_le, msgb_apdu_sw, osim_reader_hdl::ops, osim_apdu_cmd_hdr::p1, osim_apdu_cmd_hdr::p2, osim_apdu_cmd_hdr::p3, osim_card_hdl::reader, sw, and osim_reader_ops::transceive.

Referenced by osim_transceive_apdu().