1 /*
2  *
3  *  Copyright (C) 1994-2018, 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, OFFIS, Oldenburg University and CERIUM
19 **
20 **  This software and supporting documentation were
21 **  developed by
22 **
23 **    Institut OFFIS
24 **    Bereich Kommunikationssysteme
25 **    Westerstr. 10-12
26 **    26121 Oldenburg, Germany
27 **
28 **    Fachbereich Informatik
29 **    Abteilung Prozessinformatik
30 **    Carl von Ossietzky Universitaet Oldenburg
31 **    Ammerlaender Heerstr. 114-118
32 **    26111 Oldenburg, Germany
33 **
34 **    CERIUM
35 **    Laboratoire SIM
36 **    Faculte de Medecine
37 **    2 Avenue du Pr. Leon Bernard
38 **    35043 Rennes Cedex, France
39 **
40 **  for CEN/TC251/WG4 as a contribution to the Radiological
41 **  Society of North America (RSNA) 1993 Digital Imaging and
42 **  Communications in Medicine (DICOM) Demonstration.
43 **
44 **  THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER OFFIS,
45 **  OLDENBURG UNIVERSITY NOR CERIUM MAKE ANY WARRANTY REGARDING
46 **  THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR
47 **  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER
48 **  DISEASES OR ITS CONFORMITY TO ANY SPECIFICATION.  THE
49 **  ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF THE SOFTWARE
50 **  IS WITH THE USER.
51 **
52 **  Copyright of the software and supporting documentation
53 **  is, unless otherwise stated, jointly owned by OFFIS,
54 **  Oldenburg University and CERIUM and free access is hereby
55 **  granted as a license to use this software, copy this
56 **  software and prepare derivative works based upon this
57 **  software. However, any distribution of this software
58 **  source code or supporting documentation or derivative
59 **  works (source code and supporting documentation) must
60 **  include the three paragraphs of this copyright notice.
61 **
62 */
63 
64 /*
65 **          dicom.h
66 **
67 **  This header defines public typedefs for the DICOM software produced
68 **  by the CEN Dicom Development Team.  These definitions are
69 **  meant to be used in a number of packages and need to be in a central
70 **  location.
71 **
72 **  The header file has evolved from a version written for the
73 **  RSNA'92 InfoRAD DICOM Demonstration by:
74 **
75 **      Stephen Moore (smm@wuerl.wustl.edu)
76 **      Electronic Radiology Laboratory
77 **      Mallinckrodt Institute of Radiology
78 **      Washington University School of Medicine
79 **      23-May-1992
80 **
81 **
82 **  Modifications:
83 **      Andrew Hewett
84 **      OFFIS/University of Oldenburg, Germany.
85 **
86 **
87 */
88 
89 #ifndef DICOM_H
90 #define DICOM_H
91 
92 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
93 
94 #define INCLUDE_CSTDLIB
95 #define INCLUDE_CSTDIO
96 #define INCLUDE_LIBC
97 #define INCLUDE_UNISTD
98 #include "dcmtk/ofstd/ofstdinc.h"
99 
100 #include "dcmtk/dcmnet/cond.h"		/* condition typedefs */
101 #include "dcmtk/dcmnet/dcompat.h"	/* compatibility routines */
102 #include "dcmtk/dcmdata/dctypes.h"	/* dcmdata toolkit basic types */
103 #include "dcmtk/dcmdata/dcuid.h"	/* dcmdata UID definitions */
104 
105 /*
106  * Useful Types
107  */
108 
109 /* these types are for backwards compatibility */
110 typedef Uint16	U_SHORT;	/* normal unsigned short*/
111 typedef Uint32	U_LONG;		/* normal unsigned long */
112 typedef Uint32	MASK_32;	/* for bit masks */
113 
114 
115 #define DICOM_STDAPPLICATIONCONTEXT UID_StandardApplicationContext
116 
117 /* network type constants as used by the DUL layer */
118 #define	DICOM_APPLICATION_ACCEPTOR	0x01
119 #define	DICOM_APPLICATION_REQUESTOR	0x02
120 
121 /*
122 ** The following defines are used in some levels of the network code.
123 */
124 
125 #define DIC_US_LEN		sizeof(DIC_US)
126 #define DIC_UL_LEN		sizeof(DIC_UL)
127 #define DIC_UI_LEN		64
128 #define DIC_AE_LEN		16
129 #define DIC_SH_LEN		16
130 #define DIC_PN_LEN		64
131 #define DIC_LO_LEN		64
132 #define DIC_CS_LEN		16
133 #define DIC_DS_LEN		16
134 #define DIC_IS_LEN		12
135 #define DIC_AT_LEN		(2*sizeof(DIC_US))
136 
137 /* a valid DNS name can be up to 253 characters, and we need to add
138  * a port number. This should be sufficient.
139  */
140 #define DIC_NODENAME_LEN	270
141 
142 #define DICOM_UI_LENGTH DIC_UI_LEN
143 
144 typedef Uint16	DIC_US;
145 typedef Uint32	DIC_UL;
146 typedef char 	DIC_UI[DIC_UI_LEN + 1];
147 typedef char	DIC_AE[DIC_AE_LEN + 1];
148 typedef char	DIC_SH[DIC_SH_LEN + 1];
149 typedef char	DIC_PN[DIC_PN_LEN + 1];
150 typedef char	DIC_LO[DIC_LO_LEN + 1];
151 typedef char	DIC_CS[DIC_CS_LEN + 1];
152 typedef char	DIC_DS[DIC_DS_LEN + 1];
153 typedef char	DIC_IS[DIC_IS_LEN + 1];
154 typedef char	DIC_NODENAME[DIC_NODENAME_LEN + 1];
155 
156 
157 /*
158  * Useful Macros
159  */
160 
161 #ifndef MAX
162 #define MAX(x, y) (((x) < (y)) ? (y) : (x))
163 #endif
164 #ifndef MIN
165 #define MIN(x, y) (((x) < (y)) ? (x) : (y))
166 #endif
167 #ifndef IS_EVEN
168 #define IS_EVEN(i) (~(i) & 0x01)
169 #endif
170 #ifndef DIM_OF
171 #define DIM_OF(a) (sizeof(a) / sizeof(a[0]))
172 #endif
173 #ifndef IN_RANGE
174 #define IN_RANGE(n, lo, hi) ((lo) <= n && (n) <= (hi))
175 #endif
176 
177 #endif
178