Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

LONG IFDTransmit ( READER_CONTEXT rContext,
SCARD_IO_HEADER  pioTxPci,
PUCHAR  pucTxBuffer,
DWORD  dwTxLength,
PUCHAR  pucRxBuffer,
PDWORD  pdwRxLength,
PSCARD_IO_HEADER  pioRxPci 
)

Transmit an APDU to the ICC.

Definition at line 479 of file ifdwrapper.c.

References IFD_NO_SUCH_DEVICE, IFD_SUCCESS, IFDHTransmitToICC(), ReaderContext::mMutex, ReaderContext::psFunctions, ReaderContext::psFunctions_v2, SCARD_E_NOT_TRANSACTED, SCARD_E_READER_UNAVAILABLE, SCARD_S_SUCCESS, and ReaderContext::slot.

Referenced by SCardTransmit().

{
      RESPONSECODE rv = IFD_SUCCESS;

#ifndef PCSCLITE_STATIC_DRIVER
      RESPONSECODE(*IFDH_transmit_to_icc) (DWORD, SCARD_IO_HEADER, PUCHAR,
            DWORD, /*@out@*/ PUCHAR, PDWORD, PSCARD_IO_HEADER) = NULL;
#endif

      /* log the APDU */
      DebugLogCategory(DEBUG_CATEGORY_APDU, pucTxBuffer, dwTxLength);

#ifndef PCSCLITE_STATIC_DRIVER
      IFDH_transmit_to_icc =
            rContext->psFunctions.psFunctions_v2.pvfTransmitToICC;
#endif

      /* LOCK THIS CODE REGION */
      (void)pthread_mutex_lock(rContext->mMutex);

#ifndef PCSCLITE_STATIC_DRIVER
      rv = (*IFDH_transmit_to_icc) (rContext->slot, pioTxPci, (LPBYTE)
            pucTxBuffer, dwTxLength, pucRxBuffer, pdwRxLength, pioRxPci);
#else
      rv = IFDHTransmitToICC(rContext->slot, pioTxPci,
            (LPBYTE) pucTxBuffer, dwTxLength,
            pucRxBuffer, pdwRxLength, pioRxPci);
#endif

      /* END OF LOCKED REGION */
      (void)pthread_mutex_unlock(rContext->mMutex);

      /* log the returned status word */
      DebugLogCategory(DEBUG_CATEGORY_SW, pucRxBuffer, *pdwRxLength);

      if (rv == IFD_SUCCESS)
            return SCARD_S_SUCCESS;
      else
      {
            Log2(PCSC_LOG_ERROR, "Card not transacted: %ld", rv);

            if (rv == IFD_NO_SUCH_DEVICE)
            {
                  (void)SendHotplugSignal();
                  return SCARD_E_READER_UNAVAILABLE;
            }

            return SCARD_E_NOT_TRANSACTED;
      }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index