Group pj_config

group pj_config

This section contains macros that can set during PJLIB build process to controll various aspects of the library.

Note: the values in this page does NOT necessarily reflect to the macro values during the build process.

Defines

PJ_DEBUG

If this macro is set to 1, it will enable some debugging checking in the library.

Default: equal to (NOT NDEBUG).

PJ_DEBUG_MUTEX

Enable this macro to activate logging to mutex/semaphore related events. This is useful to troubleshoot concurrency problems such as deadlocks. In addition, you should also add PJ_LOG_HAS_THREAD_ID flag to the log decoration to assist the troubleshooting.

Default: 0

PJ_FUNCTIONS_ARE_INLINED

Expand functions in *_i.h header files as inline.

Default: 0.

PJ_HAS_FLOATING_POINT

Use floating point computations in the library.

Default: 1.

PJ_LOG_MAX_SIZE

Declare maximum logging level/verbosity. Lower number indicates higher importance, with the highest importance has level zero. The least important level is five in this implementation, but this can be extended by supplying the appropriate implementation.

The level conventions:

  • 0: fatal error

  • 1: error

  • 2: warning

  • 3: info

  • 4: debug

  • 5: trace

  • 6: more detailed trace

Default: 4 Maximum message size that can be sent to output device for each call to PJ_LOG(). If the message size is longer than this value, it will be cut. This may affect the stack usage, depending whether PJ_LOG_USE_STACK_BUFFER flag is set.

Default: 4000

PJ_LOG_USE_STACK_BUFFER

Log buffer. Does the log get the buffer from the stack? (default is yes). If the value is set to NO, then the buffer will be taken from static buffer, which in this case will make the log function non-reentrant.

Default: 1

PJ_TERM_HAS_COLOR

Colorfull terminal (for logging etc).

Default: 1

PJ_SAFE_POOL

Set this flag to non-zero to enable various checking for pool operations. When this flag is set, assertion must be enabled in the application.

This will slow down pool creation and destruction and will add few bytes of overhead, so application would normally want to disable this feature on release build.

Default: 0

PJ_POOL_DEBUG

If pool debugging is used, then each memory allocation from the pool will call malloc(), and pool will release all memory chunks when it is destroyed. This works better when memory verification programs such as Rational Purify is used.

Default: 0

PJ_THREAD_DEFAULT_STACK_SIZE

Specify this as stack_size argument in pj_thread_create() to specify that thread should use default stack size for the current platform.

Default: 8192

PJ_OS_HAS_CHECK_STACK

Specify if PJ_CHECK_STACK() macro is enabled to check the sanity of the stack. The OS implementation may check that no stack overflow occurs, and it also may collect statistic about stack usage. Note that this will increase the footprint of the libraries since it tracks the filename and line number of each functions.

PJ_HAS_POOL_ALT_API

Do we have alternate pool implementation?

Default: 0

PJ_HAS_IPV6

Support TCP in the library. Disabling TCP will reduce the footprint slightly (about 6KB).

Default: 1 Support IPv6 in the library. If this support is disabled, some IPv6 related functions will return PJ_EIPV6NOTSUP.

Default: 0 (disabled, for now)

PJ_MAX_HOSTNAME

Maximum hostname length. Libraries sometimes needs to make copy of an address to stack buffer; the value here affects the stack usage.

Default: 128

PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR

Maximum consecutive identical error for accept() operation before activesock stops calling the next ioqueue accept.

Default: 50

PJ_IOQUEUE_MAX_HANDLES

Constants for declaring the maximum handles that can be supported by a single IOQ framework. This constant might not be relevant to the underlying I/O queue impelementation, but still, developers should be aware of this constant, to make sure that the program will not break when the underlying implementation changes.

PJ_IOQUEUE_HAS_SAFE_UNREG

If PJ_IOQUEUE_HAS_SAFE_UNREG macro is defined, then ioqueue will do more things to ensure thread safety of handle unregistration operation by employing reference counter to each handle.

In addition, the ioqueue will preallocate memory for the handles, according to the maximum number of handles that is specified during ioqueue creation.

All applications would normally want this enabled, but you may disable this if:

  • there is no dynamic unregistration to all ioqueues.

  • there is no threading, or there is no preemptive multitasking.

Default: 1

PJ_IOQUEUE_DEFAULT_ALLOW_CONCURRENCY

Default concurrency setting for sockets/handles registered to ioqueue. This controls whether the ioqueue is allowed to call the key’s callback concurrently/in parallel. The default is yes, which means that if there are more than one pending operations complete simultaneously, more than one threads may call the key’s callback at the same time. This generally would promote good scalability for application, at the expense of more complexity to manage the concurrent accesses.

Please see the ioqueue documentation for more info.

PJ_IOQUEUE_KEY_FREE_DELAY

When safe unregistration (PJ_IOQUEUE_HAS_SAFE_UNREG) is configured in ioqueue, the PJ_IOQUEUE_KEY_FREE_DELAY macro specifies how long the ioqueue key is kept in closing state before it can be reused.

The value is in miliseconds.

Default: 500 msec.

PJ_FD_SETSIZE_SETABLE

Determine if FD_SETSIZE is changeable/set-able. If so, then we will set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking for Winsock.

PJ_IP_HELPER_IGNORE_LOOPBACK_IF

