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

Modules

 Socket Quality of Service (QoS) API: TOS, DSCP, WMM, IEEE 802.1p
 

Data Structures

struct  pj_sockaddr_in
 
struct  pj_sockaddr_in6
 
struct  pj_addr_hdr
 
union  pj_sockaddr
 
struct  pj_ip_mreq
 
struct  pj_sockopt_params
 

Macros

#define PJ_AF_LOCAL   PJ_AF_UNIX;
 
#define pj_AF_UNSPEC()   PJ_AF_UNSPEC
 
#define pj_AF_UNIX()   PJ_AF_UNIX
 
#define pj_AF_INET()   PJ_AF_INET
 
#define pj_AF_INET6()   PJ_AF_INET6
 
#define pj_AF_PACKET()   PJ_AF_PACKET
 
#define pj_AF_IRDA()   PJ_AF_IRDA
 
#define pj_SOCK_STREAM()   PJ_SOCK_STREAM
 
#define pj_SOCK_DGRAM()   PJ_SOCK_DGRAM
 
#define pj_SOCK_RAW()   PJ_SOCK_RAW
 
#define pj_SOCK_RDM()   PJ_SOCK_RDM
 
#define pj_SOL_SOCKET()   PJ_SOL_SOCKET
 
#define pj_SOL_IP()   PJ_SOL_IP
 
#define pj_SOL_TCP()   PJ_SOL_TCP
 
#define pj_SOL_UDP()   PJ_SOL_UDP
 
#define pj_SOL_IPV6()   PJ_SOL_IPV6
 
#define pj_IP_TOS()   PJ_IP_TOS
 
#define pj_IPTOS_LOWDELAY()   PJ_IP_TOS_LOWDELAY
 
#define pj_IPTOS_THROUGHPUT()   PJ_IP_TOS_THROUGHPUT
 
#define pj_IPTOS_RELIABILITY()   PJ_IP_TOS_RELIABILITY
 
#define pj_IPTOS_MINCOST()   PJ_IP_TOS_MINCOST
 
#define pj_IPV6_TCLASS()   PJ_IPV6_TCLASS
 
#define pj_SO_TYPE()   PJ_SO_TYPE
 
#define pj_SO_RCVBUF()   PJ_SO_RCVBUF
 
#define pj_SO_SNDBUF()   PJ_SO_SNDBUF
 
#define pj_TCP_NODELAY()   PJ_TCP_NODELAY
 
#define pj_SO_REUSEADDR()   PJ_SO_REUSEADDR
 
#define pj_SO_NOSIGPIPE()   PJ_SO_NOSIGPIPE
 
#define pj_SO_PRIORITY()   PJ_SO_PRIORITY
 
#define pj_IP_MULTICAST_IF()   PJ_IP_MULTICAST_IF
 
#define pj_IP_MULTICAST_TTL()   PJ_IP_MULTICAST_TTL
 
#define pj_IP_MULTICAST_LOOP()   PJ_IP_MULTICAST_LOOP
 
#define pj_IP_ADD_MEMBERSHIP()   PJ_IP_ADD_MEMBERSHIP
 
#define pj_IP_DROP_MEMBERSHIP()   PJ_IP_DROP_MEMBERSHIP
 
#define pj_MSG_OOB()   PJ_MSG_OOB
 
#define pj_MSG_PEEK()   PJ_MSG_PEEK
 
#define pj_MSG_DONTROUTE()   PJ_MSG_DONTROUTE
 
#define PJ_INADDR_ANY   ((pj_uint32_t)0)
 
#define PJ_INADDR_NONE   ((pj_uint32_t)0xffffffff)
 
#define PJ_INADDR_BROADCAST   ((pj_uint32_t)0xffffffff)
 
#define PJ_SOMAXCONN   5
 
#define PJ_INVALID_SOCKET   (-1)
 
#define PJ_INET_ADDRSTRLEN   16
 
#define PJ_INET6_ADDRSTRLEN   46
 
#define PJ_SOCKADDR_IN_SIN_ZERO_LEN   8
 
#define PJ_IN6ADDR_ANY_INIT   { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
 
#define PJ_IN6ADDR_LOOPBACK_INIT   { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
 

Typedefs

typedef struct in_addr pj_in_addr
 
typedef struct in6_addr pj_in6_addr
 

Enumerations

enum  pj_socket_sd_type {
  PJ_SD_RECEIVE = 0 , PJ_SHUT_RD = 0 , PJ_SD_SEND = 1 , PJ_SHUT_WR = 1 ,
  PJ_SD_BOTH = 2 , PJ_SHUT_RDWR = 2
}
 

Functions

pj_uint16_t pj_ntohs (pj_uint16_t netshort)
 
pj_uint16_t pj_htons (pj_uint16_t hostshort)
 
pj_uint32_t pj_ntohl (pj_uint32_t netlong)
 
pj_uint32_t pj_htonl (pj_uint32_t hostlong)
 
char * pj_inet_ntoa (pj_in_addr inaddr)
 
int pj_inet_aton (const pj_str_t *cp, pj_in_addr *inp)
 
pj_status_t pj_inet_pton (int af, const pj_str_t *src, void *dst)
 
pj_status_t pj_inet_ntop (int af, const void *src, char *dst, int size)
 
char * pj_inet_ntop2 (int af, const void *src, char *dst, int size)
 
char * pj_sockaddr_print (const pj_sockaddr_t *addr, char *buf, int size, unsigned flags)
 
pj_in_addr pj_inet_addr (const pj_str_t *cp)
 
pj_in_addr pj_inet_addr2 (const char *cp)
 
pj_status_t pj_sockaddr_in_init (pj_sockaddr_in *addr, const pj_str_t *cp, pj_uint16_t port)
 
pj_status_t pj_sockaddr_init (int af, pj_sockaddr *addr, const pj_str_t *cp, pj_uint16_t port)
 
int pj_sockaddr_cmp (const pj_sockaddr_t *addr1, const pj_sockaddr_t *addr2)
 
void * pj_sockaddr_get_addr (const pj_sockaddr_t *addr)
 
pj_bool_t pj_sockaddr_has_addr (const pj_sockaddr_t *addr)
 
unsigned pj_sockaddr_get_addr_len (const pj_sockaddr_t *addr)
 
unsigned pj_sockaddr_get_len (const pj_sockaddr_t *addr)
 
void pj_sockaddr_copy_addr (pj_sockaddr *dst, const pj_sockaddr *src)
 
void pj_sockaddr_cp (pj_sockaddr_t *dst, const pj_sockaddr_t *src)
 
pj_status_t pj_sockaddr_synthesize (int dst_af, pj_sockaddr_t *dst, const pj_sockaddr_t *src)
 
pj_in_addr pj_sockaddr_in_get_addr (const pj_sockaddr_in *addr)
 
void pj_sockaddr_in_set_addr (pj_sockaddr_in *addr, pj_uint32_t hostaddr)
 
pj_status_t pj_sockaddr_in_set_str_addr (pj_sockaddr_in *addr, const pj_str_t *cp)
 
