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_MAXINT32   0x7FFFFFFFL
#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.

#define PJ_MAXINT32   0x7FFFFFFFL

Maximum value for signed 32-bit integer.

#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

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 int pj_bool_t


typedef char pj_char_t

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

typedef unsigned int pj_color_t

Color type.

typedef struct pj_event_t pj_event_t

Event object.

Exception id.

typedef void(* pj_exit_callback)(void)

Type of callback to register to pj_atexit().

typedef struct pj_grp_lock_t pj_grp_lock_t

Group lock

typedef struct pj_hash_entry pj_hash_entry

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

Opaque data type for hash tables.

typedef short pj_int16_t

Signed 16bit integer.

typedef signed char pj_int8_t

Signed 8bit integer.

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

typedef struct pj_ioqueue_t pj_ioqueue_t

Opaque data type for I/O Queue structure.

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_lock_t pj_lock_t

Lock object.

typedef struct pj_mutex_t pj_mutex_t

Mutex handle.

File offset type.

typedef void* pj_oshandle_t

Operating system handle.

typedef struct pj_pipe_t pj_pipe_t

Unidirectional stream pipe object.

typedef struct pj_sem_t pj_sem_t

Semaphore handle.

typedef size_t pj_size_t

Large unsigned integer.

typedef long pj_sock_t

Socket handle.

typedef void pj_sockaddr_t

Generic socket address.

typedef long pj_ssize_t

Large signed integer.

typedef int pj_status_t

Status code.

typedef struct pj_thread_t pj_thread_t

Thread handle.

Opaque data to identify timer heap.

typedef unsigned short pj_uint16_t

Unsigned 16bit integer.

typedef unsigned int pj_uint32_t

Unsigned 32bit integer.

typedef unsigned char pj_uint8_t

Unsigned 8bit integer.

Enumeration Type Documentation

Some constants


Status is OK.


True value.


False value.

Function Documentation

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_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.
void pj_shutdown ( void  )

Shutdown PJLIB.

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_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_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.