Module: Smartcard::PCSC::FFILib

Extended by:
FFI::Library
Defined in:
lib/smartcard/pcsc/ffi_lib.rb,
lib/smartcard/pcsc/ffi_autogen.rb,
lib/smartcard/pcsc/ffi_structs.rb,
lib/smartcard/pcsc/ffi_functions.rb

Overview

FFI to the native PC/SC libraries.

Defined Under Namespace

Modules: Consts Classes: IoRequest, ReaderStateQuery, WordPtr

Constant Summary

Status =

Error codes returned by the PCSC functions.

enum [
  :not_transacted, Consts::SCARD_E_NOT_TRANSACTED,
  :file_not_found, Consts::SCARD_E_FILE_NOT_FOUND,
  :write_too_many, Consts::SCARD_E_WRITE_TOO_MANY,
  :no_readers_available, Consts::SCARD_E_NO_READERS_AVAILABLE,
  :not_ready, Consts::SCARD_E_NOT_READY,
  :reader_unavailable, Consts::SCARD_E_READER_UNAVAILABLE,
  :server_too_busy, Consts::SCARD_E_SERVER_TOO_BUSY,
  :removed_card, Consts::SCARD_W_REMOVED_CARD,
  :security_violation, Consts::SCARD_W_SECURITY_VIOLATION,
  :invalid_parameter, Consts::SCARD_E_INVALID_PARAMETER,
  :no_memory, Consts::SCARD_E_NO_MEMORY,
  :timeout, Consts::SCARD_E_TIMEOUT,
  :eof, Consts::SCARD_W_EOF,
  :sharing_violation, Consts::SCARD_E_SHARING_VIOLATION,
  :system_cancelled, Consts::SCARD_E_SYSTEM_CANCELLED,
  :invalid_atr, Consts::SCARD_E_INVALID_ATR,
  :dir_not_found, Consts::SCARD_E_DIR_NOT_FOUND,
  :no_access, Consts::SCARD_E_NO_ACCESS,
  :invalid_target, Consts::SCARD_E_INVALID_TARGET,
  :duplicate_reader, Consts::SCARD_E_DUPLICATE_READER,
  :no_service, Consts::SCARD_E_NO_SERVICE,
  :service_stopped, Consts::SCARD_E_SERVICE_STOPPED,
  :unsupported_feature, Consts::SCARD_E_UNSUPPORTED_FEATURE,
  :card_not_authenticated, Consts::SCARD_W_CARD_NOT_AUTHENTICATED,
  :success, Consts::SCARD_S_SUCCESS,
  :no_key_container, Consts::SCARD_E_NO_KEY_CONTAINER,
  :cancelled_by_user, Consts::SCARD_W_CANCELLED_BY_USER,
  :cant_dispose, Consts::SCARD_E_CANT_DISPOSE,
  :reader_unsupported, Consts::SCARD_E_READER_UNSUPPORTED,
  :card_unsupported, Consts::SCARD_E_CARD_UNSUPPORTED,
  :chv_blocked, Consts::SCARD_W_CHV_BLOCKED,
  :cancelled, Consts::SCARD_E_CANCELLED,
  :unknown_reader, Consts::SCARD_E_UNKNOWN_READER,
  :proto_mismatch, Consts::SCARD_E_PROTO_MISMATCH,
  :unexpected, Consts::SCARD_E_UNEXPECTED,
  :certificate_unavailable, Consts::SCARD_E_CERTIFICATE_UNAVAILABLE,
  :invalid_handle, Consts::SCARD_E_INVALID_HANDLE,
  :insufficient_buffer, Consts::SCARD_E_INSUFFICIENT_BUFFER,
  :no_smartcard, Consts::SCARD_E_NO_SMARTCARD,
  :invalid_value, Consts::SCARD_E_INVALID_VALUE,
  :icc_installation, Consts::SCARD_E_ICC_INSTALLATION,
  :icc_createorder, Consts::SCARD_E_ICC_CREATEORDER,
  :no_file, Consts::SCARD_E_NO_FILE,
  :bad_seek, Consts::SCARD_E_BAD_SEEK,
  :unknown_res_mng, Consts::SCARD_E_UNKNOWN_RES_MNG,
  :comm_data_lost, Consts::SCARD_E_COMM_DATA_LOST,
  :unpowered_card, Consts::SCARD_W_UNPOWERED_CARD,
  :reset_card, Consts::SCARD_W_RESET_CARD,
  :unknown_card, Consts::SCARD_E_UNKNOWN_CARD,
  :pci_too_small, Consts::SCARD_E_PCI_TOO_SMALL,
  :no_dir, Consts::SCARD_E_NO_DIR,
  :no_such_certificate, Consts::SCARD_E_NO_SUCH_CERTIFICATE,
  :wrong_chv, Consts::SCARD_W_WRONG_CHV,
  :invalid_chv, Consts::SCARD_E_INVALID_CHV,
  :unsupported_card, Consts::SCARD_W_UNSUPPORTED_CARD,
  :unresponsive_card, Consts::SCARD_W_UNRESPONSIVE_CARD,
]
Scope =