pj_status_t pj_sockaddr_set_str_addr (int af, pj_sockaddr *addr, const pj_str_t *cp)
 
pj_uint16_t pj_sockaddr_get_port (const pj_sockaddr_t *addr)
 
pj_uint16_t pj_sockaddr_in_get_port (const pj_sockaddr_in *addr)
 
pj_status_t pj_sockaddr_set_port (pj_sockaddr *addr, pj_uint16_t hostport)
 
void pj_sockaddr_in_set_port (pj_sockaddr_in *addr, pj_uint16_t hostport)
 
pj_status_t pj_sockaddr_parse (int af, unsigned options, const pj_str_t *str, pj_sockaddr *addr)
 
pj_status_t pj_sockaddr_parse2 (int af, unsigned options, const pj_str_t *str, pj_str_t *hostpart, pj_uint16_t *port, int *raf)
 
const pj_str_tpj_gethostname (void)
 
pj_in_addr pj_gethostaddr (void)
 
pj_status_t pj_sock_socket (int family, int type, int protocol, pj_sock_t *sock)
 
pj_status_t pj_sock_close (pj_sock_t sockfd)
 
pj_status_t pj_sock_bind (pj_sock_t sockfd, const pj_sockaddr_t *my_addr, int addrlen)
 
pj_status_t pj_sock_bind_in (pj_sock_t sockfd, pj_uint32_t addr, pj_uint16_t port)
 
pj_status_t pj_sock_bind_random (pj_sock_t sockfd, const pj_sockaddr_t *addr, pj_uint16_t port_range, pj_uint16_t max_try)
 
pj_status_t pj_sock_listen (pj_sock_t sockfd, int backlog)
 
pj_status_t pj_sock_accept (pj_sock_t serverfd, pj_sock_t *newsock, pj_sockaddr_t *addr, int *addrlen)
 
pj_status_t pj_sock_connect (pj_sock_t sockfd, const pj_sockaddr_t *serv_addr, int addrlen)
 
pj_status_t pj_sock_getpeername (pj_sock_t sockfd, pj_sockaddr_t *addr, int *namelen)
 
pj_status_t pj_sock_getsockname (pj_sock_t sockfd, pj_sockaddr_t *addr, int *namelen)
 
pj_status_t pj_sock_getsockopt (pj_sock_t sockfd, pj_uint16_t level, pj_uint16_t optname, void *optval, int *optlen)
 
pj_status_t pj_sock_setsockopt (pj_sock_t sockfd, pj_uint16_t level, pj_uint16_t optname, const void *optval, int optlen)
 
pj_status_t pj_sock_setsockopt_params (pj_sock_t sockfd, const pj_sockopt_params *params)
 
pj_status_t pj_sock_setsockopt_sobuf (pj_sock_t sockfd, pj_uint16_t optname, pj_bool_t auto_retry, unsigned *buf_size)
 
pj_status_t pj_sock_recv (pj_sock_t sockfd, void *buf, pj_ssize_t *len, unsigned flags)
 
pj_status_t pj_sock_recvfrom (pj_sock_t sockfd, void *buf, pj_ssize_t *len, unsigned flags, pj_sockaddr_t *from, int *fromlen)
 
pj_status_t pj_sock_send (pj_sock_t sockfd, const void *buf, pj_ssize_t *len, unsigned flags)
 
pj_status_t pj_sock_sendto (pj_sock_t sockfd, const void *buf, pj_ssize_t *len, unsigned flags, const pj_sockaddr_t *to, int tolen)
 
pj_status_t pj_sock_shutdown (pj_sock_t sockfd, int how)
 
char * pj_addr_str_print (const pj_str_t *host_str, int port, char *buf, int size, unsigned flag)
 
pj_status_t pj_sock_socketpair (int family, int type, int protocol, pj_sock_t sv[2])
 

Variables

const pj_uint16_t PJ_AF_UNSPEC
 
const pj_uint16_t PJ_AF_UNIX
 
const pj_uint16_t PJ_AF_INET
 
const pj_uint16_t PJ_AF_INET6
 
const pj_uint16_t PJ_AF_PACKET
 
const pj_uint16_t PJ_AF_IRDA
 
const pj_uint16_t PJ_SOCK_STREAM
 
const pj_uint16_t PJ_SOCK_DGRAM
 
const pj_uint16_t PJ_SOCK_RAW
 
const pj_uint16_t PJ_SOCK_RDM
 
const pj_uint16_t PJ_SOL_SOCKET
 
const pj_uint16_t PJ_SOL_IP
 
const pj_uint16_t PJ_SOL_TCP
 
const pj_uint16_t PJ_SOL_UDP
 
const pj_uint16_t PJ_SOL_IPV6
 
const pj_uint16_t PJ_IP_TOS
 
const pj_uint16_t PJ_IPTOS_LOWDELAY
 
const pj_uint16_t PJ_IPTOS_THROUGHPUT
 
const pj_uint16_t PJ_IPTOS_RELIABILITY
 
const pj_uint16_t PJ_IPTOS_MINCOST
 
const pj_uint16_t PJ_IPV6_TCLASS
 
const pj_uint16_t PJ_SO_TYPE
 
const pj_uint16_t PJ_SO_RCVBUF
 
const pj_uint16_t PJ_SO_SNDBUF
 
const pj_uint16_t PJ_TCP_NODELAY
 
const pj_uint16_t PJ_SO_REUSEADDR
 
const pj_uint16_t PJ_SO_NOSIGPIPE
 
const pj_uint16_t PJ_SO_PRIORITY
 
const pj_uint16_t PJ_IP_MULTICAST_IF
 
const pj_uint16_t PJ_IP_MULTICAST_TTL
 
const pj_uint16_t PJ_IP_MULTICAST_LOOP
 
const pj_uint16_t PJ_IP_ADD_MEMBERSHIP
 
const pj_uint16_t PJ_IP_DROP_MEMBERSHIP
 
const int PJ_MSG_OOB
 
const int PJ_MSG_PEEK
 
const int PJ_MSG_DONTROUTE
 

Detailed Description

The PJLIB socket abstraction layer is a thin and very portable abstraction for socket API. It provides API similar to BSD socket API. The abstraction is needed because BSD socket API is not always available on all platforms, therefore it wouldn't be possible to create a trully portable network programs unless we provide such abstraction.

Applications can use this API directly in their application, just as they would when using traditional BSD socket API, provided they call pj_init() first.

Examples

For some examples on how to use the socket API, please see:

Macro Definition Documentation

◆ pj_AF_INET

#define pj_AF_INET ( )    PJ_AF_INET

Get PJ_AF_INET value.

◆ pj_AF_INET6

#define pj_AF_INET6 ( )    PJ_AF_INET6

Get PJ_AF_INET6 value.

◆ pj_AF_IRDA

#define pj_AF_IRDA ( )    PJ_AF_IRDA

Get PJ_AF_IRDA value.

◆ PJ_AF_LOCAL

#define PJ_AF_LOCAL   PJ_AF_UNIX;

POSIX name for AF_UNIX

◆ pj_AF_PACKET

#define pj_AF_PACKET ( )    PJ_AF_PACKET

