/usr/include/dcmtk/dcmnet/dcompat.h is in libdcmtk-dev 3.6.1~20160216-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | /*
*
* Copyright (C) 1994-2011, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were partly developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
* For further copyrights, see the following paragraphs.
*
*/
/*
** Copyright (C) 1993/1994, OFFIS, Oldenburg University and CERIUM
**
** This software and supporting documentation were
** developed by
**
** Institut OFFIS
** Bereich Kommunikationssysteme
** Westerstr. 10-12
** 26121 Oldenburg, Germany
**
** Fachbereich Informatik
** Abteilung Prozessinformatik
** Carl von Ossietzky Universitaet Oldenburg
** Ammerlaender Heerstr. 114-118
** 26111 Oldenburg, Germany
**
** CERIUM
** Laboratoire SIM
** Faculte de Medecine
** 2 Avenue du Pr. Leon Bernard
** 35043 Rennes Cedex, France
**
** for CEN/TC251/WG4 as a contribution to the Radiological
** Society of North America (RSNA) 1993 Digital Imaging and
** Communications in Medicine (DICOM) Demonstration.
**
** THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER OFFIS,
** OLDENBURG UNIVERSITY NOR CERIUM MAKE ANY WARRANTY REGARDING
** THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR
** FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER
** DISEASES OR ITS CONFORMITY TO ANY SPECIFICATION. THE
** ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF THE SOFTWARE
** IS WITH THE USER.
**
** Copyright of the software and supporting documentation
** is, unless otherwise stated, jointly owned by OFFIS,
** Oldenburg University and CERIUM and free access is hereby
** granted as a license to use this software, copy this
** software and prepare derivative works based upon this
** software. However, any distribution of this software
** source code or supporting documentation or derivative
** works (source code and supporting documentation) must
** include the three paragraphs of this copyright notice.
**
*/
/*
**
** Author: Andrew Hewett Created: 11-08-93
**
** Module: dcompat.h
**
** Purpose:
** This is the place to declare compatability routines
** which can be missing on some systems.
**
** This include file is automatically included by dicom.h
**
** Module Prefix: none
**
*/
#ifndef DCOMPAT_H
#define DCOMPAT_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/ofstd/ofbmanip.h" /* for bzero workaround */
#include "dcmtk/dcmnet/dndefine.h"
#define INCLUDE_CSTDLIB
#define INCLUDE_CTIME
#define INCLUDE_CSTRING
#define INCLUDE_CERRNO
#define INCLUDE_LIBC
#define INCLUDE_UNISTD
#include "dcmtk/ofstd/ofstdinc.h"
#ifdef HAVE_GUSI_H
/* Use the Grand Unified Sockets Interface (GUSI) on Macintosh */
#include <GUSI.h>
#endif
#ifdef HAVE_WINDOWS_H
#include <windows.h> /* this includes either winsock.h or winsock2.h */
#else
#ifdef HAVE_WINSOCK_H
#include <winsock.h> /* include winsock.h directly i.e. on MacOS */
#ifdef macintosh
/*
** The WinSock header on Macintosh does not declare the WORD type nor the MAKEWORD
** macro need to initialize the WinSock library.
*/
typedef u_short WORD;
#define MAKEWORD(a,b) ((WORD) (((a)&0xff)<<8) | ((b)&0xff) )
#endif
#endif
#endif
BEGIN_EXTERN_C
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#ifndef DCOMPAT_SYS_SOCKET_H_
#define DCOMPAT_SYS_SOCKET_H_
/* some systems don't protect sys/socket.h (e.g. DEC Ultrix) */
#include <sys/socket.h>
#endif
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
END_EXTERN_C
#ifdef _WIN32
#include <process.h>
#include <io.h>
#ifndef __CYGWIN__
#include <sys/locking.h>
#endif
#endif
#ifndef EINTR
/* The WinSock header on Macintosh does not define an EINTR error code */
#ifdef HAVE_WINSOCK_H
#define EINTR WSAEINTR
#endif
#endif
#ifdef HAVE_PROTOTYPE_FLOCK
#define dcmtk_flock flock
#define dcmtk_plockerr perror
#endif
#ifndef HAVE_PROTOTYPE_FLOCK
#ifdef HAVE_FLOCK
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int flock(int fd, int operation);
END_EXTERN_C
#define dcmtk_flock flock
#define dcmtk_plockerr perror
#else
/*
* Simulate the flock function calls
* using the facilities of fcntl(2)
*/
#define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */
#define LOCK_NB 4 /* don't block when locking */
#define LOCK_UN 8 /* unlock */
DCMTK_DCMNET_EXPORT int dcmtk_flock(int fd, int operation);
DCMTK_DCMNET_EXPORT void dcmtk_plockerr(const char *s);
#endif /* !HAVE_FLOCK */
#endif
#ifndef HAVE_BZERO
#ifndef bzero
#define bzero(p,len) memset((void*)(p), 0, (len));
#endif
#endif
#ifndef HAVE_PROTOTYPE_GETHOSTNAME
#ifdef HAVE_GETHOSTNAME
/* gethostname is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int gethostname(char* name, int namelen);
END_EXTERN_C
#else
/* define gethostname ourselves */
DCMTK_DCMNET_EXPORT int gethostname(char* name, int namelen);
#endif
#endif
#ifndef HAVE_PROTOTYPE_GETHOSTBYNAME
#ifdef HAVE_GETHOSTBYNAME
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
struct hostent *gethostbyname(const char* name);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_GETSOCKOPT
#ifdef HAVE_GETSOCKOPT
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int getsockopt(int s, int level, int optname, char *optval, int *optlen);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_SETSOCKOPT
#ifdef HAVE_SETSOCKOPT
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int setsockopt(int s, int level, int optname, const char *optval, int optlen);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_LISTEN
#ifdef HAVE_LISTEN
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int listen(int s, int backlog);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_SOCKET
#ifdef HAVE_SOCKET
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int socket(int domain, int type, int protocol);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_CONNECT
#ifdef HAVE_CONNECT
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int connect(int s, struct sockaddr *name, int namelen);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_SELECT
#ifdef HAVE_SELECT
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_BIND
#ifdef HAVE_BIND
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int bind(int s, const struct sockaddr *name, int namelen);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_ACCEPT
#ifdef HAVE_ACCEPT
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int accept(int s, struct sockaddr *addr, int *addrlen);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_GETSOCKNAME
#ifdef HAVE_GETSOCKNAME
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int getsockname(int s, struct sockaddr *name, int *namelen);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_WAITPID
#ifdef HAVE_WAITPID
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int waitpid(pid_t pid, int *statusp, int options);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_PROTOTYPE_WAIT3
#ifdef HAVE_WAIT3
/* it is in the libraries but we have no prototype */
BEGIN_EXTERN_C
DCMTK_DCMNET_EXPORT int wait3(int *statusp, int options, struct rusage *rusage);
END_EXTERN_C
#else
/* don't know how to emulate */
#endif
#endif
#ifndef HAVE_ACCESS
#ifndef R_OK
#define R_OK 0x01
#define W_OK 0x02
#define X_OK 0x04
#define F_OK 0x08
#endif
DCMTK_DCMNET_EXPORT int access(const char* path, int amode);
#else /* HAVE_ACCESS */
#ifdef _WIN32
/* windows defines access but not the constants */
#ifndef R_OK
#define W_OK 02 /* Write permission */
#define R_OK 04 /* Read permission */
#define F_OK 00 /* Existance only */
#define X_OK 00 /* execute permission has no meaning under windows, treat as existance */
#endif /* R_OK */
#endif /* _WIN32 */
#endif /* HAVE_ACCESS */
#ifndef HAVE_STRERROR
DCMTK_DCMNET_EXPORT char *strerror(int e);
#endif
#ifndef HAVE_TEMPNAM
DCMTK_DCMNET_EXPORT char *tempnam(char *dir, char *pfx);
#endif
#ifdef _WIN32
#define NULL_DEVICE_NAME "nul"
#else
#define NULL_DEVICE_NAME "/dev/null"
#endif
#endif /* DCOMPAT_H */
|