5 #define GET_IP() *(struct in6_addr *)pthread_getspecific(getip)
6 #define IP_ISSET(a) !cs_in6addr_isnull(&a)
7 #define IP_EQUAL(a, b) cs_in6addr_equal(&a, &b)
8 #define IP_ASSIGN(a, b) cs_in6addr_copy(&a, &b)
9 #define SIN_GET_ADDR(a) ((struct sockaddr_in6 *)&a)->sin6_addr
10 #define SIN_GET_PORT(a) ((struct sockaddr_in6 *)&a)->sin6_port
11 #define SIN_GET_FAMILY(a) ((struct sockaddr_in6 *)&a)->sin6_family
12 extern int32_t cs_in6addr_equal(struct in6_addr
*a1
, struct in6_addr
*a2
);
13 extern int32_t cs_in6addr_isnull(struct in6_addr
*addr
);
14 extern int32_t cs_in6addr_lt(struct in6_addr
*a
, struct in6_addr
*b
);
15 extern void cs_in6addr_copy(struct in6_addr
*dst
, struct in6_addr
*src
);
16 extern void cs_in6addr_ipv4map(struct in6_addr
*dst
, in_addr_t src
);
17 extern void cs_getIPv6fromHost(const char *hostname
, struct in6_addr
*addr
, struct sockaddr_storage
*sa
, socklen_t
*sa_len
);
19 #define GET_IP() *(in_addr_t *)pthread_getspecific(getip)
20 #define IP_ISSET(a) (a)
21 #define IP_EQUAL(a, b) (a == b)
22 #define IP_ASSIGN(a, b) (a = b)
23 #define SIN_GET_ADDR(a) (a.sin_addr.s_addr)
24 #define SIN_GET_PORT(a) (a.sin_port)
25 #define SIN_GET_FAMILY(a) (a.sin_family)
28 char *cs_inet_ntoa(IN_ADDR_T addr
);
29 void cs_inet_addr(char *txt
, IN_ADDR_T
*out
);
30 void cs_resolve(const char *hostname
, IN_ADDR_T
*ip
, struct SOCKADDR
*sock
, socklen_t
*sa_len
);
31 IN_ADDR_T
get_null_ip(void);
32 void set_null_ip(IN_ADDR_T
*ip
);
33 void set_localhost_ip(IN_ADDR_T
*ip
);
34 int32_t check_ip(struct s_ip
*ip
, IN_ADDR_T n
);
35 uint32_t cs_getIPfromHost(const char *hostname
);
36 int set_socket_priority(int fd
, int priority
);
37 void setTCPTimeouts(int32_t sock
);
38 int set_nonblock(int32_t fd
, bool nonblock
);
39 void set_so_reuseport(int fd
);
40 int8_t check_fd_for_data(int32_t fd
);
41 int32_t recv_from_udpipe(uchar
*);
42 int32_t process_input(uint8_t *buf
, int32_t buflen
, int32_t timeout
);
43 int32_t accept_connection(struct s_module
*module
, int8_t module_idx
, int8_t port_idx
);
44 int32_t start_listener(struct s_module
*module
, struct s_port
*port
);
47 ssize_t
cygwin_recv(int sock
, void *buf
, int count
, int tflags
);