comparison Core/DicomNetworking/DicomAssociationParameters.cpp @ 3828:3d1bb2193832

fix build on os x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 10 Apr 2020 16:35:41 +0200
parents 4570c57668a8
children ea1d32861cfc
comparison
equal deleted inserted replaced
3826:e82bd07c384e 3828:3d1bb2193832
32 32
33 33
34 #include "../PrecompiledHeaders.h" 34 #include "../PrecompiledHeaders.h"
35 #include "DicomAssociationParameters.h" 35 #include "DicomAssociationParameters.h"
36 36
37 37 #include "../Compatibility.h"
38 #ifdef _WIN32
39 /**
40 * "The maximum length, in bytes, of the string returned in the buffer
41 * pointed to by the name parameter is dependent on the namespace provider,
42 * but this string must be 256 bytes or less.
43 * http://msdn.microsoft.com/en-us/library/windows/desktop/ms738527(v=vs.85).aspx
44 **/
45 # define HOST_NAME_MAX 256
46 # include <winsock.h>
47 #endif
48
49
50 #if !defined(HOST_NAME_MAX) && defined(_POSIX_HOST_NAME_MAX)
51 /**
52 * TO IMPROVE: "_POSIX_HOST_NAME_MAX is only the minimum value that
53 * HOST_NAME_MAX can ever have [...] Therefore you cannot allocate an
54 * array of size _POSIX_HOST_NAME_MAX, invoke gethostname() and expect
55 * that the result will fit."
56 * http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00128.html
57 **/
58 #define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
59 #endif
60
61
62 #include "../Logging.h" 38 #include "../Logging.h"
63 #include "../OrthancException.h" 39 #include "../OrthancException.h"
40 #include "NetworkingCompatibility.h"
64 41
65 #include <boost/thread/mutex.hpp> 42 #include <boost/thread/mutex.hpp>
66 43
67 // By default, the timeout for client DICOM connections is set to 10 seconds 44 // By default, the timeout for client DICOM connections is set to 10 seconds
68 static boost::mutex defaultTimeoutMutex_; 45 static boost::mutex defaultTimeoutMutex_;
141 { 118 {
142 boost::mutex::scoped_lock lock(defaultTimeoutMutex_); 119 boost::mutex::scoped_lock lock(defaultTimeoutMutex_);
143 defaultTimeout_ = seconds; 120 defaultTimeout_ = seconds;
144 } 121 }
145 } 122 }
146
147
148 size_t DicomAssociationParameters::GetMaxHostNameSize()
149 {
150 return HOST_NAME_MAX;
151 }
152 } 123 }