LDicomNet::GetErrorSecure
#include "ltdic.h"
L_UINT32 LDicomNet::GetErrorSecure()
Returns a special ISCL or TLS error. This function is available in the Medical Suite 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: |
|
Topics: |
|
|
General Integrated Secure Communication Layer (ISCL) Information |
Example
// myLDicomNet 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 myLDicomNet::GetChallengeISCL(L_UINT64 *pChallenge, L_UINT64 nParameter)
{
*pChallenge = GetRandom();
return 0;
}
L_UINT32 myLDicomNet::InternalAuthenticateISCL(L_UINT64 nChallenge, L_UINT64 *pResponse, L_UINT64 nParameter)
{
*pResponse = nChallenge + 1;
return 0;
}
L_UINT32 myLDicomNet::ExternalAuthenticateISCL(L_UINT64 nChallenge, L_UINT64 nResponse, L_UINT64 nParameter)
{
if (nResponse == nChallenge + 1)
return 0;
else
return 1;
}
L_VOID myLDicomNet::OnReceive (L_INT nError, L_UCHAR nType, L_CHAR *pBuffer, L_UINT32 nBytes)
{
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("Error during receive\n Current auth index:%d\nCurrent encryption index %d\nPeer requested message length %d\n"
AfxMessageBox(strTmp);
}
}
};