dcmnet/include/dcmtk/dcmnet/dimse.h

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


Generated on 30 Nov 2010 for OFFIS DCMTK Version 3.5.5 20101130 by Doxygen 1.5.1