Get PJ_AF_PACKET value.

◆ pj_AF_UNIX

#define pj_AF_UNIX ( )    PJ_AF_UNIX

Get PJ_AF_UNIX value.

◆ pj_AF_UNSPEC

#define pj_AF_UNSPEC ( )    PJ_AF_UNSPEC

Get PJ_AF_UNSPEC value

◆ PJ_IN6ADDR_ANY_INIT

#define PJ_IN6ADDR_ANY_INIT   { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }

Initializer value for pj_in6_addr.

◆ PJ_IN6ADDR_LOOPBACK_INIT

#define PJ_IN6ADDR_LOOPBACK_INIT   { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }

Initializer value for pj_in6_addr.

◆ PJ_INADDR_ANY

#define PJ_INADDR_ANY   ((pj_uint32_t)0)

Address to accept any incoming messages.

◆ PJ_INADDR_BROADCAST

#define PJ_INADDR_BROADCAST   ((pj_uint32_t)0xffffffff)

Address to send to all hosts.

◆ PJ_INADDR_NONE

#define PJ_INADDR_NONE   ((pj_uint32_t)0xffffffff)

Address indicating an error return

◆ PJ_INET6_ADDRSTRLEN

#define PJ_INET6_ADDRSTRLEN   46

Maximum length of text representation of an IPv6 address.

◆ PJ_INET_ADDRSTRLEN

#define PJ_INET_ADDRSTRLEN   16

Maximum length of text representation of an IPv4 address.

◆ PJ_INVALID_SOCKET

#define PJ_INVALID_SOCKET   (-1)

Constant for invalid socket returned by pj_sock_socket() and pj_sock_accept().

◆ pj_IP_ADD_MEMBERSHIP

#define pj_IP_ADD_MEMBERSHIP ( )    PJ_IP_ADD_MEMBERSHIP

Get PJ_IP_ADD_MEMBERSHIP constant

◆ pj_IP_DROP_MEMBERSHIP

#define pj_IP_DROP_MEMBERSHIP ( )    PJ_IP_DROP_MEMBERSHIP

Get PJ_IP_DROP_MEMBERSHIP constant

◆ pj_IP_MULTICAST_IF

#define pj_IP_MULTICAST_IF ( )    PJ_IP_MULTICAST_IF

Get PJ_IP_MULTICAST_IF constant

◆ pj_IP_MULTICAST_LOOP

#define pj_IP_MULTICAST_LOOP ( )    PJ_IP_MULTICAST_LOOP

Get PJ_IP_MULTICAST_LOOP constant

◆ pj_IP_MULTICAST_TTL

#define pj_IP_MULTICAST_TTL ( )    PJ_IP_MULTICAST_TTL

Get PJ_IP_MULTICAST_TTL constant

◆ pj_IP_TOS

#define pj_IP_TOS ( )    PJ_IP_TOS

Get PJ_IP_TOS constant

◆ pj_IPTOS_LOWDELAY

#define pj_IPTOS_LOWDELAY ( )    PJ_IP_TOS_LOWDELAY

Get PJ_IPTOS_LOWDELAY constant

◆ pj_IPTOS_MINCOST

#define pj_IPTOS_MINCOST ( )    PJ_IP_TOS_MINCOST

Get PJ_IPTOS_MINCOST constant

◆ pj_IPTOS_RELIABILITY

#define pj_IPTOS_RELIABILITY ( )    PJ_IP_TOS_RELIABILITY

Get PJ_IPTOS_RELIABILITY constant

◆ pj_IPTOS_THROUGHPUT

#define pj_IPTOS_THROUGHPUT ( )    PJ_IP_TOS_THROUGHPUT

Get PJ_IPTOS_THROUGHPUT constant

◆ pj_IPV6_TCLASS

#define pj_IPV6_TCLASS ( )    PJ_IPV6_TCLASS

Get PJ_IPV6_TCLASS constant

◆ pj_MSG_DONTROUTE

#define pj_MSG_DONTROUTE ( )    PJ_MSG_DONTROUTE

Get PJ_MSG_DONTROUTE constant

◆ pj_MSG_OOB

#define pj_MSG_OOB ( )    PJ_MSG_OOB

Get PJ_MSG_OOB constant

◆ pj_MSG_PEEK

#define pj_MSG_PEEK ( )    PJ_MSG_PEEK

Get PJ_MSG_PEEK constant

◆ pj_SO_NOSIGPIPE

#define pj_SO_NOSIGPIPE ( )    PJ_SO_NOSIGPIPE

Get PJ_SO_NOSIGPIPE constant

◆ pj_SO_PRIORITY

#define pj_SO_PRIORITY ( )    PJ_SO_PRIORITY

Get PJ_SO_PRIORITY constant

◆ pj_SO_RCVBUF

#define pj_SO_RCVBUF ( )    PJ_SO_RCVBUF

Get PJ_SO_RCVBUF constant

◆ pj_SO_REUSEADDR

#define pj_SO_REUSEADDR ( )    PJ_SO_REUSEADDR

Get PJ_SO_REUSEADDR constant

◆ pj_SO_SNDBUF

#define pj_SO_SNDBUF ( )    PJ_SO_SNDBUF

Get PJ_SO_SNDBUF constant

◆ pj_SO_TYPE

#define pj_SO_TYPE ( )    PJ_SO_TYPE

Get PJ_SO_TYPE constant

◆ pj_SOCK_DGRAM

#define pj_SOCK_DGRAM ( )    PJ_SOCK_DGRAM

Get PJ_SOCK_DGRAM constant

◆ pj_SOCK_RAW

#define pj_SOCK_RAW ( )    PJ_SOCK_RAW

Get PJ_SOCK_RAW constant

◆ pj_SOCK_RDM

#define pj_SOCK_RDM ( )    PJ_SOCK_RDM

Get PJ_SOCK_RDM constant

◆ pj_SOCK_STREAM

#define pj_SOCK_STREAM ( )    PJ_SOCK_STREAM

Get PJ_SOCK_STREAM constant

◆ PJ_SOCKADDR_IN_SIN_ZERO_LEN

#define PJ_SOCKADDR_IN_SIN_ZERO_LEN   8

The size of sin_zero field in pj_sockaddr_in structure. Most OSes use 8, but others such as the BSD TCP/IP stack in eCos uses 24.

◆ pj_SOL_IP

#define pj_SOL_IP ( )    PJ_SOL_IP

Get PJ_SOL_IP constant

◆ pj_SOL_IPV6

#define pj_SOL_IPV6 ( )    PJ_SOL_IPV6

Get PJ_SOL_IPV6 constant

◆ pj_SOL_SOCKET

#define pj_SOL_SOCKET ( )    PJ_SOL_SOCKET

Get PJ_SOL_SOCKET constant

◆ pj_SOL_TCP

#define pj_SOL_TCP ( )    PJ_SOL_TCP

Get PJ_SOL_TCP constant

◆ pj_SOL_UDP

#define pj_SOL_UDP ( )    PJ_SOL_UDP

Get PJ_SOL_UDP constant

◆ PJ_SOMAXCONN

