LDicomNet::GetErrorSecure

#include "ltdic.h"

L_UINT32 LDicomNet::GetErrorSecure()

Returns a special ISCL or TLS error. This function is available in the PACS Imaging toolkits.

Returns

Returns the last occurring error code.

Returns a specialized ISCL or TLS error code. For a list of possible values, refer to Return Codes.

Comments

The errors returned by this function may be useful for debugging purposes.

Required DLLs and Libraries

LTDIC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LDicomNet::GetStatusISCL, Class Members

Topics:

Sending and Receiving Messages

 

General Integrated Secure Communication Layer (ISCL) Information

Example

// LMyDicomNet is a class derived from LDicomNet. The methods are overridden as follows:
#include <stdlib.h> // for definition of rand()
L_UINT64 GetRandom()
{
   L_UINT64 nRet;
   nRet = ((L_UINT64)(rand())<<48) + ((L_UINT64)(rand())<<32) + (rand()<<16) + (rand()<<8) + rand();
   return nRet;
}
L_UINT32 LMyDicomNetExt::GetChallengeISCL(L_UINT64 *pChallenge, L_UINT64 nParameter)
{
   UNREFERENCED_PARAMETER(nParameter);
   *pChallenge = GetRandom();
   return 0;
}
L_UINT32  LMyDicomNetExt::InternalAuthenticateISCL(L_UINT64 nChallenge, L_UINT64 *pResponse, L_UINT64 nParameter)
{
   UNREFERENCED_PARAMETER(nParameter);
   *pResponse = nChallenge + 1;
   return 0;
}
L_UINT32  LMyDicomNetExt::ExternalAuthenticateISCL(L_UINT64 nChallenge, L_UINT64 nResponse, L_UINT64 nParameter)
{
   UNREFERENCED_PARAMETER(nParameter);
   if (nResponse == nChallenge + 1)
      return 0;
   else
      return 1;
}
L_VOID LMyDicomNetExt::OnReceive (L_INT nError, L_UCHAR nType, L_UCHAR *pBuffer, L_UINT32 nBytes)
{
UNREFERENCED_PARAMETER(pBuffer);
UNREFERENCED_PARAMETER(nBytes);
UNREFERENCED_PARAMETER(nType);
   if (nError == DICOM_ERROR_ISCL_MSG_TRANSMISSION)
   {
      L_UINT32 nErrorStatus, nErrorCode;
      nErrorStatus = GetStatusISCL();
      nErrorCode = GetErrorSecure();
      // usually GetErrorSecure is the same as the nError parameter. However, the internal error code keeps 
      // its value until another error happens and set it to another value.
      // Even when nError is DICOM_SUCCESS, the GetErrorSecure will return the last error code generated
      if(nErrorStatus == 57)
      {
         CString strTmp;
         // I know that the message transmission request was refused
         L_UINT32 nMutualAuthIndex, nEncryptIndex, nRequestedMessageLength;
         nMutualAuthIndex = GetIndexForMutualAuthISCL();
         nEncryptIndex = GetIndexForEncryptISCL();
         nRequestedMessageLength = GetPeerRequestedMessageLengthISCL();
         strTmp.Format(TEXT("Error during receive\n Current auth index:%d\nCurrent encryption index %d\nPeer requested message length %d\n"));
         AfxMessageBox(strTmp);
      }
   }
};