/home/tetron/hack/vos/libs/vos/vos/vosdefs.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _VOSDEFS_HH_
00026 #define _VOSDEFS_HH_
00027
00028 #include <vos/vutil/vutildefs.hh>
00029
00030
00031
00032 #ifdef USE_STRSTREAM
00033 #include <strstream>
00034 #else
00035 #include <sstream>
00036 #endif
00037
00038 #if defined(_WIN32) && defined(_MSC_VER)
00039 # pragma warning (disable : 4250)
00040
00041 # pragma warning (disable : 4995)
00042 # pragma warning (disable : 4251)
00043 # pragma warning (disable : 4003)
00044 # pragma warning (disable : 4275)
00045 #endif
00046
00047 #if defined(WIN32)
00048 # ifdef VOS_EXPORTS
00049 # define VOS_API __declspec(dllexport)
00050 # else
00051 # define VOS_API __declspec(dllimport)
00052 # endif
00053 #else
00054 # ifdef HAVE_GCC_VISIBILITY
00055 # define VOS_API __attribute__ ((visibility("default")))
00056 # else
00057 # define VOS_API
00058 # endif
00059 #endif
00060
00061 #ifdef HAVE_SYS_SOCKET_H
00062 # include <sys/socket.h>
00063 # include <netinet/in.h>
00064 # include <netinet/tcp.h>
00065 # include <netdb.h>
00066 #else
00067 # ifdef HAVE_LIBWS2_32
00068 # include <winsock2.h>
00069 # include <ws2tcpip.h>
00070 # define VOS_USE_WINSOCK2
00071 # else
00072 # warning we do not have a header file for the socket functions, things will probably fail
00073 # endif
00074 #endif
00075
00076 #include <boost/thread/thread.hpp>
00077
00078 #ifndef HAVE_SNPRINTF
00079 # include <vos/vutil/snprintf.hh>
00080 #endif
00081
00082 #include <time.h>
00083 #include <string.h>
00084 #include <sys/types.h>
00085 #include <stdio.h>
00086
00087 #ifdef HAVE_SYS_TIME_H
00088 # include <sys/time.h>
00089 #endif
00090
00091 #ifdef HAVE_UNISTD_H
00092 # include <unistd.h>
00093 #endif
00094
00095 #ifdef SSL_SUPPORT
00096 #include <openssl/ssl.h>
00097 #include <openssl/rand.h>
00098 #include <openssl/err.h>
00099 #else
00100 #define X509 void
00101 #define SSL_CTX void
00102 #define X509_STORE_CTX void
00103 #define SSL void
00104 #endif
00105
00106 #ifndef SOL_TCP
00107 #define SOL_TCP (getprotobyname("tcp")->p_proto)
00108 #endif
00109
00110
00111 #ifdef HAVE_LIBWS2_32
00112 # define SETSOCKOPT_PARAM4_CAST char*
00113 #else
00114 # define SETSOCKOPT_PARAM4_CAST int*
00115 #endif
00116
00117
00118 #if !defined(HAVE_SOCKLEN_T) && !defined(__socklen_t_defined)
00119
00120 typedef int socklen_t;
00121 #define __socklen_t_defined 1
00122 #endif
00123
00124
00125 #define VOS_DEFAULT_TIMEOUT 45.0
00126
00127 #if defined(WIN32)
00128 #define DLLEXPORT __declspec(dllexport)
00129 #define DLLIMPORT __declspec(dllimport)
00130 #else
00131 # ifdef HAVE_GCC_VISIBILITY
00132 # define DLLEXPORT __attribute__ ((visibility("default")))
00133 # define DLLIMPORT __attribute__ ((visibility("default")))
00134 # else
00135 # define DLLEXPORT
00136 # define DLLIMPORT
00137 # endif
00138 #endif
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 #define BEGIN_REGISTER_METAOBJECT_FACTORIES(cl) \
00170 class Register##cl { \
00171 public: \
00172 Register##cl() \
00173 {
00174
00175 #define END_REGISTER_METAOBJECT_FACTORIES(cl) \
00176 } \
00177 }; \
00178 DLLEXPORT Register##cl Register##cl##_globalstatic;
00179
00180
00181 #define BEGIN_REGISTER_EXTENDERS(cl) BEGIN_REGISTER_METAOBJECT_FACTORIES(cl)
00182 #define END_REGISTER_EXTENDERS(cl) END_REGISTER_METAOBJECT_FACTORIES(cl)
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 #define REGISTER_METAOBJECT_FACTORIES(ns, cl, type, factfn) \
00236 class Register##ns##_##cl { \
00237 public: \
00238 Register##ns##_##cl() { \
00239 Site::addLocalMetaObjectFactory(typeid(ns::cl).name(), factfn); \
00240 Site::addLocalMetaObjectFactory(type, factfn); \
00241 Site::addRemoteMetaObjectFactory(typeid(ns::cl).name(), type, factfn); \
00242 Site::addRemoteMetaObjectFactory(type, type, factfn); \
00243 } \
00244 }; \
00245 DLLEXPORT Register##ns##_cl Register##ns##_cl##_globalstatic;
00246
00247
00248
00249
00250
00251
00252
00253
00254 #define IMPORT_METAOBJECT_FACTORIES(cl) \
00255 class Register##cl { }; \
00256 extern DLLIMPORT Register##cl Register##cl##_globalstatic; \
00257 static Register##cl &Register##cl##_localref = Register##cl##_globalstatic;
00258
00259 #define REGISTERS_METAOBJECT_FACTORIES(cl) IMPORT_METAOBJECT_FACTORIES(cl)
00260
00261 #endif