#include <ccid.h>
#include <ccid-spec.h>
#include <Python.h>
#include <structmember.h>
#include "py_ccid.h"
Go to the source code of this file.
Defines | |
#define | _INT_CONST(m, c) PyModule_AddIntConstant(m, #c, c) |
Functions | |
static ccidev_t | get_dev (struct cp_dev *dev) |
static PyObject * | cp_dev_bus (struct cp_dev *self, PyObject *args) |
static PyObject * | cp_dev_addr (struct cp_dev *self, PyObject *args) |
static int | cp_dev_init (struct cp_dev *self, PyObject *args, PyObject *kwds) |
static void | cp_dev_dealloc (struct cp_dev *self) |
static int | cp_devlist_init (struct cp_devlist *self, PyObject *args, PyObject *kwds) |
static void | cp_devlist_dealloc (struct cp_devlist *self) |
static Py_ssize_t | devlist_len (struct cp_devlist *self) |
static PyObject * | devlist_get (struct cp_devlist *self, Py_ssize_t i) |
static int | cp_xfr_init (struct cp_xfr *self, PyObject *args, PyObject *kwds) |
static void | cp_xfr_dealloc (struct cp_xfr *self) |
static PyObject * | cp_xfr_reset (struct cp_xfr *self, PyObject *args) |
static PyObject * | cp_xfr_byte (struct cp_xfr *self, PyObject *args) |
static PyObject * | cp_xfr_str (struct cp_xfr *self, PyObject *args) |
static PyObject * | cp_xfr_sw1 (struct cp_xfr *self, PyObject *args) |
static PyObject * | cp_xfr_sw2 (struct cp_xfr *self, PyObject *args) |
static PyObject * | cp_xfr_data (struct cp_xfr *self, PyObject *args) |
static PyObject * | cp_chipcard_transact (struct cp_chipcard *self, PyObject *args) |
static PyObject * | cp_chipcard_wait (struct cp_chipcard *self, PyObject *args) |
static PyObject * | cp_chipcard_status (struct cp_chipcard *self, PyObject *args) |
static PyObject * | cp_chipcard_clock (struct cp_chipcard *self, PyObject *args) |
static PyObject * | cp_chipcard_on (struct cp_chipcard *self, PyObject *args) |
static PyObject * | cp_chipcard_off (struct cp_chipcard *self, PyObject *args) |
static void | cp_chipcard_dealloc (struct cp_chipcard *self) |
static PyObject * | cci_get (struct cp_cci *self, Py_ssize_t i) |
static int | cp_cci_init (struct cp_cci *self, PyObject *args, PyObject *kwds) |
static void | cp_cci_dealloc (struct cp_cci *self) |
static Py_ssize_t | cci_len (struct cp_cci *self) |
static PyObject * | cp_log (struct cp_cci *self, PyObject *args) |
static PyObject * | cp_hex_dump (PyObject *self, PyObject *args) |
static PyObject * | cp_ber_dump (PyObject *self, PyObject *args) |
PyMODINIT_FUNC | initccid (void) |
Variables | |
static PyMethodDef | cp_dev_methods [] |
static PyTypeObject | dev_pytype |
static PySequenceMethods | devlist_seq |
static PyTypeObject | devlist_pytype |
static PyMethodDef | cp_xfr_methods [] |
static PyTypeObject | xfr_pytype |
static PyMethodDef | cp_chipcard_methods [] |
static PyTypeObject | chipcard_pytype |
static PyMethodDef | cp_cci_methods [] |
static PySequenceMethods | cci_seq |
static PyTypeObject | cci_pytype |
static PyMethodDef | methods [] |
#define _INT_CONST | ( | m, | |||
c | ) | PyModule_AddIntConstant(m, #c, c) |
Definition at line 532 of file py_ccid.c.
Referenced by initccid(), and initemv().
static PyObject* cci_get | ( | struct cp_cci * | self, | |
Py_ssize_t | i | |||
) | [static] |
Definition at line 407 of file py_ccid.c.
References cci_get_slot(), cp_chipcard::owner, and cp_chipcard::slot.
static Py_ssize_t cci_len | ( | struct cp_cci * | self | ) | [static] |
Definition at line 460 of file py_ccid.c.
References cci_slots().
static PyObject* cp_ber_dump | ( | PyObject * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 513 of file py_ccid.c.
References ber_dump().
static void cp_cci_dealloc | ( | struct cp_cci * | self | ) | [static] |
Definition at line 454 of file py_ccid.c.
References cci_close().
static int cp_cci_init | ( | struct cp_cci * | self, | |
PyObject * | args, | |||
PyObject * | kwds | |||
) | [static] |
Definition at line 429 of file py_ccid.c.
References cci_probe(), cp_dev::dev, get_dev(), and trace.
static PyObject* cp_chipcard_clock | ( | struct cp_chipcard * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 302 of file py_ccid.c.
References CHIPCARD_CLOCK_ERR, and chipcard_slot_status().
static void cp_chipcard_dealloc | ( | struct cp_chipcard * | self | ) | [static] |
static PyObject* cp_chipcard_off | ( | struct cp_chipcard * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 348 of file py_ccid.c.
References chipcard_slot_off().
static PyObject* cp_chipcard_on | ( | struct cp_chipcard * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 320 of file py_ccid.c.
References CHIPCARD_1_8V, CHIPCARD_AUTO_VOLTAGE, and chipcard_slot_on().
static PyObject* cp_chipcard_status | ( | struct cp_chipcard * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 292 of file py_ccid.c.
References chipcard_status().
static PyObject* cp_chipcard_transact | ( | struct cp_chipcard * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 254 of file py_ccid.c.
References chipcard_transact(), cp_xfr::xfr, and xfr_rx_sw1().
static PyObject* cp_chipcard_wait | ( | struct cp_chipcard * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 279 of file py_ccid.c.
References chipcard_wait_for_card().
static PyObject* cp_dev_addr | ( | struct cp_dev * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 27 of file py_ccid.c.
References ccid_device_addr(), and get_dev().
static PyObject* cp_dev_bus | ( | struct cp_dev * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 21 of file py_ccid.c.
References ccid_device_bus(), and get_dev().
static void cp_dev_dealloc | ( | struct cp_dev * | self | ) | [static] |
static int cp_dev_init | ( | struct cp_dev * | self, | |
PyObject * | args, | |||
PyObject * | kwds | |||
) | [static] |
Definition at line 33 of file py_ccid.c.
References ccid_device().
static void cp_devlist_dealloc | ( | struct cp_devlist * | self | ) | [static] |
Definition at line 88 of file py_ccid.c.
References ccid_free_device_list().
static int cp_devlist_init | ( | struct cp_devlist * | self, | |
PyObject * | args, | |||
PyObject * | kwds | |||
) | [static] |
Definition at line 81 of file py_ccid.c.
References ccid_get_device_list().
static PyObject* cp_hex_dump | ( | PyObject * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 502 of file py_ccid.c.
References hex_dump().
static PyObject* cp_log | ( | struct cp_cci * | self, | |
PyObject * | args | |||
) | [static] |
static PyObject* cp_xfr_byte | ( | struct cp_xfr * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 163 of file py_ccid.c.
References xfr_tx_byte().
static PyObject* cp_xfr_data | ( | struct cp_xfr * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 206 of file py_ccid.c.
References str, and xfr_rx_data().
static void cp_xfr_dealloc | ( | struct cp_xfr * | self | ) | [static] |
Definition at line 150 of file py_ccid.c.
References xfr_free().
static int cp_xfr_init | ( | struct cp_xfr * | self, | |
PyObject * | args, | |||
PyObject * | kwds | |||
) | [static] |
Definition at line 134 of file py_ccid.c.
References xfr_alloc().
static PyObject* cp_xfr_reset | ( | struct cp_xfr * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 156 of file py_ccid.c.
References xfr_reset().
static PyObject* cp_xfr_str | ( | struct cp_xfr * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 179 of file py_ccid.c.
References str, and xfr_tx_buf().
static PyObject* cp_xfr_sw1 | ( | struct cp_xfr * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 196 of file py_ccid.c.
References xfr_rx_sw1().
static PyObject* cp_xfr_sw2 | ( | struct cp_xfr * | self, | |
PyObject * | args | |||
) | [static] |
Definition at line 201 of file py_ccid.c.
References xfr_rx_sw2().
static PyObject* devlist_get | ( | struct cp_devlist * | self, | |
Py_ssize_t | i | |||
) | [static] |
Definition at line 99 of file py_ccid.c.
References cp_dev::dev, cp_dev::idx, and cp_dev::owner.
static Py_ssize_t devlist_len | ( | struct cp_devlist * | self | ) | [static] |
Definition at line 13 of file py_ccid.c.
References cp_dev::dev, cp_dev::idx, cp_devlist::list, and cp_dev::owner.
Referenced by cp_cci_init(), cp_dev_addr(), and cp_dev_bus().
PyMODINIT_FUNC initccid | ( | void | ) |
Definition at line 533 of file py_ccid.c.
References _INT_CONST, CHIPCARD_1_8V, CHIPCARD_3V, CHIPCARD_5V, CHIPCARD_ACTIVE, CHIPCARD_AUTO_VOLTAGE, CHIPCARD_CLOCK_START, CHIPCARD_CLOCK_STOP_H, CHIPCARD_CLOCK_STOP_L, CHIPCARD_NOT_PRESENT, and CHIPCARD_PRESENT.
PyTypeObject cci_pytype [static] |
{ PyObject_HEAD_INIT(NULL) .tp_name = "ccid.cci", .tp_basicsize = sizeof(struct cp_cci), .tp_flags = Py_TPFLAGS_DEFAULT, .tp_new = PyType_GenericNew, .tp_init = (initproc)cp_cci_init, .tp_dealloc = (destructor)cp_cci_dealloc, .tp_as_sequence = &cci_seq, .tp_methods = cp_cci_methods, .tp_doc = "CCI device", }
PySequenceMethods cci_seq [static] |
PyTypeObject chipcard_pytype [static] |
{ PyObject_HEAD_INIT(NULL) .tp_name = "ccid.chipcard", .tp_basicsize = sizeof(struct cp_chipcard), .tp_flags = Py_TPFLAGS_DEFAULT, .tp_new = PyType_GenericNew, .tp_methods = cp_chipcard_methods, .tp_dealloc = (destructor)cp_chipcard_dealloc, .tp_doc = "CCI device slot", }
PyMethodDef cp_cci_methods[] [static] |
PyMethodDef cp_chipcard_methods[] [static] |
{ {"wait_for_card", (PyCFunction)cp_chipcard_wait, METH_NOARGS, "slot.wait_for_card()\n" "Sleep until the end of time, or until a card is inserted." "whichever comes soonest."}, {"status", (PyCFunction)cp_chipcard_status, METH_NOARGS, "slot.status()\n" "Get status of the slot."}, {"clock_status", (PyCFunction)cp_chipcard_clock, METH_NOARGS, "slot.status()\n" "Get chip card clock status."}, {"on", (PyCFunction)cp_chipcard_on, METH_VARARGS, "slotchipcard.on(voltage=CHIPCARD_AUTO_VOLTAGE)\n" "Power on card and retrieve ATR."}, {"off", (PyCFunction)cp_chipcard_off, METH_NOARGS, "slot.off()\n" "Power off card."}, {"transact", (PyCFunction)cp_chipcard_transact, METH_VARARGS, "slot.transact(xfr) - chipcard transaction."}, {NULL, } }
PyMethodDef cp_dev_methods[] [static] |
{ {"bus", (PyCFunction)cp_dev_bus, METH_NOARGS, "xfr.bus()\n" "Retrieves bus number of device."}, {"addr", (PyCFunction)cp_dev_addr, METH_NOARGS, "xfr.addr()\n" "Retrieves USB device address."}, {NULL, } }
PyMethodDef cp_xfr_methods[] [static] |
{ {"reset", (PyCFunction)cp_xfr_reset, METH_NOARGS, "xfr.reset()\n" "Reset transmit and receive buffers."}, {"tx_byte", (PyCFunction)cp_xfr_byte, METH_VARARGS, "xfr.tx_byte()\n" "Push a byte to the transmit buffer."}, {"tx_str", (PyCFunction)cp_xfr_str, METH_VARARGS, "xfr.tx_str()\n" "Push a string to the transmit buffer."}, {"rx_sw1", (PyCFunction)cp_xfr_sw1, METH_NOARGS, "xfr.rx_sw1()\n" "Retrieve SW1 status word."}, {"rx_sw2", (PyCFunction)cp_xfr_sw2, METH_NOARGS, "xfr.rx_sw1()\n" "Retrieve SW2 status word."}, {"rx_data", (PyCFunction)cp_xfr_data, METH_NOARGS, "xfr.rx_data()\n" "Return receive buffer data."}, {NULL,} }
PyTypeObject dev_pytype [static] |
{ PyObject_HEAD_INIT(NULL) .tp_name = "ccid.dev", .tp_basicsize = sizeof(struct cp_dev), .tp_flags = Py_TPFLAGS_DEFAULT, .tp_new = PyType_GenericNew, .tp_init = (initproc)cp_dev_init, .tp_dealloc = (destructor)cp_dev_dealloc, .tp_methods = cp_dev_methods, .tp_doc = "CCI device list entry", }
PyTypeObject devlist_pytype [static] |
{ PyObject_HEAD_INIT(NULL) .tp_name = "ccid.devlist", .tp_basicsize = sizeof(struct cp_devlist), .tp_flags = Py_TPFLAGS_DEFAULT, .tp_new = PyType_GenericNew, .tp_init = (initproc)cp_devlist_init, .tp_dealloc = (destructor)cp_devlist_dealloc, .tp_as_sequence = &devlist_seq, .tp_doc = "CCI device list", }
PySequenceMethods devlist_seq [static] |
{ .sq_length = (lenfunc)devlist_len, .sq_item = (ssizeargfunc)devlist_get, }
PyMethodDef methods[] [static] |
{ {"hex_dump", cp_hex_dump, METH_VARARGS, "hex_dump(string, len=16) - hex dump."}, {"ber_dump", cp_ber_dump, METH_VARARGS, "ber_dump(string) - dump BER TLV tags."}, {NULL, } }
PyTypeObject xfr_pytype [static] |
{ PyObject_HEAD_INIT(NULL) .tp_name = "ccid.xfr", .tp_basicsize = sizeof(struct cp_xfr), .tp_flags = Py_TPFLAGS_DEFAULT, .tp_new = PyType_GenericNew, .tp_methods = cp_xfr_methods, .tp_init = (initproc)cp_xfr_init, .tp_dealloc = (destructor)cp_xfr_dealloc, .tp_doc = "CCI transfer buffer", }