Group PJ_BASIC

group PJ_BASIC

Defines

PJ_T(literal_str)

This macro creates Unicode or ANSI literal string depending whether native platform string is Unicode or ANSI.

PJ_ARRAY_SIZE(a)

Utility macro to compute the number of elements in static array.

PJ_MAX_OBJ_NAME

Length of object names.

Typedefs

typedef unsigned int pj_uint32_t

Unsigned 32bit integer.

typedef short pj_int16_t

Signed 16bit integer.

typedef unsigned short pj_uint16_t

Unsigned 16bit integer.

typedef signed char pj_int8_t

Signed 8bit integer.

typedef unsigned char pj_uint8_t

Unsigned 8bit integer.

typedef size_t pj_size_t

Large unsigned integer.

typedef long pj_ssize_t

Large signed integer.

typedef int pj_status_t

Status code.

typedef int pj_bool_t

Boolean.

typedef char pj_char_t

Native char type, which will be equal to wchar_t for Unicode and char for ANSI.

typedef pj_ssize_t pj_off_t

File offset type.

typedef void pj_list_type

The opaque data type for linked list, which is used as arguments throughout the linked list operations.

typedef struct pj_hash_table_t pj_hash_table_t

Opaque data type for hash tables.

typedef struct pj_hash_entry pj_hash_entry

Opaque data type for hash entry (only used internally by hash table).

typedef struct pj_ioqueue_t pj_ioqueue_t

Opaque data type for I/O Queue structure.

typedef struct pj_ioqueue_key_t pj_ioqueue_key_t

Opaque data type for key that identifies a handle registered to the I/O queue framework.

typedef struct pj_timer_heap_t pj_timer_heap_t

Opaque data to identify timer heap.

typedef struct pj_atomic_t pj_atomic_t

Opaque data type for atomic operations.

typedef PJ_ATOMIC_VALUE_TYPE pj_atomic_value_t

Value type of an atomic variable.

typedef struct pj_thread_t pj_thread_t

Thread handle.

typedef struct pj_lock_t pj_lock_t

Lock object.

typedef struct pj_grp_lock_t pj_grp_lock_t

Group lock

typedef struct pj_mutex_t pj_mutex_t

Mutex handle.

typedef struct pj_sem_t pj_sem_t

Semaphore handle.

typedef struct pj_event_t pj_event_t

Event object.

typedef struct pj_pipe_t pj_pipe_t

Unidirectional stream pipe object.

typedef void *pj_oshandle_t

Operating system handle.

typedef long pj_sock_t

Socket handle.

typedef void pj_sockaddr_t

Generic socket address.

typedef unsigned int pj_color_t

Color type.

typedef int pj_exception_id_t

Exception id.

typedef void (*pj_exit_callback)(void)

Type of callback to register to pj_atexit().

Enums

enum pj_constants_

Some constants

Values:

PJ_SUCCESS = 0

Status is OK.

PJ_TRUE = 1

True value.

PJ_FALSE = 0

False value.

Functions

pj_status_t pj_init(void)

Initialize the PJ Library. This function must be called before using the library. The purpose of this function is to initialize static library data, such as character table used in random string generation, and to initialize operating system dependent functionality (such as WSAStartup() in Windows).

Apart from calling pj_init(), application typically should also initialize the random seed by calling pj_srand().

Return

PJ_SUCCESS on success.

void pj_shutdown(void)

Shutdown PJLIB.

pj_status_t pj_atexit(pj_exit_callback func)

Register cleanup function to be called by PJLIB when pj_shutdown() is called.

Return

PJ_SUCCESS on success.

Parameters
  • func: The function to be registered.

pj_int16_t pj_swap16(pj_int16_t val16)

Swap the byte order of an 16bit data.

Return

An 16bit data with swapped byte order.

Parameters
  • val16: The 16bit data.

pj_int32_t pj_swap32(pj_int32_t val32)

Swap the byte order of an 32bit data.

Return

An 32bit data with swapped byte order.

Parameters
  • val32: The 32bit data.

Variables

PJ_BEGIN_DECL typedef int pj_int32_t

Signed 32bit integer.

struct pj_str_t
#include <types.h>

This type is used as replacement to legacy C string, and used throughout the library. By convention, the string is NOT null terminated.

This type is used as replacement to legacy C string, and used throughout the library.

union pj_timestamp
#include <types.h>

This structure represents high resolution (64bit) time value. The time values represent time in cycles, which is retrieved by calling pj_get_timestamp().

Public Members

pj_uint32_t hi

high 32-bit value of the 64-bit value.

pj_uint32_t lo

Low 32-bit value of the 64-bit value.

struct pj_timestamp::[anonymous] u32

The 64-bit value as two 32-bit values.

struct pj_hash_iterator_t
#include <types.h>

Data type for hash search iterator. This structure should be opaque, however applications need to declare concrete variable of this type, that’s why the declaration is visible here.