00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef CCXX_CONFIG_H_
00017 #define CCXX_CONFIG_H_
00018
00019 #if defined(__APPLE__) && defined(__MACH__)
00020 #define MACOSX
00021 #define _PTHREADS 1
00022 #endif
00023
00024 #if defined(__FreeBSD__)
00025 #define __BSD_VISIBLE 1
00026 #endif
00027
00028
00029
00030
00031
00032
00033 #define __DLL
00034 #define __EXPORT
00035 #define __DLLRTL
00036
00037 #define __MEMBER_EXPORT
00038
00039 #define CCXX_EMPTY
00040 #define CCXX_EXPORT(t) t
00041 #define CCXX_MEMBER(t) t
00042 #define CCXX_MEMBER_EXPORT(t) t
00043 #define CCXX_CLASS_EXPORT
00044 #define HAVE_ENDIAN_H 1
00045
00046
00047 #define HAVE_SYS_FCNTL_H 1
00048 #define HAVE_FCNTL_H 1
00049 #define HAVE_SYS_TYPES_STD 1
00050 #define HAVE_SYS_TYPES_64 1
00051 #define HAVE_LONG_LONG 1
00052
00053 #define HAVE_SYS_TYPES_H 1
00054 #define HAVE_SIGWAIT 1
00055 #define HAVE_SIGWAIT2 1
00056 #define HAVE_SIGACTION 1
00057
00058 #define HAVE_SETITIMER 1
00059 #define HAVE_STRCASECMP 1
00060 #define HAVE_STRDUP 1
00061
00062
00063 #define HAVE_MEMMOVE 1
00064 #define HAVE_STRINGS_H 1
00065 #define HAVE_GETOPT_LONG 1
00066 #define HAVE_GETOPT_H 1
00067
00068 #define HAVE_MODULES 1
00069 #define HAVE_DLFCN_H 1
00070 #define HAVE_SCHED_GETSCHEDULER 1
00071 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
00072
00073 #define HAVE_PTHREAD_MUTEXATTR_SETTYPE 1
00074
00075
00076 #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
00077
00078
00079 #define HAVE_PTHREAD_YIELD 1
00080 #define HAVE_PTHREAD_NANOSLEEP 1
00081 #define HAVE_PTHREAD_CANCEL 1
00082 #define HAVE_PTHREAD_SETCANCELTYPE 1
00083
00084 #define HAVE_PTHREAD_RWLOCK 1
00085 #define HAVE_PREAD_PWRITE 1
00086
00087
00088 #define HAVE_SEMAPHORE_H 1
00089
00090 #define HAVE_FEATURES_H 1
00091 #define HAVE_SYS_TIME_H 1
00092 #define TIME_WITH_SYS_TIME 1
00093 #define HAVE_STRTOK_R 1
00094 #define HAVE_LOCALTIME_R 1
00095 #define HAVE_SETENV 1
00096 #define _POSIX_PII_SOCKET
00097 #define HAVE_SYS_SOCKET_H 1
00098 #define HAVE_ARPA_INET_H 1
00099 #define HAVE_NETINET_IN_SYSTM_H 1
00100 #define HAVE_NETINET_IP_H 1
00101 #define HAVE_SYS_UN_H 1
00102
00103 #define HAVE_SYS_SELECT_H 1
00104 #define HAVE_INET_ATON 1
00105 #define HAVE_INET_SOCKETS 1
00106 #define HAVE_UNIX_SOCKETS 1
00107 #define HAVE_SOCKLEN_T 1
00108
00109
00110 #define HAVE_SYS_POLL_H 1
00111 #define HAVE_POLL_H 1
00112 #define HAVE_ZLIB_H 1
00113 #define HAVE_LIBXML 1
00114
00115 #define COMMON_XML_PARSING 1
00116
00117 #define CCXX_HAVE_NEW_INIT 1
00118
00119 #define CCXX_NAMESPACES 1
00120 #define HAVE_BOOL_TYPE 1
00121 #define HAVE_EXCEPTION_HANDLING 1
00122 #define HAVE_EXCEPTION 1
00123
00124
00125
00126
00127
00128
00129 #define HAVE_ARPA_INET_H 1
00130
00131
00132
00133
00134
00135 #define HAVE_DLFCN_H 1
00136
00137
00138 #define HAVE_EXCEPTION 1
00139
00140
00141 #define HAVE_FCNTL_H 1
00142
00143
00144 #define HAVE_FEATURES_H 1
00145
00146
00147 #define HAVE_GETOPT 1
00148
00149
00150 #define HAVE_GETOPT_H 1
00151
00152
00153 #define HAVE_GETOPT_LONG 1
00154
00155
00156 #define HAVE_INTTYPES_H 1
00157
00158
00159
00160
00161
00162
00163
00164
00165 #define HAVE_MEMMOVE 1
00166
00167
00168 #define HAVE_MEMORY_H 1
00169
00170
00171 #define HAVE_NETINET_IN_SYSTM_H 1
00172
00173
00174 #define HAVE_NETINET_IP_H 1
00175
00176
00177 #define HAVE_POLL 1
00178
00179
00180 #define HAVE_POLL_H 1
00181
00182
00183
00184
00185
00186 #define HAVE_PTHREAD_H 1
00187
00188
00189
00190
00191
00192 #define HAVE_SCHED_GETSCHEDULER 1
00193
00194
00195 #define HAVE_SCHED_H 1
00196
00197
00198
00199
00200
00201 #define HAVE_SEMAPHORE_H 1
00202
00203
00204 #define HAVE_SETENV 1
00205
00206
00207 #define HAVE_SETITIMER 1
00208
00209
00210 #define HAVE_SIGACTION 1
00211
00212
00213 #define HAVE_SIGWAIT 1
00214
00215
00216 #define HAVE_SNPRINTF 1
00217
00218
00219 #define HAVE_SSTREAM 1
00220
00221
00222
00223
00224
00225 #define HAVE_STDINT_H 1
00226
00227
00228 #define HAVE_STDLIB_H 1
00229
00230
00231 #define HAVE_STRCASECMP 1
00232
00233
00234 #define HAVE_STRDUP 1
00235
00236
00237 #define HAVE_STRINGS_H 1
00238
00239
00240 #define HAVE_STRING_H 1
00241
00242
00243 #define HAVE_SYSLOG_H 1
00244
00245
00246
00247
00248
00249 #define HAVE_SYS_FCNTL_H 1
00250
00251
00252 #define HAVE_SYS_FILE_H 1
00253
00254
00255
00256
00257
00258
00259
00260
00261 #define HAVE_SYS_POLL_H 1
00262
00263
00264
00265
00266
00267 #define HAVE_SYS_SELECT_H 1
00268
00269
00270 #define HAVE_SYS_SOCKET_H 1
00271
00272
00273
00274
00275
00276 #define HAVE_SYS_STAT_H 1
00277
00278
00279
00280
00281
00282 #define HAVE_SYS_TIME_H 1
00283
00284
00285 #define HAVE_SYS_TYPES_H 1
00286
00287
00288 #define HAVE_SYS_UN_H 1
00289
00290
00291
00292
00293
00294 #define HAVE_UNISTD_H 1
00295
00296
00297
00298
00299
00300 #define HAVE_ZLIB_H 1
00301
00302
00303 #define CCXX_PACKAGE "commoncpp2"
00304
00305
00306 #define CCXX_PACKAGE_BUGREPORT ""
00307
00308
00309 #define CCXX_PACKAGE_NAME ""
00310
00311
00312 #define CCXX_PACKAGE_STRING ""
00313
00314
00315 #define CCXX_PACKAGE_TARNAME ""
00316
00317
00318 #define CCXX_PACKAGE_CCXX_VERSION ""
00319
00320
00321 #define RETSIGTYPE void
00322
00323
00324
00325
00326
00327 #define TIME_WITH_SYS_TIME 1
00328
00329
00330 #define CCXX_VERSION "1.0.13"
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342 #define COMMON_ASYNC_OVERRIDE
00343 #define COMMON_OST_NAMESPACE
00344 #define COMMON_THREAD_SLEEP
00345 #define COMMON_NET_DEVICES
00346
00347 #ifdef _AIX
00348 #ifndef _ALL_SOURCE
00349 #define _ALL_SOURCE
00350 #endif
00351 #ifdef HAVE_PTHREAD_SUSPEND
00352
00353 #endif
00354 #endif
00355
00356 #ifndef _REENTRANT
00357 #define _REENTRANT 1
00358 #endif
00359 #ifndef _THREAD_SAFE
00360 #define _THREAD_SAFE 1
00361 #endif
00362 #ifndef _GNU_SOURCE
00363 #define _GNU_SOURCE 1
00364 #endif
00365 #if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__)
00366 #define _XOPEN_SOURCE 500
00367 #endif
00368
00369
00370
00371 #ifdef HAVE_SIGWAIT2
00372 #define _POSIX_PTHREAD_SEMANTICS
00373 #endif
00374
00375 #ifdef __hpux
00376 #ifdef HAVE_ARPA_INET_H
00377 #include <netinet/inet.h>
00378 #endif
00379 #ifndef _XOPEN_SOURCE_EXTENDED
00380 #define _XOPEN_SOURCE_EXTENDED
00381 #endif
00382 #ifdef mutable
00383
00384 #endif
00385 #endif
00386
00387 #ifdef HAVE_FEATURES_H
00388 #include <features.h>
00389 #endif
00390
00391
00392
00393 #ifdef HAVE_ENDIAN_H
00394 #include <endian.h>
00395 #else
00396 #define __LITTLE_ENDIAN 1234
00397 #define __BIG_ENDIAN 4321
00398 #endif
00399
00400
00401 #if defined(__sun) || defined(__SUN__)
00402 #define __EXTENSIONS__ 1
00403 #endif
00404
00405 #ifndef HAVE_FCNTL_H
00406 #ifdef HAVE_SYS_FCNTL_H
00407 #include <sys/fcntl.h>
00408 #endif
00409 #else
00410 #include <fcntl.h>
00411 #ifndef O_NDELAY
00412 #ifdef HAVE_SYS_FCNTL_H
00413 #include <sys/fcntl.h>
00414 #endif
00415 #endif
00416 #endif
00417
00418 #ifdef HAVE_UNISTD_H
00419 #include <unistd.h>
00420 #endif
00421
00422
00423 #ifdef HAVE_SYS_TYPES_H
00424 #include <sys/types.h>
00425 #endif
00426 #ifdef HAVE_SYS_TYPES_STD
00427 typedef int8_t int8;
00428 typedef u_int8_t uint8;
00429 typedef int16_t int16;
00430 typedef u_int16_t uint16;
00431 typedef int32_t int32;
00432 typedef u_int32_t uint32;
00433 #ifdef HAVE_SYS_TYPES_64
00434 #define HAVE_64_BITS
00435 typedef int64_t int64;
00436 typedef u_int64_t uint64;
00437 #endif
00438 #else
00439 typedef char int8;
00440 typedef unsigned char uint8;
00441 typedef short int16;
00442 typedef unsigned short uint16;
00443 typedef int int32;
00444 typedef unsigned int uint32;
00445 #endif
00446 #ifndef HAVE_SYS_TYPES_64
00447 #if defined(HAVE_LONG_LONG) || defined(_LONGLONG)
00448 #define HAVE_64_BITS
00449 typedef long long int64;
00450 typedef unsigned long long uint64;
00451 #else
00452 #ifdef __arch64__
00453 #define HAVE_64_BITS
00454 typedef long int int64;
00455 typedef unsigned long int uint64;
00456 #endif
00457 #endif
00458 #endif
00459
00460 #ifdef HAVE_SS_H
00461 #include <ss.h>
00462 #define COMMON_SECURE
00463 #endif
00464
00465 #ifdef HAVE_SIGACTION
00466 #ifdef HAVE_BSD_SIGNAL_H
00467
00468 #endif
00469 #endif
00470
00471 #ifdef HAVE_BSD_SIGNAL_H
00472 #include <bsd/signal.h>
00473 #else
00474 #include <signal.h>
00475 #endif
00476
00477 #ifndef SA_ONESHOT
00478 #define SA_ONESHOT SA_RESETHAND
00479 #endif
00480
00481
00482 #include <string.h>
00483 #ifdef HAVE_STRINGS_H
00484 #include <strings.h>
00485 #endif
00486
00487 #ifndef HAVE_MEMMOVE
00488 #define memmove(d, s, l) memcpy(d, s, l)
00489 #endif
00490
00491 #ifdef HAVE_STRCASECMP
00492 #ifndef stricmp
00493 #define stricmp(x,y) strcasecmp(x,y)
00494 #endif
00495 #ifndef strnicmp
00496 #define strnicmp(x,y,n) strncasecmp(x,y,n)
00497 #endif
00498 #endif
00499
00500 #ifndef HAVE_STRDUP
00501 #define strdup(s) (char *)malloc(strlen(s))
00502 #endif
00503
00504
00505
00506
00507 #ifdef HAVE_THREAD_H
00508 #include "/usr/include/thread.h"
00509 #if defined(i386) && defined(__svr4__) && !defined(__sun)
00510 #define _THR_UNIXWARE
00511 #endif
00512 #if defined(__SVR4) && defined(__sun)
00513 #define _THR_SUNOS5
00514 #else
00515 #if defined(__SVR4__) && defined(__SUN__)
00516 #define _THR_SUNOS5
00517 #endif
00518 #endif
00519 #endif
00520
00521 #ifdef HAVE_WORKING_SYS_ATOMIC_H
00522 #include <sys/atomic.h>
00523 #define HAVE_ATOMIC
00524 #endif
00525
00526 #if defined(HAVE_PTHREAD_H) && ( defined(_THREAD_SAFE) || defined(_REENTRANT) )
00527
00528 #include <pthread.h>
00529
00530 #ifdef HAVE_PTHREAD_NP_H
00531 #include <pthread_np.h>
00532 #endif
00533
00534 #ifdef HAVE_SEMAPHORE_H
00535 #include <semaphore.h>
00536 #endif
00537 #ifdef _POSIX_PRIORITY_SCHEDULING
00538 #ifdef HAVE_SCHED_H
00539 #include <sched.h>
00540 #else
00541 #ifdef HAVE_SYS_SCHED_H
00542 #include <sys/sched.h>
00543 #endif
00544 #endif
00545 #endif
00546
00547 #define __PTHREAD_H__
00548 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
00549 #ifdef MUTEX_TYPE_COUNTING_FAST
00550 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
00551 #endif
00552 #endif
00553 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
00554 #ifdef PTHREAD_MUTEX_RECURSIVE
00555 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
00556 #endif
00557 #endif
00558 #ifndef HAVE_PTHREAD_MUTEXATTR_SETTYPE
00559 #if HAVE_PTHREAD_MUTEXATTR_SETKIND_NP
00560 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
00561 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
00562 #endif
00563 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_getkind_np(x, y)
00564 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_setkind_np(x, y)
00565 #endif
00566 #if HAVE_PTHREAD_MUTEXATTR_SETTYPE_NP
00567 #ifndef PTHREAD_MUTEXTYPE_RECURSIVE
00568 #define PTHREAD_MUTEXTYPE_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
00569 #endif
00570 #define pthread_mutexattr_settype(x, y) pthread_mutexattr_settype_np(x, y)
00571 #define pthread_mutexattr_gettype(x, y) pthread_mutexattr_gettype_np(x, y)
00572 #endif
00573 #endif
00574
00575 #ifndef HAVE_PTHREAD_YIELD
00576 #ifdef HAVE_PTHREAD_SCHED_YIELD
00577 #define pthread_yield() sched_yield()
00578 #define HAVE_PTHREAD_YIELD
00579 #endif
00580 #endif
00581
00582 #ifndef HAVE_PTHREAD_DELAY
00583 #ifdef HAVE_PTHREAD_DELAY_NP
00584 #define HAVE_PTHREAD_DELAY
00585 #define pthread_delay(x) pthread_delay_np(x)
00586 #endif
00587 #ifdef HAVE_PTHREAD_NANOSLEEP
00588 #ifndef HAVE_PTHREAD_DELAY
00589 #define HAVE_PTHREAD_DELAY
00590 #ifdef __FreeBSD__
00591 extern "C" int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
00592 #endif
00593 #define pthread_delay(x) nanosleep(x, NULL)
00594 #endif
00595 #endif
00596 #endif
00597
00598 #ifdef HAVE_PTHREAD_ATTR_SETSTACK
00599 #ifndef PTHREAD_STACK_MIN
00600 #define PTHREAD_STACK_MIN 32768
00601 #endif
00602 #endif
00603
00604 #ifndef HAVE_PTHREAD_CANCEL
00605 #ifdef SIGCANCEL
00606 #define CCXX_SIG_THREAD_CANCEL SIGCANCEL
00607 #else
00608 #define CCXX_SIG_THREAD_CANCEL SIGQUIT
00609 #endif
00610 #define pthread_cancel(x) pthread_kill(x, CCXX_SIG_THREAD_CANCEL)
00611 #endif
00612
00613 #ifndef HAVE_PTHREAD_SETCANCELTYPE
00614 #ifdef HAVE_PTHREAD_SETCANCEL
00615 enum
00616 { PTHREAD_CANCEL_ASYNCHRONOUS = CANCEL_ON,
00617 PTHREAD_CANCEL_DEFERRED = CANCEL_OFF};
00618 enum
00619 { PTHREAD_CANCEL_ENABLE = CANCEL_ON,
00620 PTHREAD_CANCEL_DISABLE = CANCEL_OFF};
00621 #define pthread_setcancelstate(x, y) \
00622 (y == NULL) ? pthread_setcancel(x) : *y = pthread_setcancel
00623 #define pthread_setcanceltype(x, y) \
00624 (y == NULL) ? pthread_setasynccancel(x) | *y = pthread_setasynccancel(x)
00625 #else
00626 #define pthread_setcanceltype(x, y)
00627 #define pthread_setcancelstate(x, y)
00628 #endif
00629 #endif
00630
00631 #endif
00632
00633
00634 #if TIME_WITH_SYS_TIME
00635 #include <sys/time.h>
00636 #include <time.h>
00637 #else
00638 #if HAVE_SYS_TIME_H
00639 #include <sys/time.h>
00640 #else
00641 #include <time.h>
00642 #endif
00643 #endif
00644
00645
00646 #ifndef HAVE_STRTOK_R
00647 #define strtok_r(s, d, r) strtok(s, d)
00648 #endif
00649
00650 #ifndef HAVE_LOCALTIME_R
00651 #define localtime_r(t, b) localtime(t)
00652 #define ctime_r(t, b) ctime(t)
00653 #define gmtime_r(t, b) gmtime(t)
00654 #define asctime_r(t, b) asctime(t)
00655 #endif
00656
00657
00658 #ifdef HAVE_SYS_LIBCSYS_H
00659 #include <sys/libcsys.h>
00660 #endif
00661
00662 #ifdef HAVE_WINSOCK_H
00663 #include <winsock.h>
00664 #else
00665 #ifdef HAVE_SYS_SOCKET_H
00666 #include <sys/socket.h>
00667 #ifdef HAVE_SELECT_H
00668 #include <select.h>
00669 #else
00670 #ifdef HAVE_SYS_SELECT_H
00671 #include <sys/select.h>
00672 #endif
00673 #endif
00674 #ifdef HAVE_ARPA_INET_H
00675 #include <netinet/in.h>
00676 #include <arpa/inet.h>
00677 #include <netdb.h>
00678 #endif
00679 #ifdef HAVE_NETINET_IN_SYSTM_H
00680 #include <netinet/in_systm.h>
00681 #endif
00682 #ifdef HAVE_NETINET_IP_H
00683 #include <netinet/ip.h>
00684 #endif
00685 #ifdef HAVE_SYS_UN_H
00686 #include <sys/un.h>
00687 #endif
00688 #endif
00689 #endif
00690
00691 #ifndef HAVE_INET_ATON
00692 #define inet_aton(cp, addr) \
00693 (((*(unsigned long int *)(addr)) = inet_addr(cp)) != -1)
00694 #endif
00695
00696 #ifndef SUN_LEN
00697 #ifdef SCM_RIGHTS
00698 #define HAVE_UN_LEN
00699 #endif
00700 #ifdef __linux__
00701 #define HAVE_UN_LEN
00702 #endif
00703 #ifdef HAVE_UN_LEN
00704 #define SUN_LEN(ptr) sizeof(sockaddr_un.sun_len) + \
00705 sizeof(sockaddr_un.sun_family) + sizeof(sockaddr_un.sun_path) + 1
00706 #else
00707 #define SUN_LEN(ptr) ((size_t)((struct sockaddr_un *)0)->sun_path) \
00708 + strlen((ptr)->sun_path))
00709 #endif
00710 #endif
00711
00712 #ifndef HAVE_SOCKLEN_T
00713 #if defined(i386) && defined(__svr4__)
00714 #define HAVE_SOCKLEN_U
00715 #else
00716 #if defined(__CYGWIN32__)
00717 #define socklen_t int
00718 #else
00719 typedef int socklen_t;
00720 #endif
00721 #endif
00722
00723 #ifdef HAVE_SOCKLEN_U
00724 #if !defined(__CYGWIN32__) && !defined(__MINGW32__)
00725 typedef unsigned socklen_t;
00726 #else
00727 typedef int socklen_t;
00728 #endif
00729 #endif
00730 #endif
00731
00732 #ifdef HAVE_POLL_H
00733 #include <poll.h>
00734 #else
00735 #ifdef HAVE_SYS_POLL_H
00736 #include <sys/poll.h>
00737 #endif
00738 #endif
00739
00745
00746 #ifndef HAVE_BOOL_TYPE
00747 typedef enum { true=1, false=0 } bool;
00748 #endif
00749
00750
00751 #ifndef HAVE_EXCEPTION_HANDLING
00752
00753 #ifdef HAVE_EXCEPTION
00754 #define HAVE_EXCEPTION 1
00755 #endif
00756
00757 #define THROW(x) abort()
00758
00759 #define THROWS(x)
00760
00761
00762
00763 #define try if(0) ; else
00764 #define catch(x) if(1) ; else
00765 #else
00766 #define THROW(x) throw x
00767 #define THROWS(x) throw(x)
00768 #endif
00769
00770 #ifdef CCXX_NAMESPACES
00771 #define USING(x) using namespace x;
00772 #else
00773 #define USING(x)
00774 #endif
00775
00776 #ifdef __KCC
00777 #define KAI_NONSTD_IOSTREAM 1
00778 #endif
00779
00780 #ifdef __FreeBSD__
00781 #define ETC_PREFIX "/usr/etc/"
00782 #endif
00783
00784 #ifndef ETC_PREFIX
00785 #define ETC_PREFIX "/etc/"
00786 #endif
00787
00788 #ifdef _MSC_VER
00789 #pragma warning ( disable : 4335 ) // 'this' used in base init
00790 #endif
00791
00792 #endif