Rejecting association with STORE request

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jerzy_cz
Posts: 25
Joined: Mon, 2007-10-22, 14:59
Location: Poznan, Poland

Rejecting association with STORE request

#1 Post by jerzy_cz »

Hello. I am developing application based on DCMT. Application accepts ECHO, STORE, FIND and MOVE commands. When application has some problems fith filesystem I would like to reject STORE command while still accepting others. When should I do it? Before receiving DIMSE command I cannot tell if it is a STORE request. But when I release association after receiving DIMSE command, client (STORESCU) has some nasty error messages: TCP/IO error (No error) in routine...
How should I do it in "polite" way?

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi,

to a C-STORE-RQ (request) that you cannot process, you should answer with with a C-STORE-RSP with error status. This how it should work. After that the sender might release the association. If not, you might release or (not politely) abort it.

Best regards,
Michael

jerzy_cz
Posts: 25
Joined: Mon, 2007-10-22, 14:59
Location: Poznan, Poland

#3 Post by jerzy_cz »

Ok, but I should still receive the dataset, as it is done in dcmqrdb (dcmqrsrv.cc), and then send respond C-STORE-RSP with error status? Even as I know before receiving dataset, that it cannot be written to a file?

jerzy_cz
Posts: 25
Joined: Mon, 2007-10-22, 14:59
Location: Poznan, Poland

#4 Post by jerzy_cz »

So, in storeSCPCallback , when progress->state is DIMSE_StoreBegin, I set rsp->DimseStatus to STATUS_STORE_Refused_OutOfResources. STORESCU didn't relase, kept sending data. In STORESCU log was no error indication. So I add in storeSCPCallback call to ASC_releaseAssociation. STORESCU displayed "Protocol Error: peer requested release (Aborting)". Is there a better way?

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#5 Post by Michael Onken »

Hi,

if you receive the C-STORE-RQ message, just respond with C-STORE-RSP with error code. The right place to insert your handler is in processCommands():

Code: Select all

 switch (msg.CommandField)
      {
        case DIMSE_C_ECHO_RQ:
          // process C-ECHO-Request
          cond = echoSCP(assoc, &msg, presID);
          break;
        case DIMSE_C_STORE_RQ:
          // process C-STORE-Request
          cond = storeSCP(assoc, &msg, presID);
          break;
        default:
          // we cannot handle this kind of message
          cond = DIMSE_BADCOMMANDTYPE;
          OFLOG_ERROR(storescpLogger, "cannot handle command: 0x"
               << STD_NAMESPACE hex << OFstatic_cast(unsigned, msg.CommandField));
          break;
Look into the storeSCP handler and instead of sending a success message, send a C-STORE-RSP with error status, e.g. status "Refused: Out of Resources" may fit in your case.

Best regards,
Michael

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 1 guest