OFFIS DCMTK  Version 3.6.0
dulstruc.h
1 /*
2  *
3  * Copyright (C) 1994-2010, 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 ** Last Update: $Author: joergr $, $Date: 2010-12-01 08:26:37 $
67 ** Revision: $Revision: 1.13 $
68 ** Status: $State: Exp $
69 */
70 
71 #ifndef DULSTRUC_H
72 #define DULSTRUC_H
73 
74 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
75 #include "dcmtk/dcmnet/extneg.h"
76 #include "dcmtk/dcmnet/dcuserid.h"
77 
79 class DcmTransportLayer;
80 
81 #define NETWORK_DISCONNECTED 2
82 #define NETWORK_CONNECTED 3
83 
84 typedef enum {
85  DUL_ASSOC_WAITINGFORACK,
86  DUL_ASSOC_ESTABLISHED,
87  DUL_ASSOC_RELEASED,
88  DUL_ASSOC_ABORTED,
89  DUL_ASSOC_DROPPED
90 } DUL_ASSOC_STATE;
91 
92 #define ASSOCIATION_DISCONNECTED 2
93 #define ASSOCIATION_ABORTED 4
94 #define ASSOCIATION_RELEASED 5
95 
96 typedef struct {
97  char keyType[40];
98  int applicationFunction;
99  int networkState;
100  int protocolState;
101  int timeout;
102  unsigned long options;
103  union {
104  struct {
105  int port;
106  int listenSocket;
107  DcmTransportLayer *tLayer;
108  int tLayerOwned;
109  } TCP;
110  } networkSpecific;
112 
113 typedef struct {
114  char keyType[40];
115  int applicationFunction;
116  char remoteNode[64];
117  DUL_ASSOC_STATE associationState;
118  int protocolState;
119  int networkState;
120  int timeout;
121  time_t timerStart;
122  unsigned long maxPDVRequestor;
123  unsigned long maxPDVAcceptor;
124  unsigned long maxPDV;
125  unsigned long maxPDVInput;
126  unsigned long receiveQp1;
127  unsigned long receiveQp2;
128  char calledAPTitle[20];
129  char callingAPTitle[20];
130  char applicationContextName[68];
131  char abstractSyntaxName[68];
132  void *receivePDUQueue;
133  DUL_PRESENTATIONCONTEXTID presentationContextID;
134  DcmTransportConnection *connection;
135  DUL_PDVLIST pdvList;
136  int inputPDU;
137  unsigned char pduHead[6];
138  unsigned char nextPDUType;
139  unsigned char nextPDUReserved;
140  unsigned long nextPDULength;
141  unsigned long compatibilityMode;
142  int pdvCount;
143  int pdvIndex;
144  void *logHandle;
145  int associatePDUFlag;
146  void *associatePDU;
147  unsigned long associatePDULength;
148  DUL_PDV currentPDV;
149  unsigned char *pdvPointer;
150  unsigned long fragmentBufferLength;
151  unsigned char *fragmentBuffer;
152  DUL_ModeCallback *modeCallback;
154 
155 #define KEY_NETWORK "KEY NETWORK"
156 #define KEY_ASSOCIATION "KEY ASSOCIATION"
157 
158 #define AE_REQUESTOR "AE REQUESTOR"
159 #define AE_ACCEPTOR "AE ACCEPTOR"
160 #define AE_BOTH "AE BOTH"
161 
162 #define NO_PDU 1
163 #define PDU_HEAD 2
164 #define PDU_DATA 2
165 
166 /* Default timeout for waiting for PDUs. 100 seconds is high,
167 ** but used for development so we have time to do things with the
168 ** debugger. A lower value would be used in a production system.
169 */
170 
171 #define DEFAULT_TIMEOUT 100
172 
173 /* Private definitions */
174 
175 typedef struct dul_subitem {
176  void *reserved[2];
177  unsigned char type;
178  unsigned char rsv1;
179  unsigned short length;
180  char data[DICOM_UI_LENGTH + 1];
181 } DUL_SUBITEM;
182 
183 typedef struct dul_maxlength {
184  void *reserved[2];
185  unsigned char type;
186  unsigned char rsv1;
187  unsigned short length;
188  unsigned long maxLength;
189 } DUL_MAXLENGTH;
190 
191 typedef struct {
192  unsigned char type;
193  unsigned char rsv1;
194  unsigned short length;
195  unsigned short maximumOperationsInvoked;
196  unsigned short maximumOperationsProvided;
198 
199 typedef struct {
200  unsigned char type;
201  unsigned char rsv1;
202  unsigned short length;
203  char implementationClassUID[DICOM_UI_LENGTH + 1];
205 
206 typedef struct {
207  unsigned char type;
208  unsigned char rsv1;
209  unsigned short length;
210  char implementationVersionName[16 + 1];
212 
213 typedef struct {
214  void *reserved[2];
215  unsigned char type;
216  unsigned char rsv1;
217  unsigned short length;
218  unsigned short UIDLength;
219  char SOPClassUID[DICOM_UI_LENGTH + 1];
220  unsigned char SCURole;
221  unsigned char SCPRole;
223 
224 typedef struct dul_presentationcontext {
225  void *reserved[2];
226  unsigned char type;
227  unsigned char rsv1;
228  unsigned short length;
229  unsigned char contextID;
230  unsigned char rsv2;
231  unsigned char result;
232  unsigned char rsv3;
233 
234  DUL_SUBITEM abstractSyntax;
235  LST_HEAD *transferSyntaxList;
237 
238 typedef struct user_info {
239  void *reserved[2];
240  unsigned char type;
241  unsigned char rsv1;
242  unsigned short length;
243  DUL_MAXLENGTH maxLength; // 51H: maximum length
244  PRV_ASYNCOPERATIONS asyncOperations; // 53H: async operations (not yet implemented!)
245  DUL_SUBITEM implementationClassUID; // 52H: implementation class UID
246  DUL_SUBITEM implementationVersionName; // 55H: implementation version name
247  LST_HEAD *SCUSCPRoleList; // 54H: SCP/SCU role selection
248  SOPClassExtendedNegotiationSubItemList *extNegList; // 56H: extended negotiation
249  // 57H: SOP CLASS COMMON EXTENDED NEGOTIATION (not implemented)
250  UserIdentityNegotiationSubItem *usrIdent; // 58H: user identity negotiation RQ or AC
251 } DUL_USERINFO;
252 
253 typedef struct dul_associatepdu {
254  void *reserved[2];
255  unsigned char type;
256  unsigned char rsv1;
257  unsigned long length;
258  unsigned short protocol;
259  unsigned char rsv2[2];
260  char calledAPTitle[18];
261  char callingAPTitle[18];
262  unsigned char rsv3[32];
263 
264  DUL_SUBITEM applicationContext;
265  LST_HEAD *presentationContextList;
266  DUL_USERINFO userInfo;
268 
270  void *reserved[2];
271  unsigned char type;
272  unsigned char rsv1;
273  unsigned long length;
274  unsigned char rsv2;
275  unsigned char result;
276  unsigned char source;
277  unsigned char reason;
279 
281  void *reserved[2];
282  unsigned long length;
283  unsigned char presentationContextID;
284  unsigned char messageControlHeader;
285  void *data;
287 
288 typedef struct dul_datapdu {
289  void *reserved[2];
290  unsigned char type;
291  unsigned char rsv1;
292  unsigned long length;
293  DUL_PRESENTATIONDATAVALUE presentationDataValue;
294 } DUL_DATAPDU;
295 
296 #define DUL_PROTOCOL (unsigned short) 0x01
297 
298 #define DUL_TYPEAPPLICATIONCONTEXT (unsigned char)0x10
299 #define DUL_TYPEPRESENTATIONCONTEXTRQ (unsigned char)0x20
300 #define DUL_TYPEPRESENTATIONCONTEXTAC (unsigned char)0x21
301 #define DUL_TYPEABSTRACTSYNTAX (unsigned char)0x30
302 #define DUL_TYPETRANSFERSYNTAX (unsigned char)0x40
303 #define DUL_TYPEUSERINFO (unsigned char)0x50
304 #define DUL_TYPEMAXLENGTH (unsigned char)0x51
305 #define DUL_TYPEIMPLEMENTATIONCLASSUID (unsigned char)0x52
306 #define DUL_TYPEASYNCOPERATIONS (unsigned char)0x53
307 #define DUL_TYPESCUSCPROLE (unsigned char)0x54
308 #define DUL_TYPEIMPLEMENTATIONVERSIONNAME (unsigned char)0x55
309 
310 #define COPY_LONG_BIG(A,B) { \
311  (B)[0] = (unsigned char)((A)>>24); \
312  (B)[1] = (unsigned char)((A)>>16) ; \
313  (B)[2] = (unsigned char)((A)>>8) ; \
314  (B)[3] = (unsigned char)(A) ; }
315 #define COPY_SHORT_BIG(A,B) { \
316  (B)[0] = (unsigned char)((A)>>8); \
317  (B)[1] = (unsigned char)(A) ; }
318 
319 #define EXTRACT_LONG_BIG(A,B) { \
320  (B) = (unsigned long)(A)[3] \
321  | (((unsigned long)(A)[2]) << 8) \
322  | (((unsigned long)(A)[1]) << 16) \
323  | (((unsigned long)(A)[0]) << 24); \
324  }
325 
326 #define EXTRACT_SHORT_BIG(A,B) { (B) = (unsigned short)(A)[1] | (((unsigned short)(A)[0]) << 8); }
327 
328 #endif // #ifndef DULSTRUC_H
329 
330 /*
331 ** CVS Log
332 ** $Log: dulstruc.h,v $
333 ** Revision 1.13 2010-12-01 08:26:37 joergr
334 ** Added OFFIS copyright header (beginning with the year 1994).
335 **
336 ** Revision 1.12 2010-10-14 13:19:29 joergr
337 ** Updated copyright header. Added reference to COPYRIGHT file.
338 **
339 ** Revision 1.11 2008-04-17 15:27:36 onken
340 ** Reworked and extended User Identity Negotiation code.
341 **
342 ** Revision 1.10 2007-09-07 08:47:54 onken
343 ** Added basic support for Extended Negotiation of User Identity. Added #ifndef
344 ** guard to header file.
345 **
346 ** Revision 1.9 2005/12/08 15:48:09 meichel
347 ** Updated Makefiles to correctly install header files
348 **
349 ** Revision 1.8 2004/02/25 12:31:17 meichel
350 ** Added global option flag for compatibility with very old DCMTK releases in the
351 ** DICOM upper layer and ACSE code. Default is automatic handling, which should
352 ** work in most cases.
353 **
354 ** Revision 1.7 2002/11/26 15:37:03 meichel
355 ** Changed DUL code to always send A-ASSOCIATE user information sub-items
356 ** in ascending order.
357 **
358 ** Revision 1.6 2001/10/12 10:18:41 meichel
359 ** Replaced the CONDITION types, constants and functions in the dcmnet module
360 ** by an OFCondition based implementation which eliminates the global condition
361 ** stack. This is a major change, caveat emptor!
362 **
363 ** Revision 1.5 2000/08/10 14:50:59 meichel
364 ** Added initial OpenSSL support.
365 **
366 ** Revision 1.4 2000/06/07 08:57:27 meichel
367 ** dcmnet ACSE routines now allow to retrieve a binary copy of the A-ASSOCIATE
368 ** RQ/AC/RJ PDUs, e.g. for logging purposes.
369 **
370 ** Revision 1.3 1999/04/19 08:39:01 meichel
371 ** Added experimental support for extended SOP class negotiation.
372 **
373 ** Revision 1.2 1997/07/07 08:11:37 andreas
374 ** - Changed macros EXTRACT_LONG_BIG and EXTRACT_SHORT_BIG to avoid
375 ** compiler warnings on SUN-CC and Windows NT/95
376 **
377 ** Revision 1.1.1.1 1996/03/26 18:38:46 hewett
378 ** Initial Release.
379 **
380 **
381 */
382 


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2