1 /* $Id$ */ 2 /* 3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) 4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 #ifndef __PJ_CONFIG_H__ 21 #define __PJ_CONFIG_H__ 22 23 24 /** 25 * @file config.h 26 * @brief PJLIB Main configuration settings. 27 */ 28 29 /******************************************************************** 30 * Include compiler specific configuration. 31 */ 32 #if defined(_MSC_VER) 33 # include <pj/compat/cc_msvc.h> 34 #elif defined(__GNUC__) 35 # include <pj/compat/cc_gcc.h> 36 #elif defined(__CW32__) 37 # include <pj/compat/cc_mwcc.h> 38 #elif defined(__MWERKS__) 39 # include <pj/compat/cc_codew.h> 40 #elif defined(__GCCE__) 41 # include <pj/compat/cc_gcce.h> 42 #elif defined(__ARMCC__) 43 # include <pj/compat/cc_armcc.h> 44 #else 45 # error "Unknown compiler." 46 #endif 47 48 /* PJ_ALIGN_DATA is compiler specific directive to align data address */ 49 #ifndef PJ_ALIGN_DATA 50 # error "PJ_ALIGN_DATA is not defined!" 51 #endif 52 53 /******************************************************************** 54 * Include target OS specific configuration. 55 */ 56 #if defined(PJ_AUTOCONF) 57 /* 58 * Autoconf 59 */ 60 # include <pj/compat/os_auto.h> 61 62 #elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 63 /* 64 * SymbianOS 65 */ 66 # include <pj/compat/os_symbian.h> 67 68 #elif defined(PJ_WIN32_WINCE) || defined(_WIN32_WCE) || defined(UNDER_CE) 69 /* 70 * Windows CE 71 */ 72 # undef PJ_WIN32_WINCE 73 # define PJ_WIN32_WINCE 1 74 # include <pj/compat/os_win32_wince.h> 75 76 /* Also define Win32 */ 77 # define PJ_WIN32 1 78 79 #elif defined(PJ_WIN32_WINPHONE8) || defined(_WIN32_WINPHONE8) 80 /* 81 * Windows Phone 8 82 */ 83 # undef PJ_WIN32_WINPHONE8 84 # define PJ_WIN32_WINPHONE8 1 85 # include <pj/compat/os_winphone8.h> 86 87 /* Also define Win32 */ 88 # define PJ_WIN32 1 89 90 #elif defined(PJ_WIN32_UWP) || defined(_WIN32_UWP) 91 /* 92 * Windows UWP 93 */ 94 # undef PJ_WIN32_UWP 95 # define PJ_WIN32_UWP 1 96 # include <pj/compat/os_winuwp.h> 97 98 /* Define Windows phone */ 99 # define PJ_WIN32_WINPHONE8 1 100 101 /* Also define Win32 */ 102 # define PJ_WIN32 1 103 104 #elif defined(PJ_WIN32) || defined(_WIN32) || defined(__WIN32__) || \ 105 defined(WIN32) || defined(PJ_WIN64) || defined(_WIN64) || \ 106 defined(WIN64) || defined(__TOS_WIN__) 107 # if defined(PJ_WIN64) || defined(_WIN64) || defined(WIN64) 108 /* 109 * Win64 110 */ 111 # undef PJ_WIN64 112 # define PJ_WIN64 1 113 # endif 114 # undef PJ_WIN32 115 # define PJ_WIN32 1 116 # include <pj/compat/os_win32.h> 117 118 #elif defined(PJ_LINUX) || defined(linux) || defined(__linux) 119 /* 120 * Linux 121 */ 122 # undef PJ_LINUX 123 # define PJ_LINUX 1 124 # include <pj/compat/os_linux.h> 125 126 #elif defined(PJ_PALMOS) && PJ_PALMOS!=0 127 /* 128 * Palm 129 */ 130 # include <pj/compat/os_palmos.h> 131 132 #elif defined(PJ_SUNOS) || defined(sun) || defined(__sun) 133 /* 134 * SunOS 135 */ 136 # undef PJ_SUNOS 137 # define PJ_SUNOS 1 138 # include <pj/compat/os_sunos.h> 139 140 #elif defined(PJ_DARWINOS) || defined(__MACOSX__) || \ 141 defined (__APPLE__) || defined (__MACH__) 142 /* 143 * MacOS X 144 */ 145 # undef PJ_DARWINOS 146 # define PJ_DARWINOS 1 147 # include <pj/compat/os_darwinos.h> 148 149 #elif defined(PJ_RTEMS) && PJ_RTEMS!=0 150 /* 151 * RTEMS 152 */ 153 # include <pj/compat/os_rtems.h> 154 #else 155 # error "Please specify target os." 156 #endif 157 158 159 /******************************************************************** 160 * Target machine specific configuration. 161 */ 162 #if defined(PJ_AUTOCONF) 163 /* 164 * Autoconf configured 165 */ 166 #include <pj/compat/m_auto.h> 167 168 #elif defined (PJ_M_I386) || defined(_i386_) || defined(i_386_) || \ 169 defined(_X86_) || defined(x86) || defined(__i386__) || \ 170 defined(__i386) || defined(_M_IX86) || defined(__I86__) 171 /* 172 * Generic i386 processor family, little-endian 173 */ 174 # undef PJ_M_I386 175 # define PJ_M_I386 1 176 # define PJ_M_NAME "i386" 177 # define PJ_HAS_PENTIUM 1 178 # define PJ_IS_LITTLE_ENDIAN 1 179 # define PJ_IS_BIG_ENDIAN 0 180 181 182 #elif defined (PJ_M_X86_64) || defined(__amd64__) || defined(__amd64) || \ 183 defined(__x86_64__) || defined(__x86_64) || \ 184 defined(_M_X64) || defined(_M_AMD64) 185 /* 186 * AMD 64bit processor, little endian 187 */ 188 # undef PJ_M_X86_64 189 # define PJ_M_X86_64 1 190 # define PJ_M_NAME "x86_64" 191 # define PJ_HAS_PENTIUM 1 192 # define PJ_IS_LITTLE_ENDIAN 1 193 # define PJ_IS_BIG_ENDIAN 0 194 195 #elif defined(PJ_M_IA64) || defined(__ia64__) || defined(_IA64) || \ 196 defined(__IA64__) || defined( _M_IA64) 197 /* 198 * Intel IA64 processor, default to little endian 199 */ 200 # undef PJ_M_IA64 201 # define PJ_M_IA64 1 202 # define PJ_M_NAME "ia64" 203 # define PJ_HAS_PENTIUM 1 204 # define PJ_IS_LITTLE_ENDIAN 1 205 # define PJ_IS_BIG_ENDIAN 0 206 207 #elif defined (PJ_M_M68K) && PJ_M_M68K != 0 208 209 /* 210 * Motorola m68k processor, big endian 211 */ 212 # undef PJ_M_M68K 213 # define PJ_M_M68K 1 214 # define PJ_M_NAME "m68k" 215 # define PJ_HAS_PENTIUM 0 216 # define PJ_IS_LITTLE_ENDIAN 0 217 # define PJ_IS_BIG_ENDIAN 1 218 219 220 #elif defined (PJ_M_ALPHA) || defined (__alpha__) || defined (__alpha) || \ 221 defined (_M_ALPHA) 222 /* 223 * DEC Alpha processor, little endian 224 */ 225 # undef PJ_M_ALPHA 226 # define PJ_M_ALPHA 1 227 # define PJ_M_NAME "alpha" 228 # define PJ_HAS_PENTIUM 0 229 # define PJ_IS_LITTLE_ENDIAN 1 230 # define PJ_IS_BIG_ENDIAN 0 231 232 233 #elif defined(PJ_M_MIPS) || defined(__mips__) || defined(__mips) || \ 234 defined(__MIPS__) || defined(MIPS) || defined(_MIPS_) 235 /* 236 * MIPS, bi-endian, so raise error if endianness is not configured 237 */ 238 # undef PJ_M_MIPS 239 # define PJ_M_MIPS 1 240 # define PJ_M_NAME "mips" 241 # define PJ_HAS_PENTIUM 0 242 # if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN 243 # error Endianness must be declared for this processor 244 # endif 245 246 247 #elif defined (PJ_M_SPARC) || defined( __sparc__) || defined(__sparc) 248 /* 249 * Sun Sparc, big endian 250 */ 251 # undef PJ_M_SPARC 252 # define PJ_M_SPARC 1 253 # define PJ_M_NAME "sparc" 254 # define PJ_HAS_PENTIUM 0 255 # define PJ_IS_LITTLE_ENDIAN 0 256 # define PJ_IS_BIG_ENDIAN 1 257 258 #elif defined(ARM) || defined(_ARM_) || defined(__arm__) || defined(_M_ARM) 259 # define PJ_HAS_PENTIUM 0 260 /* 261 * ARM, bi-endian, so raise error if endianness is not configured 262 */ 263 # if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN 264 # error Endianness must be declared for this processor 265 # endif 266 # if defined (PJ_M_ARMV7) || defined(ARMV7) 267 # undef PJ_M_ARMV7 268 # define PJ_M_ARM7 1 269 # define PJ_M_NAME "armv7" 270 # elif defined (PJ_M_ARMV4) || defined(ARMV4) 271 # undef PJ_M_ARMV4 272 # define PJ_M_ARMV4 1 273 # define PJ_M_NAME "armv4" 274 # endif 275 276 #elif defined (PJ_M_POWERPC) || defined(__powerpc) || defined(__powerpc__) || \ 277 defined(__POWERPC__) || defined(__ppc__) || defined(_M_PPC) || \ 278 defined(_ARCH_PPC) 279 /* 280 * PowerPC, bi-endian, so raise error if endianness is not configured 281 */ 282 # undef PJ_M_POWERPC 283 # define PJ_M_POWERPC 1 284 # define PJ_M_NAME "powerpc" 285 # define PJ_HAS_PENTIUM 0 286 # if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN 287 # error Endianness must be declared for this processor 288 # endif 289 290 #elif defined (PJ_M_NIOS2) || defined(__nios2) || defined(__nios2__) || \ 291 defined(__NIOS2__) || defined(__M_NIOS2) || defined(_ARCH_NIOS2) 292 /* 293 * Nios2, little endian 294 */ 295 # undef PJ_M_NIOS2 296 # define PJ_M_NIOS2 1 297 # define PJ_M_NAME "nios2" 298 # define PJ_HAS_PENTIUM 0 299 # define PJ_IS_LITTLE_ENDIAN 1 300 # define PJ_IS_BIG_ENDIAN 0 301 302 #else 303 # error "Please specify target machine." 304 #endif 305 306 /* Include size_t definition. */ 307 #include <pj/compat/size_t.h> 308 309 /* Include site/user specific configuration to control PJLIB features. 310 * YOU MUST CREATE THIS FILE YOURSELF!! 311 */ 312 #include <pj/config_site.h> 313 314 /******************************************************************** 315 * PJLIB Features. 316 */ 317 318 /* Overrides for DOXYGEN */ 319 #ifdef DOXYGEN 320 # undef PJ_FUNCTIONS_ARE_INLINED 321 # undef PJ_HAS_FLOATING_POINT 322 # undef PJ_LOG_MAX_LEVEL 323 # undef PJ_LOG_MAX_SIZE 324 # undef PJ_LOG_USE_STACK_BUFFER 325 # undef PJ_TERM_HAS_COLOR 326 # undef PJ_POOL_DEBUG 327 # undef PJ_HAS_TCP 328 # undef PJ_MAX_HOSTNAME 329 # undef PJ_IOQUEUE_MAX_HANDLES 330 # undef FD_SETSIZE 331 # undef PJ_HAS_SEMAPHORE 332 # undef PJ_HAS_EVENT_OBJ 333 # undef PJ_ENABLE_EXTRA_CHECK 334 # undef PJ_EXCEPTION_USE_WIN32_SEH 335 # undef PJ_HAS_ERROR_STRING 336 337 # define PJ_HAS_IPV6 1 338 #endif 339 340 /** 341 * @defgroup pj_config Build Configuration 342 * @{ 343 * 344 * This section contains macros that can set during PJLIB build process 345 * to controll various aspects of the library. 346 * 347 * <b>Note</b>: the values in this page does NOT necessarily reflect to the 348 * macro values during the build process. 349 */ 350 351 /** 352 * If this macro is set to 1, it will enable some debugging checking 353 * in the library. 354 * 355 * Default: equal to (NOT NDEBUG). 356 */ 357 #ifndef PJ_DEBUG 358 # ifndef NDEBUG 359 # define PJ_DEBUG 1 360 # else 361 # define PJ_DEBUG 0 362 # endif 363 #endif 364 365 /** 366 * Enable this macro to activate logging to mutex/semaphore related events. 367 * This is useful to troubleshoot concurrency problems such as deadlocks. 368 * In addition, you should also add PJ_LOG_HAS_THREAD_ID flag to the 369 * log decoration to assist the troubleshooting. 370 * 371 * Default: 0 372 */ 373 #ifndef PJ_DEBUG_MUTEX 374 # define PJ_DEBUG_MUTEX 0 375 #endif 376 377 /** 378 * Expand functions in *_i.h header files as inline. 379 * 380 * Default: 0. 381 */ 382 #ifndef PJ_FUNCTIONS_ARE_INLINED 383 # define PJ_FUNCTIONS_ARE_INLINED 0 384 #endif 385 386 /** 387 * Use floating point computations in the library. 388 * 389 * Default: 1. 390 */ 391 #ifndef PJ_HAS_FLOATING_POINT 392 # define PJ_HAS_FLOATING_POINT 1 393 #endif 394 395 /** 396 * Declare maximum logging level/verbosity. Lower number indicates higher 397 * importance, with the highest importance has level zero. The least 398 * important level is five in this implementation, but this can be extended 399 * by supplying the appropriate implementation. 400 * 401 * The level conventions: 402 * - 0: fatal error 403 * - 1: error 404 * - 2: warning 405 * - 3: info 406 * - 4: debug 407 * - 5: trace 408 * - 6: more detailed trace 409 * 410 * Default: 4 411 */ 412 #ifndef PJ_LOG_MAX_LEVEL 413 # define PJ_LOG_MAX_LEVEL 5 414 #endif 415 416 /** 417 * Maximum message size that can be sent to output device for each call 418 * to PJ_LOG(). If the message size is longer than this value, it will be cut. 419 * This may affect the stack usage, depending whether PJ_LOG_USE_STACK_BUFFER 420 * flag is set. 421 * 422 * Default: 4000 423 */ 424 #ifndef PJ_LOG_MAX_SIZE 425 # define PJ_LOG_MAX_SIZE 4000 426 #endif 427 428 /** 429 * Log buffer. 430 * Does the log get the buffer from the stack? (default is yes). 431 * If the value is set to NO, then the buffer will be taken from static 432 * buffer, which in this case will make the log function non-reentrant. 433 * 434 * Default: 1 435 */ 436 #ifndef PJ_LOG_USE_STACK_BUFFER 437 # define PJ_LOG_USE_STACK_BUFFER 1 438 #endif 439 440 /** 441 * Enable log indentation feature. 442 * 443 * Default: 1 444 */ 445 #ifndef PJ_LOG_ENABLE_INDENT 446 # define PJ_LOG_ENABLE_INDENT 1 447 #endif 448 449 /** 450 * Number of PJ_LOG_INDENT_CHAR to put every time pj_log_push_indent() 451 * is called. 452 * 453 * Default: 1 454 */ 455 #ifndef PJ_LOG_INDENT_SIZE 456 # define PJ_LOG_INDENT_SIZE 1 457 #endif 458 459 /** 460 * Log indentation character. 461 * 462 * Default: space 463 */ 464 #ifndef PJ_LOG_INDENT_CHAR 465 # define PJ_LOG_INDENT_CHAR '.' 466 #endif 467 468 /** 469 * Log sender width. 470 * 471 * Default: 22 (for 64-bit machines), 14 otherwise 472 */ 473 #ifndef PJ_LOG_SENDER_WIDTH 474 # if PJ_HAS_STDINT_H 475 # include <stdint.h> 476 # if (UINTPTR_MAX == 0xffffffffffffffff) 477 # define PJ_LOG_SENDER_WIDTH 22 478 # else 479 # define PJ_LOG_SENDER_WIDTH 14 480 # endif 481 # else 482 # define PJ_LOG_SENDER_WIDTH 14 483 # endif 484 #endif 485 486 /** 487 * Log thread name width. 488 * 489 * Default: 12 490 */ 491 #ifndef PJ_LOG_THREAD_WIDTH 492 # define PJ_LOG_THREAD_WIDTH 12 493 #endif 494 495 /** 496 * Colorfull terminal (for logging etc). 497 * 498 * Default: 1 499 */ 500 #ifndef PJ_TERM_HAS_COLOR 501 # define PJ_TERM_HAS_COLOR 1 502 #endif 503 504 505 /** 506 * Set this flag to non-zero to enable various checking for pool 507 * operations. When this flag is set, assertion must be enabled 508 * in the application. 509 * 510 * This will slow down pool creation and destruction and will add 511 * few bytes of overhead, so application would normally want to 512 * disable this feature on release build. 513 * 514 * Default: 0 515 */ 516 #ifndef PJ_SAFE_POOL 517 # define PJ_SAFE_POOL 0 518 #endif 519 520 521 /** 522 * If pool debugging is used, then each memory allocation from the pool 523 * will call malloc(), and pool will release all memory chunks when it 524 * is destroyed. This works better when memory verification programs 525 * such as Rational Purify is used. 526 * 527 * Default: 0 528 */ 529 #ifndef PJ_POOL_DEBUG 530 # define PJ_POOL_DEBUG 0 531 #endif 532 533 534 /** 535 * If enabled, when calling pj_pool_release(), the memory pool content 536 * will be wiped out first before released. 537 * 538 * Default: 0 539 */ 540 #ifndef PJ_POOL_RELEASE_WIPE_DATA 541 # define PJ_POOL_RELEASE_WIPE_DATA 0 542 #endif 543 544 545 /** 546 * Enable timer debugging facility. When this is enabled, application 547 * can call pj_timer_heap_dump() to show the contents of the timer 548 * along with the source location where the timer entries were scheduled. 549 * See https://trac.pjsip.org/repos/ticket/1527 for more info. 550 * 551 * Default: 1 552 */ 553 #ifndef PJ_TIMER_DEBUG 554 # define PJ_TIMER_DEBUG 1 555 #endif 556 557 558 /** 559 * If enabled, the timer will keep internal copies of the timer entries. 560 * This will increase the robustness and stability of the timer (against 561 * accidental modification or premature deallocation of the timer entries) and 562 * makes it easier to troubleshoot any timer related issues, with the overhead 563 * of additional memory space required. 564 * 565 * Note that the detection against premature deallocation only works if the 566 * freed memory content has changed (such as if it's been reallocated and 567 * overwritten by another data. Alternatively, you can enable 568 * PJ_POOL_RELEASE_WIPE_DATA which will erase the data first before releasing 569 * the memory). 570 * 571 * Default: 1 (enabled) 572 */ 573 #ifndef PJ_TIMER_USE_COPY 574 # define PJ_TIMER_USE_COPY 1 575 #endif 576 577 578 /** 579 * If enabled, the timer use sorted linked list instead of binary heap tree 580 * structure. Note that using sorted linked list is intended for debugging 581 * purposes and will hamper performance significantly when scheduling large 582 * number of entries. 583 * 584 * Default: 0 (Use binary heap tree) 585 */ 586 #ifndef PJ_TIMER_USE_LINKED_LIST 587 # define PJ_TIMER_USE_LINKED_LIST 0 588 #endif 589 590 /** 591 * Set this to 1 to enable debugging on the group lock. Default: 0 592 */ 593 #ifndef PJ_GRP_LOCK_DEBUG 594 # define PJ_GRP_LOCK_DEBUG 0 595 #endif 596 597 598 /** 599 * Specify this as \a stack_size argument in #pj_thread_create() to specify 600 * that thread should use default stack size for the current platform. 601 * 602 * Default: 8192 603 */ 604 #ifndef PJ_THREAD_DEFAULT_STACK_SIZE 605 # define PJ_THREAD_DEFAULT_STACK_SIZE 8192 606 #endif 607 608 609 /** 610 * Specify if PJ_CHECK_STACK() macro is enabled to check the sanity of 611 * the stack. The OS implementation may check that no stack overflow 612 * occurs, and it also may collect statistic about stack usage. Note 613 * that this will increase the footprint of the libraries since it 614 * tracks the filename and line number of each functions. 615 */ 616 #ifndef PJ_OS_HAS_CHECK_STACK 617 # define PJ_OS_HAS_CHECK_STACK 0 618 #endif 619 620 /** 621 * Do we have alternate pool implementation? 622 * 623 * Default: 0 624 */ 625 #ifndef PJ_HAS_POOL_ALT_API 626 # define PJ_HAS_POOL_ALT_API PJ_POOL_DEBUG 627 #endif 628 629 630 /** 631 * Support TCP in the library. 632 * Disabling TCP will reduce the footprint slightly (about 6KB). 633 * 634 * Default: 1 635 */ 636 #ifndef PJ_HAS_TCP 637 # define PJ_HAS_TCP 1 638 #endif 639 640 /** 641 * Support IPv6 in the library. If this support is disabled, some IPv6 642 * related functions will return PJ_EIPV6NOTSUP. 643 * 644 * Default: 0 (disabled, for now) 645 */ 646 #ifndef PJ_HAS_IPV6 647 # define PJ_HAS_IPV6 0 648 #endif 649 650 /** 651 * Maximum hostname length. 652 * Libraries sometimes needs to make copy of an address to stack buffer; 653 * the value here affects the stack usage. 654 * 655 * Default: 128 656 */ 657 #ifndef PJ_MAX_HOSTNAME 658 # define PJ_MAX_HOSTNAME (128) 659 #endif 660 661 /** 662 * Maximum consecutive identical error for accept() operation before 663 * activesock stops calling the next ioqueue accept. 664 * 665 * Default: 50 666 */ 667 #ifndef PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR 668 # define PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR 50 669 #endif 670 671 /** 672 * Constants for declaring the maximum handles that can be supported by 673 * a single IOQ framework. This constant might not be relevant to the 674 * underlying I/O queue impelementation, but still, developers should be 675 * aware of this constant, to make sure that the program will not break when 676 * the underlying implementation changes. 677 */ 678 #ifndef PJ_IOQUEUE_MAX_HANDLES 679 # define PJ_IOQUEUE_MAX_HANDLES (64) 680 #endif 681 682 683 /** 684 * If PJ_IOQUEUE_HAS_SAFE_UNREG macro is defined, then ioqueue will do more 685 * things to ensure thread safety of handle unregistration operation by 686 * employing reference counter to each handle. 687 * 688 * In addition, the ioqueue will preallocate memory for the handles, 689 * according to the maximum number of handles that is specified during 690 * ioqueue creation. 691 * 692 * All applications would normally want this enabled, but you may disable 693 * this if: 694 * - there is no dynamic unregistration to all ioqueues. 695 * - there is no threading, or there is no preemptive multitasking. 696 * 697 * Default: 1 698 */ 699 #ifndef PJ_IOQUEUE_HAS_SAFE_UNREG 700 # define PJ_IOQUEUE_HAS_SAFE_UNREG 1 701 #endif 702 703 704 /** 705 * Default concurrency setting for sockets/handles registered to ioqueue. 706 * This controls whether the ioqueue is allowed to call the key's callback 707 * concurrently/in parallel. The default is yes, which means that if there 708 * are more than one pending operations complete simultaneously, more 709 * than one threads may call the key's callback at the same time. This 710 * generally would promote good scalability for application, at the 711 * expense of more complexity to manage the concurrent accesses. 712 * 713 * Please see the ioqueue documentation for more info. 714 */ 715 #ifndef PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY 716 # define PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY 1 717 #endif 718 719 720 /* Sanity check: 721 * if ioqueue concurrency is disallowed, PJ_IOQUEUE_HAS_SAFE_UNREG 722 * must be enabled. 723 */ 724 #if (PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY==0) && (PJ_IOQUEUE_HAS_SAFE_UNREG==0) 725 # error PJ_IOQUEUE_HAS_SAFE_UNREG must be enabled if ioqueue concurrency \ 726 is disabled 727 #endif 728 729 730 /** 731 * When safe unregistration (PJ_IOQUEUE_HAS_SAFE_UNREG) is configured in 732 * ioqueue, the PJ_IOQUEUE_KEY_FREE_DELAY macro specifies how long the 733 * ioqueue key is kept in closing state before it can be reused. 734 * 735 * The value is in miliseconds. 736 * 737 * Default: 500 msec. 738 */ 739 #ifndef PJ_IOQUEUE_KEY_FREE_DELAY 740 # define PJ_IOQUEUE_KEY_FREE_DELAY 500 741 #endif 742 743 744 /** 745 * Determine if FD_SETSIZE is changeable/set-able. If so, then we will 746 * set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking 747 * for Winsock. 748 */ 749 #ifndef PJ_FD_SETSIZE_SETABLE 750 # if (defined(PJ_HAS_WINSOCK_H) && PJ_HAS_WINSOCK_H!=0) || \ 751 (defined(PJ_HAS_WINSOCK2_H) && PJ_HAS_WINSOCK2_H!=0) 752 # define PJ_FD_SETSIZE_SETABLE 1 753 # else 754 # define PJ_FD_SETSIZE_SETABLE 0 755 # endif 756 #endif 757 758 /** 759 * Overrides FD_SETSIZE so it is consistent throughout the library. 760 * We only do this if we detected that FD_SETSIZE is changeable. If 761 * FD_SETSIZE is not set-able, then PJ_IOQUEUE_MAX_HANDLES must be 762 * set to value lower than FD_SETSIZE. 763 */ 764 #if PJ_FD_SETSIZE_SETABLE 765 /* Only override FD_SETSIZE if the value has not been set */ 766 # ifndef FD_SETSIZE 767 # define FD_SETSIZE PJ_IOQUEUE_MAX_HANDLES 768 # endif 769 #else 770 /* When FD_SETSIZE is not changeable, check if PJ_IOQUEUE_MAX_HANDLES 771 * is lower than FD_SETSIZE value. 772 * 773 * Update: Not all ioqueue backends require this (such as epoll), so 774 * this check will be done on the ioqueue implementation itself, such as 775 * ioqueue select. 776 */ 777 /* 778 # ifdef FD_SETSIZE 779 # if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE 780 # error "PJ_IOQUEUE_MAX_HANDLES is greater than FD_SETSIZE" 781 # endif 782 # endif 783 */ 784 #endif 785 786 787 /** 788 * Specify whether #pj_enum_ip_interface() function should exclude 789 * loopback interfaces. 790 * 791 * Default: 1 792 */ 793 #ifndef PJ_IP_HELPER_IGNORE_LOOPBACK_IF 794 # define PJ_IP_HELPER_IGNORE_LOOPBACK_IF 1 795 #endif 796 797 798 /** 799 * Has semaphore functionality? 800 * 801 * Default: 1 802 */ 803 #ifndef PJ_HAS_SEMAPHORE 804 # define PJ_HAS_SEMAPHORE 1 805 #endif 806 807 /** 808 * Use dispatch semaphores on Darwin. 809 * 810 * Default: 1 on Darwin, 0 otherwise 811 */ 812 #ifndef PJ_SEMAPHORE_USE_DISPATCH_SEM 813 # if defined(PJ_DARWINOS) && PJ_DARWINOS != 0 814 # define PJ_SEMAPHORE_USE_DISPATCH_SEM 1 815 # else 816 # define PJ_SEMAPHORE_USE_DISPATCH_SEM 0 817 # endif 818 #endif 819 820 821 /** 822 * Event object (for synchronization, e.g. in Win32) 823 * 824 * Default: 1 825 */ 826 #ifndef PJ_HAS_EVENT_OBJ 827 # define PJ_HAS_EVENT_OBJ 1 828 #endif 829 830 831 /** 832 * Maximum file name length. 833 */ 834 #ifndef PJ_MAXPATH 835 # define PJ_MAXPATH 260 836 #endif 837 838 839 /** 840 * Enable library's extra check. 841 * If this macro is enabled, #PJ_ASSERT_RETURN macro will expand to 842 * run-time checking. If this macro is disabled, #PJ_ASSERT_RETURN 843 * will simply evaluate to #pj_assert(). 844 * 845 * You can disable this macro to reduce size, at the risk of crashes 846 * if invalid value (e.g. NULL) is passed to the library. 847 * 848 * Default: 1 849 */ 850 #ifndef PJ_ENABLE_EXTRA_CHECK 851 # define PJ_ENABLE_EXTRA_CHECK 1 852 #endif 853 854 855 /** 856 * Enable name registration for exceptions with #pj_exception_id_alloc(). 857 * If this feature is enabled, then the library will keep track of 858 * names associated with each exception ID requested by application via 859 * #pj_exception_id_alloc(). 860 * 861 * Disabling this macro will reduce the code and .bss size by a tad bit. 862 * See also #PJ_MAX_EXCEPTION_ID. 863 * 864 * Default: 1 865 */ 866 #ifndef PJ_HAS_EXCEPTION_NAMES 867 # define PJ_HAS_EXCEPTION_NAMES 1 868 #endif 869 870 /** 871 * Maximum number of unique exception IDs that can be requested 872 * with #pj_exception_id_alloc(). For each entry, a small record will 873 * be allocated in the .bss segment. 874 * 875 * Default: 16 876 */ 877 #ifndef PJ_MAX_EXCEPTION_ID 878 # define PJ_MAX_EXCEPTION_ID 16 879 #endif 880 881 /** 882 * Should we use Windows Structured Exception Handling (SEH) for the 883 * PJLIB exceptions. 884 * 885 * Default: 0 886 */ 887 #ifndef PJ_EXCEPTION_USE_WIN32_SEH 888 # define PJ_EXCEPTION_USE_WIN32_SEH 0 889 #endif 890 891 /** 892 * Should we attempt to use Pentium's rdtsc for high resolution 893 * timestamp. 894 * 895 * Default: 0 896 */ 897 #ifndef PJ_TIMESTAMP_USE_RDTSC 898 # define PJ_TIMESTAMP_USE_RDTSC 0 899 #endif 900 901 /** 902 * Is native platform error positive number? 903 * Default: 1 (yes) 904 */ 905 #ifndef PJ_NATIVE_ERR_POSITIVE 906 # define PJ_NATIVE_ERR_POSITIVE 1 907 #endif 908 909 /** 910 * Include error message string in the library (pj_strerror()). 911 * This is very much desirable! 912 * 913 * Default: 1 914 */ 915 #ifndef PJ_HAS_ERROR_STRING 916 # define PJ_HAS_ERROR_STRING 1 917 #endif 918 919 920 /** 921 * Include pj_stricmp_alnum() and pj_strnicmp_alnum(), i.e. custom 922 * functions to compare alnum strings. On some systems, they're faster 923 * then stricmp/strcasecmp, but they can be slower on other systems. 924 * When disabled, pjlib will fallback to stricmp/strnicmp. 925 * 926 * Default: 0 927 */ 928 #ifndef PJ_HAS_STRICMP_ALNUM 929 # define PJ_HAS_STRICMP_ALNUM 0 930 #endif 931 932 933 /* 934 * Types of QoS backend implementation. 935 */ 936 937 /** 938 * Dummy QoS backend implementation, will always return error on all 939 * the APIs. 940 */ 941 #define PJ_QOS_DUMMY 1 942 943 /** QoS backend based on setsockopt(IP_TOS) */ 944 #define PJ_QOS_BSD 2 945 946 /** QoS backend for Windows Mobile 6 */ 947 #define PJ_QOS_WM 3 948 949 /** QoS backend for Symbian */ 950 #define PJ_QOS_SYMBIAN 4 951 952 /** QoS backend for Darwin */ 953 #define PJ_QOS_DARWIN 5 954 955 /** 956 * Force the use of some QoS backend API for some platforms. 957 */ 958 #ifndef PJ_QOS_IMPLEMENTATION 959 # if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE && _WIN32_WCE >= 0x502 960 /* Windows Mobile 6 or later */ 961 # define PJ_QOS_IMPLEMENTATION PJ_QOS_WM 962 # elif defined(PJ_DARWINOS) 963 /* Darwin OS (e.g: iOS, MacOS, tvOS) */ 964 # define PJ_QOS_IMPLEMENTATION PJ_QOS_DARWIN 965 # endif 966 #endif 967 968 969 /** 970 * Enable secure socket. For most platforms, this is implemented using 971 * OpenSSL or GnuTLS, so this will require one of those libraries to 972 * be installed. For Symbian platform, this is implemented natively 973 * using CSecureSocket. 974 * 975 * Default: 0 (for now) 976 */ 977 #ifndef PJ_HAS_SSL_SOCK 978 # define PJ_HAS_SSL_SOCK 0 979 #endif 980 981 982 /* 983 * Secure socket implementation. 984 * Select one of these implementations in PJ_SSL_SOCK_IMP. 985 */ 986 #define PJ_SSL_SOCK_IMP_NONE 0 /**< Disable SSL socket. */ 987 #define PJ_SSL_SOCK_IMP_OPENSSL 1 /**< Using OpenSSL. */ 988 #define PJ_SSL_SOCK_IMP_GNUTLS 2 /**< Using GnuTLS. */ 989 #define PJ_SSL_SOCK_IMP_DARWIN 3 /**< Using Apple's Secure 990 Transport (deprecated in 991 MacOS 10.15 & iOS 13.0)*/ 992 #define PJ_SSL_SOCK_IMP_APPLE 4 /**< Using Apple's Network 993 framework. */ 994 995 /** 996 * Select which SSL socket implementation to use. Currently pjlib supports 997 * PJ_SSL_SOCK_IMP_OPENSSL, which uses OpenSSL, and PJ_SSL_SOCK_IMP_GNUTLS, 998 * which uses GnuTLS. Setting this to PJ_SSL_SOCK_IMP_NONE will disable 999 * secure socket. 1000 * 1001 * Default is PJ_SSL_SOCK_IMP_NONE if PJ_HAS_SSL_SOCK is not set, otherwise 1002 * it is PJ_SSL_SOCK_IMP_OPENSSL. 1003 */ 1004 #ifndef PJ_SSL_SOCK_IMP 1005 # if PJ_HAS_SSL_SOCK==0 1006 # define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_NONE 1007 # else 1008 # define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_OPENSSL 1009 # endif 1010 #endif 1011 1012 1013 /** 1014 * Define the maximum number of ciphers supported by the secure socket. 1015 * 1016 * Default: 256 1017 */ 1018 #ifndef PJ_SSL_SOCK_MAX_CIPHERS 1019 # define PJ_SSL_SOCK_MAX_CIPHERS 256 1020 #endif 1021 1022 1023 /** 1024 * Specify what should be set as the available list of SSL_CIPHERs. For 1025 * example, set this as "DEFAULT" to use the default cipher list (Note: 1026 * PJSIP release 2.4 and before used this "DEFAULT" setting). 1027 * 1028 * Default: "HIGH:-COMPLEMENTOFDEFAULT" 1029 */ 1030 #ifndef PJ_SSL_SOCK_OSSL_CIPHERS 1031 # define PJ_SSL_SOCK_OSSL_CIPHERS "HIGH:-COMPLEMENTOFDEFAULT" 1032 #endif 1033 1034 1035 /** 1036 * Define the maximum number of curves supported by the secure socket. 1037 * 1038 * Default: 32 1039 */ 1040 #ifndef PJ_SSL_SOCK_MAX_CURVES 1041 # define PJ_SSL_SOCK_MAX_CURVES 32 1042 #endif 1043 1044 /** 1045 * Use OpenSSL thread locking callback. This is only applicable for OpenSSL 1046 * version prior to 1.1.0 1047 * 1048 * Default: 1 (enabled) 1049 */ 1050 #ifndef PJ_SSL_SOCK_OSSL_USE_THREAD_CB 1051 # define PJ_SSL_SOCK_OSSL_USE_THREAD_CB 1 1052 #else 1053 # define PJ_SSL_SOCK_OSSL_USE_THREAD_CB 0 1054 #endif 1055 1056 1057 /** 1058 * Disable WSAECONNRESET error for UDP sockets on Win32 platforms. See 1059 * https://trac.pjsip.org/repos/ticket/1197. 1060 * 1061 * Default: 1 1062 */ 1063 #ifndef PJ_SOCK_DISABLE_WSAECONNRESET 1064 # define PJ_SOCK_DISABLE_WSAECONNRESET 1 1065 #endif 1066 1067 1068 /** 1069 * Maximum number of socket options in pj_sockopt_params. 1070 * 1071 * Default: 4 1072 */ 1073 #ifndef PJ_MAX_SOCKOPT_PARAMS 1074 # define PJ_MAX_SOCKOPT_PARAMS 4 1075 #endif 1076 1077 1078 1079 /** @} */ 1080 1081 /******************************************************************** 1082 * General macros. 1083 */ 1084 1085 /** 1086 * @defgroup pj_dll_target Building Dynamic Link Libraries (DLL/DSO) 1087 * @ingroup pj_config 1088 * @{ 1089 * 1090 * The libraries support generation of dynamic link libraries for 1091 * Symbian ABIv2 target (.dso/Dynamic Shared Object files, in Symbian 1092 * terms). Similar procedures may be applied for Win32 DLL with some 1093 * modification. 1094 * 1095 * Depending on the platforms, these steps may be necessary in order to 1096 * produce the dynamic libraries: 1097 * - Create the (Visual Studio) projects to produce DLL output. PJLIB 1098 * does not provide ready to use project files to produce DLL, so 1099 * you need to create these projects yourself. For Symbian, the MMP 1100 * files have been setup to produce DSO files for targets that 1101 * require them. 1102 * - In the (Visual Studio) projects, some macros need to be declared 1103 * so that appropriate modifiers are added to symbol declarations 1104 * and definitions. Please see the macro section below for information 1105 * regarding these macros. For Symbian, these have been taken care by the 1106 * MMP files. 1107 * - Some build systems require .DEF file to be specified when creating 1108 * the DLL. For Symbian, .DEF files are included in pjlib distribution, 1109 * in <tt>pjlib/build.symbian</tt> directory. These DEF files are 1110 * created by running <tt>./makedef.sh all</tt> from this directory, 1111 * inside Mingw. 1112 * 1113 * Macros related for building DLL/DSO files: 1114 * - For platforms that supports dynamic link libraries generation, 1115 * it must declare <tt>PJ_EXPORT_SPECIFIER</tt> macro which value contains 1116 * the prefix to be added to symbol definition, to export this 1117 * symbol in the DLL/DSO. For example, on Win32/Visual Studio, the 1118 * value of this macro is \a __declspec(dllexport), and for ARM 1119 * ABIv2/Symbian, the value is \a EXPORT_C. 1120 * - For platforms that supports linking with dynamic link libraries, 1121 * it must declare <tt>PJ_IMPORT_SPECIFIER</tt> macro which value contains 1122 * the prefix to be added to symbol declaration, to import this 1123 * symbol from a DLL/DSO. For example, on Win32/Visual Studio, the 1124 * value of this macro is \a __declspec(dllimport), and for ARM 1125 * ABIv2/Symbian, the value is \a IMPORT_C. 1126 * - Both <tt>PJ_EXPORT_SPECIFIER</tt> and <tt>PJ_IMPORT_SPECIFIER</tt> 1127 * macros above can be declared in your \a config_site.h if they are not 1128 * declared by pjlib. 1129 * - When PJLIB is built as DLL/DSO, both <tt>PJ_DLL</tt> and 1130 * <tt>PJ_EXPORTING</tt> macros must be declared, so that 1131 * <tt>PJ_EXPORT_SPECIFIER</tt> modifier will be added into function 1132 * definition. 1133 * - When application wants to link dynamically with PJLIB, then it 1134 * must declare <tt>PJ_DLL</tt> macro when using/including PJLIB header, 1135 * so that <tt>PJ_IMPORT_SPECIFIER</tt> modifier is properly added into 1136 * symbol declarations. 1137 * 1138 * When <b>PJ_DLL</b> macro is not declared, static linking is assumed. 1139 * 1140 * For example, here are some settings to produce DLLs with Visual Studio 1141 * on Windows/Win32: 1142 * - Create Visual Studio projects to produce DLL. Add the appropriate 1143 * project dependencies to avoid link errors. 1144 * - In the projects, declare <tt>PJ_DLL</tt> and <tt>PJ_EXPORTING</tt> 1145 * macros. 1146 * - Declare these macros in your <tt>config_site.h</tt>: 1147 \verbatim 1148 #define PJ_EXPORT_SPECIFIER __declspec(dllexport) 1149 #define PJ_IMPORT_SPECIFIER __declspec(dllimport) 1150 \endverbatim 1151 * - And in the application (that links with the DLL) project, add 1152 * <tt>PJ_DLL</tt> in the macro declarations. 1153 */ 1154 1155 /** @} */ 1156 1157 /** 1158 * @defgroup pj_config Build Configuration 1159 * @{ 1160 */ 1161 1162 /** 1163 * @def PJ_INLINE(type) 1164 * @param type The return type of the function. 1165 * Expand the function as inline. 1166 */ 1167 #define PJ_INLINE(type) PJ_INLINE_SPECIFIER type 1168 1169 /** 1170 * This macro declares platform/compiler specific specifier prefix 1171 * to be added to symbol declaration to export the symbol when PJLIB 1172 * is built as dynamic library. 1173 * 1174 * This macro should have been added by platform specific headers, 1175 * if the platform supports building dynamic library target. 1176 */ 1177 #ifndef PJ_EXPORT_DECL_SPECIFIER 1178 # define PJ_EXPORT_DECL_SPECIFIER 1179 #endif 1180 1181 1182 /** 1183 * This macro declares platform/compiler specific specifier prefix 1184 * to be added to symbol definition to export the symbol when PJLIB 1185 * is built as dynamic library. 1186 * 1187 * This macro should have been added by platform specific headers, 1188 * if the platform supports building dynamic library target. 1189 */ 1190 #ifndef PJ_EXPORT_DEF_SPECIFIER 1191 # define PJ_EXPORT_DEF_SPECIFIER 1192 #endif 1193 1194 1195 /** 1196 * This macro declares platform/compiler specific specifier prefix 1197 * to be added to symbol declaration to import the symbol. 1198 * 1199 * This macro should have been added by platform specific headers, 1200 * if the platform supports building dynamic library target. 1201 */ 1202 #ifndef PJ_IMPORT_DECL_SPECIFIER 1203 # define PJ_IMPORT_DECL_SPECIFIER 1204 #endif 1205 1206 1207 /** 1208 * This macro has been deprecated. It will evaluate to nothing. 1209 */ 1210 #ifndef PJ_EXPORT_SYMBOL 1211 # define PJ_EXPORT_SYMBOL(x) 1212 #endif 1213 1214 1215 /** 1216 * @def PJ_DECL(type) 1217 * @param type The return type of the function. 1218 * Declare a function. 1219 */ 1220 #if defined(PJ_DLL) 1221 # if defined(PJ_EXPORTING) 1222 # define PJ_DECL(type) PJ_EXPORT_DECL_SPECIFIER type 1223 # else 1224 # define PJ_DECL(type) PJ_IMPORT_DECL_SPECIFIER type 1225 # endif 1226 #elif !defined(PJ_DECL) 1227 # if defined(__cplusplus) 1228 # define PJ_DECL(type) type 1229 # else 1230 # define PJ_DECL(type) extern type 1231 # endif 1232 #endif 1233 1234 1235 /** 1236 * @def PJ_DEF(type) 1237 * @param type The return type of the function. 1238 * Define a function. 1239 */ 1240 #if defined(PJ_DLL) && defined(PJ_EXPORTING) 1241 # define PJ_DEF(type) PJ_EXPORT_DEF_SPECIFIER type 1242 #elif !defined(PJ_DEF) 1243 # define PJ_DEF(type) type 1244 #endif 1245 1246 1247 /** 1248 * @def PJ_DECL_NO_RETURN(type) 1249 * @param type The return type of the function. 1250 * Declare a function that will not return. 1251 */ 1252 /** 1253 * @def PJ_IDECL_NO_RETURN(type) 1254 * @param type The return type of the function. 1255 * Declare an inline function that will not return. 1256 */ 1257 /** 1258 * @def PJ_BEGIN_DECL 1259 * Mark beginning of declaration section in a header file. 1260 */ 1261 /** 1262 * @def PJ_END_DECL 1263 * Mark end of declaration section in a header file. 1264 */ 1265 #ifdef __cplusplus 1266 # define PJ_DECL_NO_RETURN(type) PJ_DECL(type) PJ_NORETURN 1267 # define PJ_IDECL_NO_RETURN(type) PJ_INLINE(type) PJ_NORETURN 1268 # define PJ_BEGIN_DECL extern "C" { 1269 # define PJ_END_DECL } 1270 #else 1271 # define PJ_DECL_NO_RETURN(type) PJ_NORETURN PJ_DECL(type) 1272 # define PJ_IDECL_NO_RETURN(type) PJ_NORETURN PJ_INLINE(type) 1273 # define PJ_BEGIN_DECL 1274 # define PJ_END_DECL 1275 #endif 1276 1277 1278 1279 /** 1280 * @def PJ_DECL_DATA(type) 1281 * @param type The data type. 1282 * Declare a global data. 1283 */ 1284 #if defined(PJ_DLL) 1285 # if defined(PJ_EXPORTING) 1286 # define PJ_DECL_DATA(type) PJ_EXPORT_DECL_SPECIFIER extern type 1287 # else 1288 # define PJ_DECL_DATA(type) PJ_IMPORT_DECL_SPECIFIER extern type 1289 # endif 1290 #elif !defined(PJ_DECL_DATA) 1291 # define PJ_DECL_DATA(type) extern type 1292 #endif 1293 1294 1295 /** 1296 * @def PJ_DEF_DATA(type) 1297 * @param type The data type. 1298 * Define a global data. 1299 */ 1300 #if defined(PJ_DLL) && defined(PJ_EXPORTING) 1301 # define PJ_DEF_DATA(type) PJ_EXPORT_DEF_SPECIFIER type 1302 #elif !defined(PJ_DEF_DATA) 1303 # define PJ_DEF_DATA(type) type 1304 #endif 1305 1306 1307 /** 1308 * @def PJ_IDECL(type) 1309 * @param type The function's return type. 1310 * Declare a function that may be expanded as inline. 1311 */ 1312 /** 1313 * @def PJ_IDEF(type) 1314 * @param type The function's return type. 1315 * Define a function that may be expanded as inline. 1316 */ 1317 1318 #if PJ_FUNCTIONS_ARE_INLINED 1319 # define PJ_IDECL(type) PJ_INLINE(type) 1320 # define PJ_IDEF(type) PJ_INLINE(type) 1321 #else 1322 # define PJ_IDECL(type) PJ_DECL(type) 1323 # define PJ_IDEF(type) PJ_DEF(type) 1324 #endif 1325 1326 1327 /** 1328 * @def PJ_UNUSED_ARG(arg) 1329 * @param arg The argument name. 1330 * PJ_UNUSED_ARG prevents warning about unused argument in a function. 1331 */ 1332 #define PJ_UNUSED_ARG(arg) (void)arg 1333 1334 /** 1335 * @def PJ_TODO(id) 1336 * @param id Any identifier that will be printed as TODO message. 1337 * PJ_TODO macro will display TODO message as warning during compilation. 1338 * Example: PJ_TODO(CLEAN_UP_ERROR); 1339 */ 1340 #ifndef PJ_TODO 1341 # define PJ_TODO(id) TODO___##id: 1342 #endif 1343 1344 /** 1345 * Simulate race condition by sleeping the thread in strategic locations. 1346 * Default: no! 1347 */ 1348 #ifndef PJ_RACE_ME 1349 # define PJ_RACE_ME(x) 1350 #endif 1351 1352 /** 1353 * Function attributes to inform that the function may throw exception. 1354 * 1355 * @param x The exception list, enclosed in parenthesis. 1356 */ 1357 #define __pj_throw__(x) 1358 1359 /** @} */ 1360 1361 /******************************************************************** 1362 * Sanity Checks 1363 */ 1364 #ifndef PJ_HAS_HIGH_RES_TIMER 1365 # error "PJ_HAS_HIGH_RES_TIMER is not defined!" 1366 #endif 1367 1368 #if !defined(PJ_HAS_PENTIUM) 1369 # error "PJ_HAS_PENTIUM is not defined!" 1370 #endif 1371 1372 #if !defined(PJ_IS_LITTLE_ENDIAN) 1373 # error "PJ_IS_LITTLE_ENDIAN is not defined!" 1374 #endif 1375 1376 #if !defined(PJ_IS_BIG_ENDIAN) 1377 # error "PJ_IS_BIG_ENDIAN is not defined!" 1378 #endif 1379 1380 #if !defined(PJ_EMULATE_RWMUTEX) 1381 # error "PJ_EMULATE_RWMUTEX should be defined in compat/os_xx.h" 1382 #endif 1383 1384 #if !defined(PJ_THREAD_SET_STACK_SIZE) 1385 # error "PJ_THREAD_SET_STACK_SIZE should be defined in compat/os_xx.h" 1386 #endif 1387 1388 #if !defined(PJ_THREAD_ALLOCATE_STACK) 1389 # error "PJ_THREAD_ALLOCATE_STACK should be defined in compat/os_xx.h" 1390 #endif 1391 1392 PJ_BEGIN_DECL 1393 1394 /** PJLIB version major number. */ 1395 #define PJ_VERSION_NUM_MAJOR 2 1396 1397 /** PJLIB version minor number. */ 1398 #define PJ_VERSION_NUM_MINOR 11 1399 1400 /** PJLIB version revision number. */ 1401 #define PJ_VERSION_NUM_REV 1 1402 1403 /** 1404 * Extra suffix for the version (e.g. "-trunk"), or empty for 1405 * web release version. 1406 */ 1407 #define PJ_VERSION_NUM_EXTRA "" 1408 1409 /** 1410 * PJLIB version number consists of three bytes with the following format: 1411 * 0xMMIIRR00, where MM: major number, II: minor number, RR: revision 1412 * number, 00: always zero for now. 1413 */ 1414 #define PJ_VERSION_NUM ((PJ_VERSION_NUM_MAJOR << 24) | \ 1415 (PJ_VERSION_NUM_MINOR << 16) | \ 1416 (PJ_VERSION_NUM_REV << 8)) 1417 1418 /** 1419 * PJLIB version string constant. @see pj_get_version() 1420 */ 1421 PJ_DECL_DATA(const char*) PJ_VERSION; 1422 1423 /** 1424 * Get PJLIB version string. 1425 * 1426 * @return #PJ_VERSION constant. 1427 */ 1428 PJ_DECL(const char*) pj_get_version(void); 1429 1430 /** 1431 * Dump configuration to log with verbosity equal to info(3). 1432 */ 1433 PJ_DECL(void) pj_dump_config(void); 1434 1435 PJ_END_DECL 1436 1437 1438 #endif /* __PJ_CONFIG_H__ */ 1439 1440