Home --> Documentations --> PJLIB Reference
Go to the documentation of this file.
28#include <pj/compat/socket.h>
71#define PJ_AF_LOCAL PJ_AF_UNIX;
109# define pj_AF_UNSPEC() PJ_AF_UNSPEC
111# define pj_AF_UNIX() PJ_AF_UNIX
113# define pj_AF_INET() PJ_AF_INET
115# define pj_AF_INET6() PJ_AF_INET6
117# define pj_AF_PACKET() PJ_AF_PACKET
119# define pj_AF_IRDA() PJ_AF_IRDA
160# define pj_SOCK_STREAM() PJ_SOCK_STREAM
162# define pj_SOCK_DGRAM() PJ_SOCK_DGRAM
164# define pj_SOCK_RAW() PJ_SOCK_RAW
166# define pj_SOCK_RDM() PJ_SOCK_RDM
204# define pj_SOL_SOCKET() PJ_SOL_SOCKET
206# define pj_SOL_IP() PJ_SOL_IP
208# define pj_SOL_TCP() PJ_SOL_TCP
210# define pj_SOL_UDP() PJ_SOL_UDP
212# define pj_SOL_IPV6() PJ_SOL_IPV6
263# define pj_IP_TOS() PJ_IP_TOS
266# define pj_IPTOS_LOWDELAY() PJ_IP_TOS_LOWDELAY
269# define pj_IPTOS_THROUGHPUT() PJ_IP_TOS_THROUGHPUT
272# define pj_IPTOS_RELIABILITY() PJ_IP_TOS_RELIABILITY
275# define pj_IPTOS_MINCOST() PJ_IP_TOS_MINCOST
288# define pj_IPV6_TCLASS() PJ_IPV6_TCLASS
374# define pj_SO_TYPE() PJ_SO_TYPE
377# define pj_SO_RCVBUF() PJ_SO_RCVBUF
380# define pj_SO_SNDBUF() PJ_SO_SNDBUF
383# define pj_TCP_NODELAY() PJ_TCP_NODELAY
386# define pj_SO_REUSEADDR() PJ_SO_REUSEADDR
389# define pj_SO_NOSIGPIPE() PJ_SO_NOSIGPIPE
392# define pj_SO_PRIORITY() PJ_SO_PRIORITY
395# define pj_IP_MULTICAST_IF() PJ_IP_MULTICAST_IF
398# define pj_IP_MULTICAST_TTL() PJ_IP_MULTICAST_TTL
401# define pj_IP_MULTICAST_LOOP() PJ_IP_MULTICAST_LOOP
404# define pj_IP_ADD_MEMBERSHIP() PJ_IP_ADD_MEMBERSHIP
407# define pj_IP_DROP_MEMBERSHIP() PJ_IP_DROP_MEMBERSHIP
436# define pj_MSG_OOB() PJ_MSG_OOB
439# define pj_MSG_PEEK() PJ_MSG_PEEK
442# define pj_MSG_DONTROUTE() PJ_MSG_DONTROUTE
462#define PJ_INADDR_ANY ((pj_uint32_t)0)
465#define PJ_INADDR_NONE ((pj_uint32_t)0xffffffff)
468#define PJ_INADDR_BROADCAST ((pj_uint32_t)0xffffffff)
476#if !defined(PJ_SOMAXCONN)
477# define PJ_SOMAXCONN 5
485#define PJ_INVALID_SOCKET (-1)
510#define PJ_INET_ADDRSTRLEN 16
515#define PJ_INET6_ADDRSTRLEN 46
521#ifndef PJ_SOCKADDR_IN_SIN_ZERO_LEN
522# define PJ_SOCKADDR_IN_SIN_ZERO_LEN 8
535#if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0
567#if 0 && defined(PJ_HAS_INT64) && PJ_HAS_INT64!=0 && \
568 (!defined(PJ_WIN32) || PJ_WIN32==0)
569 pj_int64_t u6_addr64[2];
582#define PJ_IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
585#define PJ_IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
597#if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0
620#if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0
770 char *dst, int size);
790 char *dst, int size);
1409 unsigned *buf_size);
1527 char *buf, int size, unsigned flag);
unsigned char pj_uint8_t Definition: types.h:55
long pj_ssize_t Definition: types.h:64
int pj_bool_t Definition: types.h:71
unsigned short pj_uint16_t Definition: types.h:49
long pj_sock_t Definition: types.h:263
void pj_sockaddr_t Definition: types.h:267
int pj_status_t Definition: types.h:68
unsigned int pj_uint32_t Definition: types.h:43
void pj_sockaddr_in_set_addr(pj_sockaddr_in *addr, pj_uint32_t hostaddr)
#define pj_AF_PACKET() Definition: sock.h:117
#define pj_IPTOS_RELIABILITY() Definition: sock.h:272
const pj_uint16_t PJ_IP_ADD_MEMBERSHIP
const pj_uint16_t PJ_SO_PRIORITY
pj_status_t pj_sockaddr_init(int af, pj_sockaddr *addr, const pj_str_t *cp, pj_uint16_t port)
pj_status_t pj_sockaddr_parse(int af, unsigned options, const pj_str_t *str, pj_sockaddr *addr)
pj_status_t pj_sock_bind(pj_sock_t sockfd, const pj_sockaddr_t *my_addr, int addrlen)
#define pj_SOCK_RDM() Definition: sock.h:166
#define pj_SO_SNDBUF() Definition: sock.h:380
const pj_uint16_t PJ_SOCK_STREAM
const pj_uint16_t PJ_SO_SNDBUF
pj_status_t pj_sock_send(pj_sock_t sockfd, const void *buf, pj_ssize_t *len, unsigned flags)
void * pj_sockaddr_get_addr(const pj_sockaddr_t *addr)
char * pj_sockaddr_print(const pj_sockaddr_t *addr, char *buf, int size, unsigned flags)
pj_uint16_t pj_htons(pj_uint16_t hostshort)
pj_socket_sd_type Definition: sock.h:450
const pj_uint16_t PJ_SO_TYPE
#define pj_SOL_IPV6() Definition: sock.h:212
#define pj_SOCK_RAW() Definition: sock.h:164
#define pj_MSG_DONTROUTE() Definition: sock.h:442
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_uint16_t pj_sockaddr_get_port(const pj_sockaddr_t *addr)
#define pj_IPTOS_THROUGHPUT() Definition: sock.h:269
pj_status_t pj_sock_close(pj_sock_t sockfd)
pj_in_addr pj_inet_addr2(const char *cp)
const pj_uint16_t PJ_SO_NOSIGPIPE
pj_status_t pj_sockaddr_in_set_str_addr(pj_sockaddr_in *addr, const pj_str_t *cp)
const pj_uint16_t PJ_IP_MULTICAST_LOOP
pj_in_addr pj_sockaddr_in_get_addr(const pj_sockaddr_in *addr)
const pj_uint16_t PJ_SOL_SOCKET
#define pj_IP_MULTICAST_TTL() Definition: sock.h:398
const pj_uint16_t PJ_AF_INET6
const pj_uint16_t PJ_IPTOS_LOWDELAY
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)
#define pj_IPTOS_LOWDELAY() Definition: sock.h:266
#define pj_SO_TYPE() Definition: sock.h:374
int pj_sockaddr_cmp(const pj_sockaddr_t *addr1, const pj_sockaddr_t *addr2)
pj_status_t pj_inet_ntop(int af, const void *src, char *dst, int size)
pj_status_t pj_sock_accept(pj_sock_t serverfd, pj_sock_t *newsock, pj_sockaddr_t *addr, int *addrlen)
const pj_uint16_t PJ_SOCK_RAW
const pj_str_t * pj_gethostname(void)
pj_status_t pj_sockaddr_set_port(pj_sockaddr *addr, pj_uint16_t hostport)
pj_uint32_t pj_ntohl(pj_uint32_t netlong)
const pj_uint16_t PJ_SOL_IPV6
#define pj_SOL_TCP() Definition: sock.h:208
#define pj_AF_INET6() Definition: sock.h:115
#define pj_IP_DROP_MEMBERSHIP() Definition: sock.h:407
const pj_uint16_t PJ_AF_IRDA
#define PJ_SOCKADDR_IN_SIN_ZERO_LEN Definition: sock.h:522
const pj_uint16_t PJ_IP_TOS
const int PJ_MSG_DONTROUTE
#define pj_SO_NOSIGPIPE() Definition: sock.h:389
const pj_uint16_t PJ_SOL_UDP
pj_status_t pj_sock_listen(pj_sock_t sockfd, int backlog)
const pj_uint16_t PJ_SO_REUSEADDR
#define pj_AF_IRDA() Definition: sock.h:119
const pj_uint16_t PJ_AF_UNIX
#define pj_AF_UNSPEC() Definition: sock.h:109
const pj_uint16_t PJ_SO_RCVBUF
const pj_uint16_t PJ_TCP_NODELAY
const pj_uint16_t PJ_IPTOS_RELIABILITY
#define pj_SOL_IP() Definition: sock.h:206
const pj_uint16_t PJ_IPTOS_MINCOST
pj_uint32_t pj_htonl(pj_uint32_t hostlong)
pj_status_t pj_sock_bind_in(pj_sock_t sockfd, pj_uint32_t addr, pj_uint16_t port)
void pj_sockaddr_in_set_port(pj_sockaddr_in *addr, pj_uint16_t hostport)
pj_status_t pj_sockaddr_synthesize(int dst_af, pj_sockaddr_t *dst, const pj_sockaddr_t *src)
pj_uint16_t pj_ntohs(pj_uint16_t netshort)
const pj_uint16_t PJ_IPV6_TCLASS
#define pj_IP_MULTICAST_IF() Definition: sock.h:395
const pj_uint16_t PJ_SOL_IP
#define pj_TCP_NODELAY() Definition: sock.h:383
#define pj_AF_INET() Definition: sock.h:113
pj_status_t pj_inet_pton(int af, const pj_str_t *src, void *dst)
pj_status_t pj_sock_getsockopt(pj_sock_t sockfd, pj_uint16_t level, pj_uint16_t optname, void *optval, int *optlen)
const pj_uint16_t PJ_SOCK_RDM
#define pj_IPTOS_MINCOST() Definition: sock.h:275
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)
#define pj_IP_ADD_MEMBERSHIP() Definition: sock.h:404
int pj_inet_aton(const pj_str_t *cp, pj_in_addr *inp)
const pj_uint16_t PJ_IP_MULTICAST_TTL
#define pj_SO_RCVBUF() Definition: sock.h:377
pj_status_t pj_sock_setsockopt(pj_sock_t sockfd, pj_uint16_t level, pj_uint16_t optname, const void *optval, int optlen)
#define pj_SO_REUSEADDR() Definition: sock.h:386
const pj_uint16_t PJ_SOCK_DGRAM
pj_status_t pj_sock_recvfrom(pj_sock_t sockfd, void *buf, pj_ssize_t *len, unsigned flags, pj_sockaddr_t *from, int *fromlen)
#define pj_SOCK_DGRAM() Definition: sock.h:162
pj_status_t pj_sock_connect(pj_sock_t sockfd, const pj_sockaddr_t *serv_addr, int addrlen)
const pj_uint16_t PJ_AF_INET
pj_status_t pj_sockaddr_set_str_addr(int af, pj_sockaddr *addr, const pj_str_t *cp)
pj_status_t pj_sock_socketpair(int family, int type, int protocol, pj_sock_t sv[2])
char * pj_inet_ntoa(pj_in_addr inaddr)
struct in_addr pj_in_addr Definition: sock.h:504
#define pj_SOL_UDP() Definition: sock.h:210
const pj_uint16_t PJ_AF_PACKET
#define pj_AF_UNIX() Definition: sock.h:111
pj_in_addr pj_gethostaddr(void)
pj_in_addr pj_inet_addr(const pj_str_t *cp)
#define pj_IP_TOS() Definition: sock.h:263
#define pj_IPV6_TCLASS() Definition: sock.h:288
pj_status_t pj_sock_setsockopt_params(pj_sock_t sockfd, const pj_sockopt_params *params)
#define pj_SOL_SOCKET() Definition: sock.h:204
#define pj_SO_PRIORITY() Definition: sock.h:392
pj_status_t pj_sock_setsockopt_sobuf(pj_sock_t sockfd, pj_uint16_t optname, pj_bool_t auto_retry, unsigned *buf_size)
unsigned pj_sockaddr_get_addr_len(const pj_sockaddr_t *addr)
#define pj_MSG_PEEK() Definition: sock.h:439
pj_status_t pj_sock_shutdown(pj_sock_t sockfd, int how)
pj_status_t pj_sock_getsockname(pj_sock_t sockfd, pj_sockaddr_t *addr, int *namelen)
pj_uint16_t pj_sockaddr_in_get_port(const pj_sockaddr_in *addr)
pj_bool_t pj_sockaddr_has_addr(const pj_sockaddr_t *addr)
const pj_uint16_t PJ_IP_MULTICAST_IF
const pj_uint16_t PJ_AF_UNSPEC
#define pj_IP_MULTICAST_LOOP() Definition: sock.h:401
unsigned pj_sockaddr_get_len(const pj_sockaddr_t *addr)
#define pj_SOCK_STREAM() Definition: sock.h:160
char * pj_addr_str_print(const pj_str_t *host_str, int port, char *buf, int size, unsigned flag)
void pj_sockaddr_copy_addr(pj_sockaddr *dst, const pj_sockaddr *src)
pj_status_t pj_sockaddr_in_init(pj_sockaddr_in *addr, const pj_str_t *cp, pj_uint16_t port)
const pj_uint16_t PJ_IPTOS_THROUGHPUT
void pj_sockaddr_cp(pj_sockaddr_t *dst, const pj_sockaddr_t *src)
pj_status_t pj_sock_getpeername(pj_sock_t sockfd, pj_sockaddr_t *addr, int *namelen)
pj_status_t pj_sock_socket(int family, int type, int protocol, pj_sock_t *sock)
const pj_uint16_t PJ_SOL_TCP
pj_status_t pj_sock_recv(pj_sock_t sockfd, void *buf, pj_ssize_t *len, unsigned flags)
const pj_uint16_t PJ_IP_DROP_MEMBERSHIP
char * pj_inet_ntop2(int af, const void *src, char *dst, int size)
#define pj_MSG_OOB() Definition: sock.h:436
struct in6_addr pj_in6_addr Definition: sock.h:577
@ PJ_SHUT_RDWR Definition: sock.h:456
@ PJ_SD_RECEIVE Definition: sock.h:451
@ PJ_SD_BOTH Definition: sock.h:455
@ PJ_SHUT_RD Definition: sock.h:452
@ PJ_SHUT_WR Definition: sock.h:454
@ PJ_SD_SEND Definition: sock.h:453
#define PJ_BEGIN_DECL Definition: config.h:1284
#define PJ_MAX_SOCKOPT_PARAMS Definition: config.h:1085
#define PJ_END_DECL Definition: config.h:1285
pj_uint16_t sa_family Definition: sock.h:624
pj_in_addr imr_interface Definition: sock.h:645
pj_in_addr imr_multiaddr Definition: sock.h:644
pj_uint32_t sin6_flowinfo Definition: sock.h:604
pj_uint16_t sin6_family Definition: sock.h:601
pj_in6_addr sin6_addr Definition: sock.h:605
pj_uint32_t sin6_scope_id Definition: sock.h:606
pj_uint16_t sin6_port Definition: sock.h:603
pj_uint16_t sin_port Definition: sock.h:541
pj_uint16_t sin_family Definition: sock.h:539
pj_in_addr sin_addr Definition: sock.h:542
char sin_zero_pad[8] Definition: sock.h:543
int optname Definition: sock.h:663
struct pj_sockopt_params::@1 options[PJ_MAX_SOCKOPT_PARAMS]
unsigned cnt Definition: sock.h:655
int level Definition: sock.h:660
int optlen Definition: sock.h:669
void * optval Definition: sock.h:666
Declaration of basic types and utility.
pj_sockaddr_in6 ipv6 Definition: sock.h:636
pj_addr_hdr addr Definition: sock.h:634
pj_sockaddr_in ipv4 Definition: sock.h:635
PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.
|