[Pcsclite-cvs-commit] r4718 - in /trunk/PCSC/src: winscard_clnt.c winscard_msg.c winscard_msg.h winscard_svc.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Feb 8 15:56:09 UTC 2010


Author: rousseau
Date: Mon Feb  8 15:56:09 2010
New Revision: 4718

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4718
Log:
add a command parameter to SHMMessageReceive() to be able log the
ongoing command in case of problem

Modified:
    trunk/PCSC/src/winscard_clnt.c
    trunk/PCSC/src/winscard_msg.c
    trunk/PCSC/src/winscard_msg.h
    trunk/PCSC/src/winscard_svc.c

Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=4718&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Mon Feb  8 15:56:09 2010
@@ -548,7 +548,7 @@
 			return SCARD_E_NO_SERVICE;
 
 		/* Read a message from the server */
-		if (SHMMessageReceive(&veStr, sizeof(veStr), dwClientID,
+		if (SHMMessageReceive(CMD_VERSION, &veStr, sizeof(veStr), dwClientID,
 			PCSCLITE_READ_TIMEOUT) < 0)
 		{
 			Log1(PCSC_LOG_CRITICAL, "Your pcscd is too old and does not support CMD_VERSION");
@@ -580,7 +580,7 @@
 	/*
 	 * Read the response from the server
 	 */
-	rv = SHMMessageReceive(&scEstablishStruct, sizeof(scEstablishStruct), dwClientID, PCSCLITE_READ_TIMEOUT);
+	rv = SHMMessageReceive(SCARD_ESTABLISH_CONTEXT, &scEstablishStruct, sizeof(scEstablishStruct), dwClientID, PCSCLITE_READ_TIMEOUT);
 
 	if (rv < 0)
 		return SCARD_F_COMM_ERROR;
@@ -673,7 +673,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scReleaseStruct, sizeof(scReleaseStruct),
+	rv = SHMMessageReceive(SCARD_RELEASE_CONTEXT, &scReleaseStruct, sizeof(scReleaseStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
 
@@ -850,7 +850,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scConnectStruct, sizeof(scConnectStruct),
+	rv = SHMMessageReceive(SCARD_CONNECT, &scConnectStruct, sizeof(scConnectStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
 
@@ -1010,7 +1010,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scReconnectStruct,
+	rv = SHMMessageReceive(SCARD_RECONNECT, &scReconnectStruct,
 		sizeof(scReconnectStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
@@ -1111,7 +1111,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scDisconnectStruct,
+	rv = SHMMessageReceive(SCARD_DISCONNECT, &scDisconnectStruct,
 		sizeof(scDisconnectStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
@@ -1223,7 +1223,7 @@
 		/*
 		 * Read a message from the server
 		 */
-		rv = SHMMessageReceive(&scBeginStruct, sizeof(scBeginStruct),
+		rv = SHMMessageReceive(SCARD_BEGIN_TRANSACTION, &scBeginStruct, sizeof(scBeginStruct),
 			currentContextMap->dwClientID,
 			PCSCLITE_READ_TIMEOUT);
 
@@ -1339,7 +1339,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scEndStruct, sizeof(scEndStruct),
+	rv = SHMMessageReceive(SCARD_END_TRANSACTION, &scEndStruct, sizeof(scEndStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
 
@@ -1416,7 +1416,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scCancelStruct, sizeof(scCancelStruct),
+	rv = SHMMessageReceive(SCARD_CANCEL_TRANSACTION, &scCancelStruct, sizeof(scCancelStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
 
@@ -1623,7 +1623,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scStatusStruct, sizeof(scStatusStruct),
+	rv = SHMMessageReceive(SCARD_STATUS, &scStatusStruct, sizeof(scStatusStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
 
@@ -2193,7 +2193,7 @@
 				/*
 				 * Read a message from the server
 				 */
-				rv = SHMMessageReceive(&waitStatusStruct, sizeof(waitStatusStruct),
+				rv = SHMMessageReceive(CMD_WAIT_READER_STATE_CHANGE, &waitStatusStruct, sizeof(waitStatusStruct),
 					currentContextMap->dwClientID,
 					dwTime);
 
@@ -2213,7 +2213,7 @@
 					}
 
 					/* Read a message from the server */
-					rv = SHMMessageReceive(&waitStatusStruct, sizeof(waitStatusStruct),
+					rv = SHMMessageReceive(CMD_STOP_WAITING_READER_STATE_CHANGE, &waitStatusStruct, sizeof(waitStatusStruct),
 						currentContextMap->dwClientID,
 						PCSCLITE_READ_TIMEOUT);
 
@@ -2404,7 +2404,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scControlStruct, sizeof(scControlStruct),
+	rv = SHMMessageReceive(SCARD_CONTROL, &scControlStruct, sizeof(scControlStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
 
@@ -2417,7 +2417,7 @@
 	if (SCARD_S_SUCCESS == scControlStruct.rv)
 	{
 		/* read the received buffer */
-		rv = SHMMessageReceive(pbRecvBuffer, scControlStruct.dwBytesReturned,
+		rv = SHMMessageReceive(SCARD_CONTROL, pbRecvBuffer, scControlStruct.dwBytesReturned,
 			currentContextMap->dwClientID,
 			PCSCLITE_READ_TIMEOUT);
 
@@ -2693,7 +2693,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scGetSetStruct, sizeof(scGetSetStruct),
+	rv = SHMMessageReceive(command, &scGetSetStruct, sizeof(scGetSetStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
 
@@ -2876,7 +2876,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scTransmitStruct, sizeof(scTransmitStruct),
+	rv = SHMMessageReceive(SCARD_TRANSMIT, &scTransmitStruct, sizeof(scTransmitStruct),
 		currentContextMap->dwClientID,
 		PCSCLITE_READ_TIMEOUT);
 
@@ -2889,7 +2889,7 @@
 	if (SCARD_S_SUCCESS == scTransmitStruct.rv)
 	{
 		/* read the received buffer */
-		rv = SHMMessageReceive(pbRecvBuffer, scTransmitStruct.pcbRecvLength,
+		rv = SHMMessageReceive(SCARD_TRANSMIT, pbRecvBuffer, scTransmitStruct.pcbRecvLength,
 			currentContextMap->dwClientID,
 			PCSCLITE_READ_TIMEOUT);
 
@@ -3307,7 +3307,7 @@
 	/*
 	 * Read a message from the server
 	 */
-	rv = SHMMessageReceive(&scCancelStruct, sizeof(scCancelStruct),
+	rv = SHMMessageReceive(SCARD_CANCEL, &scCancelStruct, sizeof(scCancelStruct),
 		dwClientID, PCSCLITE_READ_TIMEOUT);
 
 	if (rv < 0)
@@ -3764,7 +3764,7 @@
 		return SCARD_E_NO_SERVICE;
 
 	/* Read a message from the server */
-	if (SHMMessageReceive(&readerStates, sizeof(readerStates), dwClientID,
+	if (SHMMessageReceive(CMD_GET_READERS_STATE, &readerStates, sizeof(readerStates), dwClientID,
 		PCSCLITE_READ_TIMEOUT) < 0)
 		return SCARD_F_COMM_ERROR;
 

Modified: trunk/PCSC/src/winscard_msg.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_msg.c?rev=4718&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_msg.c (original)
+++ trunk/PCSC/src/winscard_msg.c Mon Feb  8 15:56:09 2010
@@ -249,8 +249,8 @@
  * @retval -1 Socket is closed.
  * @retval -1 A signal was received.
  */
-INTERNAL int32_t SHMMessageReceive(void *buffer_void, uint64_t buffer_size,
-	int32_t filedes, int32_t timeOut)
+INTERNAL int32_t SHMMessageReceive(uint32_t command, void *buffer_void,
+	uint64_t buffer_size, int32_t filedes, int32_t timeOut)
 {
 	char *buffer = buffer_void;
 
@@ -345,7 +345,7 @@
 			/* you need to set the env variable PCSCLITE_DEBUG=0 since
 			 * this is logged on the client side and not on the pcscd
 			 * side*/
-			Log1(PCSC_LOG_INFO, "Command not yet finished");
+			Log2(PCSC_LOG_INFO, "Command 0x%X not yet finished", command);
 #endif
 		} else
 		{

Modified: trunk/PCSC/src/winscard_msg.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_msg.h?rev=4718&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_msg.h (original)
+++ trunk/PCSC/src/winscard_msg.h Mon Feb  8 15:56:09 2010
@@ -276,8 +276,8 @@
 	int32_t SHMProcessEventsServer(/*@out@*/ uint32_t *);
 	int32_t SHMMessageSend(void *buffer, uint64_t buffer_size, int32_t filedes,
 		int32_t blockAmount);
-	int32_t SHMMessageReceive(/*@out@*/ void *buffer, uint64_t buffer_size,
-		int32_t filedes, int32_t blockAmount);
+	int32_t SHMMessageReceive(uint32_t command, /*@out@*/ void *buffer,
+		uint64_t buffer_size, int32_t filedes, int32_t blockAmount);
 	int32_t SHMMessageSendWithHeader(uint32_t command, uint32_t dwClientID, uint64_t size,
 		uint32_t blockAmount, void *data);
 	void SHMCleanupSharedSegment(int32_t, const char *);

Modified: trunk/PCSC/src/winscard_svc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_svc.c?rev=4718&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_svc.c (original)
+++ trunk/PCSC/src/winscard_svc.c Mon Feb  8 15:56:09 2010
@@ -259,7 +259,7 @@
 
 #define READ_BODY(v) \
 	if (header.size != sizeof(v)) { goto wrong_length; } \
-	ret = SHMMessageReceive(&v, sizeof(v), filedes, PCSCLITE_READ_TIMEOUT); \
+	ret = SHMMessageReceive(header.command, &v, sizeof(v), filedes, PCSCLITE_READ_TIMEOUT); \
 	if (ret < 0) { Log2(PCSC_LOG_DEBUG, "Client die: %d", filedes); goto exit; }
 
 #define WRITE_BODY(v) \
@@ -276,7 +276,7 @@
 	while (1)
 	{
 		struct rxHeader header;
-		int32_t ret = SHMMessageReceive(&header, sizeof(header), filedes, PCSCLITE_READ_TIMEOUT);
+		int32_t ret = SHMMessageReceive(0, &header, sizeof(header), filedes, PCSCLITE_READ_TIMEOUT);
 
 		if (ret < 0)
 		{
@@ -600,7 +600,7 @@
 					goto exit;
 
 				/* read sent buffer */
-				ret = SHMMessageReceive(pbSendBuffer, trStr.cbSendLength,
+				ret = SHMMessageReceive(SCARD_TRANSMIT, pbSendBuffer, trStr.cbSendLength,
 					filedes, PCSCLITE_READ_TIMEOUT);
 				if (ret < 0)
 				{
@@ -653,7 +653,7 @@
 				}
 
 				/* read sent buffer */
-				ret = SHMMessageReceive(pbSendBuffer, ctStr.cbSendLength,
+				ret = SHMMessageReceive(SCARD_CONTROL, pbSendBuffer, ctStr.cbSendLength,
 					filedes, PCSCLITE_READ_TIMEOUT);
 				if (ret < 0)
 				{




More information about the Pcsclite-cvs-commit mailing list