24 #include "tdelibs_export.h"
30 #include <sys/socket.h>
35 typedef unsigned ksocklen_t;
42 #define AF_LOCAL AF_UNIX
43 #define PF_LOCAL PF_UNIX
47 #define kde_in6_addr in6_addr
48 #define kde_sockaddr_in6 sockaddr_in6
59 unsigned char __u6_addr[16];
66 struct kde_sockaddr_in6
68 #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
72 TQ_UINT16 sin6_family;
74 unsigned short sin6_port;
75 TQ_UINT32 sin6_flowinfo;
76 struct kde_in6_addr sin6_addr;
77 TQ_UINT32 sin6_scope_id;
82 #define KDE_IN6_IS_ADDR_UNSPECIFIED(a) \
83 (((TQ_UINT32 *) (a))[0] == 0 && ((TQ_UINT32 *) (a))[1] == 0 && \
84 ((TQ_UINT32 *) (a))[2] == 0 && ((TQ_UINT32 *) (a))[3] == 0)
86 #define KDE_IN6_IS_ADDR_LOOPBACK(a) \
87 (((TQ_UINT32 *) (a))[0] == 0 && ((TQ_UINT32 *) (a))[1] == 0 && \
88 ((TQ_UINT32 *) (a))[2] == 0 && ((TQ_UINT32 *) (a))[3] == htonl (1))
90 #define KDE_IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff)
92 #define KDE_IN6_IS_ADDR_LINKLOCAL(a) \
93 ((((TQ_UINT32 *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
95 #define KDE_IN6_IS_ADDR_SITELOCAL(a) \
96 ((((TQ_UINT32 *) (a))[0] & htonl (0xffc00000)) == htonl (0xfec00000))
98 #define KDE_IN6_IS_ADDR_V4MAPPED(a) \
99 ((((TQ_UINT32 *) (a))[0] == 0) && (((TQ_UINT32 *) (a))[1] == 0) && \
100 (((TQ_UINT32 *) (a))[2] == htonl (0xffff)))
102 #define KDE_IN6_IS_ADDR_V4COMPAT(a) \
103 ((((TQ_UINT32 *) (a))[0] == 0) && (((TQ_UINT32 *) (a))[1] == 0) && \
104 (((TQ_UINT32 *) (a))[2] == 0) && (ntohl (((TQ_UINT32 *) (a))[3]) > 1))
106 #define KDE_IN6_ARE_ADDR_EQUAL(a,b) \
107 ((((TQ_UINT32 *) (a))[0] == ((TQ_UINT32 *) (b))[0]) && \
108 (((TQ_UINT32 *) (a))[1] == ((TQ_UINT32 *) (b))[1]) && \
109 (((TQ_UINT32 *) (a))[2] == ((TQ_UINT32 *) (b))[2]) && \
110 (((TQ_UINT32 *) (a))[3] == ((TQ_UINT32 *) (b))[3]))
112 #define KDE_IN6_IS_ADDR_MC_NODELOCAL(a) \
113 (KDE_IN6_IS_ADDR_MULTICAST(a) && ((((TQ_UINT8 *) (a))[1] & 0xf) == 0x1))
115 #define KDE_IN6_IS_ADDR_MC_LINKLOCAL(a) \
116 (KDE_IN6_IS_ADDR_MULTICAST(a) && ((((TQ_UINT8 *) (a))[1] & 0xf) == 0x2))
118 #define KDE_IN6_IS_ADDR_MC_SITELOCAL(a) \
119 (KDE_IN6_IS_ADDR_MULTICAST(a) && ((((TQ_UINT8 *) (a))[1] & 0xf) == 0x5))
121 #define KDE_IN6_IS_ADDR_MC_ORGLOCAL(a) \
122 (KDE_IN6_IS_ADDR_MULTICAST(a) && ((((TQ_UINT8 *) (a))[1] & 0xf) == 0x8))
124 #define KDE_IN6_IS_ADDR_MC_GLOBAL(a) \
125 (KDE_IN6_IS_ADDR_MULTICAST(a) && ((((TQ_UINT8 *) (a))[1] & 0xf) == 0xe))
127 #ifdef NEED_IN6_TESTS
128 # define IN6_IS_ADDR_UNSPECIFIED KDE_IN6_IS_ADDR_UNSPECIFIED
129 # define IN6_IS_ADDR_LOOPBACK KDE_IN6_IS_ADDR_LOOPBACK
130 # define IN6_IS_ADDR_MULTICAST KDE_IN6_IS_ADDR_MULTICAST
131 # define IN6_IS_ADDR_LINKLOCAL KDE_IN6_IS_ADDR_LINKLOCAL
132 # define IN6_IS_ADDR_SITELOCAL KDE_IN6_IS_ADDR_SITELOCAL
133 # define IN6_IS_ADDR_V4MAPPED KDE_IN6_IS_ADDR_V4MAPPED
134 # define IN6_IS_ADDR_V4COMPAT KDE_IN6_IS_ADDR_V4COMPAT
135 # define IN6_ARE_ADDR_EQUAL KDE_IN6_ARE_ADDR_EQUAL
136 # define IN6_IS_ADDR_MC_NODELOCAL KDE_IN6_IS_ADDR_MC_NODELOCAL
137 # define IN6_IS_ADDR_MC_LINKLOCAL KDE_IN6_IS_ADDR_MC_LINKLOCAL
138 # define IN6_IS_ADDR_MC_SITELOCAL KDE_IN6_IS_ADDR_MC_SITELOCAL
139 # define IN6_IS_ADDR_MC_ORGLOCAL KDE_IN6_IS_ADDR_MC_ORGLOCAL
140 # define IN6_IS_ADDR_MC_GLOBAL KDE_IN6_IS_ADDR_MC_GLOBAL
146 #define KAI_LOCALUNIX 1
161 struct addrinfo *data;
165 extern TDECORE_EXPORT
int kde_getaddrinfo(
const char *name,
const char *service,
166 const struct addrinfo* hint,
167 struct kde_addrinfo** result);
168 extern TDECORE_EXPORT
void kde_freeaddrinfo(
struct kde_addrinfo *p);
170 #if !defined(HAVE_GETADDRINFO) || defined(HAVE_BROKEN_GETADDRINFO)
172 # ifndef HAVE_STRUCT_ADDRINFO
183 struct sockaddr *ai_addr;
185 struct addrinfo *ai_next;
192 # undef AI_NUMERICHOST
196 # define AI_PASSIVE 1
197 # define AI_CANONNAME 2
198 # define AI_NUMERICHOST 4
200 # ifdef EAI_ADDRFAMILY
201 # undef EAI_ADDRFAMILY
215 # define EAI_ADDRFAMILY 1
217 # define EAI_BADFLAGS 3
219 # define EAI_FAMILY 5
220 # define EAI_MEMORY 6
221 # define EAI_NODATA 7
222 # define EAI_NONAME 8
223 # define EAI_SERVICE 9
224 # define EAI_SOCKTYPE 10
225 # define EAI_SYSTEM 11
232 # define NI_MAXHOST 1025
233 # define NI_MAXSERV 32
235 # ifdef NI_NUMERICHOST
236 # undef NI_NUMERICHOST
237 # undef NI_NUMERICSERV
243 # define NI_NUMERICHOST 1
244 # define NI_NUMERICSERV 2
246 # define NI_NAMEREQD 8
256 extern TDECORE_EXPORT
int getaddrinfo(
const char *name,
const char *service,
257 const struct addrinfo* hint,
258 struct addrinfo** result);
260 extern TDECORE_EXPORT
void freeaddrinfo(
struct addrinfo* ai);
262 extern TDECORE_EXPORT
char *gai_strerror(
int errorcode);
264 extern TDECORE_EXPORT
int getnameinfo(
const struct sockaddr *sa,
266 char *host,
size_t hostlen,
267 char *serv,
size_t servlen,
271 # define getaddrinfo KDE::getaddrinfo
272 # define freeaddrinfo KDE::freeaddrinfo
273 # define gai_strerror KDE::gai_strerror
274 # define getnameinfo KDE::getnameinfo
279 #ifndef HAVE_INET_PTON
284 extern TDECORE_EXPORT
int inet_pton(
int af,
const char *cp,
void* buf);
287 # define inet_pton KDE::inet_pton
290 #ifndef HAVE_INET_NTOP
295 extern TDECORE_EXPORT
const char* inet_ntop(
int af,
const void *cp,
char *buf,
size_t len);
298 # define inet_ntop KDE::inet_ntop
Namespace for general KDE functions.