dcmnet/libsrc/dulstruc.h

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


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1