2 #include "ace/OS_NS_macros.h"
3 #include "ace/OS_NS_string.h"
4 #include "ace/OS_NS_errno.h"
6 #if defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
7 # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
8 # define ACE_NETDBCALL_RETURN(OP,TYPE,FAILVALUE,TARGET,SIZE) \
11 if (ACE_OS::netdb_acquire ()) \
16 ACE_OSCALL (OP, TYPE, ace_result_); \
17 if (ace_result_ != FAILVALUE) \
18 ACE_OS::memcpy (TARGET, \
20 SIZE < sizeof (TYPE) ? SIZE : sizeof (TYPE)); \
21 ACE_OS::netdb_release (); \
25 # else /* ! (ACE_MT_SAFE && ACE_MT_SAFE != 0) */
26 # define ACE_NETDBCALL_RETURN(OP,TYPE,FAILVALUE,TARGET,SIZE) \
30 ACE_OSCALL(OP,TYPE,ace_result_); \
31 if (ace_result_ != FAILVALUE) \
32 ACE_OS::memcpy (TARGET, \
34 SIZE < sizeof (TYPE) ? SIZE : sizeof (TYPE)); \
37 # endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
38 #endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
40 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
42 ACE_INLINE struct hostent *
43 ACE_OS::gethostbyaddr (const char *addr, int length, int type)
45 ACE_OS_TRACE ("ACE_OS::gethostbyaddr");
46 # if defined (ACE_LACKS_GETHOSTBYADDR)
47 ACE_UNUSED_ARG (addr);
48 ACE_UNUSED_ARG (length);
49 ACE_UNUSED_ARG (type);
50 ACE_NOTSUP_RETURN (0);
53 if (0 == addr || '\0' == addr[0])
56 # if defined (ACE_VXWORKS_HAS_GETHOSTBYADDR_REENTRANT)
57 // VxWorks 6.x has a gethostbyaddr() that is threadsafe and
58 // returns an heap-allocated hostentry structure.
59 // just call ACE_OS::gethostbyaddr_r () which knows how to handle this.
60 struct hostent hentry;
62 int h_error; // Not the same as errno!
63 return ACE_OS::gethostbyaddr_r (addr, length, type, &hentry, buf, &h_error);
64 # elif defined (ACE_HAS_NONCONST_GETBY)
65 //FUZZ: disable check_for_lack_ACE_OS
66 ACE_SOCKCALL_RETURN (::gethostbyaddr (const_cast<char *> (addr),
67 (ACE_SOCKET_LEN) length,
71 //FUZZ: enable check_for_lack_ACE_OS
73 //FUZZ: disable check_for_lack_ACE_OS
74 ACE_SOCKCALL_RETURN (::gethostbyaddr (addr,
75 (ACE_SOCKET_LEN) length,
79 //FUZZ: enable check_for_lack_ACE_OS
80 # endif /* ACE_HAS_NONCONST_GETBY */
81 # endif /* !ACE_LACKS_GETHOSTBYADDR */
84 ACE_INLINE struct hostent *
85 ACE_OS::gethostbyaddr_r (const char *addr,
88 struct hostent *result,
89 ACE_HOSTENT_DATA buffer,
92 ACE_OS_TRACE ("ACE_OS::gethostbyaddr_r");
93 # if defined (ACE_LACKS_GETHOSTBYADDR_R)
94 ACE_UNUSED_ARG (addr);
95 ACE_UNUSED_ARG (length);
96 ACE_UNUSED_ARG (type);
97 ACE_UNUSED_ARG (result);
98 ACE_UNUSED_ARG (buffer);
101 ACE_NOTSUP_RETURN (0);
102 # elif defined (ACE_HAS_REENTRANT_FUNCTIONS)
104 if (0 == addr || '\0' == addr[0])
107 # if defined (__GLIBC__)
108 // GNU C library has a different signature
109 ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
111 //FUZZ: disable check_for_lack_ACE_OS
112 if (::gethostbyaddr_r ((char *) addr,
117 sizeof (ACE_HOSTENT_DATA),
121 //FUZZ: enable check_for_lack_ACE_OS
123 return (struct hostent *) 0;
124 # elif defined (ACE_VXWORKS_HAS_GETHOSTBYADDR_REENTRANT)
125 ACE_UNUSED_ARG (h_errnop);
126 // VxWorks 6.x has a threadsafe gethostbyaddr() which returns a heap-allocated
127 // data structure which needs to be freed with hostentFree()
128 //FUZZ: disable check_for_lack_ACE_OS
129 struct hostent* hp = ::gethostbyaddr (addr, length, type);
130 //FUZZ: enable check_for_lack_ACE_OS
134 result->h_addrtype = hp->h_addrtype;
135 result->h_length = hp->h_length;
138 // buffer[0-3]: h_addr_list[0], pointer to the addr.
139 // buffer[4-7]: h_addr_list[1], null terminator for the h_addr_list.
140 // buffer[8..(8+h_length)]: the first (and only) addr.
141 // buffer[(8+h_length)...]: hostname
143 // Store the address list in buffer.
144 result->h_addr_list = (char **) buffer;
145 // Store the actual address _after_ the address list.
146 result->h_addr_list[0] = (char *) &result->h_addr_list[2];
147 ACE_OS::memcpy (result->h_addr_list[0], hp->h_addr_list[0], hp->h_length);
148 // Null-terminate the list of addresses.
149 result->h_addr_list[1] = 0;
150 // And no aliases, so null-terminate h_aliases.
151 result->h_aliases = &result->h_addr_list[1];
153 if (((2*sizeof(char*))+hp->h_length+ACE_OS::strlen (hp->h_name)+1) <= sizeof (ACE_HOSTENT_DATA))
155 result->h_name = (char *) result->h_addr_list[0] + hp->h_length;
156 ACE_OS::strcpy (result->h_name, hp->h_name);
160 result->h_name = (char *)0;
163 // free hostent memory
170 return (struct hostent *) 0;
173 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
174 ACE_UNUSED_ARG (result);
175 ACE_UNUSED_ARG (h_errnop);
176 //FUZZ: disable check_for_lack_ACE_OS
177 ACE_NETDBCALL_RETURN (::gethostbyaddr (addr, (ACE_SOCKET_LEN) length, type),
179 buffer, sizeof (ACE_HOSTENT_DATA));
180 //FUZZ: enable check_for_lack_ACE_OS
182 //FUZZ: disable check_for_lack_ACE_OS
183 ACE_SOCKCALL_RETURN (::gethostbyaddr_r (addr, length, type, result,
184 buffer, sizeof (ACE_HOSTENT_DATA),
186 struct hostent *, 0);
187 //FUZZ: enable check_for_lack_ACE_OS
188 # endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
189 # endif /* defined (__GLIBC__) */
190 # elif defined (ACE_HAS_NONCONST_GETBY)
191 ACE_UNUSED_ARG (result);
192 ACE_UNUSED_ARG (buffer);
193 ACE_UNUSED_ARG (h_errnop);
194 //FUZZ: disable check_for_lack_ACE_OS
195 ACE_SOCKCALL_RETURN (::gethostbyaddr (const_cast<char *> (addr),
196 (ACE_SOCKET_LEN) length,
200 //FUZZ: enable check_for_lack_ACE_OS
202 ACE_UNUSED_ARG (h_errnop);
203 ACE_UNUSED_ARG (buffer);
204 ACE_UNUSED_ARG (result);
206 //FUZZ: disable check_for_lack_ACE_OS
207 ACE_SOCKCALL_RETURN (::gethostbyaddr (addr,
208 (ACE_SOCKET_LEN) length,
212 //FUZZ: enable check_for_lack_ACE_OS
213 # endif /* ACE_LACKS_GETHOSTBYADDR_R */
216 ACE_INLINE struct hostent *
217 ACE_OS::gethostbyname (const char *name)
219 ACE_OS_TRACE ("ACE_OS::gethostbyname");
220 # if defined (ACE_LACKS_GETHOSTBYNAME)
221 ACE_UNUSED_ARG (name);
222 ACE_NOTSUP_RETURN (0);
225 if (0 == name || '\0' == name[0])
228 # if defined (ACE_VXWORKS_HAS_GETHOSTBYNAME_REENTRANT)
229 // VxWorks 6.x has a gethostbyname() that is threadsafe and
230 // returns an heap-allocated hostentry structure.
231 // just call ACE_OS::gethostbyname_r () which knows how to handle this.
232 // With VxWorks 7 it depends on the GETHOSTBYNAME_REENTRANT
234 struct hostent hentry;
235 ACE_HOSTENT_DATA buf;
236 int h_error; // Not the same as errno!
237 return ACE_OS::gethostbyname_r (name, &hentry, buf, &h_error);
238 # elif defined (ACE_HAS_NONCONST_GETBY)
239 //FUZZ: disable check_for_lack_ACE_OS
240 ACE_SOCKCALL_RETURN (::gethostbyname (const_cast<char *> (name)),
243 //FUZZ: enable check_for_lack_ACE_OS
245 //FUZZ: disable check_for_lack_ACE_OS
246 ACE_SOCKCALL_RETURN (::gethostbyname (name),
249 //FUZZ: enable check_for_lack_ACE_OS
250 # endif /* ACE_HAS_NONCONST_GETBY */
251 # endif /* !ACE_LACKS_GETHOSTBYNAME */
254 ACE_INLINE struct hostent *
255 ACE_OS::gethostbyname_r (const char *name,
256 struct hostent *result,
257 ACE_HOSTENT_DATA buffer,
260 ACE_OS_TRACE ("ACE_OS::gethostbyname_r");
261 #if defined (ACE_LACKS_GETHOSTBYNAME)
262 ACE_UNUSED_ARG (name);
263 ACE_UNUSED_ARG (result);
264 ACE_UNUSED_ARG (buffer);
267 ACE_NOTSUP_RETURN (0);
268 # elif defined (ACE_HAS_REENTRANT_FUNCTIONS)
270 if (0 == name || '\0' == name[0])
271 return (struct hostent *)0;
273 # if defined (__GLIBC__)
274 // GNU C library has a different signature
275 ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
277 //FUZZ: disable check_for_lack_ACE_OS
278 if (::gethostbyname_r (name,
281 sizeof (ACE_HOSTENT_DATA),
285 //FUZZ: enable check_for_lack_ACE_OS
287 return (struct hostent *) 0;
288 # elif defined (ACE_VXWORKS_HAS_GETHOSTBYNAME_REENTRANT)
289 ACE_UNUSED_ARG (h_errnop);
290 // VxWorks 6.x has a threadsafe gethostbyname() which returns a heap-allocated
291 // data structure which needs to be freed with hostentFree()
292 // With VxWorks 7 it depends on the GETHOSTBYNAME_REENTRANT macro
293 //FUZZ: disable check_for_lack_ACE_OS
294 struct hostent* hp = ::gethostbyname (name);
295 //FUZZ: enable check_for_lack_ACE_OS
299 result->h_addrtype = hp->h_addrtype;
300 result->h_length = hp->h_length;
303 // buffer[0-3]: h_addr_list[0], pointer to the addr.
304 // buffer[4-7]: h_addr_list[1], null terminator for the h_addr_list.
305 // buffer[8...]: the first (and only) addr.
307 // Store the address list in buffer.
308 result->h_addr_list = (char **) buffer;
309 // Store the actual address _after_ the address list.
310 result->h_addr_list[0] = (char *) &result->h_addr_list[2];
311 ACE_OS::memcpy (result->h_addr_list[0], hp->h_addr_list[0], hp->h_length);
312 // Null-terminate the list of addresses.
313 result->h_addr_list[1] = 0;
314 // And no aliases, so null-terminate h_aliases.
315 result->h_aliases = &result->h_addr_list[1];
317 if (((2*sizeof(char*))+hp->h_length+ACE_OS::strlen (hp->h_name)+1) <= sizeof (ACE_HOSTENT_DATA))
319 result->h_name = (char *) result->h_addr_list[0] + hp->h_length;
320 ACE_OS::strcpy (result->h_name, hp->h_name);
324 result->h_name = (char *)0;
327 // free hostent memory
337 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
338 ACE_UNUSED_ARG (result);
339 ACE_UNUSED_ARG (h_errnop);
340 //FUZZ: disable check_for_lack_ACE_OS
341 ACE_NETDBCALL_RETURN (::gethostbyname (name),
343 buffer, sizeof (ACE_HOSTENT_DATA));
344 //FUZZ: enable check_for_lack_ACE_OS
346 //FUZZ: disable check_for_lack_ACE_OS
347 ACE_SOCKCALL_RETURN (::gethostbyname_r (name, result, buffer,
348 sizeof (ACE_HOSTENT_DATA),
352 //FUZZ: enable check_for_lack_ACE_OS
353 # endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
354 # endif /* defined (__GLIBC__) */
355 # elif defined (ACE_HAS_NONCONST_GETBY)
356 ACE_UNUSED_ARG (result);
357 ACE_UNUSED_ARG (buffer);
358 ACE_UNUSED_ARG (h_errnop);
359 //FUZZ: disable check_for_lack_ACE_OS
360 ACE_SOCKCALL_RETURN (::gethostbyname (const_cast<char *> (name)),
363 //FUZZ: enable check_for_lack_ACE_OS
365 ACE_UNUSED_ARG (result);
366 ACE_UNUSED_ARG (buffer);
368 // FUZZ: disable check_for_lack_ACE_OS
369 struct hostent *result2 = 0;
370 ACE_SOCKCALL (::gethostbyname (name),
374 if (result2 == 0 && h_errnop)
377 //FUZZ: enable check_for_lack_ACE_OS
378 # endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) */
381 ACE_INLINE struct hostent *
382 ACE_OS::getipnodebyaddr (const void *src, size_t len, int family)
384 #if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
385 # if defined (ACE_LACKS_GETIPNODEBYADDR)
386 ACE_UNUSED_ARG (src);
387 ACE_UNUSED_ARG (len);
388 ACE_UNUSED_ARG (family);
389 ACE_NOTSUP_RETURN (0);
391 struct hostent *hptr = 0;
393 //FUZZ: disable check_for_lack_ACE_OS
394 if ((hptr = ::getipnodebyaddr (src, len, family, &errnum)) == 0)
398 //FUZZ: enable check_for_lack_ACE_OS
400 # endif /* ACE_LACKS_GETIPNODEBYADDR */
402 // IPv4-only implementation
403 if (family == AF_INET)
404 return ACE_OS::gethostbyaddr (static_cast<const char *> (src),
405 static_cast<int> (len),
408 ACE_NOTSUP_RETURN (0);
409 # endif /* defined (ACE_HAS_IPV6) && !defined (ACE_WIN32) */
412 ACE_INLINE struct hostent *
413 ACE_OS::getipnodebyname (const char *name, int family, int flags)
415 ACE_OS_TRACE ("ACE_OS::getipnodebyname");
416 # if defined (ACE_HAS_IPV6) && !defined (ACE_LACKS_GETIPNODEBYNAME_IPV6)
417 # if defined (ACE_LACKS_GETIPNODEBYNAME)
418 ACE_UNUSED_ARG (flags);
419 # if defined (ACE_HAS_NONCONST_GETBY)
420 ACE_SOCKCALL_RETURN (::gethostbyname2 (const_cast<char *> (name),
422 struct hostent *, 0);
424 ACE_SOCKCALL_RETURN (::gethostbyname2 (name, family),
425 struct hostent *, 0);
426 # endif /* ACE_HAS_NONCONST_GETBY */
428 struct hostent *hptr = 0;
430 //FUZZ: disable check_for_lack_ACE_OS
431 if ((hptr = ::getipnodebyname (name, family, flags, &errnum)) == 0)
435 //FUZZ: enable check_for_lack_ACE_OS
437 # endif /* ACE_LACKS_GETIPNODEBYNAME */
439 // IPv4-only implementation
440 ACE_UNUSED_ARG (flags);
441 if (family == AF_INET)
442 return ACE_OS::gethostbyname (name);
444 ACE_NOTSUP_RETURN (0);
445 # endif /* defined (ACE_HAS_IPV6) && !ACE_LACKS_GETIPNODEBYNAME_IPV6 */
448 ACE_INLINE struct protoent *
449 ACE_OS::getprotobyname (const char *name)
451 #if defined (ACE_LACKS_GETPROTOBYNAME)
452 ACE_UNUSED_ARG (name);
453 ACE_NOTSUP_RETURN (0);
454 #elif defined (ACE_HAS_NONCONST_GETBY)
455 //FUZZ: disable check_for_lack_ACE_OS
456 ACE_SOCKCALL_RETURN (::getprotobyname (const_cast<char *> (name)),
459 //FUZZ: enable check_for_lack_ACE_OS
461 //FUZZ: disable check_for_lack_ACE_OS
462 ACE_SOCKCALL_RETURN (::getprotobyname (name),
465 //FUZZ: enable check_for_lack_ACE_OS
466 #endif /* ACE_LACKS_GETPROTOBYNAME */
469 ACE_INLINE struct protoent *
470 ACE_OS::getprotobyname_r (const char *name,
471 struct protoent *result,
472 ACE_PROTOENT_DATA buffer)
474 #if defined (ACE_LACKS_GETPROTOBYNAME)
475 ACE_UNUSED_ARG (name);
476 ACE_UNUSED_ARG (result);
477 ACE_UNUSED_ARG (buffer);
478 ACE_NOTSUP_RETURN (0);
479 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS)
480 #if defined (__GLIBC__)
481 // GNU C library has a different signature
482 //FUZZ: disable check_for_lack_ACE_OS
483 if (::getprotobyname_r (name,
486 sizeof (ACE_PROTOENT_DATA),
488 //FUZZ: enable check_for_lack_ACE_OS
493 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
494 ACE_UNUSED_ARG (result);
495 //FUZZ: disable check_for_lack_ACE_OS
496 ACE_NETDBCALL_RETURN (::getprotobyname (name),
497 struct protoent *, 0,
498 buffer, sizeof (ACE_PROTOENT_DATA));
499 //FUZZ: enable check_for_lack_ACE_OS
501 //FUZZ: disable check_for_lack_ACE_OS
502 ACE_SOCKCALL_RETURN (::getprotobyname_r (name,
505 sizeof (ACE_PROTOENT_DATA)),
506 struct protoent *, 0);
507 //FUZZ: enable check_for_lack_ACE_OS
508 # endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
509 # endif /* defined (__GLIBC__) */
510 #elif defined (ACE_HAS_NONCONST_GETBY)
511 ACE_UNUSED_ARG (result);
512 ACE_UNUSED_ARG (buffer);
513 //FUZZ: disable check_for_lack_ACE_OS
514 ACE_SOCKCALL_RETURN (::getprotobyname (const_cast<char *> (name)),
515 struct protoent *, 0);
516 //FUZZ: enable check_for_lack_ACE_OS
518 ACE_UNUSED_ARG (buffer);
519 ACE_UNUSED_ARG (result);
521 //FUZZ: disable check_for_lack_ACE_OS
522 ACE_SOCKCALL_RETURN (::getprotobyname (name),
525 //FUZZ: enable check_for_lack_ACE_OS
526 #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) */
529 ACE_INLINE struct protoent *
530 ACE_OS::getprotobynumber (int proto)
532 #if defined (ACE_LACKS_GETPROTOBYNUMBER)
533 ACE_UNUSED_ARG (proto);
534 ACE_NOTSUP_RETURN (0);
536 //FUZZ: disable check_for_lack_ACE_OS
537 ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
538 struct protoent *, 0);
539 //FUZZ: enable check_for_lack_ACE_OS
540 #endif /* ACE_LACKS_GETPROTOBYNUMBER */
543 ACE_INLINE struct protoent *
544 ACE_OS::getprotobynumber_r (int proto,
545 struct protoent *result,
546 ACE_PROTOENT_DATA buffer)
548 #if defined (ACE_LACKS_GETPROTOBYNUMBER)
549 ACE_UNUSED_ARG (proto);
550 ACE_UNUSED_ARG (result);
551 ACE_UNUSED_ARG (buffer);
552 ACE_NOTSUP_RETURN (0);
553 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS)
554 # if defined (__GLIBC__)
555 // GNU C library has a different signature
556 //FUZZ: disable check_for_lack_ACE_OS
557 if (::getprotobynumber_r (proto,
560 sizeof (ACE_PROTOENT_DATA),
562 //FUZZ: enable check_for_lack_ACE_OS
567 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
568 ACE_UNUSED_ARG (result);
569 //FUZZ: disable check_for_lack_ACE_OS
570 ACE_NETDBCALL_RETURN (::getprotobynumber (proto),
571 struct protoent *, 0,
572 buffer, sizeof (ACE_PROTOENT_DATA));
573 //FUZZ: enable check_for_lack_ACE_OS
575 //FUZZ: disable check_for_lack_ACE_OS
576 ACE_SOCKCALL_RETURN (::getprotobynumber_r (proto, result, buffer, sizeof (ACE_PROTOENT_DATA)),
577 struct protoent *, 0);
578 //FUZZ: enable check_for_lack_ACE_OS
579 # endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
580 # endif /* defined (__GLIBC__) */
582 ACE_UNUSED_ARG (buffer);
583 ACE_UNUSED_ARG (result);
585 //FUZZ: disable check_for_lack_ACE_OS
586 ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
587 struct protoent *, 0);
588 //FUZZ: enable check_for_lack_ACE_OS
589 #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) */
592 ACE_INLINE struct servent *
593 ACE_OS::getservbyname (const char *svc, const char *proto)
595 ACE_OS_TRACE ("ACE_OS::getservbyname");
596 #if defined (ACE_LACKS_GETSERVBYNAME)
597 ACE_UNUSED_ARG (svc);
598 ACE_UNUSED_ARG (proto);
599 ACE_NOTSUP_RETURN (0);
600 #elif defined (ACE_HAS_NONCONST_GETBY)
601 //FUZZ: disable check_for_lack_ACE_OS
602 ACE_SOCKCALL_RETURN (::getservbyname (const_cast<char *> (svc),
603 const_cast<char *> (proto)),
606 //FUZZ: enable check_for_lack_ACE_OS
608 //FUZZ: disable check_for_lack_ACE_OS
609 ACE_SOCKCALL_RETURN (::getservbyname (svc,
613 //FUZZ: enable check_for_lack_ACE_OS
614 #endif /* ACE_HAS_NONCONST_GETBY */
617 ACE_INLINE struct servent *
618 ACE_OS::getservbyname_r (const char *svc,
620 struct servent *result,
621 ACE_SERVENT_DATA buf)
623 ACE_OS_TRACE ("ACE_OS::getservbyname_r");
624 #if defined (ACE_LACKS_GETSERVBYNAME)
625 ACE_UNUSED_ARG (svc);
626 ACE_UNUSED_ARG (proto);
627 ACE_UNUSED_ARG (result);
628 ACE_UNUSED_ARG (buf);
629 ACE_NOTSUP_RETURN (0);
630 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS)
631 # if defined (__GLIBC__)
632 // GNU C library has a different signature
633 ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
635 //FUZZ: disable check_for_lack_ACE_OS
636 if (::getservbyname_r (svc,
640 sizeof (ACE_SERVENT_DATA),
643 //FUZZ: enable check_for_lack_ACE_OS
645 return (struct servent *) 0;
647 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
648 ACE_UNUSED_ARG (result);
649 //FUZZ: disable check_for_lack_ACE_OS
650 ACE_NETDBCALL_RETURN (::getservbyname (svc, proto),
652 buf, sizeof (ACE_SERVENT_DATA));
653 //FUZZ: enable check_for_lack_ACE_OS
655 //FUZZ: disable check_for_lack_ACE_OS
656 ACE_SOCKCALL_RETURN (::getservbyname_r (svc, proto, result, buf,
657 sizeof (ACE_SERVENT_DATA)),
658 struct servent *, 0);
659 //FUZZ: enable check_for_lack_ACE_OS
660 # endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
661 # endif /* defined (__GLIBC__) */
662 #elif defined (ACE_HAS_NONCONST_GETBY)
663 ACE_UNUSED_ARG (buf);
664 ACE_UNUSED_ARG (result);
665 //FUZZ: disable check_for_lack_ACE_OS
666 ACE_SOCKCALL_RETURN (::getservbyname (const_cast<char *> (svc),
667 const_cast<char *> (proto)),
670 //FUZZ: enable check_for_lack_ACE_OS
672 ACE_UNUSED_ARG (buf);
673 ACE_UNUSED_ARG (result);
674 //FUZZ: disable check_for_lack_ACE_OS
675 ACE_SOCKCALL_RETURN (::getservbyname (svc,
679 //FUZZ: enable check_for_lack_ACE_OS
680 #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) */
684 ACE_OS::getaddrinfo (const char *name, const char *service,
685 const addrinfo *hints, addrinfo **result)
687 ACE_OS_TRACE ("ACE_OS::getaddrinfo");
688 #ifdef ACE_LACKS_GETADDRINFO
689 ACE_UNUSED_ARG (service);
690 ACE_UNUSED_ARG (hints);
691 return ACE_OS::getaddrinfo_emulation (name, result);
693 return ::getaddrinfo (name, service, hints, result);
698 ACE_OS::freeaddrinfo (addrinfo *result)
700 ACE_OS_TRACE ("ACE_OS::freeaddrinfo");
701 #ifdef ACE_LACKS_GETADDRINFO
702 ACE_OS::freeaddrinfo_emulation (result);
704 ::freeaddrinfo (result);
708 ACE_INLINE const ACE_TCHAR *
709 ACE_OS::gai_strerror (int errcode)
711 ACE_OS_TRACE ("ACE_OS::gai_strerror");
712 #ifdef ACE_LACKS_GAI_STRERROR
716 return ACE_TEXT ("Name does not resolve to an address");
718 return ACE_TEXT ("Temporary failure, try again");
720 return ACE_TEXT ("Name resolution failed");
722 return ACE_TEXT ("Address family not supported");
724 return ACE_TEXT ("Out of memory");
726 return ACE_TEXT ("Other error, see errno");
728 return ACE_TEXT ("Buffer provided by caller was too small");
730 return ACE_TEXT ("Unknown error");
732 #elif defined ACE_WIN32
733 return ACE_TEXT_gai_strerror (errcode);
735 return ACE_TEXT_CHAR_TO_TCHAR (::gai_strerror (errcode));
740 ACE_OS::getnameinfo (const sockaddr *addr, ACE_SOCKET_LEN addr_len,
741 char *host, ACE_SOCKET_LEN host_len,
742 char *service, ACE_SOCKET_LEN service_len,
745 ACE_OS_TRACE ("ACE_OS::getnameinfo");
746 #ifdef ACE_LACKS_GETNAMEINFO
747 ACE_UNUSED_ARG (service);
748 ACE_UNUSED_ARG (service_len);
749 ACE_UNUSED_ARG (flags);
750 return ACE_OS::getnameinfo_emulation (addr, addr_len, host, host_len);
752 return ::getnameinfo (addr, addr_len, host, host_len,
753 service, service_len, flags);
757 ACE_END_VERSIONED_NAMESPACE_DECL