Values for the context's scope.

enum [
  :user, Consts::SCARD_SCOPE_USER,
  :system, Consts::SCARD_SCOPE_SYSTEM,
  :terminal, Consts::SCARD_SCOPE_TERMINAL,
]
Protocol =

Smart-card communication protocols.

enum [
  :raw, Consts::SCARD_PROTOCOL_RAW,
  :t0, Consts::SCARD_PROTOCOL_T0,
  :t1, Consts::SCARD_PROTOCOL_T1,
  :any, Consts::SCARD_PROTOCOL_ANY,
  :t15, Consts::SCARD_PROTOCOL_T15,
  :undefined, Consts::SCARD_PROTOCOL_UNDEFINED,
  :unset, Consts::SCARD_PROTOCOL_UNSET,
]
Share =

Smart-card sharing modes.

enum [
  :exclusive, Consts::SCARD_SHARE_EXCLUSIVE,
  :shared, Consts::SCARD_SHARE_SHARED,
  :direct, Consts::SCARD_SHARE_DIRECT,
]
Disposition =

Smart-card dispositions.

enum [
  :leave, Consts::SCARD_LEAVE_CARD,
  :reset, Consts::SCARD_RESET_CARD,
  :eject, Consts::SCARD_EJECT_CARD,
  :unpower, Consts::SCARD_UNPOWER_CARD,
]
Attribute =

Smart-card reader attributes.

