00001 /* 00002 * 00003 * Copyright (C) 1994-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were partly developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * For further copyrights, see the following paragraphs. 00014 * 00015 */ 00016 00017 /* 00018 ** Copyright (C) 1993/1994, OFFIS, Oldenburg University and CERIUM 00019 ** 00020 ** This software and supporting documentation were 00021 ** developed by 00022 ** 00023 ** Institut OFFIS 00024 ** Bereich Kommunikationssysteme 00025 ** Westerstr. 10-12 00026 ** 26121 Oldenburg, Germany 00027 ** 00028 ** Fachbereich Informatik 00029 ** Abteilung Prozessinformatik 00030 ** Carl von Ossietzky Universitaet Oldenburg 00031 ** Ammerlaender Heerstr. 114-118 00032 ** 26111 Oldenburg, Germany 00033 ** 00034 ** CERIUM 00035 ** Laboratoire SIM 00036 ** Faculte de Medecine 00037 ** 2 Avenue du Pr. Leon Bernard 00038 ** 35043 Rennes Cedex, France 00039 ** 00040 ** for CEN/TC251/WG4 as a contribution to the Radiological 00041 ** Society of North America (RSNA) 1993 Digital Imaging and 00042 ** Communications in Medicine (DICOM) Demonstration. 00043 ** 00044 ** THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER OFFIS, 00045 ** OLDENBURG UNIVERSITY NOR CERIUM MAKE ANY WARRANTY REGARDING 00046 ** THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00047 ** FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER 00048 ** DISEASES OR ITS CONFORMITY TO ANY SPECIFICATION. THE 00049 ** ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF THE SOFTWARE 00050 ** IS WITH THE USER. 00051 ** 00052 ** Copyright of the software and supporting documentation 00053 ** is, unless otherwise stated, jointly owned by OFFIS, 00054 ** Oldenburg University and CERIUM and free access is hereby 00055 ** granted as a license to use this software, copy this 00056 ** software and prepare derivative works based upon this 00057 ** software. However, any distribution of this software 00058 ** source code or supporting documentation or derivative 00059 ** works (source code and supporting documentation) must 00060 ** include the three paragraphs of this copyright notice. 00061 ** 00062 */ 00063 00064 /* 00065 ** 00066 ** Author: Andrew Hewett Created: 03-06-93 00067 ** 00068 ** Module: dimse 00069 ** 00070 ** Purpose: 00071 ** This file contains the routines which provide dimse layer services 00072 ** for DICOM applications. 00073 ** 00074 ** Module Prefix: DIMSE_ 00075 ** 00076 ** Last Update: $Author: joergr $ 00077 ** Update Date: $Date: 2010-12-01 08:26:10 $ 00078 ** CVS/RCS Revision: $Revision: 1.23 $ 00079 ** Status: $State: Exp $ 00080 ** 00081 ** CVS/RCS Log at end of file 00082 ** 00083 */ 00084 00085 00086 #ifndef DIMSE_H 00087 #define DIMSE_H 00088 00089 /* 00090 * Required Include Files 00091 */ 00092 00093 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00094 00095 #include "dcmtk/dcmnet/dicom.h" 00096 #include "dcmtk/dcmnet/lst.h" 00097 #include "dcmtk/dcmnet/cond.h" 00098 #include "dcmtk/dcmnet/dul.h" 00099 #include "dcmtk/dcmnet/assoc.h" 00100 #include "dcmtk/dcmdata/dcdatset.h" 00101 #include "dcmtk/ofstd/ofglobal.h" 00102 00103 class DcmOutputFileStream; 00104 00113 extern OFGlobal<OFBool> dcmPeerRequiresExactUIDCopy; /* default OFFalse */ 00114 00121 extern OFGlobal<Uint32> dcmMaxOutgoingPDUSize; /* default 2^32-1 */ 00122 00123 00124 /* 00125 * General Status Codes 00126 */ 00127 #define STATUS_Success 0x0000 00128 #define STATUS_Pending 0xff00 00129 00130 #define DICOM_PENDING_STATUS(status) (((status)&0xff00) == 0xff00) 00131 #define DICOM_WARNING_STATUS(status) (((status)&0xf000) == 0xb000) 00132 00133 /* 00134 * Service Class Specific Status Codes 00135 * NOTE: some codes are only significant in the high byte 00136 * or high nibble (4 bits). 00137 */ 00138 /* Storage Specific Codes*/ 00139 #define STATUS_STORE_Refused_OutOfResources /* high byte */ 0xa700 00140 #define STATUS_STORE_Refused_SOPClassNotSupported /* high byte */ 0xa800 00141 #define STATUS_STORE_Error_DataSetDoesNotMatchSOPClass /* high byte */ 0xa900 00142 #define STATUS_STORE_Error_CannotUnderstand /* high nibble */ 0xc000 00143 #define STATUS_STORE_Warning_CoersionOfDataElements 0xb000 00144 #define STATUS_STORE_Warning_DataSetDoesNotMatchSOPClass 0xb007 00145 #define STATUS_STORE_Warning_ElementsDiscarded 0xb006 00146 00147 /* Find Specific Codes */ 00148 #define STATUS_FIND_Refused_OutOfResources 0xa700 00149 #define STATUS_FIND_Refused_SOPClassNotSupported 0xa800 00150 #define STATUS_FIND_Failed_IdentifierDoesNotMatchSOPClass 0xa900 00151 #define STATUS_FIND_Failed_UnableToProcess /* high nibble */ 0xc000 00152 #define STATUS_FIND_Cancel_MatchingTerminatedDueToCancelRequest 0xfe00 00153 #define STATUS_FIND_Pending_WarningUnsupportedOptionalKeys 0xff01 00154 00155 /* Move Specific Codes */ 00156 #define STATUS_MOVE_Refused_OutOfResourcesNumberOfMatches 0xa701 00157 #define STATUS_MOVE_Refused_OutOfResourcesSubOperations 0xa702 00158 #define STATUS_MOVE_Failed_SOPClassNotSupported 0xa800 00159 #define STATUS_MOVE_Failed_MoveDestinationUnknown 0xa801 00160 #define STATUS_MOVE_Failed_IdentifierDoesNotMatchSOPClass 0xa900 00161 #define STATUS_MOVE_Failed_UnableToProcess /* high nibble */ 0xc000 00162 #define STATUS_MOVE_Cancel_SubOperationsTerminatedDueToCancelIndication 0xfe00 00163 #define STATUS_MOVE_Warning_SubOperationsCompleteOneOrMoreFailures 0xb000 00164 00165 /* Get Specific Codes */ 00166 #define STATUS_GET_Refused_OutOfResourcesNumberOfMatches 0xa701 00167 #define STATUS_GET_Refused_OutOfResourcesSubOperations 0xa702 00168 #define STATUS_GET_Failed_SOPClassNotSupported 0xa800 00169 #define STATUS_GET_Failed_IdentifierDoesNotMatchSOPClass 0xa900 00170 #define STATUS_GET_Failed_UnableToProcess /* high nibble */ 0xc000 00171 #define STATUS_GET_Cancel_SubOperationsTerminatedDueToCancelIndication 0xfe00 00172 #define STATUS_GET_Warning_SubOperationsCompleteOneOrMoreFailures 0xb000 00173 00174 /* DIMSE-N Specific Codes */ 00175 #define STATUS_N_Cancel 0xFE00 00176 #define STATUS_N_AttributeListError 0x0107 00177 #define STATUS_N_SOPClassNotSupported 0x0122 00178 #define STATUS_N_ClassInstanceConflict 0x0119 00179 #define STATUS_N_DuplicateSOPInstance 0x0111 00180 #define STATUS_N_DuplicateInvocation 0x0210 00181 #define STATUS_N_InvalidArgumentValue 0x0115 00182 #define STATUS_N_InvalidAttributeValue 0x0106 00183 #define STATUS_N_InvalidObjectInstance 0x0117 00184 #define STATUS_N_MissingAttribute 0x0120 00185 #define STATUS_N_MissingAttributeValue 0x0121 00186 #define STATUS_N_MistypedArgument 0x0212 00187 #define STATUS_N_NoSuchArgument 0x0114 00188 #define STATUS_N_NoSuchAttribute 0x0105 00189 #define STATUS_N_NoSuchEventType 0x0113 00190 #define STATUS_N_NoSuchObjectInstance 0x0112 00191 #define STATUS_N_NoSuchSOPClass 0x0118 00192 #define STATUS_N_ProcessingFailure 0x0110 00193 #define STATUS_N_ResourceLimitation 0x0213 00194 #define STATUS_N_UnrecognizedOperation 0x0211 00195 #define STATUS_N_NoSuchAction 0x0123 00196 00197 /* Print Management Service Class Specific Codes */ 00198 #define STATUS_N_PRINT_BFS_Warn_MemoryAllocation 0xB600 00199 #define STATUS_N_PRINT_BFS_Warn_NoSessionPrinting 0xB601 00200 #define STATUS_N_PRINT_BFS_Warn_EmptyPage 0xB602 00201 #define STATUS_N_PRINT_BFB_Warn_EmptyPage 0xB603 00202 #define STATUS_N_PRINT_BFS_Fail_NoFilmBox 0xC600 00203 #define STATUS_N_PRINT_BFS_Fail_PrintQueueFull 0xC601 00204 #define STATUS_N_PRINT_BSB_Fail_PrintQueueFull 0xC602 00205 #define STATUS_N_PRINT_BFS_BFB_Fail_ImageSize 0xC603 00206 #define STATUS_N_PRINT_BFS_BFB_Fail_PositionCollision 0xC604 00207 #define STATUS_N_PRINT_IB_Fail_InsufficientMemory 0xC605 00208 #define STATUS_N_PRINT_IB_Fail_MoreThanOneVOILUT 0xC606 00209 00210 00211 /* 00212 * Type Definitions 00213 */ 00214 00215 00216 /* 00217 * DIMSE Command Codes (Request and Response) 00218 */ 00219 typedef enum { /* DIC_US */ 00220 DIMSE_NOTHING = 0x0000, /* none of the rest !! */ 00221 DIMSE_C_STORE_RQ = 0x0001, /* also known as C_SEND_RQ */ 00222 DIMSE_C_STORE_RSP = 0x8001, /* also known as C_SEND_RSP */ 00223 DIMSE_C_GET_RQ = 0x0010, 00224 DIMSE_C_GET_RSP = 0x8010, 00225 DIMSE_C_FIND_RQ = 0x0020, 00226 DIMSE_C_FIND_RSP = 0x8020, 00227 DIMSE_C_MOVE_RQ = 0x0021, 00228 DIMSE_C_MOVE_RSP = 0x8021, 00229 DIMSE_C_ECHO_RQ = 0x0030, 00230 DIMSE_C_ECHO_RSP = 0x8030, 00231 DIMSE_C_CANCEL_RQ = 0x0fff, 00232 /* there is no DIMSE_C_CANCEL_RSP */ 00233 00234 DIMSE_N_EVENT_REPORT_RQ = 0x0100, 00235 DIMSE_N_EVENT_REPORT_RSP = 0x8100, 00236 DIMSE_N_GET_RQ = 0x0110, 00237 DIMSE_N_GET_RSP = 0x8110, 00238 DIMSE_N_SET_RQ = 0x0120, 00239 DIMSE_N_SET_RSP = 0x8120, 00240 DIMSE_N_ACTION_RQ = 0x0130, 00241 DIMSE_N_ACTION_RSP = 0x8130, 00242 DIMSE_N_CREATE_RQ = 0x0140, 00243 DIMSE_N_CREATE_RSP = 0x8140, 00244 DIMSE_N_DELETE_RQ = 0x0150, 00245 DIMSE_N_DELETE_RSP = 0x8150 00246 } T_DIMSE_Command; 00247 00248 /* 00249 * DIMSE Data Set Type Codes 00250 */ 00251 00252 typedef enum { /* DIC_US */ 00253 DIMSE_DATASET_PRESENT = 0x0001, /* anything other than 0x0101) */ 00254 DIMSE_DATASET_NULL = 0x0101 00255 } T_DIMSE_DataSetType; 00256 00257 /* 00258 * DIMSE Priority Codes 00259 */ 00260 00261 typedef enum { /* DIC_US */ 00262 DIMSE_PRIORITY_LOW = 0x0002, 00263 DIMSE_PRIORITY_MEDIUM = 0x0000, 00264 DIMSE_PRIORITY_HIGH = 0x0001 00265 } T_DIMSE_Priority; 00266 00267 /* 00268 * DIMSE Blocking Modes (reading) 00269 */ 00270 00271 typedef enum { 00272 DIMSE_BLOCKING, 00273 DIMSE_NONBLOCKING 00274 } T_DIMSE_BlockingMode; 00275 00276 00277 /* 00278 * DIMSE Messages 00279 * 00280 */ 00281 00282 /* C-STORE */ 00283 00284 struct T_DIMSE_C_StoreRQ { 00285 DIC_US MessageID; /* M */ 00286 DIC_UI AffectedSOPClassUID; /* M */ 00287 T_DIMSE_Priority Priority; /* M */ 00288 T_DIMSE_DataSetType DataSetType; /* M */ 00289 DIC_UI AffectedSOPInstanceUID; /* M */ 00290 DIC_AE MoveOriginatorApplicationEntityTitle; /* U */ 00291 DIC_US MoveOriginatorID; /* U */ 00292 /* DataSet provided as argument to DIMSE functions */ /* M */ 00293 unsigned int opts; /* which optional items are set */ 00294 #define O_STORE_MOVEORIGINATORAETITLE 0x0001 00295 #define O_STORE_MOVEORIGINATORID 0x0002 00296 /* the following flag is set on incoming C-STORE requests if 00297 * the SOP instance UID is (incorrectly) padded with a space 00298 * character. Will only be detected if the dcmdata flag 00299 * dcmEnableAutomaticInputDataCorrection is false. 00300 */ 00301 #define O_STORE_RQ_BLANK_PADDING 0x0008 00302 }; 00303 00304 struct T_DIMSE_C_StoreRSP { 00305 DIC_US MessageIDBeingRespondedTo; /* M */ 00306 DIC_UI AffectedSOPClassUID; /* U(=) */ 00307 T_DIMSE_DataSetType DataSetType; /* M */ 00308 DIC_US DimseStatus; /* M */ 00309 DIC_UI AffectedSOPInstanceUID; /* U(=) */ 00310 unsigned int opts; /* which optional items are set */ 00311 #define O_STORE_AFFECTEDSOPCLASSUID 0x0001 00312 #define O_STORE_AFFECTEDSOPINSTANCEUID 0x0002 00313 /* peer requires an exact copy of the SOP instance UID 00314 * as it was sent in the C-STORE-RQ, 00315 * including any illegal trailing space padding. 00316 */ 00317 #define O_STORE_PEER_REQUIRES_EXACT_UID_COPY 0x0004 00318 /* SOP instance UID in C-STORE-RQ was space padded. */ 00319 #define O_STORE_RSP_BLANK_PADDING 0x0008 00320 } ; 00321 00322 /* C-ECHO */ 00323 00324 struct T_DIMSE_C_EchoRQ { 00325 DIC_US MessageID; /* M */ 00326 DIC_UI AffectedSOPClassUID; /* M */ 00327 T_DIMSE_DataSetType DataSetType; /* M */ 00328 } ; 00329 00330 struct T_DIMSE_C_EchoRSP { 00331 DIC_US MessageIDBeingRespondedTo; /* M */ 00332 DIC_UI AffectedSOPClassUID; /* U(=) */ 00333 T_DIMSE_DataSetType DataSetType; /* M */ 00334 DIC_US DimseStatus; /* M */ 00335 unsigned int opts; /* which optional items are set */ 00336 #define O_ECHO_AFFECTEDSOPCLASSUID 0x0001 00337 } ; 00338 00339 /* C-FIND */ 00340 00341 struct T_DIMSE_C_FindRQ { 00342 DIC_US MessageID; /* M */ 00343 DIC_UI AffectedSOPClassUID; /* M */ 00344 T_DIMSE_Priority Priority; /* M */ 00345 T_DIMSE_DataSetType DataSetType; /* M */ 00346 /* Identifier provided as argument to DIMSE functions *//* M */ 00347 } ; 00348 00349 struct T_DIMSE_C_FindRSP { 00350 DIC_US MessageIDBeingRespondedTo; /* M */ 00351 DIC_UI AffectedSOPClassUID; /* U(=) */ 00352 T_DIMSE_DataSetType DataSetType; /* M */ 00353 DIC_US DimseStatus; /* M */ 00354 /* Identifier provided as argument to DIMSE functions *//* C */ 00355 unsigned int opts; /* which optional items are set */ 00356 #define O_FIND_AFFECTEDSOPCLASSUID 0x0001 00357 } ; 00358 00359 /* C-GET */ 00360 00361 struct T_DIMSE_C_GetRQ { 00362 DIC_US MessageID; /* M */ 00363 DIC_UI AffectedSOPClassUID; /* M */ 00364 T_DIMSE_Priority Priority; /* M */ 00365 T_DIMSE_DataSetType DataSetType; /* M */ 00366 /* Identifier provided as argument to DIMSE functions *//* M */ 00367 } ; 00368 00369 struct T_DIMSE_C_GetRSP { 00370 DIC_US MessageIDBeingRespondedTo; /* M */ 00371 DIC_UI AffectedSOPClassUID; /* U(=) */ 00372 T_DIMSE_DataSetType DataSetType; /* M */ 00373 DIC_US DimseStatus; /* M */ 00374 DIC_US NumberOfRemainingSubOperations; /* C */ 00375 DIC_US NumberOfCompletedSubOperations; /* C */ 00376 DIC_US NumberOfFailedSubOperations; /* C */ 00377 DIC_US NumberOfWarningSubOperations; /* C */ 00378 unsigned int opts; /* which optional items are set */ 00379 #define O_GET_AFFECTEDSOPCLASSUID 0x0001 00380 #define O_GET_NUMBEROFREMAININGSUBOPERATIONS 0x0002 00381 #define O_GET_NUMBEROFCOMPLETEDSUBOPERATIONS 0x0004 00382 #define O_GET_NUMBEROFFAILEDSUBOPERATIONS 0x0008 00383 #define O_GET_NUMBEROFWARNINGSUBOPERATIONS 0x0010 00384 } ; 00385 00386 /* C-MOVE */ 00387 00388 struct T_DIMSE_C_MoveRQ { 00389 DIC_US MessageID; /* M */ 00390 DIC_UI AffectedSOPClassUID; /* M */ 00391 T_DIMSE_Priority Priority; /* M */ 00392 T_DIMSE_DataSetType DataSetType; /* M */ 00393 DIC_AE MoveDestination; /* M */ 00394 /* Identifier provided as argument to DIMSE functions *//* M */ 00395 } ; 00396 00397 struct T_DIMSE_C_MoveRSP { 00398 DIC_US MessageIDBeingRespondedTo; /* M */ 00399 DIC_UI AffectedSOPClassUID; /* U(=) */ 00400 T_DIMSE_DataSetType DataSetType; /* M */ 00401 DIC_US DimseStatus; /* M */ 00402 DIC_US NumberOfRemainingSubOperations; /* C */ 00403 DIC_US NumberOfCompletedSubOperations; /* C */ 00404 DIC_US NumberOfFailedSubOperations; /* C */ 00405 DIC_US NumberOfWarningSubOperations; /* C */ 00406 unsigned int opts; /* which optional items are set */ 00407 #define O_MOVE_AFFECTEDSOPCLASSUID 0x0001 00408 #define O_MOVE_NUMBEROFREMAININGSUBOPERATIONS 0x0002 00409 #define O_MOVE_NUMBEROFCOMPLETEDSUBOPERATIONS 0x0004 00410 #define O_MOVE_NUMBEROFFAILEDSUBOPERATIONS 0x0008 00411 #define O_MOVE_NUMBEROFWARNINGSUBOPERATIONS 0x0010 00412 } ; 00413 00414 00415 /* C-CANCEL */ 00416 00417 struct T_DIMSE_C_CancelRQ { 00418 DIC_US MessageIDBeingRespondedTo; /* M */ 00419 T_DIMSE_DataSetType DataSetType; /* M */ 00420 } ; 00421 00422 00423 /* N-EVENT-REPORT */ 00424 00425 struct T_DIMSE_N_EventReportRQ { 00426 DIC_US MessageID; /* M */ 00427 DIC_UI AffectedSOPClassUID; /* M */ 00428 DIC_UI AffectedSOPInstanceUID; /* M */ 00429 T_DIMSE_DataSetType DataSetType; /* M */ 00430 DIC_US EventTypeID; /* M */ 00431 /* EventInformation provided as argument to DIMSE functions *//* U */ 00432 } ; 00433 00434 struct T_DIMSE_N_EventReportRSP { 00435 DIC_US MessageIDBeingRespondedTo; /* M */ 00436 DIC_UI AffectedSOPClassUID; /* U(=) */ 00437 DIC_US DimseStatus; /* M */ 00438 DIC_UI AffectedSOPInstanceUID; /* U(=) */ 00439 T_DIMSE_DataSetType DataSetType; /* M */ 00440 DIC_US EventTypeID; /* C(=) */ 00441 /* EventReply provided as argument to DIMSE functions *//* C */ 00442 unsigned int opts; /* which optional items are set */ 00443 #define O_NEVENTREPORT_AFFECTEDSOPCLASSUID 0x0001 00444 #define O_NEVENTREPORT_AFFECTEDSOPINSTANCEUID 0x0002 00445 #define O_NEVENTREPORT_EVENTTYPEID 0x0004 00446 } ; 00447 00448 /* N-GET */ 00449 00450 struct T_DIMSE_N_GetRQ { 00451 DIC_US MessageID; /* M */ 00452 DIC_UI RequestedSOPClassUID; /* M */ 00453 DIC_UI RequestedSOPInstanceUID; /* M */ 00454 T_DIMSE_DataSetType DataSetType; /* M */ 00455 /* 00456 * In the following array, the attributes to get should be coded 00457 * in pairs along the array (e.g. {g,e,g,e,g,e,...}). The ListCount 00458 * variable should contain the number of 'DIC_US' values in the 00459 * array (not the number of pairs). 00460 */ 00461 int ListCount; 00462 DIC_US *AttributeIdentifierList; /* U */ 00463 } ; 00464 00465 struct T_DIMSE_N_GetRSP { 00466 DIC_US MessageIDBeingRespondedTo; /* M */ 00467 DIC_UI AffectedSOPClassUID; /* U */ 00468 DIC_US DimseStatus; /* M */ 00469 DIC_UI AffectedSOPInstanceUID; /* U */ 00470 T_DIMSE_DataSetType DataSetType; /* M */ 00471 /* AttributeList provided as argument to DIMSE functions *//* C */ 00472 unsigned int opts; /* which optional items are set */ 00473 #define O_NGET_AFFECTEDSOPCLASSUID 0x0001 00474 #define O_NGET_AFFECTEDSOPINSTANCEUID 0x0002 00475 } ; 00476 00477 /* N-SET */ 00478 00479 struct T_DIMSE_N_SetRQ { 00480 DIC_US MessageID; /* M */ 00481 DIC_UI RequestedSOPClassUID; /* M */ 00482 DIC_UI RequestedSOPInstanceUID; /* M */ 00483 T_DIMSE_DataSetType DataSetType; /* M */ 00484 /* ModificationList provided as argument to DIMSE functions *//* M */ 00485 } ; 00486 00487 struct T_DIMSE_N_SetRSP { 00488 DIC_US MessageIDBeingRespondedTo; /* M */ 00489 DIC_UI AffectedSOPClassUID; /* U */ 00490 DIC_US DimseStatus; /* M */ 00491 DIC_UI AffectedSOPInstanceUID; /* U */ 00492 T_DIMSE_DataSetType DataSetType; /* M */ 00493 /* AttributeList provided as argument to DIMSE functions *//* U */ 00494 unsigned int opts; /* which optional items are set */ 00495 #define O_NSET_AFFECTEDSOPCLASSUID 0x0001 00496 #define O_NSET_AFFECTEDSOPINSTANCEUID 0x0002 00497 } ; 00498 00499 /* N-ACTION */ 00500 00501 struct T_DIMSE_N_ActionRQ { 00502 DIC_US MessageID; /* M */ 00503 DIC_UI RequestedSOPClassUID; /* M */ 00504 DIC_UI RequestedSOPInstanceUID; /* M */ 00505 DIC_US ActionTypeID; /* M */ 00506 T_DIMSE_DataSetType DataSetType; /* M */ 00507 /* ActionInformation provided as argument to DIMSE functions *//* U */ 00508 } ; 00509 00510 struct T_DIMSE_N_ActionRSP { 00511 DIC_US MessageIDBeingRespondedTo; /* M */ 00512 DIC_UI AffectedSOPClassUID; /* U */ 00513 DIC_US DimseStatus; /* M */ 00514 DIC_UI AffectedSOPInstanceUID; /* U */ 00515 DIC_US ActionTypeID; /* C(=) */ 00516 T_DIMSE_DataSetType DataSetType; /* M */ 00517 /* ActionReply provided as argument to DIMSE functions *//* C */ 00518 unsigned int opts; /* which optional items are set */ 00519 #define O_NACTION_AFFECTEDSOPCLASSUID 0x0001 00520 #define O_NACTION_AFFECTEDSOPINSTANCEUID 0x0002 00521 #define O_NACTION_ACTIONTYPEID 0x0004 00522 } ; 00523 00524 /* N-CREATE */ 00525 00526 struct T_DIMSE_N_CreateRQ { 00527 DIC_US MessageID; /* M */ 00528 DIC_UI AffectedSOPClassUID; /* M */ 00529 DIC_UI AffectedSOPInstanceUID; /* U */ 00530 T_DIMSE_DataSetType DataSetType; /* M */ 00531 /* AttributeList provided as argument to DIMSE functions *//* M */ 00532 unsigned int opts; /* which optional items are set */ 00533 #define O_NCREATE_AFFECTEDSOPINSTANCEUID 0x0002 00534 } ; 00535 00536 struct T_DIMSE_N_CreateRSP { 00537 DIC_US MessageIDBeingRespondedTo; /* M */ 00538 DIC_UI AffectedSOPClassUID; /* U(=) */ 00539 DIC_US DimseStatus; /* M */ 00540 DIC_UI AffectedSOPInstanceUID; /* C */ 00541 T_DIMSE_DataSetType DataSetType; /* M */ 00542 /* AttributeList provided as argument to DIMSE functions *//* U */ 00543 unsigned int opts; /* which optional items are set */ 00544 #define O_NCREATE_AFFECTEDSOPCLASSUID 0x0001 00545 #define O_NCREATE_AFFECTEDSOPINSTANCEUID 0x0002 00546 } ; 00547 00548 /* N-DELETE */ 00549 00550 struct T_DIMSE_N_DeleteRQ { 00551 DIC_US MessageID; /* M */ 00552 DIC_UI RequestedSOPClassUID; /* M */ 00553 DIC_UI RequestedSOPInstanceUID; /* M */ 00554 T_DIMSE_DataSetType DataSetType; /* M */ 00555 } ; 00556 00557 struct T_DIMSE_N_DeleteRSP { 00558 DIC_US MessageIDBeingRespondedTo; /* M */ 00559 DIC_UI AffectedSOPClassUID; /* U */ 00560 DIC_US DimseStatus; /* M */ 00561 DIC_UI AffectedSOPInstanceUID; /* U */ 00562 T_DIMSE_DataSetType DataSetType; /* M */ 00563 unsigned int opts; /* which optional items are set */ 00564 #define O_NDELETE_AFFECTEDSOPCLASSUID 0x0001 00565 #define O_NDELETE_AFFECTEDSOPINSTANCEUID 0x0002 00566 } ; 00567 00568 00569 00570 /* 00571 * Composite DIMSE Message 00572 */ 00573 00574 struct T_DIMSE_Message { 00575 T_DIMSE_Command CommandField; /* M */ 00576 00577 union { 00578 /* requests */ 00579 T_DIMSE_C_StoreRQ CStoreRQ; 00580 T_DIMSE_C_EchoRQ CEchoRQ; 00581 T_DIMSE_C_FindRQ CFindRQ; 00582 T_DIMSE_C_GetRQ CGetRQ; 00583 T_DIMSE_C_MoveRQ CMoveRQ; 00584 T_DIMSE_C_CancelRQ CCancelRQ; 00585 T_DIMSE_N_EventReportRQ NEventReportRQ; 00586 T_DIMSE_N_GetRQ NGetRQ; 00587 T_DIMSE_N_SetRQ NSetRQ; 00588 T_DIMSE_N_ActionRQ NActionRQ; 00589 T_DIMSE_N_CreateRQ NCreateRQ; 00590 T_DIMSE_N_DeleteRQ NDeleteRQ; 00591 00592 /* responses */ 00593 T_DIMSE_C_StoreRSP CStoreRSP; 00594 T_DIMSE_C_EchoRSP CEchoRSP; 00595 T_DIMSE_C_FindRSP CFindRSP; 00596 T_DIMSE_C_GetRSP CGetRSP; 00597 T_DIMSE_C_MoveRSP CMoveRSP; 00598 T_DIMSE_N_EventReportRSP NEventReportRSP; 00599 T_DIMSE_N_GetRSP NGetRSP; 00600 T_DIMSE_N_SetRSP NSetRSP; 00601 T_DIMSE_N_ActionRSP NActionRSP; 00602 T_DIMSE_N_CreateRSP NCreateRSP; 00603 T_DIMSE_N_DeleteRSP NDeleteRSP; 00604 } msg; 00605 00606 }; 00607 00608 00609 /* 00610 * Globale Variables 00611 */ 00612 00613 /* 00614 * Define global defaults for data encoding when sending out data-sets. 00615 * These can be adjusted to allow variants to be tested. 00616 */ 00617 00618 extern E_GrpLenEncoding g_dimse_send_groupLength_encoding; /* default: EGL_recalcGL */ 00619 extern E_EncodingType g_dimse_send_sequenceType_encoding; /* default: EET_ExplicitLength */ 00620 00621 /* 00622 * If this global flag is set to OFTrue, all DIMSE messages sent or received 00623 * are stored in files with the name 00624 * "dimse-TTT-DDD-XXXX.dcm" or "dimse-TTT-DDD-XXXX-YY.dcm", where 00625 * TTT is "cmd" for a command set, or "dat" for a data set 00626 * DDD is "snd" for data sent, or "rcv" for data received 00627 * XXXX is a counter, starting at 1 (global for all associations) 00628 * YY is an additional counter used if multiple datasets follow a single command set 00629 * The files are in implicit VR little endian encoding, without meta-header. 00630 */ 00631 00632 extern OFBool g_dimse_save_dimse_data; /* default: OFFalse */ 00633 00634 /* 00635 * Public Function Prototypes 00636 */ 00637 00638 00639 /* 00640 * High Level DIMSE Messaging. 00641 */ 00642 00643 /* 00644 * General Information. 00645 * 00646 * Many of the DIMSE routines take parameters for a blocking mode 00647 * and a timeout. In all cases, these parameters are only used 00648 * when receiving commands or data sets (reading). There are no blocking 00649 * and timeout options for send operations. 00650 * When receiving commands or data sets: 00651 * If the parameter blockMode is DIMSE_BLOCKING, the DIMSE routine 00652 * will wait until a response arrives before returning. 00653 * If the parameter blockMode is DIMSE_NONBLOCKING then the DIMSE routine 00654 * will wait at most timeout seconds for a response and if no response arrives 00655 * will return DIMSE_NODATAAVAILABLE. In both cases waiting will be 00656 * interupted by association release, and abort messages, or network 00657 * disruption. 00658 */ 00659 00660 00661 /* 00662 * Verification Service Class 00663 */ 00664 00665 OFCondition 00666 DIMSE_echoUser( 00667 /* in */ 00668 T_ASC_Association *assoc, DIC_US msgId, 00669 /* blocking info for response */ 00670 T_DIMSE_BlockingMode blockMode, int timeout, 00671 /* out */ 00672 DIC_US *status, DcmDataset **statusDetail); 00673 00674 OFCondition 00675 DIMSE_sendEchoResponse(T_ASC_Association * assoc, 00676 T_ASC_PresentationContextID presID, 00677 T_DIMSE_C_EchoRQ *request, DIC_US status, DcmDataset *statusDetail); 00678 00679 00680 /* 00681 * Storage Service Class 00682 */ 00683 00684 typedef enum { 00685 DIMSE_StoreBegin, /* before data set */ 00686 DIMSE_StoreProgressing, /* during data set */ 00687 DIMSE_StoreEnd /* after data set */ 00688 } T_DIMSE_StoreProgressState; 00689 00690 struct T_DIMSE_StoreProgress { /* progress structure for store callback routines */ 00691 T_DIMSE_StoreProgressState state; /* current state */ 00692 long callbackCount; /* callback execution count */ 00693 long progressBytes; /* sent/received so far */ 00694 long totalBytes; /* total/estimated total to send/receive */ 00695 } ; 00696 00697 00698 typedef void (*DIMSE_StoreUserCallback)( 00699 void *callbackData, 00700 T_DIMSE_StoreProgress *progress, 00701 T_DIMSE_C_StoreRQ *request /* original store request */ 00702 ); 00703 00704 struct T_DIMSE_DetectedCancelParameters { 00705 OFBool cancelEncountered; 00706 T_ASC_PresentationContextID presId; 00707 T_DIMSE_C_CancelRQ req; 00708 } ; 00709 00710 OFCondition 00711 DIMSE_storeUser( 00712 /* in */ 00713 T_ASC_Association *assoc, T_ASC_PresentationContextID presId, 00714 T_DIMSE_C_StoreRQ *request, 00715 const char *imageFileName, DcmDataset *imageDataSet, 00716 DIMSE_StoreUserCallback callback, void *callbackData, 00717 /* blocking info for response */ 00718 T_DIMSE_BlockingMode blockMode, int timeout, 00719 /* out */ 00720 T_DIMSE_C_StoreRSP *response, 00721 DcmDataset **statusDetail, 00722 T_DIMSE_DetectedCancelParameters *checkForCancelParams = NULL, 00723 /* in */ 00724 long imageFileTotalBytes=0); 00725 00726 typedef void (*DIMSE_StoreProviderCallback)( 00727 /* in */ 00728 void *callbackData, 00729 T_DIMSE_StoreProgress *progress, /* progress state */ 00730 T_DIMSE_C_StoreRQ *request, /* original store request */ 00731 char *imageFileName, DcmDataset **imageDataSet, /* being received into */ 00732 /* in/out */ 00733 T_DIMSE_C_StoreRSP *response, /* final store response */ 00734 /* out */ 00735 DcmDataset **statusDetail); 00736 00737 OFCondition 00738 DIMSE_storeProvider(/* in */ 00739 T_ASC_Association *assoc, 00740 T_ASC_PresentationContextID presIdCmd, 00741 T_DIMSE_C_StoreRQ *request, 00742 const char* imageFileName, int writeMetaheader, 00743 DcmDataset **imageDataSet, 00744 DIMSE_StoreProviderCallback callback, void *callbackData, 00745 /* blocking info for data set */ 00746 T_DIMSE_BlockingMode blockMode, int timeout); 00747 00748 OFCondition 00749 DIMSE_sendStoreResponse(T_ASC_Association * assoc, 00750 T_ASC_PresentationContextID presID, 00751 T_DIMSE_C_StoreRQ *request, /* send response to this request */ 00752 T_DIMSE_C_StoreRSP *response, /* response structure */ 00753 DcmDataset *statusDetail); 00754 00755 /* 00756 * Query/Retrieve Service Class (FIND) 00757 */ 00758 00759 00760 typedef void (*DIMSE_FindUserCallback)( 00761 /* in */ 00762 void *callbackData, 00763 T_DIMSE_C_FindRQ *request, /* original find request */ 00764 int responseCount, 00765 T_DIMSE_C_FindRSP *response, /* pending response received */ 00766 DcmDataset *responseIdentifiers /* pending response identifiers */ 00767 ); 00768 00769 OFCondition 00770 DIMSE_findUser( 00771 /* in */ 00772 T_ASC_Association *assoc, 00773 T_ASC_PresentationContextID presID, 00774 T_DIMSE_C_FindRQ *request, DcmDataset *requestIdentifiers, 00775 DIMSE_FindUserCallback callback, void *callbackData, 00776 /* blocking info for response */ 00777 T_DIMSE_BlockingMode blockMode, int timeout, 00778 /* out */ 00779 T_DIMSE_C_FindRSP *response, DcmDataset **statusDetail); 00780 00781 typedef void (*DIMSE_FindProviderCallback)( 00782 /* in */ 00783 void *callbackData, 00784 OFBool cancelled, T_DIMSE_C_FindRQ *request, 00785 DcmDataset *requestIdentifiers, int responseCount, 00786 /* out */ 00787 T_DIMSE_C_FindRSP *response, 00788 DcmDataset **responseIdentifiers, 00789 DcmDataset **statusDetail); 00790 00791 OFCondition 00792 DIMSE_findProvider( 00793 /* in */ 00794 T_ASC_Association *assoc, 00795 T_ASC_PresentationContextID presIdCmd, 00796 T_DIMSE_C_FindRQ *request, 00797 DIMSE_FindProviderCallback callback, void *callbackData, 00798 /* blocking info for data set */ 00799 T_DIMSE_BlockingMode blockMode, int timeout); 00800 00801 OFCondition 00802 DIMSE_sendFindResponse(T_ASC_Association * assoc, 00803 T_ASC_PresentationContextID presID, 00804 T_DIMSE_C_FindRQ *request, 00805 T_DIMSE_C_FindRSP *response, DcmDataset *responseIdentifiers, 00806 DcmDataset *statusDetail); 00807 00808 /* 00809 * Query/Retrieve Service Class (MOVE) 00810 */ 00811 00812 typedef void (*DIMSE_MoveUserCallback)( 00813 /* in */ 00814 void *callbackData, 00815 T_DIMSE_C_MoveRQ *request, 00816 int responseCount, T_DIMSE_C_MoveRSP *response); 00817 00818 typedef void (*DIMSE_SubOpProviderCallback)(void *subOpCallbackData, 00819 T_ASC_Network *net, T_ASC_Association **subOpAssoc); 00820 00821 OFCondition 00822 DIMSE_moveUser( 00823 /* in */ 00824 T_ASC_Association *assoc, 00825 T_ASC_PresentationContextID presID, 00826 T_DIMSE_C_MoveRQ *request, 00827 DcmDataset *requestIdentifiers, 00828 DIMSE_MoveUserCallback callback, void *callbackData, 00829 /* blocking info for response */ 00830 T_DIMSE_BlockingMode blockMode, int timeout, 00831 /* sub-operation provider callback */ 00832 T_ASC_Network *net, 00833 DIMSE_SubOpProviderCallback subOpCallback, void *subOpCallbackData, 00834 /* out */ 00835 T_DIMSE_C_MoveRSP *response, DcmDataset **statusDetail, 00836 DcmDataset **responseIdentifers, 00837 OFBool ignorePendingDatasets = OFFalse); 00838 00839 typedef void (*DIMSE_MoveProviderCallback)( 00840 /* in */ 00841 void *callbackData, 00842 OFBool cancelled, T_DIMSE_C_MoveRQ *request, 00843 DcmDataset *requestIdentifiers, int responseCount, 00844 /* out */ 00845 T_DIMSE_C_MoveRSP *response, DcmDataset **statusDetail, 00846 DcmDataset **responseIdentifiers); 00847 00848 OFCondition 00849 DIMSE_moveProvider( 00850 /* in */ 00851 T_ASC_Association *assoc, 00852 T_ASC_PresentationContextID presIdCmd, 00853 T_DIMSE_C_MoveRQ *request, 00854 DIMSE_MoveProviderCallback callback, void *callbackData, 00855 /* blocking info for data set */ 00856 T_DIMSE_BlockingMode blockMode, int timeout); 00857 00858 OFCondition 00859 DIMSE_sendMoveResponse(T_ASC_Association * assoc, 00860 T_ASC_PresentationContextID presID, T_DIMSE_C_MoveRQ *request, 00861 T_DIMSE_C_MoveRSP *response, DcmDataset *rspIds, 00862 DcmDataset *statusDetail); 00863 00864 /* 00865 * Query/Retrieve Service Class (GET) 00866 */ 00867 00868 typedef void (*DIMSE_GetUserCallback)( 00869 /* in */ 00870 void *callbackData, 00871 T_DIMSE_C_GetRQ *request, 00872 int responseCount, T_DIMSE_C_GetRSP *response); 00873 00874 typedef void (*DIMSE_SubOpProviderCallback)(void *subOpCallbackData, 00875 T_ASC_Network *net, T_ASC_Association **subOpAssoc); 00876 00877 OFCondition 00878 DIMSE_getUser( 00879 /* in */ 00880 T_ASC_Association *assoc, 00881 T_ASC_PresentationContextID presID, 00882 T_DIMSE_C_GetRQ *request, 00883 DcmDataset *requestIdentifiers, 00884 DIMSE_GetUserCallback callback, void *callbackData, 00885 /* blocking info for response */ 00886 T_DIMSE_BlockingMode blockMode, int timeout, 00887 /* sub-operation provider callback */ 00888 T_ASC_Network *net, 00889 DIMSE_SubOpProviderCallback subOpCallback, void *subOpCallbackData, 00890 /* out */ 00891 T_DIMSE_C_GetRSP *response, DcmDataset **statusDetail, 00892 DcmDataset **responseIdentifers); 00893 00894 typedef void (*DIMSE_GetProviderCallback)( 00895 /* in */ 00896 void *callbackData, 00897 OFBool cancelled, T_DIMSE_C_GetRQ *request, 00898 DcmDataset *requestIdentifiers, int responseCount, 00899 /* out */ 00900 T_DIMSE_C_GetRSP *response, DcmDataset **statusDetail, 00901 DcmDataset **responseIdentifiers); 00902 00903 OFCondition 00904 DIMSE_getProvider( 00905 /* in */ 00906 T_ASC_Association *assoc, 00907 T_ASC_PresentationContextID presIdCmd, 00908 T_DIMSE_C_GetRQ *request, 00909 DIMSE_GetProviderCallback callback, void *callbackData, 00910 /* blocking info for data set */ 00911 T_DIMSE_BlockingMode blockMode, int timeout); 00912 00913 OFCondition 00914 DIMSE_sendGetResponse(T_ASC_Association * assoc, 00915 T_ASC_PresentationContextID presID, T_DIMSE_C_GetRQ *request, 00916 T_DIMSE_C_GetRSP *response, DcmDataset *rspIds, 00917 DcmDataset *statusDetail); 00918 00919 /* 00920 * Query/Retrieve Service Class (CANCEL) 00921 */ 00922 00923 OFCondition 00924 DIMSE_sendCancelRequest(T_ASC_Association * assoc, 00925 T_ASC_PresentationContextID presId, DIC_US msgId); 00926 00927 OFCondition 00928 DIMSE_checkForCancelRQ(T_ASC_Association * assoc, 00929 T_ASC_PresentationContextID presId, DIC_US msgId); 00930 00931 00932 /**** 00933 * 00934 * Low Level DIMSE Messaging 00935 * With the exception of DIMSE_receiveCommand, 00936 * the following function are only intended for use if you 00937 * wish to implement an alternative interface to the 00938 * higher level routines provided above. 00939 * Service call providers will have to use DIMSE_receiveCommand 00940 * before calling the appropriate provider routine declared above. 00941 * 00942 */ 00943 00944 00945 typedef void (*DIMSE_ProgressCallback)(void *callbackContext, 00946 unsigned long byteCount); 00947 00948 00949 OFCondition 00950 DIMSE_sendMessageUsingFileData(T_ASC_Association *association, 00951 T_ASC_PresentationContextID presID, 00952 T_DIMSE_Message *msg, DcmDataset *statusDetail, 00953 const char* dataFileName, 00954 DIMSE_ProgressCallback callback, 00955 void *callbackContext, 00956 DcmDataset **commandSet=NULL); 00957 00958 OFCondition 00959 DIMSE_sendMessageUsingMemoryData(T_ASC_Association *association, 00960 T_ASC_PresentationContextID presID, 00961 T_DIMSE_Message *msg, DcmDataset *statusDetail, 00962 DcmDataset *dataObject, 00963 DIMSE_ProgressCallback callback, 00964 void *callbackContext, 00965 DcmDataset **commandSet=NULL); 00966 00967 OFCondition 00968 DIMSE_receiveCommand(T_ASC_Association *association, 00969 T_DIMSE_BlockingMode blocking, 00970 int timeout, 00971 T_ASC_PresentationContextID *presID, 00972 T_DIMSE_Message *msg, 00973 DcmDataset **statusDetail, 00974 DcmDataset **commandSet=NULL); 00975 00976 OFCondition 00977 DIMSE_receiveDataSetInMemory(T_ASC_Association *association, 00978 T_DIMSE_BlockingMode blocking, 00979 int timeout, 00980 T_ASC_PresentationContextID *presID, 00981 DcmDataset **dataObject, 00982 DIMSE_ProgressCallback callback, 00983 void *callbackContext); 00984 00985 OFCondition 00986 DIMSE_createFilestream( 00987 /* in */ 00988 const char *filename, 00989 const T_DIMSE_C_StoreRQ *request, 00990 const T_ASC_Association *assoc, 00991 T_ASC_PresentationContextID presIdCmd, 00992 int writeMetaheader, 00993 /* out */ 00994 DcmOutputFileStream **filestream); 00995 00996 OFCondition 00997 DIMSE_receiveDataSetInFile(T_ASC_Association *assoc, 00998 T_DIMSE_BlockingMode blocking, int timeout, 00999 T_ASC_PresentationContextID *presID, 01000 DcmOutputStream *filestream, 01001 DIMSE_ProgressCallback callback, void *callbackData); 01002 01003 OFCondition 01004 DIMSE_ignoreDataSet( T_ASC_Association * assoc, 01005 T_DIMSE_BlockingMode blocking, 01006 int timeout, 01007 DIC_UL * bytesRead, 01008 DIC_UL * pdvCount); 01009 01010 /* 01011 * Misc functions 01012 */ 01013 01014 OFString DIMSE_warn_str(T_ASC_Association *assoc); 01015 01016 enum DIMSE_direction { 01017 DIMSE_INCOMING, 01018 DIMSE_OUTGOING 01019 }; 01020 01021 /* Debugging functions for printing contents of a command structure */ 01022 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_Message &msg, 01023 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01024 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_EchoRQ &msg, 01025 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01026 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_EchoRSP &msg, 01027 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01028 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_GetRQ &msg, 01029 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01030 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_GetRSP &msg, 01031 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01032 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_MoveRQ &msg, 01033 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01034 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_MoveRSP &msg, 01035 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01036 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_FindRQ &msg, 01037 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01038 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_FindRSP &msg, 01039 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01040 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_StoreRQ &msg, 01041 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01042 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_StoreRSP &msg, 01043 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01044 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_C_CancelRQ &msg, 01045 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01046 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_EventReportRQ &msg, 01047 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01048 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_EventReportRSP &msg, 01049 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01050 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_GetRQ &msg, 01051 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01052 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_GetRSP &msg, 01053 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01054 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_SetRQ &msg, 01055 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01056 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_SetRSP &msg, 01057 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01058 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_ActionRQ &msg, 01059 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01060 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_ActionRSP &msg, 01061 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01062 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_CreateRQ &msg, 01063 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01064 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_CreateRSP &msg, 01065 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01066 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_DeleteRQ &msg, 01067 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01068 OFString& DIMSE_dumpMessage(OFString &str, T_DIMSE_N_DeleteRSP &msg, 01069 enum DIMSE_direction dir, DcmItem *dataset = NULL, T_ASC_PresentationContextID presID = 0); 01070 01071 01072 // Compatibility wrapper 01073 #define DIMSE_COMPAT_WRAP(func, type) \ 01074 static inline void func (FILE * f, type * msg) \ 01075 { \ 01076 OFString str; \ 01077 DIMSE_dumpMessage(str, *msg, DIMSE_INCOMING); \ 01078 fprintf(f, "%s\n", str.c_str()); \ 01079 } 01080 #define DIMSE_COMPAT_WRAP_R(func, type) \ 01081 DIMSE_COMPAT_WRAP(func ## RQ, type ## RQ) \ 01082 DIMSE_COMPAT_WRAP(func ## RSP, type ## RSP) 01083 01084 static inline void DIMSE_printMessage(STD_NAMESPACE ostream& ostream, T_DIMSE_Message &msg, DcmItem *dataset = NULL) 01085 { 01086 OFString str; 01087 ostream << DIMSE_dumpMessage(str, msg, DIMSE_INCOMING, dataset) << OFendl; 01088 } 01089 01090 DIMSE_COMPAT_WRAP(DIMSE_printCommand, T_DIMSE_Message) 01091 DIMSE_COMPAT_WRAP_R(DIMSE_printCEcho, T_DIMSE_C_Echo) 01092 DIMSE_COMPAT_WRAP_R(DIMSE_printCStore, T_DIMSE_C_Store) 01093 DIMSE_COMPAT_WRAP_R(DIMSE_printCGet, T_DIMSE_C_Get) 01094 DIMSE_COMPAT_WRAP_R(DIMSE_printCMove, T_DIMSE_C_Move) 01095 DIMSE_COMPAT_WRAP_R(DIMSE_printCFind, T_DIMSE_C_Find) 01096 DIMSE_COMPAT_WRAP(DIMSE_printCCancelRQ, T_DIMSE_C_EchoRQ) 01097 DIMSE_COMPAT_WRAP_R(DIMSE_printNEventReport, T_DIMSE_N_EventReport) 01098 DIMSE_COMPAT_WRAP_R(DIMSE_printNGet, T_DIMSE_N_Get) 01099 DIMSE_COMPAT_WRAP_R(DIMSE_printNSet, T_DIMSE_N_Set) 01100 DIMSE_COMPAT_WRAP_R(DIMSE_printNAction, T_DIMSE_N_Action) 01101 DIMSE_COMPAT_WRAP_R(DIMSE_printNCreate, T_DIMSE_N_Create) 01102 DIMSE_COMPAT_WRAP_R(DIMSE_printNDelete, T_DIMSE_N_Delete) 01103 01104 #undef DIMSE_COMPAT_WRAP 01105 #undef DIMSE_COMPAT_WRAP_R 01106 01107 #endif 01108 01109 /* 01110 ** CVS Log 01111 ** $Log: dimse.h,v $ 01112 ** Revision 1.23 2010-12-01 08:26:10 joergr 01113 ** Added OFFIS copyright header (beginning with the year 1994). 01114 ** 01115 ** Revision 1.22 2010-10-14 13:17:22 joergr 01116 ** Updated copyright header. Added reference to COPYRIGHT file. 01117 ** 01118 ** Revision 1.21 2009-11-18 11:53:58 uli 01119 ** Switched to logging mechanism provided by the "new" oflog module. 01120 ** 01121 ** Revision 1.20 2009-08-04 10:07:48 joergr 01122 ** Added optional parameter to printCStore() functions that allows for printing 01123 ** the Presentation Context ID. 01124 ** 01125 ** Revision 1.19 2007/07/12 12:18:00 onken 01126 ** Added status codes and corresponding printing routines for DIMSE-N. 01127 ** 01128 ** Revision 1.18 2006/08/15 16:04:29 meichel 01129 ** Updated the code in module dcmnet to correctly compile when 01130 ** all standard C++ classes remain in namespace std. 01131 ** 01132 ** Revision 1.17 2005/12/08 16:02:21 meichel 01133 ** Changed include path schema for all DCMTK header files 01134 ** 01135 ** Revision 1.16 2005/11/22 16:44:44 meichel 01136 ** Added option to movescu that allows graceful handling of Move SCPs 01137 ** that send illegal datasets following pending C-MOVE-RSP messages. 01138 ** 01139 ** Revision 1.15 2005/02/22 09:40:55 meichel 01140 ** Fixed two bugs in "bit-preserving" Store SCP code. Errors while creating or 01141 ** writing the DICOM file (e.g. file system full) now result in a DIMSE error 01142 ** response (out of resources) being sent back to the SCU. 01143 ** 01144 ** Revision 1.14 2003/08/27 15:03:33 meichel 01145 ** Changed anonymous struct typedefs into struct declarations 01146 ** 01147 ** Revision 1.13 2002/09/10 16:00:47 meichel 01148 ** Added global flag dcmMaxOutgoingPDUSize that allows to restrict the maximum 01149 ** size of outgoiung P-DATA PDUs to a value less than the maximum supported by 01150 ** the remote application entity or this library. May be useful if there is an 01151 ** interaction between PDU size and other network layers, e. g. TLS, IP or 01152 ** below. 01153 ** 01154 ** Revision 1.12 2002/08/27 17:00:59 meichel 01155 ** Initial release of new DICOM I/O stream classes that add support for stream 01156 ** compression (deflated little endian explicit VR transfer syntax) 01157 ** 01158 ** Revision 1.11 2001/10/12 10:18:26 meichel 01159 ** Replaced the CONDITION types, constants and functions in the dcmnet module 01160 ** by an OFCondition based implementation which eliminates the global condition 01161 ** stack. This is a major change, caveat emptor! 01162 ** 01163 ** Revision 1.10 2000/12/15 13:28:16 meichel 01164 ** Global flag to enable/disable workaround code for some buggy Store SCUs 01165 ** in DIMSE_storeProvider(). If enabled, an illegal space-padding in the 01166 ** Affected SOP Instance UID field of the C-STORE-RQ message is retained 01167 ** in the corresponding C-STORE-RSP message. 01168 ** 01169 ** Revision 1.9 2000/06/07 08:57:52 meichel 01170 ** dcmnet DIMSE routines now allow to retrieve raw command sets as DcmDataset 01171 ** objects, e.g. for logging purposes. Added enhanced message dump functions. 01172 ** 01173 ** Revision 1.8 2000/01/31 17:14:17 meichel 01174 ** ntroduced new flag g_dimse_save_dimse_data. If enabled, all DIMSE messages 01175 ** and data sets sent or received are stored in files. 01176 ** This facilitates debugging of DIMSE problems. 01177 ** 01178 ** Revision 1.7 1999/04/19 08:36:48 meichel 01179 ** Added support for C-FIND-CANCEL/C-MOVE-CANCEL in DIMSE_storeUser(). 01180 ** 01181 ** Revision 1.6 1998/08/10 08:53:40 meichel 01182 ** renamed member variable in DIMSE structures from "Status" to 01183 ** "DimseStatus". This is required if dcmnet is used together with 01184 ** <X11/Xlib.h> where Status is #define'd as int. 01185 ** 01186 ** Revision 1.5 1998/06/29 12:14:26 meichel 01187 ** Removed some name clashes (e.g. local variable with same 01188 ** name as class member) to improve maintainability. 01189 ** Applied some code purifications proposed by the gcc 2.8.1 -Weffc++ option. 01190 ** 01191 ** Revision 1.4 1997/07/21 08:40:10 andreas 01192 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL) 01193 ** with one unique boolean type OFBool. 01194 ** 01195 ** Revision 1.3 1997/05/23 10:47:06 meichel 01196 ** Major rewrite of storescp application. See CHANGES for details. 01197 ** Changes required to interfaces of some DIMSE functions. 01198 ** 01199 ** Revision 1.2 1996/04/25 16:06:28 hewett 01200 ** Replaced declarations of DIC_UL with unsigned long. 01201 ** 01202 ** Revision 1.1.1.1 1996/03/26 18:38:45 hewett 01203 ** Initial Release. 01204 ** 01205 ** 01206 */