ONSECURELINKREADY

#include "ltdic.h"

L_VOID pEXT_CALLBACK Your_Function(hNet, nError, pUserData)

HDICOMNET hNet;

/* handle to an existing DICOM Network */

L_UINT32 nError;

/* error code */

L_VOID * pUserData;

/* optional pointer to more parameters for the callback */

This function is called when an ISCL or TLS secured connection is successfully established. This function is available in the Medical Suite toolkits.

Parameter

Description

hNet

Handle to an existing DICOM Network. This is the handle returned from the L_DicomCreateNet function.

nError

Error code. For a list of possible values, refer to Return Codes.

pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs. To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure. If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

None.

Comments

This function is called after the ISCL or TLS connection is successfully established. From this moment until the connection is closed, an application can securely send and receive data.

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:

L_DicomGetPeerAuthDataISCL, L_DicomSendAssociateRequest

Topics:

DICOM Net:Callback Function

 

Adding TLS Security to a DICOM Connection

 

Negotiating a Ciphersuite

 

General Transport Layer Secure (TLS) Information

Example

L_VOID myLDicomNet::OnSecureLinkReady (L_UINT32 nError)
{
   char str[128];
   if (nError == DICOM_SUCCESS)
   {
      L_CIPHERSUITE tmp;
      tmp = this->GetCiphersuiteTLS();
      if (tmp == TLS_DHE_RSA_WITH_DES_CBC_SHA)
         sprintf(str, "Secure connected, cipher is TLS_DHE_RSA_WITH_DES_CBC_SHA");
      if (tmp == TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA)
         sprintf(str, "Secure connected, cipher is TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA");
      theApp.m_pMainWnd->SetWindowText(str);
   }
   else
   {
      sprintf(str, "ClientTLS: Secure link error %d", nError);
      theApp.m_pMainWnd->SetWindowText(str);
   }
};


L_VOID L_EXPORT exOnSecureLinkReady(HDICOMNET hNet, L_UINT32 nError, L_VOID *pUserData)
{
   L_CHAR szMsg[MAX_STRING_LEN];
   L_CHAR szTmp[MAX_STRING_LEN];
   L_INT  nRet;

   char PeerId[128];
   int nPeerLength = sizeof(PeerId);

   if(nError == DICOM_SUCCESS)
   {
      L_DicomGetPeerAuthDataISCL (hNet, PeerId, &nPeerLength);
      wsprintf(szMsg,"ISCLLink ready, peer identified by %s", PeerId);
      LogMessage(MSG_SEND, szMsg);
   }

   FinishProcess(PROCESS_CONNECT);

   if (nError == DICOM_SUCCESS)
   {
      //Send associate request
      StartProcess(PROCESS_ASSOCIATE, 0);
      DisplayAssociate(MSG_SEND, "Send Associate Request", hNet, hAssociateRequest, TRUE);
      nRet = L_DicomSendAssociateRequest (hNet, hAssociateRequest);
      if (nRet != DICOM_SUCCESS)
         FinishProcess(PROCESS_ASSOCIATE);
      else
         StatusServer(connections.connection[iIndexConnectionGlobal].szName, TRUE);
   } 
   else
   {
      wsprintf(szTmp, "%sError[%d]\n", szMsg, nError);
      lstrcpy(szMsg, szTmp);
      LogMessage(MSG_ERROR, szMsg);
      bConnectedGlobal = FALSE;
   }
};