#define PJ_SOMAXCONN   5

Maximum length specifiable by pj_sock_listen(). If the build system doesn't override this value, then the lowest denominator (five, in Win32 systems) will be used.

◆ pj_TCP_NODELAY

#define pj_TCP_NODELAY ( )    PJ_TCP_NODELAY

Get PJ_TCP_NODELAY constant

Typedef Documentation

◆ pj_in6_addr

typedef struct in6_addr pj_in6_addr

This structure describes IPv6 address.

◆ pj_in_addr

typedef struct in_addr pj_in_addr

This structure describes Internet address.

Enumeration Type Documentation

◆ pj_socket_sd_type

Flag to be specified in pj_sock_shutdown().

Enumerator
PJ_SD_RECEIVE 

No more receive.

PJ_SHUT_RD 

Alias for SD_RECEIVE.

PJ_SD_SEND 

No more sending.

PJ_SHUT_WR 

Alias for SD_SEND.

PJ_SD_BOTH 

No more send and receive.

PJ_SHUT_RDWR 

Alias for SD_BOTH.

Function Documentation

◆ pj_addr_str_print()

char * pj_addr_str_print ( const pj_str_t host_str,
int  port,
char *  buf,
int  size,
unsigned  flag 
)

Print socket address string. This method will enclose the address string with square bracket if it's IPv6 address.

Parameters
host_strThe host address string.
portThe port address.
bufText buffer.
sizeSize of buffer.
flagBitmask combination of these value:
  • 1: port number is included.
Returns
The address string.

◆ pj_gethostaddr()

pj_in_addr pj_gethostaddr ( void  )

Get host's IP address, which the the first IP address that is resolved from the hostname.

Returns
The host's IP address, PJ_INADDR_NONE if the host IP address can not be identified.

◆ pj_gethostname()

const pj_str_t * pj_gethostname ( void  )

Get system's host name.

Returns
The hostname, or empty string if the hostname can not be identified.

◆ pj_htonl()

pj_uint32_t pj_htonl ( pj_uint32_t  hostlong)

Convert 32-bit value from host byte order to network byte order.

Parameters
hostlong32-bit host value.
Returns
32-bit network value.

◆ pj_htons()

pj_uint16_t pj_htons ( pj_uint16_t  hostshort)

Convert 16-bit value from host byte order to network byte order.

Parameters
hostshort16-bit host value.
Returns
16-bit network value.

◆ pj_inet_addr()

pj_in_addr pj_inet_addr ( const pj_str_t cp)

Convert address string with numbers and dots to binary IP address.

Parameters
cpThe IP address in numbers and dots notation.
Returns
If success, the IP address is returned in network byte order. If failed, PJ_INADDR_NONE will be returned.
Remarks
This is an obsolete interface to pj_inet_aton(); it is obsolete because -1 is a valid address (255.255.255.255), and pj_inet_aton() provides a cleaner way to indicate error return.

◆ pj_inet_addr2()

pj_in_addr pj_inet_addr2 ( const char *  cp)

Convert address string with numbers and dots to binary IP address.

Parameters
cpThe IP address in numbers and dots notation.
Returns
If success, the IP address is returned in network byte order. If failed, PJ_INADDR_NONE will be returned.
Remarks
This is an obsolete interface to pj_inet_aton(); it is obsolete because -1 is a valid address (255.255.255.255), and pj_inet_aton() provides a cleaner way to indicate error return.

◆ pj_inet_aton()

int pj_inet_aton ( const pj_str_t cp,
pj_in_addr inp 
)

This function converts the Internet host address cp from the standard numbers-and-dots notation into binary data and stores it in the structure that inp points to.

Parameters
cpIP address in standard numbers-and-dots notation.
inpStructure that holds the output of the conversion.
Returns
nonzero if the address is valid, zero if not.

◆ pj_inet_ntoa()

char * pj_inet_ntoa ( pj_in_addr  inaddr)

Convert an Internet host address given in network byte order to string in standard numbers and dots notation.

Parameters
inaddrThe host address.
Returns
The string address.

◆ pj_inet_ntop()

pj_status_t pj_inet_ntop ( int  af,
const void *  src,
char *  dst,
int  size 
)

This function converts a numeric address into a text string suitable for presentation. It supports both IPv4 and IPv6 address conversion.

See also
pj_sockaddr_print()
Parameters
afSpecify the family of the address. This can be PJ_AF_INET or PJ_AF_INET6.
srcPoints to a buffer holding an IPv4 address if the af argument is PJ_AF_INET, or an IPv6 address if the af argument is PJ_AF_INET6; the address must be in network byte order.
dstPoints to a buffer where the function stores the resulting text string; it shall not be NULL.
sizeSpecifies the size of this buffer, which shall be large enough to hold the text string (PJ_INET_ADDRSTRLEN characters for IPv4, PJ_INET6_ADDRSTRLEN characters for IPv6).
Returns
PJ_SUCCESS if conversion was successful.

◆ pj_inet_ntop2()

char * pj_inet_ntop2 ( int  af,
const void *  src,
char *  dst,
int  size 
)

Converts numeric address into its text string representation.

See also
pj_sockaddr_print()
Parameters
afSpecify the family of the address. This can be PJ_AF_INET or PJ_AF_INET6.
srcPoints to a buffer holding an IPv4 address if the af argument is PJ_AF_INET, or an IPv6 address if the af argument is PJ_AF_INET6; the address must be in network byte order.
dstPoints to a buffer where the function stores the resulting text string; it shall not be NULL.
sizeSpecifies the size of this buffer, which shall be large enough to hold the text string (PJ_INET_ADDRSTRLEN characters for IPv4, PJ_INET6_ADDRSTRLEN characters for IPv6).
Returns
The address string or NULL if failed.

◆ pj_inet_pton()

pj_status_t pj_inet_pton ( int  af,
const pj_str_t src,
void *  dst 
)

This function converts an address in its standard text presentation form into its numeric binary form. It supports both IPv4 and IPv6 address conversion.

Parameters
afSpecify the family of the address. The PJ_AF_INET and PJ_AF_INET6 address families shall be supported.
srcPoints to the string being passed in.
dstPoints to a buffer into which the function stores the numeric address; this shall be large enough to hold the numeric address (32 bits for PJ_AF_INET, 128 bits for PJ_AF_INET6).
Returns
PJ_SUCCESS if conversion was successful.

◆ pj_ntohl()

pj_uint32_t pj_ntohl ( pj_uint32_t  netlong)

Convert 32-bit value from network byte order to host byte order.

Parameters
netlong32-bit network value.
Returns
32-bit host value.

◆ pj_ntohs()

pj_uint16_t pj_ntohs ( pj_uint16_t  netshort)

Convert 16-bit value from network byte order to host byte order.

Parameters
netshort16-bit network value.
Returns
16-bit host value.

◆ pj_sock_accept()

pj_status_t pj_sock_accept ( pj_sock_t  serverfd,
pj_sock_t newsock,
pj_sockaddr_t addr,
int *  addrlen 
)

Accept new connection on the specified connection oriented server socket.

