WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

Basic Data Types and Library Functionality.
[Data Structure.]

Data Structures

struct  pj_str_t
union  pj_timestamp
struct  pj_hash_iterator_t

Defines

#define PJ_T(literal_str)   literal_str
#define PJ_SUCCESS   0
#define PJ_TRUE   1
#define PJ_FALSE   0
#define PJ_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define PJ_MAXINT32   0x7FFFFFFFL
#define PJ_MAX_OBJ_NAME   32

Typedefs

typedef int pj_int32_t
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_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)

Functions

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)

Define Documentation

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

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

#define PJ_FALSE   0

False value.

#define PJ_MAX_OBJ_NAME   32

Length of object names.

#define PJ_MAXINT32   0x7FFFFFFFL

Maximum value for signed 32-bit integer.

#define PJ_SUCCESS   0

Status is OK.

#define PJ_T (   literal_str  )     literal_str

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

#define PJ_TRUE   1

True value.


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

Boolean.

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.

typedef int pj_exception_id_t

Exception id.

typedef void(* pj_exit_callback)(void)

Type of callback to register to pj_atexit().

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

Signed 32bit 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.


Function Documentation

pj_status_t pj_atexit ( pj_exit_callback  func  ) 

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

Parameters:
func The function to be registered.
Returns:
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().

Returns:
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.

Parameters:
val16 The 16bit data.
Returns:
An 16bit data with swapped byte order.
pj_int32_t pj_swap32 ( pj_int32_t  val32  ) 

Swap the byte order of an 32bit data.

Parameters:
val32 The 32bit data.
Returns:
An 32bit data with swapped byte order.

 


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