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

int WrapSHMWrite ( unsigned int  command,
DWORD  dwClientID,
unsigned int  size,
unsigned int  blockAmount,
void *  data 

Wrapper for the SHMMessageSend() function.

Called by clients to send messages to the server. The parameters command and data are set in the sharedSegmentMsg struct in order to be sent.

[in] command Command to be sent.
[in] dwClientID Client socket handle.
[in] size Size of the message (data).
[in] blockAmount Timeout to the operation in ms.
[in] data Data to be sent.
Same error codes as SHMMessageSend().

Definition at line 385 of file winscard_msg.c.

References rxSharedSegment::command, rxSharedSegment::data, rxSharedSegment::date, rxSharedSegment::group_id, rxSharedSegment::mtype, PCSCLITE_MAX_MESSAGE_SIZE, SHMMessageSend(), and rxSharedSegment::user_id.

Referenced by SCardBeginTransaction(), SCardCancelTransaction(), SCardConnect(), SCardControl(), SCardDisconnect(), SCardEndTransaction(), SCardEstablishContextTH(), SCardReconnect(), SCardReleaseContext(), SCardStatus(), and SCardTransmit().

      sharedSegmentMsg msgStruct;
      int ret;

       * Set the appropriate packet parameters 

      memset(&msgStruct, 0, sizeof(msgStruct));
      msgStruct.mtype = CMD_FUNCTION;
      msgStruct.user_id = SYS_GetUID();
      msgStruct.group_id = SYS_GetGID();
      msgStruct.command = command;
      msgStruct.date = time(NULL);
      if (SCARD_TRANSMIT_EXTENDED == command)
            /* first block */
            memcpy(msgStruct.data, data, PCSCLITE_MAX_MESSAGE_SIZE);
            ret = SHMMessageSend(&msgStruct, sizeof(msgStruct), dwClientID,
            if (ret)
                  return ret;

            /* do not send an empty second block */
            if (size > PCSCLITE_MAX_MESSAGE_SIZE)
                  /* second block */
                  ret = SHMMessageSend(data+PCSCLITE_MAX_MESSAGE_SIZE,
                        size-PCSCLITE_MAX_MESSAGE_SIZE, dwClientID, blockAmount);
                  if (ret)
                        return ret;
            memcpy(msgStruct.data, data, size);

            ret = SHMMessageSend(&msgStruct, sizeof(msgStruct), dwClientID,
      return ret;

Generated by  Doxygen 1.6.0   Back to index