Go to the documentation of this file.00001 #ifndef _CP_COMMON_H
00002 #define _CP_COMMON_H
00003
00004
00005
00006
00007
00008
00009
00010 #ifdef __cplusplus
00011 #ifndef __BEGIN_DECLS
00012 #define __BEGIN_DECLS extern "C" {
00013 #endif
00014 #ifndef __END_DECLS
00015 #define __END_DECLS }
00016 #endif
00017 #else
00018 #ifndef __BEGIN_DECLS
00019 #define __BEGIN_DECLS
00020 #endif
00021 #ifndef __END_DECLS
00022 #define __END_DECLS
00023 #endif
00024 #endif
00025
00026 #if defined(linux) || defined(__linux__) || defined (__linux) || defined(__gnu_linux__)
00027 #ifndef _GNU_SOURCE
00028 #define _GNU_SOURCE
00029 #endif
00030 #endif
00031
00032 #ifdef __NetBSD__
00033 #ifndef __unix__
00034 #define __unix__ 1
00035 #endif
00036 #endif
00037
00038 #ifdef _WINDOWS
00039
00040
00041 typedef int pid_t;
00042
00043 #define SHUT_RD SD_RECEIVE
00044 #define SHUT_WR SD_SEND
00045 #define SHUT_RDWR SD_BOTH
00046
00047 #define close closesocket
00048
00049 #ifdef CPROPS_EXPORTS
00050 #define CPROPS_DLL __declspec(dllexport)
00051 #else
00052 #define CPROPS_DLL __declspec(dllimport)
00053 #endif
00054 #else
00055 #define CPROPS_DLL
00056 #endif
00057
00058 #if (defined linux || defined __linux || defined __gnu_linux__)
00059
00060 #ifndef _REENTRANT
00061 #define _REENTRANT
00062 #endif
00063
00064
00065 #ifndef _XOPEN_SOURCE
00066 #define _XOPEN_SOURCE 600
00067 #endif
00068 #ifndef __USE_UNIX98
00069 #define __USE_UNIX98
00070 #endif
00071
00072 #include <features.h>
00073
00074 #endif
00075
00076 #define DEFAULT_LOGFILE "cp.log"
00077 #if defined(unix) || defined(__unix__) || defined(__MACH__)
00078 #define DEFAULT_TIME_FORMAT "%Y-%m-%d %T"
00079 #else
00080 #define DEFAULT_TIME_FORMAT "%Y-%m-%d %H:%M:%S"
00081 #endif
00082
00083
00084 #define CP_MEMORY_ALLOCATION_FAILURE 10000
00085 #define CP_INVALID_FUNCTION_POINTER 10010
00086 #define CP_THREAD_CREATION_FAILURE 10020
00087 #define CP_INITIALIZATION_FAILURE 10030
00088 #define CP_LOCK_FAILED 10040
00089 #define CP_UNLOCK_FAILED 10050
00090
00091 #define CP_LOADLIB_FAILED 11010
00092 #define CP_LOADFN_FAILED 11020
00093 #define CP_MODULE_NOT_LOADED 11030
00094
00095 #define CP_IO_ERROR 12000
00096 #define CP_OPEN_PORT_FAILED 12010
00097 #define CP_HTTP_FETCH_FAILED 12020
00098 #define CP_INVALID_RESPONSE 12030
00099 #define CP_HTTP_EMPTY_REQUEST 12100
00100 #define CP_HTTP_INVALID_REQUEST_LINE 12110
00101 #define CP_HTTP_INVALID_STATUS_LINE 12111
00102 #define CP_HTTP_UNKNOWN_REQUEST_TYPE 12120
00103 #define CP_HTTP_INVALID_URI 12130
00104 #define CP_HTTP_INVALID_URL 12131
00105 #define CP_HTTP_VERSION_NOT_SPECIFIED 12140
00106 #define CP_HTTP_1_1_HOST_NOT_SPECIFIED 12150
00107 #define CP_HTTP_INCORRECT_REQUEST_BODY_LENGTH 12160
00108 #define CP_SSL_CTX_INITIALIZATION_ERROR 12200
00109 #define CP_SSL_HANDSHAKE_FAILED 12210
00110 #define CP_SSL_VERIFICATION_ERROR 12220
00111
00112 #define CP_LOG_FILE_OPEN_FAILURE 13000
00113 #define CP_LOG_NOT_OPEN 13010
00114
00115 #define CP_INVALID_VALUE 14000
00116 #define CP_MISSING_PARAMETER 14010
00117 #define CP_BAD_PARAMETER_SET 14020
00118 #define CP_ITEM_EXISTS 14030
00119 #define CP_ITEM_DOES_NOT_EXIST 14031
00120 #define CP_UNHANDLED_SIGNAL 14040
00121 #define CP_FILE_NOT_FOUND 14050
00122 #define CP_METHOD_NOT_IMPLEMENTED 14060
00123 #define CP_INVALID_FILE_OFFSET 14070
00124 #define CP_CORRUPT_FILE 14080
00125 #define CP_CORRUPT_INDEX 14081
00126 #define CP_UNIQUE_INDEX_VIOLATION 14090
00127
00128 #define CP_REGEX_COMPILATION_FAILURE 15000
00129 #define CP_COMPILATION_FAILURE 15010
00130
00131 #define CP_DBMS_NO_DRIVER 16000
00132 #define CP_DBMS_CONNECTION_FAILURE 16010
00133 #define CP_DBMS_QUERY_FAILED 16020
00134 #define CP_DBMS_CLIENT_ERROR 16030
00135 #define CP_DBMS_STATEMENT_ERROR 16040
00136
00137
00138
00139 #endif
00140