libosmosim 1.9.0.209-e0c63
Osmocom SIM library
reader_pcsc.c File Reference

PC/SC Card reader backend for libosmosim. More...

#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <osmocom/core/talloc.h>
#include <osmocom/sim/sim.h>
#include <wintypes.h>
#include <winscard.h>
#include "sim_int.h"

Data Structures

struct  pcsc_reader_state
 

Macros

#define PCSC_ERROR(rv, text)
 

Functions

static int pcsc_get_atr (struct osim_card_hdl *card)
 
static struct osim_reader_hdlpcsc_reader_open (int num, const char *id, void *ctx)
 
static struct osim_card_hdlpcsc_card_open (struct osim_reader_hdl *rh, enum osim_proto proto)
 
static int pcsc_card_reset (struct osim_card_hdl *card, bool cold_reset)
 
static int pcsc_card_close (struct osim_card_hdl *card)
 
static int pcsc_transceive (struct osim_reader_hdl *rh, struct msgb *msg)
 

Variables

const struct osim_reader_ops pcsc_reader_ops
 

Detailed Description

PC/SC Card reader backend for libosmosim.

Macro Definition Documentation

◆ PCSC_ERROR

#define PCSC_ERROR (   rv,
  text 
)
Value:
if (rv != SCARD_S_SUCCESS) { \
fprintf(stderr, text ": %s (0x%lX)\n", pcsc_stringify_error(rv), rv); \
goto end; \
}

Function Documentation

◆ pcsc_card_close()

static int pcsc_card_close ( struct osim_card_hdl card)
static

◆ pcsc_card_open()

◆ pcsc_card_reset()

static int pcsc_card_reset ( struct osim_card_hdl card,
bool  cold_reset 
)
static

◆ pcsc_get_atr()

◆ pcsc_reader_open()

static struct osim_reader_hdl * pcsc_reader_open ( int  num,
const char *  id,
void *  ctx 
)
static

◆ pcsc_transceive()

Variable Documentation

◆ pcsc_reader_ops

const struct osim_reader_ops pcsc_reader_ops
Initial value:
= {
.name = "PC/SC",
.reader_open = pcsc_reader_open,
.card_open = pcsc_card_open,
.card_reset = pcsc_card_reset,
.card_close = pcsc_card_close,
.transceive = pcsc_transceive,
}
static int pcsc_card_reset(struct osim_card_hdl *card, bool cold_reset)
Definition: reader_pcsc.c:155
static int pcsc_transceive(struct osim_reader_hdl *rh, struct msgb *msg)
Definition: reader_pcsc.c:184
static struct osim_reader_hdl * pcsc_reader_open(int num, const char *id, void *ctx)
Definition: reader_pcsc.c:73
static struct osim_card_hdl * pcsc_card_open(struct osim_reader_hdl *rh, enum osim_proto proto)
Definition: reader_pcsc.c:119
static int pcsc_card_close(struct osim_card_hdl *card)
Definition: reader_pcsc.c:170

Referenced by osim_reader_open().