00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00023 #if !defined(GLOBUS_COMMON_INCLUDE_H)
00024 #define GLOBUS_COMMON_INCLUDE_H 1
00025
00026 #include "globus_config.h"
00027
00028 #if defined(_WIN32) && !defined(__CYGWIN__)
00029 #include <winsock2.h>
00030 #include <ws2tcpip.h>
00031 #endif
00032
00033 #ifdef __GNUC__
00034 #define GlobusFuncName(func) static const char * _globus_func_name \
00035 __attribute__((__unused__)) = #func
00036 #else
00037 #define GlobusFuncName(func) static const char * _globus_func_name = #func
00038 #endif
00039
00040 extern const char * _globus_func_name;
00041
00042 #define _GCSL(s) globus_common_i18n_get_string(GLOBUS_COMMON_MODULE,\
00043 s)
00044
00046 #ifndef __USE_POSIX
00047 #define __USE_POSIX
00048 #endif
00049
00050
00051
00052
00053 #include <sys/types.h>
00054 #include <sys/stat.h>
00055 #if !defined(_WIN32)
00056 #include <unistd.h>
00057 #endif
00058 #include <sys/param.h>
00059 #include <fcntl.h>
00060
00061 #if defined(_WIN32)
00062 # include <windows.h>
00063 # include <winsock2.h>
00064 # include <process.h>
00065 # include <io.h>
00066 # include <sys/timeb.h>
00067 # include <signal.h>
00068 # include <malloc.h>
00069 #else
00070 # include <pwd.h>
00071 # include <netdb.h>
00072 # include <netinet/in.h>
00073 # include <sys/socket.h>
00074 # include <sys/uio.h>
00075 #endif
00076
00077
00078 #include <sys/time.h>
00079 #include <time.h>
00080
00081 #include <stdint.h>
00082 #include <errno.h>
00083 #include <stdlib.h>
00084 #include <stdio.h>
00085 #include <limits.h>
00086 #include <assert.h>
00087 #include <signal.h>
00088 #include <string.h>
00089 #include <ctype.h>
00090 #include <stdarg.h>
00091
00092 #include <dirent.h>
00093 #include <fcntl.h>
00094
00095 #ifdef _WIN32
00096 extern int inet_pton(int af, const char *src, void *dst);
00097 #endif
00098
00099
00100
00101
00102
00103
00104
00105
00106 #if 0
00107 void globus_dump_stack();
00108 #define GLOBUS_DUMP_STACK() globus_dump_stack()
00109 #else
00110 #define GLOBUS_DUMP_STACK()
00111 #endif
00112
00113 #if defined(BUILD_DEBUG)
00114 # define globus_assert(assertion) \
00115 do { \
00116 if (!(assertion)) \
00117 { \
00118 fprintf(stderr, "Assertion " #assertion \
00119 " failed in file %s at line %d\n", \
00120 __FILE__, __LINE__); \
00121 GLOBUS_DUMP_STACK(); \
00122 abort(); \
00123 } \
00124 } while(0)
00125
00126 # define globus_assert_string(assertion, string) \
00127 do { \
00128 if (!(assertion)) \
00129 { \
00130 fprintf(stderr, "Assertion " #assertion \
00131 " failed in file %s at line %d: %s", \
00132 __FILE__, __LINE__, string); \
00133 GLOBUS_DUMP_STACK(); \
00134 abort(); \
00135 } \
00136 } while(0)
00137 #else
00138 # define globus_assert(assertion)
00139 # define globus_assert_string(assertion, string)
00140 #endif
00141
00142 #define GLOBUS_MAX(V1,V2) (((V1) > (V2)) ? (V1) : (V2))
00143 #define GLOBUS_MIN(V1,V2) (((V1) < (V2)) ? (V1) : (V2))
00144
00145 #ifndef EXTERN_C_BEGIN
00146 #ifdef __cplusplus
00147 #define EXTERN_C_BEGIN extern "C" {
00148 #define EXTERN_C_END }
00149 #else
00150 #define EXTERN_C_BEGIN
00151 #define EXTERN_C_END
00152 #endif
00153 #endif
00154
00155
00156 #ifdef _WIN32
00157 #ifndef EWOULDBLOCK
00158 #define EWOULDBLOCK EAGAIN
00159 #endif
00160 #ifndef ETIMEDOUT
00161 #define ETIMEDOUT WSAETIMEDOUT
00162 #endif
00163 #ifndef EINPROGRESS
00164 #define EINPROGRESS WSAEINPROGRESS
00165 #endif
00166 #endif
00167
00168 #include <inttypes.h>
00169
00170
00171 #if defined(_WIN32) && !defined(__USE_MINGW_ANSI_STDIO)
00172 # define vsnprintf _vsnprintf
00173 #endif
00174
00175 #ifndef MAXHOSTNAMELEN
00176 #define MAXHOSTNAMELEN 64
00177 #endif
00178
00179 #include "globus_types.h"
00180 #endif
00181