Parameters
serverfdThe server socket.
newsockNew socket on success, of PJ_INVALID_SOCKET if failed.
addrA pointer to sockaddr type. If the argument is not NULL, it will be filled by the address of connecting entity.
addrlenInitially specifies the length of the address, and upon return will be filled with the exact address length.
Returns
Zero on success, or the error number.

◆ pj_sock_bind()

pj_status_t pj_sock_bind ( pj_sock_t  sockfd,
const pj_sockaddr_t my_addr,
int  addrlen 
)

This function gives the socket sockfd the local address my_addr. my_addr is addrlen bytes long. Traditionally, this is called assigning a name to a socket. When a socket is created with pj_sock_socket(), it exists in a name space (address family) but has no name assigned.

Parameters
sockfdThe socket desriptor.
my_addrThe local address to bind the socket to.
addrlenThe length of the address.
Returns
Zero on success.

◆ pj_sock_bind_in()

pj_status_t pj_sock_bind_in ( pj_sock_t  sockfd,
pj_uint32_t  addr,
pj_uint16_t  port 
)

Bind the IP socket sockfd to the given address and port.

Parameters
sockfdThe socket descriptor.
addrLocal address to bind the socket to, in host byte order.
portThe local port to bind the socket to, in host byte order.
Returns
Zero on success.

◆ pj_sock_bind_random()

pj_status_t pj_sock_bind_random ( pj_sock_t  sockfd,
const pj_sockaddr_t addr,
pj_uint16_t  port_range,
pj_uint16_t  max_try 
)

Bind the IP socket sockfd to the given address and a random port in the specified range.

Parameters
sockfdThe socket desriptor.
addrThe local address and port to bind the socket to.
port_rangeThe port range, relative the to start port number specified in port field in addr. Note that if the port is zero, this param will be ignored.
max_tryMaximum retries.
Returns
Zero on success.

◆ pj_sock_close()

pj_status_t pj_sock_close ( pj_sock_t  sockfd)

Close the socket descriptor.

Parameters
sockfdThe socket descriptor.
Returns
Zero on success.

◆ pj_sock_connect()

pj_status_t pj_sock_connect ( pj_sock_t  sockfd,
const pj_sockaddr_t serv_addr,
int  addrlen 
)

The file descriptor sockfd must refer to a socket. If the socket is of type PJ_SOCK_DGRAM then the serv_addr address is the address to which datagrams are sent by default, and the only address from which datagrams are received. If the socket is of type PJ_SOCK_STREAM or PJ_SOCK_SEQPACKET, this call attempts to make a connection to another socket. The other socket is specified by serv_addr, which is an address (of length addrlen) in the communications space of the socket. Each communications space interprets the serv_addr parameter in its own way.

Parameters
sockfdThe socket descriptor.
serv_addrServer address to connect to.
addrlenThe length of server address.
Returns
Zero on success.

◆ pj_sock_getpeername()

pj_status_t pj_sock_getpeername ( pj_sock_t  sockfd,
pj_sockaddr_t addr,
int *  namelen 
)

Return the address of peer which is connected to socket sockfd.

Parameters
sockfdThe socket descriptor.
addrPointer to sockaddr structure to which the address will be returned.
namelenInitially the length of the addr. Upon return the value will be set to the actual length of the address.
Returns
Zero on success.

◆ pj_sock_getsockname()

pj_status_t pj_sock_getsockname ( pj_sock_t  sockfd,
pj_sockaddr_t addr,
int *  namelen 
)

Return the current name of the specified socket.

Parameters
sockfdThe socket descriptor.
addrPointer to sockaddr structure to which the address will be returned.
namelenInitially the length of the addr. Upon return the value will be set to the actual length of the address.
Returns
Zero on success.

◆ pj_sock_getsockopt()

pj_status_t pj_sock_getsockopt ( pj_sock_t  sockfd,
pj_uint16_t  level,
pj_uint16_t  optname,
void *  optval,
int *  optlen 
)

Get socket option associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level.

Parameters
sockfdThe socket descriptor.
levelThe level which to get the option from.
optnameThe option name.
optvalIdentifies the buffer which the value will be returned.
optlenInitially contains the length of the buffer, upon return will be set to the actual size of the value.
Returns
Zero on success.

◆ pj_sock_listen()

pj_status_t pj_sock_listen ( pj_sock_t  sockfd,
int  backlog 
)

Listen for incoming connection. This function only applies to connection oriented sockets (such as PJ_SOCK_STREAM or PJ_SOCK_SEQPACKET), and it indicates the willingness to accept incoming connections.

Parameters
sockfdThe socket descriptor.
backlogDefines the maximum length the queue of pending connections may grow to.
Returns
Zero on success.

◆ pj_sock_recv()

pj_status_t pj_sock_recv ( pj_sock_t  sockfd,
void *  buf,
pj_ssize_t len,
unsigned  flags 
)

Receives data stream or message coming to the specified socket.

Parameters
sockfdThe socket descriptor.
bufThe buffer to receive the data or message.
lenOn input, the length of the buffer. On return, contains the length of data received.
flagsFlags (such as pj_MSG_PEEK()).
Returns
PJ_SUCCESS or the error code.

◆ pj_sock_recvfrom()

pj_status_t pj_sock_recvfrom ( pj_sock_t  sockfd,
void *  buf,
pj_ssize_t len,
unsigned  flags,
pj_sockaddr_t from,
int *  fromlen 
)

Receives data stream or message coming to the specified socket.

Parameters
sockfdThe socket descriptor.
bufThe buffer to receive the data or message.
lenOn input, the length of the buffer. On return, contains the length of data received.
flagsFlags (such as pj_MSG_PEEK()).
fromIf not NULL, it will be filled with the source address of the connection.
fromlenInitially contains the length of from address, and upon return will be filled with the actual length of the address.
Returns
PJ_SUCCESS or the error code.

◆ pj_sock_send()

pj_status_t pj_sock_send ( pj_sock_t  sockfd,
const void *  buf,
pj_ssize_t len,
unsigned  flags 
)

Transmit data to the socket.

Parameters
sockfdSocket descriptor.
bufBuffer containing data to be sent.
lenOn input, the length of the data in the buffer. Upon return, it will be filled with the length of data sent.
flagsFlags (such as pj_MSG_DONTROUTE()).
Returns
PJ_SUCCESS or the status code.

◆ pj_sock_sendto()

pj_status_t pj_sock_sendto ( pj_sock_t  sockfd,
const void *  buf,
pj_ssize_t len,
unsigned  flags,
const pj_sockaddr_t to,
int  tolen 
)

Transmit data to the socket to the specified address.

Parameters
sockfdSocket descriptor.
bufBuffer containing data to be sent.
lenOn input, the length of the data in the buffer. Upon return, it will be filled with the length of data sent.
flagsFlags (such as pj_MSG_DONTROUTE()).
toThe address to send.
tolenThe length of the address in bytes.
Returns
PJ_SUCCESS or the status code.

◆ pj_sock_setsockopt()

pj_status_t pj_sock_setsockopt ( pj_sock_t  sockfd,
pj_uint16_t  level,
pj_uint16_t  optname,
const void *  optval,
int  optlen 
)

Manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level.

Parameters
sockfdThe socket descriptor.
levelThe level which to get the option from.
optnameThe option name.
optvalIdentifies the buffer which contain the value.
optlenThe length of the value.
Returns
PJ_SUCCESS or the status code.

◆ pj_sock_setsockopt_params()

pj_status_t pj_sock_setsockopt_params ( pj_sock_t  sockfd,
const pj_sockopt_params params 
)

Set socket options associated with a socket. This method will apply all the options specified, and ignore any errors that might be raised.

Parameters
sockfdThe socket descriptor.
paramsThe socket options.
Returns
PJ_SUCCESS or the last error code.

◆ pj_sock_setsockopt_sobuf()

pj_status_t pj_sock_setsockopt_sobuf ( pj_sock_t  sockfd,
pj_uint16_t  optname,
pj_bool_t  auto_retry,
unsigned *  buf_size 
)

Helper function to set socket buffer size using pj_sock_setsockopt() with capability to auto retry with lower buffer setting value until the highest possible value is successfully set.

Parameters
sockfdThe socket descriptor.
optnameThe option name, valid values are pj_SO_RCVBUF() and pj_SO_SNDBUF().
auto_retryOption whether auto retry with lower value is enabled.
buf_sizeOn input, specify the prefered buffer size setting, on output, the buffer size setting applied.
Returns
PJ_SUCCESS or the status code.

◆ pj_sock_shutdown()

pj_status_t pj_sock_shutdown ( pj_sock_t  sockfd,
int  how 
)

The shutdown call causes all or part of a full-duplex connection on the socket associated with sockfd to be shut down.

Parameters
sockfdThe socket descriptor.
howIf how is PJ_SHUT_RD, further receptions will be disallowed. If how is PJ_SHUT_WR, further transmissions will be disallowed. If how is PJ_SHUT_RDWR, further receptions andtransmissions will be disallowed.
Returns
Zero on success.

◆ pj_sock_socket()

pj_status_t pj_sock_socket ( int  family,
int  type,
int  protocol,
pj_sock_t sock 
)

Create new socket/endpoint for communication.

Parameters
familySpecifies a communication domain; this selects the protocol family which will be used for communication.
typeThe socket has the indicated type, which specifies the communication semantics.
protocolSpecifies a particular protocol to be used with the socket. Normally only a single protocol exists to support a particular socket type within a given protocol family, in which a case protocol can be specified as 0.
sockNew socket descriptor, or PJ_INVALID_SOCKET on error.
Returns
Zero on success.

◆ pj_sock_socketpair()

pj_status_t pj_sock_socketpair ( int  family,
int  type,
int  protocol,
pj_sock_t  sv[2] 
)

Create socket pair

Parameters
familySpecifies a communication domain; this selects the protocol family which will be used for communication. On Unix, support AF_UNIX, AF_INET and AF_INET6, On Win32, not support AF_UNIX.
typeThe socket has the indicated type, which specifies the communication semantics.
protocolSpecifies a particular protocol to be used with the socket. Normally only a single protocol exists to support a particular socket type within a given protocol family, in which a case protocol can be specified as 0.
svThe new sockets vector
Returns
Zero on success.

◆ pj_sockaddr_cmp()

int pj_sockaddr_cmp ( const pj_sockaddr_t addr1,
const pj_sockaddr_t addr2 
)

Compare two socket addresses.

Parameters
addr1First address.
addr2Second address.
Returns
Zero on equal, -1 if addr1 is less than addr2, and +1 if addr1 is more than addr2.

◆ pj_sockaddr_copy_addr()

void pj_sockaddr_copy_addr ( pj_sockaddr dst,
const pj_sockaddr src 
)

Copy only the address part (sin_addr/sin6_addr) of a socket address.

Parameters
dstDestination socket address.
srcSource socket address.
See also
pj_sockaddr_cp()

◆ pj_sockaddr_cp()

void pj_sockaddr_cp ( pj_sockaddr_t dst,
const pj_sockaddr_t src 
)

Copy socket address. This will copy the whole structure depending on the address family of the source socket address.

Parameters
dstDestination socket address.
srcSource socket address.
See also
pj_sockaddr_copy_addr()

◆ pj_sockaddr_get_addr()

void * pj_sockaddr_get_addr ( const pj_sockaddr_t addr)

Get pointer to the address part of a socket address.

Parameters
addrSocket address.
Returns
Pointer to address part (sin_addr or sin6_addr, depending on address family)

◆ pj_sockaddr_get_addr_len()

unsigned pj_sockaddr_get_addr_len ( const pj_sockaddr_t addr)

Get the address part length of a socket address, based on its address family. For PJ_AF_INET, the length will be sizeof(pj_in_addr), and for PJ_AF_INET6, the length will be sizeof(pj_in6_addr).

Parameters
addrSocket address.
Returns
Length in bytes.

◆ pj_sockaddr_get_len()

unsigned pj_sockaddr_get_len ( const pj_sockaddr_t addr)

Get the socket address length, based on its address family. For PJ_AF_INET, the length will be sizeof(pj_sockaddr_in), and for PJ_AF_INET6, the length will be sizeof(pj_sockaddr_in6).

Parameters
addrSocket address.
Returns
Length in bytes.

◆ pj_sockaddr_get_port()

pj_uint16_t pj_sockaddr_get_port ( const pj_sockaddr_t addr)

Get the port number of a socket address, in host byte order. This function can be used for both IPv4 and IPv6 socket address.

Parameters
addrSocket address.
Returns
Port number, in host byte order.

◆ pj_sockaddr_has_addr()

pj_bool_t pj_sockaddr_has_addr ( const pj_sockaddr_t addr)

Check that a socket address contains a non-zero address part.

Parameters
addrSocket address.
Returns
Non-zero if address is set to non-zero.

◆ pj_sockaddr_in_get_addr()

pj_in_addr pj_sockaddr_in_get_addr ( const pj_sockaddr_in addr)

Get the IP address of an IPv4 socket address. The address is returned as 32bit value in host byte order.

Parameters
addrThe IP socket address.
Returns
32bit address, in host byte order.

◆ pj_sockaddr_in_get_port()

pj_uint16_t pj_sockaddr_in_get_port ( const pj_sockaddr_in addr)

Get the transport layer port number of an Internet socket address. The port is returned in host byte order.

Parameters
addrThe IP socket address.
Returns
Port number, in host byte order.

◆ pj_sockaddr_in_init()

pj_status_t pj_sockaddr_in_init ( pj_sockaddr_in addr,
const pj_str_t cp,
pj_uint16_t  port 
)

Initialize IPv4 socket address based on the address and port info. The string address may be in a standard numbers and dots notation or may be a hostname. If hostname is specified, then the function will resolve the host into the IP address.

See also
pj_sockaddr_init()
Parameters
addrThe IP socket address to be set.
cpThe address string, which can be in a standard dotted numbers or a hostname to be resolved.
portThe port number, in host byte order.
Returns
Zero on success.

◆ pj_sockaddr_in_set_addr()