enum [
  :user_auth_input_device, Consts::SCARD_ATTR_USER_AUTH_INPUT_DEVICE,
  :current_w, Consts::SCARD_ATTR_CURRENT_W,
  :icc_type_per_atr, Consts::SCARD_ATTR_ICC_TYPE_PER_ATR,
  :esc_cancel, Consts::SCARD_ATTR_ESC_CANCEL,
  :max_clk, Consts::SCARD_ATTR_MAX_CLK,
  :channel_id, Consts::SCARD_ATTR_CHANNEL_ID,
  :current_protocol_type, Consts::SCARD_ATTR_CURRENT_PROTOCOL_TYPE,
  :current_n, Consts::SCARD_ATTR_CURRENT_N,
  :current_bwt, Consts::SCARD_ATTR_CURRENT_BWT,
  :extended_bwt, Consts::SCARD_ATTR_EXTENDED_BWT,
  :icc_interface_status, Consts::SCARD_ATTR_ICC_INTERFACE_STATUS,
  :esc_authrequest, Consts::SCARD_ATTR_ESC_AUTHREQUEST,
  :supress_t1_ifs_request, Consts::SCARD_ATTR_SUPRESS_T1_IFS_REQUEST,
  :max_ifsd, Consts::SCARD_ATTR_MAX_IFSD,
  :current_d, Consts::SCARD_ATTR_CURRENT_D,
  :current_cwt, Consts::SCARD_ATTR_CURRENT_CWT,
  :current_io_state, Consts::SCARD_ATTR_CURRENT_IO_STATE,
  :device_friendly_name_a, Consts::SCARD_ATTR_DEVICE_FRIENDLY_NAME_A,
  :sync_protocol_types, Consts::SCARD_ATTR_SYNC_PROTOCOL_TYPES,
  :user_to_card_auth_device, Consts::SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE,
  :maxinput, Consts::SCARD_ATTR_MAXINPUT,
  :device_friendly_name_w, Consts::SCARD_ATTR_DEVICE_FRIENDLY_NAME_W,
  :vendor_ifd_type, Consts::SCARD_ATTR_VENDOR_IFD_TYPE,
  :vendor_ifd_version, Consts::SCARD_ATTR_VENDOR_IFD_VERSION,
  :current_clk, Consts::SCARD_ATTR_CURRENT_CLK,
  :current_f, Consts::SCARD_ATTR_CURRENT_F,
  :icc_presence, Consts::SCARD_ATTR_ICC_PRESENCE,
  :device_unit, Consts::SCARD_ATTR_DEVICE_UNIT,
  :vendor_ifd_serial_no, Consts::SCARD_ATTR_VENDOR_IFD_SERIAL_NO,
  :characteristics, Consts::SCARD_ATTR_CHARACTERISTICS,
  :current_ebc_encoding, Consts::SCARD_ATTR_CURRENT_EBC_ENCODING,
  :device_in_use, Consts::SCARD_ATTR_DEVICE_IN_USE,
  :device_system_name, Consts::SCARD_ATTR_DEVICE_SYSTEM_NAME,
  :vendor_name, Consts::SCARD_ATTR_VENDOR_NAME,
  :default_data_rate, Consts::SCARD_ATTR_DEFAULT_DATA_RATE,
  :atr_string, Consts::SCARD_ATTR_ATR_STRING,
  :max_data_rate, Consts::SCARD_ATTR_MAX_DATA_RATE,
  :device_system_name_a, Consts::SCARD_ATTR_DEVICE_SYSTEM_NAME_A,
  :device_system_name_w, Consts::SCARD_ATTR_DEVICE_SYSTEM_NAME_W,
  :async_protocol_types, Consts::SCARD_ATTR_ASYNC_PROTOCOL_TYPES,
  :default_clk, Consts::SCARD_ATTR_DEFAULT_CLK,
  :power_mgmt_support, Consts::SCARD_ATTR_POWER_MGMT_SUPPORT,
  :current_ifsc, Consts::SCARD_ATTR_CURRENT_IFSC,
  :current_ifsd, Consts::SCARD_ATTR_CURRENT_IFSD,
  :esc_reset, Consts::SCARD_ATTR_ESC_RESET,
  :device_friendly_name, Consts::SCARD_ATTR_DEVICE_FRIENDLY_NAME,
]
CardState =

Smart-card states.

enum [
  :unknown, Consts::SCARD_STATE_UNKNOWN,
  :exclusive, Consts::SCARD_STATE_EXCLUSIVE,
  :changed, Consts::SCARD_STATE_CHANGED,
  :empty, Consts::SCARD_STATE_EMPTY,
  :unpowered, Consts::SCARD_STATE_UNPOWERED,
  :inuse, Consts::SCARD_STATE_INUSE,
  :unaware, Consts::SCARD_STATE_UNAWARE,
  :atrmatch, Consts::SCARD_STATE_ATRMATCH,
  :mute, Consts::SCARD_STATE_MUTE,
  :ignore, Consts::SCARD_STATE_IGNORE,
  :unavailable, Consts::SCARD_STATE_UNAVAILABLE,
  :present, Consts::SCARD_STATE_PRESENT,
]
State =

Smart-card reader states.

enum [
  :present, Consts::SCARD_PRESENT,
  :swallowed, Consts::SCARD_SWALLOWED,
  :absent, Consts::SCARD_ABSENT,
  :specific, Consts::SCARD_SPECIFIC,
  :unknown, Consts::SCARD_UNKNOWN,
  :autoallocate, Consts::SCARD_AUTOALLOCATE,
  :powered, Consts::SCARD_POWERED,
  :negotiable, Consts::SCARD_NEGOTIABLE,
]
Word =

64-bit MacOS is different from 64-bit Linux.

:ulong
PROTOCOLS =

Protocol enum members, indexed by their numeric value.

Protocol.to_h.invert