1 /* 2 * 3 * Copyright (C) 1994-2017, OFFIS e.V. 4 * All rights reserved. See COPYRIGHT file for details. 5 * 6 * This software and supporting documentation were partly developed by 7 * 8 * OFFIS e.V. 9 * R&D Division Health 10 * Escherweg 2 11 * D-26121 Oldenburg, Germany 12 * 13 * For further copyrights, see the following paragraphs. 14 * 15 */ 16 17 /* 18 Copyright (C) 1993, 1994, RSNA and Washington University 19 20 The software and supporting documentation for the Radiological 21 Society of North America (RSNA) 1993, 1994 Digital Imaging and 22 Communications in Medicine (DICOM) Demonstration were developed 23 at the 24 Electronic Radiology Laboratory 25 Mallinckrodt Institute of Radiology 26 Washington University School of Medicine 27 510 S. Kingshighway Blvd. 28 St. Louis, MO 63110 29 as part of the 1993, 1994 DICOM Central Test Node project for, and 30 under contract with, the Radiological Society of North America. 31 32 THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER RSNA NOR 33 WASHINGTON UNIVERSITY MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS 34 PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR 35 USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY 36 SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF 37 THE SOFTWARE IS WITH THE USER. 38 39 Copyright of the software and supporting documentation is 40 jointly owned by RSNA and Washington University, and free access 41 is hereby granted as a license to use this software, copy this 42 software and prepare derivative works based upon this software. 43 However, any distribution of this software source code or 44 supporting documentation or derivative works (source code and 45 supporting documentation) must include the three paragraphs of 46 the copyright notice. 47 */ 48 49 /* 50 ** DICOM 93 51 ** Electronic Radiology Laboratory 52 ** Mallinckrodt Institute of Radiology 53 ** Washington University School of Medicine 54 ** 55 ** Module Name(s): 56 ** Author, Date: Stephen M. Moore, 19-May-93 57 ** Intent: 58 ** This header contains private typedefs for the DICOM Upper Layer 59 ** (DUL) protocol package. This is to be used to compile the DUL 60 ** package and is not intended to be seen by the applications programmer. 61 ** Files at the package level should include this file to get the 62 ** proper typedefs and include the public file "dulprotocol.h" to 63 ** get the public definitions and function prototypes. I have omitted 64 ** the public definitions and prototypes on purpose so that they 65 ** exist in only one location. 66 */ 67 68 #ifndef DULSTRUC_H 69 #define DULSTRUC_H 70 71 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 72 #include "dcmtk/dcmnet/extneg.h" 73 #include "dcmtk/dcmnet/dcuserid.h" 74 75 class DcmTransportConnection; 76 class DcmTransportLayer; 77 78 #define NETWORK_DISCONNECTED 2 79 #define NETWORK_CONNECTED 3 80 81 typedef enum { 82 DUL_ASSOC_WAITINGFORACK, 83 DUL_ASSOC_ESTABLISHED, 84 DUL_ASSOC_RELEASED, 85 DUL_ASSOC_ABORTED, 86 DUL_ASSOC_DROPPED 87 } DUL_ASSOC_STATE; 88 89 #define ASSOCIATION_DISCONNECTED 2 90 #define ASSOCIATION_ABORTED 4 91 #define ASSOCIATION_RELEASED 5 92 93 typedef struct { 94 char keyType[40]; 95 int applicationFunction; 96 int networkState; 97 int protocolState; 98 int timeout; 99 unsigned long options; 100 union { 101 struct { 102 int port; 103 DcmNativeSocketType listenSocket; 104 DcmTransportLayer *tLayer; 105 int tLayerOwned; 106 } TCP; 107 } networkSpecific; 108 } PRIVATE_NETWORKKEY; 109 110 typedef struct { 111 char keyType[40]; 112 int applicationFunction; 113 char remoteNode[64]; 114 DUL_ASSOC_STATE associationState; 115 int protocolState; 116 int networkState; 117 int timeout; 118 time_t timerStart; 119 unsigned long maxPDVRequestor; 120 unsigned long maxPDVAcceptor; 121 unsigned long maxPDV; 122 unsigned long maxPDVInput; 123 unsigned long receiveQp1; 124 unsigned long receiveQp2; 125 char calledAPTitle[20]; 126 char callingAPTitle[20]; 127 char applicationContextName[68]; 128 char abstractSyntaxName[68]; 129 void *receivePDUQueue; 130 DUL_PRESENTATIONCONTEXTID presentationContextID; 131 DcmTransportConnection *connection; 132 DUL_PDVLIST pdvList; 133 int inputPDU; 134 unsigned char pduHead[6]; 135 unsigned char nextPDUType; 136 unsigned char nextPDUReserved; 137 unsigned long nextPDULength; 138 unsigned long compatibilityMode; 139 int pdvCount; 140 int pdvIndex; 141 void *logHandle; 142 int associatePDUFlag; 143 void *associatePDU; 144 unsigned long associatePDULength; 145 DUL_PDV currentPDV; 146 unsigned char *pdvPointer; 147 unsigned long fragmentBufferLength; 148 unsigned char *fragmentBuffer; 149 DUL_ModeCallback *modeCallback; 150 } PRIVATE_ASSOCIATIONKEY; 151 152 #define KEY_NETWORK "KEY NETWORK" 153 #define KEY_ASSOCIATION "KEY ASSOCIATION" 154 155 #define AE_REQUESTOR "AE REQUESTOR" 156 #define AE_ACCEPTOR "AE ACCEPTOR" 157 #define AE_BOTH "AE BOTH" 158 159 #define NO_PDU 1 160 #define PDU_HEAD 2 161 #define PDU_DATA 2 162 163 /* Default timeout for waiting for PDUs. 100 seconds is high, 164 ** but used for development so we have time to do things with the 165 ** debugger. A lower value would be used in a production system. 166 */ 167 168 #define DEFAULT_TIMEOUT 100 169 170 /* Private definitions */ 171 172 typedef struct dul_subitem { 173 void *reserved[2]; 174 unsigned char type; 175 unsigned char rsv1; 176 unsigned short length; 177 char data[DICOM_UI_LENGTH + 1]; 178 } DUL_SUBITEM; 179 180 typedef struct dul_maxlength { 181 void *reserved[2]; 182 unsigned char type; 183 unsigned char rsv1; 184 unsigned short length; 185 unsigned long maxLength; 186 } DUL_MAXLENGTH; 187 188 typedef struct { 189 unsigned char type; 190 unsigned char rsv1; 191 unsigned short length; 192 unsigned short maximumOperationsInvoked; 193 unsigned short maximumOperationsProvided; 194 } PRV_ASYNCOPERATIONS; 195 196 typedef struct { 197 unsigned char type; 198 unsigned char rsv1; 199 unsigned short length; 200 char implementationClassUID[DICOM_UI_LENGTH + 1]; 201 } PRV_IMPLEMENTATIONCLASSUID; 202 203 typedef struct { 204 unsigned char type; 205 unsigned char rsv1; 206 unsigned short length; 207 char implementationVersionName[16 + 1]; 208 } PRV_IMPLEMENTATIONVERSIONNAME; 209 210 typedef struct { 211 void *reserved[2]; 212 unsigned char type; 213 unsigned char rsv1; 214 unsigned short length; 215 unsigned short UIDLength; 216 char SOPClassUID[DICOM_UI_LENGTH + 1]; 217 unsigned char SCURole; 218 unsigned char SCPRole; 219 } PRV_SCUSCPROLE; 220 221 typedef struct dul_presentationcontext { 222 void *reserved[2]; 223 unsigned char type; 224 unsigned char rsv1; 225 unsigned short length; 226 unsigned char contextID; 227 unsigned char rsv2; 228 unsigned char result; 229 unsigned char rsv3; 230 231 DUL_SUBITEM abstractSyntax; 232 LST_HEAD *transferSyntaxList; 233 } PRV_PRESENTATIONCONTEXTITEM; 234 235 typedef struct user_info { 236 void *reserved[2]; 237 unsigned char type; 238 unsigned char rsv1; 239 unsigned short length; 240 DUL_MAXLENGTH maxLength; // 51H: maximum length 241 PRV_ASYNCOPERATIONS asyncOperations; // 53H: async operations (not yet implemented!) 242 DUL_SUBITEM implementationClassUID; // 52H: implementation class UID 243 DUL_SUBITEM implementationVersionName; // 55H: implementation version name 244 LST_HEAD *SCUSCPRoleList; // 54H: SCP/SCU role selection 245 SOPClassExtendedNegotiationSubItemList *extNegList; // 56H: extended negotiation 246 // 57H: SOP CLASS COMMON EXTENDED NEGOTIATION (not implemented) 247 UserIdentityNegotiationSubItem *usrIdent; // 58H: user identity negotiation RQ or AC 248 } DUL_USERINFO; 249 250 typedef struct dul_associatepdu { 251 void *reserved[2]; 252 unsigned char type; 253 unsigned char rsv1; 254 unsigned long length; 255 unsigned short protocol; 256 unsigned char rsv2[2]; 257 char calledAPTitle[18]; 258 char callingAPTitle[18]; 259 unsigned char rsv3[32]; 260 261 DUL_SUBITEM applicationContext; 262 LST_HEAD *presentationContextList; 263 DUL_USERINFO userInfo; 264 } PRV_ASSOCIATEPDU; 265 266 typedef struct dul_rejectreleaseabortpdu { 267 void *reserved[2]; 268 unsigned char type; 269 unsigned char rsv1; 270 unsigned long length; 271 unsigned char rsv2; 272 unsigned char result; 273 unsigned char source; 274 unsigned char reason; 275 } DUL_REJECTRELEASEABORTPDU; 276 277 typedef struct dul_presentationdatavalue { 278 void *reserved[2]; 279 unsigned long length; 280 unsigned char presentationContextID; 281 unsigned char messageControlHeader; 282 void *data; 283 } DUL_PRESENTATIONDATAVALUE; 284 285 typedef struct dul_datapdu { 286 void *reserved[2]; 287 unsigned char type; 288 unsigned char rsv1; 289 unsigned long length; 290 DUL_PRESENTATIONDATAVALUE presentationDataValue; 291 } DUL_DATAPDU; 292 293 #define DUL_PROTOCOL (unsigned short) 0x01 294 295 #define DUL_TYPEAPPLICATIONCONTEXT (unsigned char)0x10 296 #define DUL_TYPEPRESENTATIONCONTEXTRQ (unsigned char)0x20 297 #define DUL_TYPEPRESENTATIONCONTEXTAC (unsigned char)0x21 298 #define DUL_TYPEABSTRACTSYNTAX (unsigned char)0x30 299 #define DUL_TYPETRANSFERSYNTAX (unsigned char)0x40 300 #define DUL_TYPEUSERINFO (unsigned char)0x50 301 #define DUL_TYPEMAXLENGTH (unsigned char)0x51 302 #define DUL_TYPEIMPLEMENTATIONCLASSUID (unsigned char)0x52 303 #define DUL_TYPEASYNCOPERATIONS (unsigned char)0x53 304 #define DUL_TYPESCUSCPROLE (unsigned char)0x54 305 #define DUL_TYPEIMPLEMENTATIONVERSIONNAME (unsigned char)0x55 306 307 #define COPY_LONG_BIG(A,B) { \ 308 (B)[0] = (unsigned char)((A)>>24); \ 309 (B)[1] = (unsigned char)((A)>>16) ; \ 310 (B)[2] = (unsigned char)((A)>>8) ; \ 311 (B)[3] = (unsigned char)(A) ; } 312 #define COPY_SHORT_BIG(A,B) { \ 313 (B)[0] = (unsigned char)((A)>>8); \ 314 (B)[1] = (unsigned char)(A) ; } 315 316 #define EXTRACT_LONG_BIG(A,B) { \ 317 (B) = (unsigned long)(A)[3] \ 318 | (((unsigned long)(A)[2]) << 8) \ 319 | (((unsigned long)(A)[1]) << 16) \ 320 | (((unsigned long)(A)[0]) << 24); \ 321 } 322 323 #define EXTRACT_SHORT_BIG(A,B) { (B) = (unsigned short)(A)[1] | (((unsigned short)(A)[0]) << 8); } 324 325 #endif // #ifndef DULSTRUC_H 326