void pj_sockaddr_in_set_addr ( pj_sockaddr_in addr,
pj_uint32_t  hostaddr 
)

Set the IP address of an IPv4 socket address.

Parameters
addrThe IP socket address.
hostaddrThe host address, in host byte order.

◆ pj_sockaddr_in_set_port()

void pj_sockaddr_in_set_port ( pj_sockaddr_in addr,
pj_uint16_t  hostport 
)

Set the port number of an IPv4 socket address.

See also
pj_sockaddr_set_port()
Parameters
addrThe IP socket address.
hostportThe port number, in host byte order.

◆ pj_sockaddr_in_set_str_addr()

pj_status_t pj_sockaddr_in_set_str_addr ( pj_sockaddr_in addr,
const pj_str_t cp 
)

Set the IP address of an IP socket address from string address, with resolving the host if necessary. The string address may be in a standard numbers and dots notation or may be a hostname. If hostname is specified, then the function will resolve the host into the IP address.

See also
pj_sockaddr_set_str_addr()
Parameters
addrThe IP socket address to be set.
cpThe address string, which can be in a standard dotted numbers or a hostname to be resolved.
Returns
PJ_SUCCESS on success.

◆ pj_sockaddr_init()

pj_status_t pj_sockaddr_init ( int  af,
pj_sockaddr addr,
const pj_str_t cp,
pj_uint16_t  port 
)

Initialize IP socket address based on the address and port info. The string address may be in a standard numbers and dots notation or may be a hostname. If hostname is specified, then the function will resolve the host into the IP address.

See also
pj_sockaddr_in_init()
Parameters
afInternet address family.
addrThe IP socket address to be set.
cpThe address string, which can be in a standard dotted numbers or a hostname to be resolved.
portThe port number, in host byte order.
Returns
Zero on success.

◆ pj_sockaddr_parse()

pj_status_t pj_sockaddr_parse ( int  af,
unsigned  options,
const pj_str_t str,
pj_sockaddr addr 
)

Parse string containing IP address and optional port into socket address, possibly also with address family detection. This function supports both IPv4 and IPv6 parsing, however IPv6 parsing may only be done if IPv6 is enabled during compilation.

This function supports parsing several formats. Sample IPv4 inputs and their default results::

  • "10.0.0.1:80": address 10.0.0.1 and port 80.
  • "10.0.0.1": address 10.0.0.1 and port zero.
  • "10.0.0.1:": address 10.0.0.1 and port zero.
  • "10.0.0.1:0": address 10.0.0.1 and port zero.
  • ":80": address 0.0.0.0 and port 80.
  • ":": address 0.0.0.0 and port 0.
  • "localhost": address 127.0.0.1 and port 0.
  • "localhost:": address 127.0.0.1 and port 0.
  • "localhost:80": address 127.0.0.1 and port 80.

Sample IPv6 inputs and their default results:

  • "[fec0::01]:80": address fec0::01 and port 80
  • "[fec0::01]": address fec0::01 and port 0
  • "[fec0::01]:": address fec0::01 and port 0
  • "[fec0::01]:0": address fec0::01 and port 0
  • "fec0::01": address fec0::01 and port 0
  • "fec0::01:80": address fec0::01:80 and port 0
  • "::": address zero (::) and port 0
  • "[::]": address zero (::) and port 0
  • "[::]:": address zero (::) and port 0
  • ":::": address zero (::) and port 0
  • "[::]:80": address zero (::) and port 0
  • ":::80": address zero (::) and port 80

Note: when the IPv6 socket address contains port number, the IP part of the socket address should be enclosed with square brackets, otherwise the port number will be included as part of the IP address (see "fec0::01:80" example above).

Parameters
afOptionally specify the address family to be used. If the address family is to be deducted from the input, specify pj_AF_UNSPEC() here. Other supported values are pj_AF_INET() and pj_AF_INET6()
optionsAdditional options to assist the parsing, must be zero for now.
strThe input string to be parsed.
addrPointer to store the result.
Returns
PJ_SUCCESS if the parsing is successful.
See also
pj_sockaddr_parse2()

◆ pj_sockaddr_parse2()

pj_status_t pj_sockaddr_parse2 ( int  af,
unsigned  options,
const pj_str_t str,
pj_str_t hostpart,
pj_uint16_t port,
int *  raf 
)

