src/py_ccid.c File Reference

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

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 Documentation

#define _INT_CONST ( m,
 )     PyModule_AddIntConstant(m, #c, c)

Definition at line 532 of file py_ccid.c.

Referenced by initccid(), and initemv().


Function Documentation

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.

Here is the call graph for this function:

static Py_ssize_t cci_len ( struct cp_cci self  )  [static]

Definition at line 460 of file py_ccid.c.

References cci_slots().

Here is the call graph for this function:

static PyObject* cp_ber_dump ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 513 of file py_ccid.c.

References ber_dump().

Here is the call graph for this function:

static void cp_cci_dealloc ( struct cp_cci self  )  [static]

Definition at line 454 of file py_ccid.c.

References cci_close().

Here is the call graph for this function:

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.

Here is the call graph for this function:

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().

Here is the call graph for this function:

static void cp_chipcard_dealloc ( struct cp_chipcard self  )  [static]

Definition at line 386 of file py_ccid.c.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

static PyObject* cp_chipcard_status ( struct cp_chipcard self,
PyObject *  args 
) [static]

Definition at line 292 of file py_ccid.c.

References chipcard_status().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

static void cp_dev_dealloc ( struct cp_dev self  )  [static]

Definition at line 52 of file py_ccid.c.

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().

Here is the call graph for this function:

static void cp_devlist_dealloc ( struct cp_devlist self  )  [static]

Definition at line 88 of file py_ccid.c.

References ccid_free_device_list().

Here is the call graph for this function:

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().

Here is the call graph for this function:

static PyObject* cp_hex_dump ( PyObject *  self,
PyObject *  args 
) [static]

Definition at line 502 of file py_ccid.c.

References hex_dump().

Here is the call graph for this function:

static PyObject* cp_log ( struct cp_cci self,
PyObject *  args 
) [static]

Definition at line 465 of file py_ccid.c.

References cci_log(), and str.

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

static void cp_xfr_dealloc ( struct cp_xfr self  )  [static]

Definition at line 150 of file py_ccid.c.

References xfr_free().

Here is the call graph for this function:

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().

Here is the call graph for this function:

static PyObject* cp_xfr_reset ( struct cp_xfr self,
PyObject *  args 
) [static]

Definition at line 156 of file py_ccid.c.

References xfr_reset().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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 94 of file py_ccid.c.

static ccidev_t get_dev ( struct cp_dev dev  )  [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().

Here is the caller graph for this function:

PyMODINIT_FUNC initccid ( void   ) 

Variable Documentation

PyTypeObject cci_pytype [static]
Initial value:
 {
        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",
}

Definition at line 489 of file py_ccid.c.

PySequenceMethods cci_seq [static]
Initial value:
 {
        .sq_length = (lenfunc)cci_len,
        .sq_item = (ssizeargfunc)cci_get,
}

Definition at line 484 of file py_ccid.c.

PyTypeObject chipcard_pytype [static]
Initial value:
 {
        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",
}

Definition at line 395 of file py_ccid.c.

PyMethodDef cp_cci_methods[] [static]
Initial value:
 {
        {"log",(PyCFunction)cp_log, METH_VARARGS,
                "cci.log(string) - Log some text to the tracefile"},
        {NULL, }
}

Definition at line 478 of file py_ccid.c.

PyMethodDef cp_chipcard_methods[] [static]
Initial value:
 {
        {"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, }
}

Definition at line 364 of file py_ccid.c.

PyMethodDef cp_dev_methods[] [static]
Initial value:
 {
        {"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, }
}

Definition at line 59 of file py_ccid.c.

PyMethodDef cp_xfr_methods[] [static]
Initial value:
 {
        {"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,}
}

Definition at line 219 of file py_ccid.c.

PyTypeObject dev_pytype [static]
Initial value:
 {
        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",
}

Definition at line 69 of file py_ccid.c.

PyTypeObject devlist_pytype [static]
Initial value:
 {
        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",
}

Definition at line 121 of file py_ccid.c.

PySequenceMethods devlist_seq [static]
Initial value:
 {
        .sq_length = (lenfunc)devlist_len,
        .sq_item = (ssizeargfunc)devlist_get,
}

Definition at line 116 of file py_ccid.c.

PyMethodDef methods[] [static]
Initial value:
 {
        {"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, }
}

Definition at line 524 of file py_ccid.c.

PyTypeObject xfr_pytype [static]
Initial value:
 {
        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",
}

Definition at line 241 of file py_ccid.c.

Generated on Sun Jan 2 08:35:46 2011 for ccid-utils by  doxygen 1.6.3