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 5796 2011-06-16 08:56:03Z 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 2

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

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

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

00078       struct client_struct
      {
            uint32_t hContext;
      };

      /**
       * @brief Information contained in \ref CMD_WAIT_READER_STATE_CHANGE Messages.
       */
00086       struct wait_reader_state_change
      {
00088             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.
       */
00097       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.
       */
00109       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.
       */
00120       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.
       */
00136       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.
       */
00151       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.
       */
00163       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.
       */
00174       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.
       */
00186       struct cancel_struct
      {
            int32_t hContext;
            uint32_t rv;
      };

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

      /**
       * @brief contained in \ref SCARD_TRANSMIT Messages.
       *
       * These data are passed throw the field \c sharedSegmentMsg.data.
       */
00208       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.
       */
00225       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.
       */
00240       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
       */

#ifdef PCSCD
      int32_t InitializeSocket(void);
      int32_t ProcessEventsServer(/*@out@*/ uint32_t *);
#else
      char *getSocketName(void);
      int32_t ClientSetupSession(uint32_t *);
      int32_t ClientCloseSession(uint32_t);
      LONG MessageReceiveTimeout(uint32_t command, /*@out@*/ void *buffer,
            uint64_t buffer_size, int32_t filedes, unsigned long timeOut);
      LONG MessageSendWithHeader(uint32_t command, uint32_t dwClientID,
            uint64_t size, void *data);
#endif
      LONG MessageSend(void *buffer, uint64_t buffer_size, int32_t filedes);
      LONG MessageReceive(/*@out@*/ void *buffer, uint64_t buffer_size,
            int32_t filedes);

#endif

Generated by  Doxygen 1.6.0   Back to index