Overrides FD_SETSIZE so it is consistent throughout the library. We only do this if we detected that FD_SETSIZE is changeable. If FD_SETSIZE is not set-able, then PJ_IOQUEUE_MAX_HANDLES must be set to value lower than FD_SETSIZE. Specify whether pj_enum_ip_interface() function should exclude loopback interfaces.

Default: 1

PJ_MAXPATH

Has semaphore functionality?

Default: 1 Event object (for synchronization, e.g. in Win32)

Default: 1 Maximum file name length.

PJ_ENABLE_EXTRA_CHECK

Enable library’s extra check. If this macro is enabled, PJ_ASSERT_RETURN macro will expand to run-time checking. If this macro is disabled, PJ_ASSERT_RETURN will simply evaluate to pj_assert().

You can disable this macro to reduce size, at the risk of crashes if invalid value (e.g. NULL) is passed to the library.

Default: 1

PJ_HAS_EXCEPTION_NAMES

Enable name registration for exceptions with pj_exception_id_alloc(). If this feature is enabled, then the library will keep track of names associated with each exception ID requested by application via pj_exception_id_alloc().

Disabling this macro will reduce the code and .bss size by a tad bit. See also PJ_MAX_EXCEPTION_ID.

Default: 1

PJ_MAX_EXCEPTION_ID

Maximum number of unique exception IDs that can be requested with pj_exception_id_alloc(). For each entry, a small record will be allocated in the .bss segment.

Default: 16

PJ_EXCEPTION_USE_WIN32_SEH

Should we use Windows Structured Exception Handling (SEH) for the PJLIB exceptions.

Default: 0

PJ_TIMESTAMP_USE_RDTSC

Should we attempt to use Pentium’s rdtsc for high resolution timestamp.

Default: 0

PJ_NATIVE_ERR_POSITIVE

Is native platform error positive number? Default: 1 (yes)

PJ_HAS_ERROR_STRING

Include error message string in the library (pj_strerror()). This is very much desirable!

Default: 1

PJ_HAS_STRICMP_ALNUM

Include pj_stricmp_alnum() and pj_strnicmp_alnum(), i.e. custom functions to compare alnum strings. On some systems, they’re faster then stricmp/strcasecmp, but they can be slower on other systems. When disabled, pjlib will fallback to stricmp/strnicmp.

Default: 0

PJ_QOS_DUMMY

Dummy QoS backend implementation, will always return error on all the APIs.

PJ_QOS_BSD

QoS backend based on setsockopt(IP_TOS)

PJ_QOS_WM

QoS backend for Windows Mobile 6

PJ_QOS_SYMBIAN

QoS backend for Symbian

PJ_HAS_SSL_SOCK

Force the use of some QoS backend API for some platforms. Enable secure socket. For most platforms, this is implemented using OpenSSL, so this will require OpenSSL to be installed. For Symbian platform, this is implemented natively using CSecureSocket.

Default: 0 (for now)

PJ_SOCK_DISABLE_WSAECONNRESET

Disable WSAECONNRESET error for UDP sockets on Win32 platforms. See https://trac.pjsip.org/repos/ticket/1197.

Default: 1

PJ_INLINE(type)
Parameters
  • type – The return type of the function. Expand the function as inline.

PJ_EXPORT_DECL_SPECIFIER

This macro declares platform/compiler specific specifier prefix to be added to symbol declaration to export the symbol when PJLIB is built as dynamic library.

This macro should have been added by platform specific headers, if the platform supports building dynamic library target.

PJ_EXPORT_DEF_SPECIFIER

This macro declares platform/compiler specific specifier prefix to be added to symbol definition to export the symbol when PJLIB is built as dynamic library.

This macro should have been added by platform specific headers, if the platform supports building dynamic library target.

PJ_IMPORT_DECL_SPECIFIER

This macro declares platform/compiler specific specifier prefix to be added to symbol declaration to import the symbol.

This macro should have been added by platform specific headers, if the platform supports building dynamic library target.

PJ_EXPORT_SYMBOL(x)

This macro has been deprecated. It will evaluate to nothing.

PJ_DECL_NO_RETURN(type)
Parameters
  • type – The return type of the function. Declare a function that will not return.

PJ_IDECL_NO_RETURN(type)
Parameters
  • type – The return type of the function. Declare an inline function that will not return.

PJ_BEGIN_DECL

Mark beginning of declaration section in a header file.

PJ_END_DECL

Mark end of declaration section in a header file.

PJ_DEF_DATA(type)
Parameters
  • type – The data type. Define a global data.

PJ_IDECL(type)
Parameters
  • type – The function’s return type. Declare a function that may be expanded as inline.

PJ_IDEF(type)
Parameters
  • type – The function’s return type. Define a function that may be expanded as inline.

PJ_UNUSED_ARG(arg)
Parameters
  • arg – The argument name. PJ_UNUSED_ARG prevents warning about unused argument in a function.

PJ_TODO(id)
Parameters
  • id – Any identifier that will be printed as TODO message. PJ_TODO macro will display TODO message as warning during compilation. Example: PJ_TODO(CLEAN_UP_ERROR);

__pj_throw__(x)

Function attributes to inform that the function may throw exception.

Parameters
  • x – The exception list, enclosed in parenthesis.