Previous Next

RDF_TRANSMIT

The data transmission callback function performs data transmissions.

NTSTATUS 
  (*ReaderFunction[RDF_TRANSMIT])(
    PSMARTCARD_EXTENSION  SmartcardExtension
    );

Parameters

Caller must pass the following values to the function on input:
SmartcardExtension->MajorIoControlCode
Contains IOCTL_SMARTCARD_TRANSMIT.
SmartcardExtension->IoRequest.RequestBuffer
Pointer to an SCARD_IO_REQUEST structure followed by data to be transmitted to the card.
SmartcardExtension->IoRequest.RequestBufferLength
The number of bytes to be transmitted to the card.
SmartcardExtension->IoRequest.ReplyBufferLength
The size, in bytes, of the reply buffer.
The request returns the following values:
SmartcardExtension->IoRequest.ReplyBuffer
Pointer to the buffer that receives the SCARD_IO_REQUEST structure, plus the result of the card.
SmartcardExtension->IoRequest.Information
Receives the actual number of bytes returned by the card, plus the size of the SCARD_IO_REQUEST structure. For a definition of the SCARD_IO_REQUEST structure see IOCTL_SMARTCARD_TRANSMIT.

Return Value

This function returns an NTSTATUS value. Possible values are the following.

Value Meaning
STATUS_SUCCESS Transmission successful.
STATUS_NO_MEDIA No card is in the reader.
STATUS_IO_TIMEOUT The request has timed out.
STATUS_INVALID_DEVICE_REQUEST The protocol, defined by dwProtocol, is invalid.

Headers

Declared in smclib.h. Include smclib.h.

Comments

It is mandatory for card reader drivers to implement this callback function.

When this function is called, SmartcardExtension->IoRequest.RequestBuffer points to a SCARD_IO_REQUEST structure followed by the data to be transmitted:

typedef struct _SCARD_IO_REQUEST{
  DWORD  dwProtocol;   // Protocol identifier
  DWORD  cbPciLength;  // Protocol Control Information Length
} SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;

The dwProtocol member must contain the protocol identifier that was returned by a call to IOCTL_SMARTCARD_SET_PROTOCOL.

The cbPciLength member contains the size, in bytes, of the SCARD_IO_REQUEST structure. The size of this structure is usually 8 bytes. This structure will be used mainly for future implementations.

The SCARD_IO_REQUEST structure is followed by (protocol) data to be transmitted to the card. Depending on the protocol to be used for this transmission, the library offers several support functions. See SmartcardT0Request (WDM), SmartcardT0Request (VxD), SmartcardT1Request (WDM), and SmartcardT1Request (VxD).

RequestBuffer and ReplyBuffer point to the same system buffer. If you use the library function SmartcardxxRequest and SmartcardxxReply, you do not have to worry that you might overwrite the input buffer. If you do not use these functions, make a copy of the RequestBuffer before you start transmissions.

You must copy the SCARD_IO_REQUEST structure to the ReplyBuffer, followed by the data received from the card. Again, if you use the SmartcardxxRequest and SmartcardxxReply functions, you do not need to copy the structure because the library does this.

See Also

SMARTCARD_EXTENSION, IOCTL_SMARTCARD_TRANSMIT, IOCTL_SMARTCARD_SET_PROTOCOL, SmartcardT0Request (WDM), SmartcardT0Request (VxD), SmartcardT1Request (WDM), SmartcardT1Request (VxD)