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

winscard_msg.h

Go to the documentation of this file.
/*
 * MUSCLE SmartCard Development ( http://www.linuxnet.com )
 *
 * Copyright (C) 2001-2004
 *  David Corcoran <corcoran@linuxnet.com>
 * Copyright (C) 2003-2004
 *  Damien Sauveron <damien.sauveron@labri.fr>
 * Copyright (C) 2002-2010
 *  Ludovic Rousseau <ludovic.rousseau@free.fr>
 *
 * $Id: winscard_msg.h 5047 2010-06-29 14:39:24Z rousseau $
 */

/**
 * @file
 * @brief This defines some structures and \#defines to be used over
 * the transport layer.
 */

#ifndef __winscard_msg_h__
#define __winscard_msg_h__

#include <stdint.h>

/** Major version of the current message protocol */
00026 #define PROTOCOL_VERSION_MAJOR 4
/** Minor version of the current message protocol */
00028 #define PROTOCOL_VERSION_MINOR 0

#ifdef __cplusplus
extern "C"
{
#endif

      /**
       * @brief Information transmitted in \ref CMD_VERSION Messages.
       */
00038       struct version_struct
      {
00040             int32_t major;    /**< IPC major \ref PROTOCOL_VERSION_MAJOR */
00041             int32_t minor;    /**< IPC minor \ref PROTOCOL_VERSION_MINOR */
            uint32_t rv;
      };

      /**
       * @brief header structure for client/server message data exchange.
       */
00048       struct rxHeader
      {
00050             uint32_t size;          /**< size of the message excluding this header */
00051             uint32_t command; /**< one of the \c pcsc_msg_commands */
      };

      /**
       * @brief Commands available to use in the field \c sharedSegmentMsg.command.
       */
00057       enum pcsc_msg_commands
      {
            CMD_ENUM_FIRST,
00060             SCARD_ESTABLISH_CONTEXT = 0x01,     /**< used by SCardEstablishContext() */
00061             SCARD_RELEASE_CONTEXT = 0x02, /**< used by SCardReleaseContext() */
00062             SCARD_LIST_READERS = 0x03,          /**< used by SCardListReaders() */
00063             SCARD_CONNECT = 0x04,               /**< used by SCardConnect() */
00064             SCARD_RECONNECT = 0x05,             /**< used by SCardReconnect() */
00065             SCARD_DISCONNECT = 0x06,            /**< used by SCardDisconnect() */
00066             SCARD_BEGIN_TRANSACTION = 0x07,     /**< used by SCardBeginTransaction() */
00067             SCARD_END_TRANSACTION = 0x08, /**< used by SCardEndTransaction() */
00068             SCARD_TRANSMIT = 0x09,              /**< used by SCardTransmit() */
00069             SCARD_CONTROL = 0x0A,               /**< used by SCardControl() */
00070             SCARD_STATUS = 0x0B,                /**< used by SCardStatus() */
00071             SCARD_GET_STATUS_CHANGE = 0x0C,     /**< used by SCardGetStatusChange() */
00072             SCARD_CANCEL = 0x0D,                /**< used by SCardCancel() */
00073             SCARD_CANCEL_TRANSACTION = 0x0E,    /**< used by SCardCancelTransaction() */
00074             SCARD_GET_ATTRIB = 0x0F,            /**< used by SCardGetAttrib() */
00075             SCARD_SET_ATTRIB = 0x10,            /**< used by SCardSetAttrib() */
00076             CMD_VERSION = 0x11,                       /**< get the client/server protocol version */
00077             CMD_GET_READERS_STATE = 0x12, /**< get the readers state */
00078             CMD_WAIT_READER_STATE_CHANGE = 0x13,      /**< wait for a reader state change */
00079             CMD_STOP_WAITING_READER_STATE_CHANGE = 0x14,    /**< stop waiting for a reader state change */
            CMD_ENUM_LAST
      };

      struct client_struct
      {
            uint32_t hContext;
      };

      /**
       * @brief Information contained in \ref CMD_WAIT_READER_STATE_CHANGE Messages.
       */
00091       struct wait_reader_state_change
      {
00093             uint32_t timeOut; /**< timeout in ms */
            uint32_t rv;
      };

      /**
       * @brief Information contained in \ref SCARD_ESTABLISH_CONTEXT Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00102       struct establish_struct
      {
            uint32_t dwScope;
            uint32_t hContext;
            uint32_t rv;
      };

      /**
       * @brief Information contained in \ref SCARD_RELEASE_CONTEXT Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00114       struct release_struct
      {
            uint32_t hContext;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_CONNECT Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00125       struct connect_struct
      {
            uint32_t hContext;
            char szReader[MAX_READERNAME];
            uint32_t dwShareMode;
            uint32_t dwPreferredProtocols;
            int32_t hCard;
            uint32_t dwActiveProtocol;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_RECONNECT Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00141       struct reconnect_struct
      {
            int32_t hCard;
            uint32_t dwShareMode;
            uint32_t dwPreferredProtocols;
            uint32_t dwInitialization;
            uint32_t dwActiveProtocol;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_DISCONNECT Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00156       struct disconnect_struct
      {
            int32_t hCard;
            uint32_t dwDisposition;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_BEGIN_TRANSACTION Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00168       struct begin_struct
      {
            int32_t hCard;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_END_TRANSACTION Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00179       struct end_struct
      {
            int32_t hCard;
            uint32_t dwDisposition;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_CANCEL Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00191       struct cancel_struct
      {
            int32_t hContext;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_CANCEL_TRANSACTION Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00202       struct cancel_transaction_struct
      {
            int32_t hCard;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_STATUS Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00213       struct status_struct
      {
            int32_t hCard;
            char mszReaderNames[MAX_READERNAME];
            uint32_t pcchReaderLen;
            uint32_t dwState;
            uint32_t dwProtocol;
            uint8_t pbAtr[MAX_ATR_SIZE];
            uint32_t pcbAtrLen;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_TRANSMIT Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00230       struct transmit_struct
      {
            int32_t hCard;
            uint32_t ioSendPciProtocol;
            uint32_t ioSendPciLength;
            uint32_t cbSendLength;
            uint32_t ioRecvPciProtocol;
            uint32_t ioRecvPciLength;
            uint32_t pcbRecvLength;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_CONTROL Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00247       struct control_struct
      {
            int32_t hCard;
            uint32_t dwControlCode;
            uint32_t cbSendLength;
            uint32_t cbRecvLength;
            uint32_t dwBytesReturned;
            uint32_t rv;
      };

      /**
       * @brief contained in \ref SCARD_GET_ATTRIB and \c  Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00262       struct getset_struct
      {
            int32_t hCard;
            uint32_t dwAttrId;
            uint8_t pbAttr[MAX_BUFFER_SIZE];
            uint32_t cbAttrLen;
            uint32_t rv;
      };

      /*
       * Now some function definitions
       */

      int32_t ClientSetupSession(uint32_t *);
      int32_t ClientCloseSession(uint32_t);
      int32_t InitializeSocket(void);
      int32_t ProcessEventsServer(/*@out@*/ uint32_t *);
      int32_t MessageSend(void *buffer, uint64_t buffer_size, int32_t filedes);
      int32_t MessageReceive(/*@out@*/ void *buffer, uint64_t buffer_size,
            int32_t filedes);
      int32_t MessageReceiveTimeout(uint32_t command, /*@out@*/ void *buffer,
            uint64_t buffer_size, int32_t filedes, int32_t timeOut);
      int32_t MessageSendWithHeader(uint32_t command, uint32_t dwClientID, uint64_t size, void *data);
      void CleanupSharedSegment(int32_t, const char *);

#ifdef __cplusplus
}
#endif

#endif

Generated by  Doxygen 1.6.0   Back to index