31#ifdef PCP_SOCKET_IS_VOIDPTR
32#define PD_SOCKET_STARTUP()
33#define PD_SOCKET_CLEANUP()
34#define PCP_INVALID_SOCKET NULL
35#define PCP_SOCKET_ERROR (-1)
38#define CLOSE(sockfd) closesocket(sockfd)
40#define CLOSE(sockfd) close(sockfd)
47int pcp_win_sock_startup();
48int pcp_win_sock_cleanup();
50#define PD_SOCKET_STARTUP pcp_win_sock_startup
51#define PD_SOCKET_CLEANUP pcp_win_sock_cleanup
52#define PCP_SOCKET_ERROR SOCKET_ERROR
53#define PCP_INVALID_SOCKET INVALID_SOCKET
54#define CLOSE(sockfd) closesocket(sockfd)
58#define PD_SOCKET_STARTUP()
59#define PD_SOCKET_CLEANUP()
60#define PCP_SOCKET_ERROR (-1)
61#define PCP_INVALID_SOCKET (-1)
62#define CLOSE(sockfd) close(sockfd)
72 struct sockaddr *src);
75 uint16_t sport,
int ret_ipv6_mapped_ipv4,
uint32_t scope_id);
81 int flags,
struct sockaddr *src_addr, socklen_t *addrlen);
84 int flags,
struct sockaddr *dest_addr, socklen_t addrlen);
89#if (defined(_MSC_VER) && !defined(inline))
90#define inline __inline
94#ifdef HAVE_SOCKADDR_SA_LEN
95#define SA_LEN(addr) ((addr)->sa_len)
98static inline size_t get_sa_len(
struct sockaddr *addr)
100 switch (addr->sa_family) {
103 return (
sizeof(
struct sockaddr_in));
106 return (
sizeof(
struct sockaddr_in6));
109 return (
sizeof(
struct sockaddr));
112#define SA_LEN(addr) (get_sa_len(addr))
116#ifdef HAVE_SOCKADDR_SA_LEN
117#define SET_SA_LEN(s, l) ((struct sockaddr*)s)->sa_len=l
119#define SET_SA_LEN(s, l)
void pcp_fill_in6_addr(struct in6_addr *dst_ip6, uint16_t *dst_port, struct sockaddr *src)
int pcp_socket_close(struct pcp_ctx_s *ctx)
pcp_socket_vt_t default_socket_vt
ssize_t pcp_socket_recvfrom(struct pcp_ctx_s *ctx, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen)
PCP_SOCKET pcp_socket_create(struct pcp_ctx_s *ctx, int domain, int type, int protocol)
void pcp_fill_sockaddr(struct sockaddr *dst, struct in6_addr *sip, uint16_t sport, int ret_ipv6_mapped_ipv4, uint32_t scope_id)
ssize_t pcp_socket_sendto(struct pcp_ctx_s *ctx, const void *buf, size_t len, int flags, struct sockaddr *dest_addr, socklen_t addrlen)