This function is similar to pj_sockaddr_parse(), except that it will not convert the hostpart into IP address (thus possibly resolving the hostname into a pj_sockaddr.

Unlike pj_sockaddr_parse(), this function has a limitation that if port number is specified in an IPv6 input string, the IP part of the IPv6 socket address MUST be enclosed in square brackets, otherwise the port number will be considered as part of the IPv6 IP address.

Parameters
afOptionally specify the address family to be used. If the address family is to be deducted from the input, specify pj_AF_UNSPEC() here. Other supported values are pj_AF_INET() and pj_AF_INET6()
optionsAdditional options to assist the parsing, must be zero for now.
strThe input string to be parsed.
hostpartOptional pointer to store the host part of the socket address, with any brackets removed.
portOptional pointer to store the port number. If port number is not found, this will be set to zero upon return.
rafOptional pointer to store the detected address family of the input address.
Returns
PJ_SUCCESS if the parsing is successful.
See also
pj_sockaddr_parse()

◆ pj_sockaddr_print()

char * pj_sockaddr_print ( const pj_sockaddr_t addr,
char *  buf,
int  size,
unsigned  flags 
)

Print socket address.

Parameters
addrThe socket address.
bufText buffer.
sizeSize of buffer.
flagsBitmask combination of these value:
  • 1: port number is included.
  • 2: square bracket is included for IPv6 address.
Returns
The address string.

◆ pj_sockaddr_set_port()

pj_status_t pj_sockaddr_set_port ( pj_sockaddr addr,
pj_uint16_t  hostport 
)

Set the port number of an Internet socket address.

Parameters
addrThe socket address.
hostportThe port number, in host byte order.

◆ pj_sockaddr_set_str_addr()

pj_status_t pj_sockaddr_set_str_addr ( int  af,
pj_sockaddr addr,
const pj_str_t cp 
)

Set the IP address of an IPv4 or IPv6 socket address from string address, with resolving the host if necessary. The string address may be in a standard IPv6 or IPv6 address or may be a hostname. If hostname is specified, then the function will resolve the host into the IP address according to the address family.

Parameters
afAddress family.
addrThe IP socket address to be set.
cpThe address string, which can be in a standard IP numbers (IPv4 or IPv6) or a hostname to be resolved.
Returns
PJ_SUCCESS on success.

◆ pj_sockaddr_synthesize()

pj_status_t pj_sockaddr_synthesize ( int  dst_af,
pj_sockaddr_t dst,
const pj_sockaddr_t src 
)

If the source's and desired address family matches, copy the address, otherwise synthesize a new address with the desired address family, from the source address. This can be useful to generate an IPv4-mapped IPv6 address.

Parameters
dst_afDesired address family.
dstDestination socket address, invalid if synthesis is required and failed.
srcSource socket address.
Returns
PJ_SUCCESS on success, or the error status if synthesis is required and failed.

Variable Documentation

◆ PJ_AF_INET

const pj_uint16_t PJ_AF_INET
extern

Internet IP protocol.

See also
pj_AF_INET()

◆ PJ_AF_INET6

const pj_uint16_t PJ_AF_INET6
extern

IP version 6.

See also
pj_AF_INET6()

◆ PJ_AF_IRDA

const pj_uint16_t PJ_AF_IRDA
extern

IRDA sockets.

See also
pj_AF_IRDA()

◆ PJ_AF_PACKET

const pj_uint16_t PJ_AF_PACKET
extern

Packet family.

See also
pj_AF_PACKET()

◆ PJ_AF_UNIX

const pj_uint16_t PJ_AF_UNIX
extern

Unix domain socket.

See also
pj_AF_UNIX()

◆ PJ_AF_UNSPEC

const pj_uint16_t PJ_AF_UNSPEC
extern

Supported address families. APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL AF_*, BECAUSE THE LIBRARY WILL DO TRANSLATION TO THE NATIVE VALUE. Address family is unspecified.

See also
pj_AF_UNSPEC()

◆ PJ_IP_ADD_MEMBERSHIP

const pj_uint16_t PJ_IP_ADD_MEMBERSHIP
extern

Add an IP group membership.

See also
pj_IP_ADD_MEMBERSHIP()

◆ PJ_IP_DROP_MEMBERSHIP

const pj_uint16_t PJ_IP_DROP_MEMBERSHIP
extern

Drop an IP group membership.

See also
pj_IP_DROP_MEMBERSHIP()

◆ PJ_IP_MULTICAST_IF

const pj_uint16_t PJ_IP_MULTICAST_IF
extern

IP multicast interface.

See also
pj_IP_MULTICAST_IF()

◆ PJ_IP_MULTICAST_LOOP

const pj_uint16_t PJ_IP_MULTICAST_LOOP
extern

IP multicast loopback.

See also
pj_IP_MULTICAST_LOOP()

◆ PJ_IP_MULTICAST_TTL

const pj_uint16_t PJ_IP_MULTICAST_TTL
extern

IP multicast ttl.

See also
pj_IP_MULTICAST_TTL()

◆ PJ_IP_TOS

const pj_uint16_t PJ_IP_TOS
extern

IP_TOS optname in setsockopt().

See also
pj_IP_TOS()

◆ PJ_IPTOS_LOWDELAY

const pj_uint16_t PJ_IPTOS_LOWDELAY
extern

Minimize delays.

See also
pj_IPTOS_LOWDELAY()

◆ PJ_IPTOS_MINCOST

const pj_uint16_t PJ_IPTOS_MINCOST
extern

"filler data" where slow transmission does't matter.

See also
pj_IPTOS_MINCOST()

◆ PJ_IPTOS_RELIABILITY

const pj_uint16_t PJ_IPTOS_RELIABILITY
extern

Optimize for reliability.

See also
pj_IPTOS_RELIABILITY()

◆ PJ_IPTOS_THROUGHPUT

const pj_uint16_t PJ_IPTOS_THROUGHPUT
extern

Optimize throughput.

See also
pj_IPTOS_THROUGHPUT()

◆ PJ_IPV6_TCLASS

const pj_uint16_t PJ_IPV6_TCLASS
extern

IPV6_TCLASS optname in setsockopt().

See also
pj_IPV6_TCLASS()

◆ PJ_MSG_DONTROUTE

const int PJ_MSG_DONTROUTE
extern

Don't route.

See also
pj_MSG_DONTROUTE()

◆ PJ_MSG_OOB

const int PJ_MSG_OOB
extern

Out-of-band messages.

See also
pj_MSG_OOB()

◆ PJ_MSG_PEEK

const int PJ_MSG_PEEK
extern

Peek, don't remove from buffer.

See also
pj_MSG_PEEK()

◆ PJ_SO_NOSIGPIPE

const pj_uint16_t PJ_SO_NOSIGPIPE
extern

Do not generate SIGPIPE.

See also
pj_SO_NOSIGPIPE

◆ PJ_SO_PRIORITY

const pj_uint16_t PJ_SO_PRIORITY
extern

Set the protocol-defined priority for all packets to be sent on socket.

◆ PJ_SO_RCVBUF

const pj_uint16_t PJ_SO_RCVBUF
extern

Buffer size for receive.

See also
pj_SO_RCVBUF()

◆ PJ_SO_REUSEADDR

const pj_uint16_t PJ_SO_REUSEADDR
extern

Allows the socket to be bound to an address that is already in use.

See also
pj_SO_REUSEADDR

◆ PJ_SO_SNDBUF

const pj_uint16_t PJ_SO_SNDBUF
extern

Buffer size for send.

See also
pj_SO_SNDBUF()

◆ PJ_SO_TYPE

const pj_uint16_t PJ_SO_TYPE
extern

Values to be specified as optname when calling pj_sock_setsockopt() or pj_sock_getsockopt(). Socket type.

See also
pj_SO_TYPE()

◆ PJ_SOCK_DGRAM

const pj_uint16_t PJ_SOCK_DGRAM
extern

Connectionless, unreliable datagrams of fixed maximum lengths.

See also
pj_SOCK_DGRAM()

◆ PJ_SOCK_RAW

const pj_uint16_t PJ_SOCK_RAW
extern

Raw protocol interface.

See also
pj_SOCK_RAW()

◆ PJ_SOCK_RDM

const pj_uint16_t PJ_SOCK_RDM
extern

Reliably-delivered messages.

See also
pj_SOCK_RDM()

◆ PJ_SOCK_STREAM

const pj_uint16_t PJ_SOCK_STREAM
extern

Supported types of sockets. APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL SOCK_*, BECAUSE THE LIBRARY WILL TRANSLATE THE VALUE TO THE NATIVE VALUE. Sequenced, reliable, connection-based byte streams.

See also
pj_SOCK_STREAM()

◆ PJ_SOL_IP

const pj_uint16_t PJ_SOL_IP
extern

IP level.

See also
pj_SOL_IP()

◆ PJ_SOL_IPV6

const pj_uint16_t PJ_SOL_IPV6
extern

IP version 6.

See also
pj_SOL_IPV6()

◆ PJ_SOL_SOCKET

const pj_uint16_t PJ_SOL_SOCKET
extern

Socket level specified in pj_sock_setsockopt() or pj_sock_getsockopt(). APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL SOL_*, BECAUSE THE LIBRARY WILL TRANSLATE THE VALUE TO THE NATIVE VALUE. Socket level.

See also
pj_SOL_SOCKET()

◆ PJ_SOL_TCP

const pj_uint16_t PJ_SOL_TCP
extern

TCP level.

See also
pj_SOL_TCP()

◆ PJ_SOL_UDP

const pj_uint16_t PJ_SOL_UDP
extern

UDP level.

See also
pj_SOL_UDP()

◆ PJ_TCP_NODELAY

const pj_uint16_t PJ_TCP_NODELAY
extern

Disables the Nagle algorithm for send coalescing.

See also
pj_TCP_NODELAY

 


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