Home --> Documentations --> PJLIB Reference

Basic Data Types and Library Functionality.

Data Structures

struct  pj_str_t
union  pj_timestamp
struct  pj_hash_iterator_t


#define PJ_T(literal_str)   literal_str
#define PJ_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define PJ_MAX_OBJ_NAME   32


typedef unsigned int pj_uint32_t
typedef short pj_int16_t
typedef unsigned short pj_uint16_t
typedef signed char pj_int8_t
typedef unsigned char pj_uint8_t
typedef size_t pj_size_t
typedef long pj_ssize_t
typedef int pj_status_t
typedef int pj_bool_t
typedef char pj_char_t
typedef pj_ssize_t pj_off_t
typedef void pj_list_type
typedef struct pj_hash_table_t pj_hash_table_t
typedef struct pj_hash_entry pj_hash_entry
typedef struct pj_ioqueue_t pj_ioqueue_t
typedef struct pj_ioqueue_key_t pj_ioqueue_key_t
typedef struct pj_timer_heap_t pj_timer_heap_t
typedef struct pj_atomic_t pj_atomic_t
typedef PJ_ATOMIC_VALUE_TYPE pj_atomic_value_t
typedef struct pj_thread_t pj_thread_t
typedef struct pj_lock_t pj_lock_t
typedef struct pj_grp_lock_t pj_grp_lock_t
typedef struct pj_mutex_t pj_mutex_t
typedef struct pj_sem_t pj_sem_t
typedef struct pj_event_t pj_event_t
typedef struct pj_pipe_t pj_pipe_t
typedef void * pj_oshandle_t
typedef long pj_sock_t
typedef void pj_sockaddr_t
typedef unsigned int pj_color_t
typedef int pj_exception_id_t
typedef void(* pj_exit_callback) (void)


enum  pj_constants_ { PJ_SUCCESS =0, PJ_TRUE =1, PJ_FALSE =0 }


pj_status_t pj_init (void)
void pj_shutdown (void)
pj_status_t pj_atexit (pj_exit_callback func)
pj_int16_t pj_swap16 (pj_int16_t val16)
pj_int32_t pj_swap32 (pj_int32_t val32)


PJ_BEGIN_DECL typedef int pj_int32_t

Detailed Description

Macro Definition Documentation


#define PJ_ARRAY_SIZE (   a)    (sizeof(a)/sizeof(a[0]))

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


#define PJ_MAX_OBJ_NAME   32

Length of object names.

◆ PJ_T

#define PJ_T (   literal_str)    literal_str

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

Typedef Documentation

◆ pj_atomic_t

typedef struct pj_atomic_t pj_atomic_t

Opaque data type for atomic operations.

◆ pj_atomic_value_t

typedef PJ_ATOMIC_VALUE_TYPE pj_atomic_value_t

Value type of an atomic variable.

◆ pj_bool_t

typedef int pj_bool_t


◆ pj_char_t

typedef char pj_char_t

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

◆ pj_color_t

typedef unsigned int pj_color_t

Color type.

◆ pj_event_t

typedef struct pj_event_t pj_event_t

Event object.

◆ pj_exception_id_t

Exception id.

◆ pj_exit_callback

typedef void(* pj_exit_callback) (void)

Type of callback to register to pj_atexit().

◆ pj_grp_lock_t

typedef struct pj_grp_lock_t pj_grp_lock_t

Group lock

◆ pj_hash_entry

typedef struct pj_hash_entry pj_hash_entry

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

◆ pj_hash_table_t

Opaque data type for hash tables.

◆ pj_int16_t

typedef short pj_int16_t

Signed 16bit integer.

◆ pj_int8_t

typedef signed char pj_int8_t

Signed 8bit integer.

◆ pj_ioqueue_key_t

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

◆ pj_ioqueue_t

typedef struct pj_ioqueue_t pj_ioqueue_t

Opaque data type for I/O Queue structure.

◆ pj_list_type

typedef void pj_list_type

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

◆ pj_lock_t

typedef struct pj_lock_t pj_lock_t

Lock object.

◆ pj_mutex_t

typedef struct pj_mutex_t pj_mutex_t

Mutex handle.

◆ pj_off_t

File offset type.

◆ pj_oshandle_t

typedef void* pj_oshandle_t

Operating system handle.

◆ pj_pipe_t

typedef struct pj_pipe_t pj_pipe_t

Unidirectional stream pipe object.

◆ pj_sem_t

typedef struct pj_sem_t pj_sem_t

Semaphore handle.

◆ pj_size_t

typedef size_t pj_size_t

Large unsigned integer.

◆ pj_sock_t

typedef long pj_sock_t

Socket handle.

◆ pj_sockaddr_t

typedef void pj_sockaddr_t

Generic socket address.

◆ pj_ssize_t

typedef long pj_ssize_t

Large signed integer.

◆ pj_status_t

typedef int pj_status_t

Status code.

◆ pj_thread_t

typedef struct pj_thread_t pj_thread_t

Thread handle.

◆ pj_timer_heap_t

Opaque data to identify timer heap.

◆ pj_uint16_t

typedef unsigned short pj_uint16_t

Unsigned 16bit integer.

◆ pj_uint32_t

typedef unsigned int pj_uint32_t

Unsigned 32bit integer.

◆ pj_uint8_t

typedef unsigned char pj_uint8_t

Unsigned 8bit integer.

Enumeration Type Documentation

◆ pj_constants_

Some constants


Status is OK.


True value.


False value.

Function Documentation

◆ pj_atexit()

pj_status_t pj_atexit ( pj_exit_callback  func)

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

funcThe function to be registered.
PJ_SUCCESS on success.

◆ pj_init()

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().

PJ_SUCCESS on success.

◆ pj_shutdown()

void pj_shutdown ( void  )

Shutdown PJLIB.

◆ pj_swap16()

pj_int16_t pj_swap16 ( pj_int16_t  val16)

Swap the byte order of an 16bit data.

val16The 16bit data.
An 16bit data with swapped byte order.

◆ pj_swap32()

pj_int32_t pj_swap32 ( pj_int32_t  val32)

Swap the byte order of an 32bit data.

val32The 32bit data.
An 32bit data with swapped byte order.

Variable Documentation

◆ pj_int32_t

PJ_BEGIN_DECL typedef int pj_int32_t

Signed 32bit integer.

Referenced by pj_timestamp_diff32().


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.