dcmnet/libsrc/dulstruc.h

00001 /*
00002           Copyright (C) 1993, 1994, RSNA and Washington University
00003 
00004           The software and supporting documentation for the Radiological
00005           Society of North America (RSNA) 1993, 1994 Digital Imaging and
00006           Communications in Medicine (DICOM) Demonstration were developed
00007           at the
00008                   Electronic Radiology Laboratory
00009                   Mallinckrodt Institute of Radiology
00010                   Washington University School of Medicine
00011                   510 S. Kingshighway Blvd.
00012                   St. Louis, MO 63110
00013           as part of the 1993, 1994 DICOM Central Test Node project for, and
00014           under contract with, the Radiological Society of North America.
00015 
00016           THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER RSNA NOR
00017           WASHINGTON UNIVERSITY MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS
00018           PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
00019           USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY
00020           SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF
00021           THE SOFTWARE IS WITH THE USER.
00022 
00023           Copyright of the software and supporting documentation is
00024           jointly owned by RSNA and Washington University, and free access
00025           is hereby granted as a license to use this software, copy this
00026           software and prepare derivative works based upon this software.
00027           However, any distribution of this software source code or
00028           supporting documentation or derivative works (source code and
00029           supporting documentation) must include the three paragraphs of
00030           the copyright notice.
00031 */
00032 /* Copyright marker.  Copyright will be inserted above.  Do not remove */
00033 /*
00034 ** @$=@$=@$=
00035 */
00036 /*
00037 **        DICOM 93
00038 **         Electronic Radiology Laboratory
00039 **       Mallinckrodt Institute of Radiology
00040 **    Washington University School of Medicine
00041 **
00042 ** Module Name(s):
00043 ** Author, Date:  Stephen M. Moore, 19-May-93
00044 ** Intent:
00045 **  This header contains private typedefs for the DICOM Upper Layer
00046 **  (DUL) protocol package.  This is to be used to compile the DUL
00047 **  package and is not intended to be seen by the applications programmer.
00048 **  Files at the package level should include this file to get the
00049 **  proper typedefs and include the public file "dulprotocol.h" to
00050 **  get the public definitions and function prototypes.  I have omitted
00051 **  the public definitions and prototypes on purpose so that they
00052 **  exist in only one location.
00053 ** Last Update:   $Author: joergr $, $Date: 2010-10-14 13:19:29 $
00054 ** Revision:    $Revision: 1.12 $
00055 ** Status:    $State: Exp $
00056 */
00057 
00058 #ifndef DULSTRUC_H
00059 #define DULSTRUC_H
00060 
00061 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
00062 #include "dcmtk/dcmnet/extneg.h"
00063 #include "dcmtk/dcmnet/dcuserid.h"
00064 
00065 class DcmTransportConnection;
00066 class DcmTransportLayer;
00067 
00068 #define NETWORK_DISCONNECTED  2
00069 #define NETWORK_CONNECTED 3
00070 
00071 typedef enum {
00072     DUL_ASSOC_WAITINGFORACK,
00073     DUL_ASSOC_ESTABLISHED,
00074     DUL_ASSOC_RELEASED,
00075     DUL_ASSOC_ABORTED,
00076     DUL_ASSOC_DROPPED
00077 }   DUL_ASSOC_STATE;
00078 
00079 #define ASSOCIATION_DISCONNECTED  2
00080 #define ASSOCIATION_ABORTED   4
00081 #define ASSOCIATION_RELEASED    5
00082 
00083 typedef struct {
00084     char keyType[40];
00085     int applicationFunction;
00086     int networkState;
00087     int protocolState;
00088     int timeout;
00089     unsigned long options;
00090     union {
00091   struct {
00092       int port;
00093       int listenSocket;
00094             DcmTransportLayer *tLayer;
00095             int tLayerOwned;
00096   }   TCP;
00097     }   networkSpecific;
00098 }   PRIVATE_NETWORKKEY;
00099 
00100 typedef struct {
00101     char keyType[40];
00102     int applicationFunction;
00103     char remoteNode[64];
00104     DUL_ASSOC_STATE associationState;
00105     int protocolState;
00106     int networkState;
00107     int timeout;
00108     time_t timerStart;
00109     unsigned long maxPDVRequestor;
00110     unsigned long maxPDVAcceptor;
00111     unsigned long maxPDV;
00112     unsigned long maxPDVInput;
00113     unsigned long receiveQp1;
00114     unsigned long receiveQp2;
00115     char calledAPTitle[20];
00116     char callingAPTitle[20];
00117     char applicationContextName[68];
00118     char abstractSyntaxName[68];
00119     void *receivePDUQueue;
00120     DUL_PRESENTATIONCONTEXTID presentationContextID;
00121     DcmTransportConnection *connection;
00122     DUL_PDVLIST pdvList;
00123     int inputPDU;
00124     unsigned char pduHead[6];
00125     unsigned char nextPDUType;
00126     unsigned char nextPDUReserved;
00127     unsigned long nextPDULength;
00128     unsigned long compatibilityMode;
00129     int pdvCount;
00130     int pdvIndex;
00131     void *logHandle;
00132     int associatePDUFlag;
00133     void *associatePDU;
00134     unsigned long associatePDULength;
00135     DUL_PDV currentPDV;
00136     unsigned char *pdvPointer;
00137     unsigned long fragmentBufferLength;
00138     unsigned char *fragmentBuffer;
00139     DUL_ModeCallback *modeCallback;
00140 }   PRIVATE_ASSOCIATIONKEY;
00141 
00142 #define KEY_NETWORK "KEY NETWORK"
00143 #define KEY_ASSOCIATION "KEY ASSOCIATION"
00144 
00145 #define AE_REQUESTOR  "AE REQUESTOR"
00146 #define AE_ACCEPTOR "AE ACCEPTOR"
00147 #define AE_BOTH   "AE BOTH"
00148 
00149 #define NO_PDU    1
00150 #define PDU_HEAD  2
00151 #define PDU_DATA  2
00152 
00153 /* Default timeout for waiting for PDUs.  100 seconds is high,
00154 ** but used for development so we have time to do things with the
00155 ** debugger.  A lower value would be used in a production system.
00156 */
00157 
00158 #define DEFAULT_TIMEOUT     100
00159 
00160 /*  Private definitions */
00161 
00162 typedef struct dul_subitem {
00163     void *reserved[2];
00164     unsigned char type;
00165     unsigned char rsv1;
00166     unsigned short length;
00167     char data[DICOM_UI_LENGTH + 1];
00168 }   DUL_SUBITEM;
00169 
00170 typedef struct dul_maxlength {
00171     void *reserved[2];
00172     unsigned char type;
00173     unsigned char rsv1;
00174     unsigned short length;
00175     unsigned long maxLength;
00176 }   DUL_MAXLENGTH;
00177 
00178 typedef struct {
00179     unsigned char type;
00180     unsigned char rsv1;
00181     unsigned short length;
00182     unsigned short maximumOperationsInvoked;
00183     unsigned short maximumOperationsProvided;
00184 }   PRV_ASYNCOPERATIONS;
00185 
00186 typedef struct {
00187     unsigned char type;
00188     unsigned char rsv1;
00189     unsigned short length;
00190     char implementationClassUID[DICOM_UI_LENGTH + 1];
00191 }   PRV_IMPLEMENTATIONCLASSUID;
00192 
00193 typedef struct {
00194     unsigned char type;
00195     unsigned char rsv1;
00196     unsigned short length;
00197     char implementationVersionName[16 + 1];
00198 }   PRV_IMPLEMENTATIONVERSIONNAME;
00199 
00200 typedef struct {
00201     void *reserved[2];
00202     unsigned char type;
00203     unsigned char rsv1;
00204     unsigned short length;
00205     unsigned short UIDLength;
00206     char SOPClassUID[DICOM_UI_LENGTH + 1];
00207     unsigned char SCURole;
00208     unsigned char SCPRole;
00209 }   PRV_SCUSCPROLE;
00210 
00211 typedef struct dul_presentationcontext {
00212     void *reserved[2];
00213     unsigned char type;
00214     unsigned char rsv1;
00215     unsigned short length;
00216     unsigned char contextID;
00217     unsigned char rsv2;
00218     unsigned char result;
00219     unsigned char rsv3;
00220 
00221     DUL_SUBITEM abstractSyntax;
00222     LST_HEAD *transferSyntaxList;
00223 }   PRV_PRESENTATIONCONTEXTITEM;
00224 
00225 typedef struct user_info {
00226     void *reserved[2];
00227     unsigned char type;
00228     unsigned char rsv1;
00229     unsigned short length;
00230     DUL_MAXLENGTH maxLength;                             // 51H: maximum length
00231     PRV_ASYNCOPERATIONS asyncOperations;                 // 53H: async operations (not yet implemented!)
00232     DUL_SUBITEM implementationClassUID;                  // 52H: implementation class UID
00233     DUL_SUBITEM implementationVersionName;               // 55H: implementation version name
00234     LST_HEAD *SCUSCPRoleList;                            // 54H: SCP/SCU role selection
00235     SOPClassExtendedNegotiationSubItemList *extNegList;  // 56H: extended negotiation
00236                                                          // 57H: SOP CLASS COMMON EXTENDED NEGOTIATION (not implemented)
00237     UserIdentityNegotiationSubItem *usrIdent;            // 58H: user identity negotiation RQ or AC
00238 }   DUL_USERINFO;
00239 
00240 typedef struct dul_associatepdu {
00241     void *reserved[2];
00242     unsigned char type;
00243     unsigned char rsv1;
00244     unsigned long length;
00245     unsigned short protocol;
00246     unsigned char rsv2[2];
00247     char calledAPTitle[18];
00248     char callingAPTitle[18];
00249     unsigned char rsv3[32];
00250 
00251     DUL_SUBITEM applicationContext;
00252     LST_HEAD *presentationContextList;
00253     DUL_USERINFO userInfo;
00254 }   PRV_ASSOCIATEPDU;
00255 
00256 typedef struct dul_rejectreleaseabortpdu {
00257     void *reserved[2];
00258     unsigned char type;
00259     unsigned char rsv1;
00260     unsigned long length;
00261     unsigned char rsv2;
00262     unsigned char result;
00263     unsigned char source;
00264     unsigned char reason;
00265 }   DUL_REJECTRELEASEABORTPDU;
00266 
00267 typedef struct dul_presentationdatavalue {
00268     void *reserved[2];
00269     unsigned long length;
00270     unsigned char presentationContextID;
00271     unsigned char messageControlHeader;
00272     void *data;
00273 }   DUL_PRESENTATIONDATAVALUE;
00274 
00275 typedef struct dul_datapdu {
00276     void *reserved[2];
00277     unsigned char type;
00278     unsigned char rsv1;
00279     unsigned long length;
00280     DUL_PRESENTATIONDATAVALUE presentationDataValue;
00281 }   DUL_DATAPDU;
00282 
00283 #define DUL_PROTOCOL      (unsigned short) 0x01
00284 
00285 #define DUL_TYPEAPPLICATIONCONTEXT  (unsigned char)0x10
00286 #define DUL_TYPEPRESENTATIONCONTEXTRQ (unsigned char)0x20
00287 #define DUL_TYPEPRESENTATIONCONTEXTAC (unsigned char)0x21
00288 #define DUL_TYPEABSTRACTSYNTAX    (unsigned char)0x30
00289 #define DUL_TYPETRANSFERSYNTAX    (unsigned char)0x40
00290 #define DUL_TYPEUSERINFO    (unsigned char)0x50
00291 #define DUL_TYPEMAXLENGTH   (unsigned char)0x51
00292 #define DUL_TYPEIMPLEMENTATIONCLASSUID  (unsigned char)0x52
00293 #define DUL_TYPEASYNCOPERATIONS   (unsigned char)0x53
00294 #define DUL_TYPESCUSCPROLE    (unsigned char)0x54
00295 #define DUL_TYPEIMPLEMENTATIONVERSIONNAME (unsigned char)0x55
00296 
00297 #define COPY_LONG_BIG(A,B) {  \
00298   (B)[0] = (unsigned char)((A)>>24);    \
00299   (B)[1] = (unsigned char)((A)>>16) ; \
00300   (B)[2] = (unsigned char)((A)>>8) ;  \
00301   (B)[3] = (unsigned char)(A) ; }
00302 #define COPY_SHORT_BIG(A,B) { \
00303   (B)[0] = (unsigned char)((A)>>8);   \
00304   (B)[1] = (unsigned char)(A) ; }
00305 
00306 #define EXTRACT_LONG_BIG(A,B) {     \
00307   (B) = (unsigned long)(A)[3]       \
00308     | (((unsigned long)(A)[2]) << 8)    \
00309     | (((unsigned long)(A)[1]) << 16)   \
00310     | (((unsigned long)(A)[0]) << 24);  \
00311   }
00312 
00313 #define EXTRACT_SHORT_BIG(A,B)  { (B) = (unsigned short)(A)[1] | (((unsigned short)(A)[0]) << 8); }
00314 
00315 #endif // #ifndef DULSTRUC_H
00316 
00317 /*
00318 ** CVS Log
00319 ** $Log: dulstruc.h,v $
00320 ** Revision 1.12  2010-10-14 13:19:29  joergr
00321 ** Updated copyright header. Added reference to COPYRIGHT file.
00322 **
00323 ** Revision 1.11  2008-04-17 15:27:36  onken
00324 ** Reworked and extended User Identity Negotiation code.
00325 **
00326 ** Revision 1.10  2007-09-07 08:47:54  onken
00327 ** Added basic support for Extended Negotiation of User Identity. Added #ifndef
00328 ** guard to header file.
00329 **
00330 ** Revision 1.9  2005/12/08 15:48:09  meichel
00331 ** Updated Makefiles to correctly install header files
00332 **
00333 ** Revision 1.8  2004/02/25 12:31:17  meichel
00334 ** Added global option flag for compatibility with very old DCMTK releases in the
00335 **   DICOM upper layer and ACSE code. Default is automatic handling, which should
00336 **   work in most cases.
00337 **
00338 ** Revision 1.7  2002/11/26 15:37:03  meichel
00339 ** Changed DUL code to always send A-ASSOCIATE user information sub-items
00340 **   in ascending order.
00341 **
00342 ** Revision 1.6  2001/10/12 10:18:41  meichel
00343 ** Replaced the CONDITION types, constants and functions in the dcmnet module
00344 **   by an OFCondition based implementation which eliminates the global condition
00345 **   stack.  This is a major change, caveat emptor!
00346 **
00347 ** Revision 1.5  2000/08/10 14:50:59  meichel
00348 ** Added initial OpenSSL support.
00349 **
00350 ** Revision 1.4  2000/06/07 08:57:27  meichel
00351 ** dcmnet ACSE routines now allow to retrieve a binary copy of the A-ASSOCIATE
00352 **   RQ/AC/RJ PDUs, e.g. for logging purposes.
00353 **
00354 ** Revision 1.3  1999/04/19 08:39:01  meichel
00355 ** Added experimental support for extended SOP class negotiation.
00356 **
00357 ** Revision 1.2  1997/07/07 08:11:37  andreas
00358 ** - Changed macros EXTRACT_LONG_BIG and EXTRACT_SHORT_BIG to avoid
00359 **   compiler warnings on SUN-CC and Windows NT/95
00360 **
00361 ** Revision 1.1.1.1  1996/03/26 18:38:46  hewett
00362 ** Initial Release.
00363 **
00364 **
00365 */
00366 


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