00001
00002
00003
00004
00005 #include "ace/OS_NS_macros.h"
00006 #include "ace/OS_NS_string.h"
00007 #include "ace/OS_NS_errno.h"
00008
00009 #if defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00010 # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
00011 # define ACE_NETDBCALL_RETURN(OP,TYPE,FAILVALUE,TARGET,SIZE) \
00012 do \
00013 { \
00014 if (ACE_OS::netdb_acquire ()) \
00015 return FAILVALUE; \
00016 else \
00017 { \
00018 TYPE ace_result_; \
00019 ACE_OSCALL (OP, TYPE, FAILVALUE, ace_result_); \
00020 if (ace_result_ != FAILVALUE) \
00021 ACE_OS::memcpy (TARGET, \
00022 ace_result_, \
00023 SIZE < sizeof (TYPE) ? SIZE : sizeof (TYPE)); \
00024 ACE_OS::netdb_release (); \
00025 return ace_result_; \
00026 } \
00027 } while(0)
00028 # else
00029 # define ACE_NETDBCALL_RETURN(OP,TYPE,FAILVALUE,TARGET,SIZE) \
00030 do \
00031 { \
00032 TYPE ace_result_; \
00033 ACE_OSCALL(OP,TYPE,FAILVALUE,ace_result_); \
00034 if (ace_result_ != FAILVALUE) \
00035 ACE_OS::memcpy (TARGET, \
00036 ace_result_, \
00037 SIZE < sizeof (TYPE) ? SIZE : sizeof (TYPE)); \
00038 return ace_result_; \
00039 } while(0)
00040 # endif
00041 #endif
00042
00043 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00044
00045 #if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR))
00046
00047 ACE_INLINE struct hostent *
00048 ACE_OS::gethostbyaddr (const char *addr, int length, int type)
00049 {
00050 ACE_OS_TRACE ("ACE_OS::gethostbyaddr");
00051 # if defined (ACE_LACKS_GETHOSTBYADDR)
00052 ACE_UNUSED_ARG (addr);
00053 ACE_UNUSED_ARG (length);
00054 ACE_UNUSED_ARG (type);
00055 ACE_NOTSUP_RETURN (0);
00056 # else
00057
00058 if (0 == addr || '\0' == addr[0])
00059 return 0;
00060
00061 # if defined (ACE_VXWORKS)
00062
00063
00064
00065 struct hostent hentry;
00066 ACE_HOSTENT_DATA buf;
00067 int h_error;
00068 return ACE_OS::gethostbyaddr_r (addr, length, type, &hentry, buf, &h_error);
00069 # elif defined (ACE_HAS_NONCONST_GETBY)
00070
00071 ACE_SOCKCALL_RETURN (::gethostbyaddr (const_cast<char *> (addr),
00072 (ACE_SOCKET_LEN) length,
00073 type),
00074 struct hostent *,
00075 0);
00076
00077 # else
00078
00079 ACE_SOCKCALL_RETURN (::gethostbyaddr (addr,
00080 (ACE_SOCKET_LEN) length,
00081 type),
00082 struct hostent *,
00083 0);
00084
00085 # endif
00086 # endif
00087 }
00088
00089 #endif
00090
00091 #if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR))
00092
00093 ACE_INLINE struct hostent *
00094 ACE_OS::gethostbyaddr_r (const char *addr,
00095 int length,
00096 int type,
00097 struct hostent *result,
00098 ACE_HOSTENT_DATA buffer,
00099 int *h_errnop)
00100 {
00101 ACE_OS_TRACE ("ACE_OS::gethostbyaddr_r");
00102 # if defined (ACE_LACKS_GETHOSTBYADDR_R)
00103 ACE_UNUSED_ARG (addr);
00104 ACE_UNUSED_ARG (length);
00105 ACE_UNUSED_ARG (type);
00106 ACE_UNUSED_ARG (result);
00107 ACE_UNUSED_ARG (buffer);
00108 ACE_UNUSED_ARG (h_errnop);
00109 ACE_NOTSUP_RETURN (0);
00110 # elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00111
00112 if (0 == addr || '\0' == addr[0])
00113 return 0;
00114
00115 # if defined (AIX) || defined (DIGITAL_UNIX)
00116 ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
00117
00118
00119 if (::gethostbyaddr_r ((char *) addr, length, type, result,
00120 (struct hostent_data *) buffer)== 0)
00121 return result;
00122
00123 else
00124 {
00125 *h_errnop = h_errno;
00126 return (struct hostent *) 0;
00127 }
00128 # elif defined (__GLIBC__)
00129
00130 ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
00131
00132
00133 if (::gethostbyaddr_r ((char *) addr,
00134 length,
00135 type,
00136 result,
00137 buffer,
00138 sizeof (ACE_HOSTENT_DATA),
00139 &result,
00140 h_errnop) == 0)
00141 return result;
00142
00143 else
00144 return (struct hostent *) 0;
00145 # elif defined (ACE_VXWORKS)
00146
00147
00148
00149 struct hostent* hp = ::gethostbyaddr (addr, length, type);
00150
00151
00152 if (hp)
00153 {
00154 result->h_addrtype = hp->h_addrtype;
00155 result->h_length = hp->h_length;
00156
00157
00158
00159
00160
00161
00162
00163
00164 result->h_addr_list = (char **) buffer;
00165
00166 result->h_addr_list[0] = (char *) &result->h_addr_list[2];
00167 ACE_OS::memcpy (result->h_addr_list[0], hp->h_addr_list[0], hp->h_length);
00168
00169 result->h_addr_list[1] = 0;
00170
00171 result->h_aliases = &result->h_addr_list[1];
00172
00173 if (((2*sizeof(char*))+hp->h_length+ACE_OS::strlen (hp->h_name)+1) <= sizeof (ACE_HOSTENT_DATA))
00174 {
00175 result->h_name = (char *) result->h_addr_list[0] + hp->h_length;
00176 ACE_OS::strcpy (result->h_name, hp->h_name);
00177 }
00178 else
00179 {
00180 result->h_name = (char *)0;
00181 }
00182
00183
00184 ::hostentFree (hp);
00185
00186 return result;
00187 }
00188 else
00189 {
00190 return (struct hostent *) 0;
00191 }
00192 # else
00193 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00194 ACE_UNUSED_ARG (result);
00195 ACE_UNUSED_ARG (h_errnop);
00196
00197 ACE_NETDBCALL_RETURN (::gethostbyaddr (addr, (ACE_SOCKET_LEN) length, type),
00198 struct hostent *, 0,
00199 buffer, sizeof (ACE_HOSTENT_DATA));
00200
00201 # else
00202
00203 ACE_SOCKCALL_RETURN (::gethostbyaddr_r (addr, length, type, result,
00204 buffer, sizeof (ACE_HOSTENT_DATA),
00205 h_errnop),
00206 struct hostent *, 0);
00207
00208 # endif
00209 # endif
00210 # elif defined (ACE_HAS_NONCONST_GETBY)
00211 ACE_UNUSED_ARG (result);
00212 ACE_UNUSED_ARG (buffer);
00213 ACE_UNUSED_ARG (h_errnop);
00214
00215 ACE_SOCKCALL_RETURN (::gethostbyaddr (const_cast<char *> (addr),
00216 (ACE_SOCKET_LEN) length,
00217 type),
00218 struct hostent *,
00219 0);
00220
00221 # else
00222 ACE_UNUSED_ARG (h_errnop);
00223 ACE_UNUSED_ARG (buffer);
00224 ACE_UNUSED_ARG (result);
00225
00226
00227 ACE_SOCKCALL_RETURN (::gethostbyaddr (addr,
00228 (ACE_SOCKET_LEN) length,
00229 type),
00230 struct hostent *,
00231 0);
00232
00233 # endif
00234 }
00235
00236 #endif
00237
00238 #if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME))
00239
00240 ACE_INLINE struct hostent *
00241 ACE_OS::gethostbyname (const char *name)
00242 {
00243 ACE_OS_TRACE ("ACE_OS::gethostbyname");
00244 # if defined (ACE_LACKS_GETHOSTBYNAME)
00245 ACE_UNUSED_ARG (name);
00246 ACE_NOTSUP_RETURN (0);
00247 # else
00248
00249 if (0 == name || '\0' == name[0])
00250 return 0;
00251
00252 # if defined (ACE_VXWORKS)
00253
00254
00255
00256 struct hostent hentry;
00257 ACE_HOSTENT_DATA buf;
00258 int h_error;
00259 return ACE_OS::gethostbyname_r (name, &hentry, buf, &h_error);
00260 # elif defined (ACE_HAS_NONCONST_GETBY)
00261
00262 ACE_SOCKCALL_RETURN (::gethostbyname (const_cast<char *> (name)),
00263 struct hostent *,
00264 0);
00265
00266 # else
00267
00268 ACE_SOCKCALL_RETURN (::gethostbyname (name),
00269 struct hostent *,
00270 0);
00271
00272 # endif
00273 # endif
00274 }
00275
00276 #endif
00277
00278 #if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME))
00279
00280 ACE_INLINE struct hostent *
00281 ACE_OS::gethostbyname_r (const char *name,
00282 struct hostent *result,
00283 ACE_HOSTENT_DATA buffer,
00284 int *h_errnop)
00285 {
00286 ACE_OS_TRACE ("ACE_OS::gethostbyname_r");
00287 #if defined (ACE_LACKS_GETHOSTBYNAME)
00288 ACE_UNUSED_ARG (name);
00289 ACE_UNUSED_ARG (result);
00290 ACE_UNUSED_ARG (buffer);
00291 ACE_UNUSED_ARG (h_errnop);
00292 ACE_NOTSUP_RETURN (0);
00293 # elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00294
00295 if (0 == name || '\0' == name[0])
00296 return (struct hostent *)0;
00297
00298 # if defined (DIGITAL_UNIX) || \
00299 (defined (ACE_AIX_MINOR_VERS) && (ACE_AIX_MINOR_VERS > 2))
00300 ACE_UNUSED_ARG (result);
00301 ACE_UNUSED_ARG (buffer);
00302 ACE_UNUSED_ARG (h_errnop);
00303
00304
00305
00306
00307 ACE_SOCKCALL_RETURN (::gethostbyname (name), struct hostent *, 0);
00308
00309 # elif defined (AIX)
00310 ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
00311
00312
00313 if (::gethostbyname_r (name, result, (struct hostent_data *) buffer) == 0)
00314 return result;
00315
00316 else
00317 {
00318 *h_errnop = h_errno;
00319 return (struct hostent *) 0;
00320 }
00321 # elif defined (__GLIBC__)
00322
00323 ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
00324
00325
00326 if (::gethostbyname_r (name,
00327 result,
00328 buffer,
00329 sizeof (ACE_HOSTENT_DATA),
00330 &result,
00331 h_errnop) == 0)
00332 return result;
00333
00334 else
00335 return (struct hostent *) 0;
00336 # elif defined (ACE_VXWORKS)
00337
00338
00339
00340 struct hostent* hp = ::gethostbyname (name);
00341
00342
00343 if (hp)
00344 {
00345 result->h_addrtype = hp->h_addrtype;
00346 result->h_length = hp->h_length;
00347
00348
00349
00350
00351
00352
00353
00354 result->h_addr_list = (char **) buffer;
00355
00356 result->h_addr_list[0] = (char *) &result->h_addr_list[2];
00357 ACE_OS::memcpy (result->h_addr_list[0], hp->h_addr_list[0], hp->h_length);
00358
00359 result->h_addr_list[1] = 0;
00360
00361 result->h_aliases = &result->h_addr_list[1];
00362
00363 if (((2*sizeof(char*))+hp->h_length+ACE_OS::strlen (hp->h_name)+1) <= sizeof (ACE_HOSTENT_DATA))
00364 {
00365 result->h_name = (char *) result->h_addr_list[0] + hp->h_length;
00366 ACE_OS::strcpy (result->h_name, hp->h_name);
00367 }
00368 else
00369 {
00370 result->h_name = (char *)0;
00371 }
00372
00373
00374 ::hostentFree (hp);
00375
00376 return result;
00377 }
00378 else
00379 {
00380 return (struct hostent *) 0;
00381 }
00382 # else
00383 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00384 ACE_UNUSED_ARG (result);
00385 ACE_UNUSED_ARG (h_errnop);
00386
00387 ACE_NETDBCALL_RETURN (::gethostbyname (name),
00388 struct hostent *, 0,
00389 buffer, sizeof (ACE_HOSTENT_DATA));
00390
00391 # else
00392
00393 ACE_SOCKCALL_RETURN (::gethostbyname_r (name, result, buffer,
00394 sizeof (ACE_HOSTENT_DATA),
00395 h_errnop),
00396 struct hostent *,
00397 0);
00398
00399 # endif
00400 # endif
00401 # elif defined (ACE_HAS_NONCONST_GETBY)
00402 ACE_UNUSED_ARG (result);
00403 ACE_UNUSED_ARG (buffer);
00404 ACE_UNUSED_ARG (h_errnop);
00405
00406 ACE_SOCKCALL_RETURN (::gethostbyname (const_cast<char *> (name)),
00407 struct hostent *,
00408 0);
00409
00410 # else
00411 ACE_UNUSED_ARG (result);
00412 ACE_UNUSED_ARG (buffer);
00413
00414
00415 struct hostent *result2 = 0;
00416 ACE_SOCKCALL (::gethostbyname (name),
00417 struct hostent *,
00418 0,
00419 result2);
00420 if (result2 == 0 && h_errnop)
00421 *h_errnop = errno;
00422 return result2;
00423
00424 # endif
00425 }
00426
00427 #endif
00428
00429 ACE_INLINE struct hostent *
00430 ACE_OS::getipnodebyaddr (const void *src, size_t len, int family)
00431 {
00432 #if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
00433 # if defined (ACE_LACKS_GETIPNODEBYADDR)
00434 ACE_UNUSED_ARG (src);
00435 ACE_UNUSED_ARG (len);
00436 ACE_UNUSED_ARG (family);
00437 ACE_NOTSUP_RETURN (0);
00438 # else
00439 struct hostent *hptr = 0;
00440 int errnum;
00441
00442 if ((hptr = ::getipnodebyaddr (src, len, family, &errnum)) == 0)
00443 {
00444 errno = errnum;
00445 }
00446
00447 return hptr;
00448 # endif
00449 #else
00450
00451 if (family == AF_INET)
00452 return ACE_OS::gethostbyaddr (static_cast<const char *> (src),
00453 static_cast<int> (len),
00454 family);
00455
00456 ACE_NOTSUP_RETURN (0);
00457 # endif
00458 }
00459
00460 ACE_INLINE struct hostent *
00461 ACE_OS::getipnodebyname (const char *name, int family, int flags)
00462 {
00463 ACE_OS_TRACE ("ACE_OS::getipnodebyname");
00464 # if defined (ACE_HAS_IPV6) && !defined (ACE_LACKS_GETIPNODEBYNAME_IPV6)
00465 # if defined (ACE_LACKS_GETIPNODEBYNAME)
00466 ACE_UNUSED_ARG (flags);
00467 # if defined (ACE_HAS_NONCONST_GETBY)
00468 ACE_SOCKCALL_RETURN (::gethostbyname2 (const_cast<char *> (name),
00469 family),
00470 struct hostent *, 0);
00471 # else
00472 ACE_SOCKCALL_RETURN (::gethostbyname2 (name, family),
00473 struct hostent *, 0);
00474 # endif
00475 # else
00476 struct hostent *hptr = 0;
00477 int errnum;
00478
00479 if ((hptr = ::getipnodebyname (name, family, flags, &errnum)) == 0)
00480 {
00481 errno = errnum;
00482 }
00483
00484 return hptr;
00485 # endif
00486 # else
00487
00488 ACE_UNUSED_ARG (flags);
00489 if (family == AF_INET)
00490 return ACE_OS::gethostbyname (name);
00491
00492 ACE_NOTSUP_RETURN (0);
00493 # endif
00494 }
00495
00496 ACE_INLINE struct protoent *
00497 ACE_OS::getprotobyname (const char *name)
00498 {
00499 #if defined (ACE_LACKS_GETPROTOBYNAME)
00500 ACE_UNUSED_ARG (name);
00501 ACE_NOTSUP_RETURN (0);
00502 #elif defined (ACE_HAS_NONCONST_GETBY)
00503
00504 ACE_SOCKCALL_RETURN (::getprotobyname (const_cast<char *> (name)),
00505 struct protoent *,
00506 0);
00507
00508 #else
00509
00510 ACE_SOCKCALL_RETURN (::getprotobyname (name),
00511 struct protoent *,
00512 0);
00513
00514 #endif
00515 }
00516
00517 ACE_INLINE struct protoent *
00518 ACE_OS::getprotobyname_r (const char *name,
00519 struct protoent *result,
00520 ACE_PROTOENT_DATA buffer)
00521 {
00522 #if defined (ACE_LACKS_GETPROTOBYNAME)
00523 ACE_UNUSED_ARG (name);
00524 ACE_UNUSED_ARG (result);
00525 ACE_UNUSED_ARG (buffer);
00526 ACE_NOTSUP_RETURN (0);
00527 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00528 # if defined (AIX) || defined (DIGITAL_UNIX)
00529
00530 if (::getprotobyname_r (name, result, (struct protoent_data *) buffer) == 0)
00531 return result;
00532 else
00533 return 0;
00534
00535 # elif defined (__GLIBC__)
00536
00537
00538 if (::getprotobyname_r (name,
00539 result,
00540 buffer,
00541 sizeof (ACE_PROTOENT_DATA),
00542 &result) == 0)
00543
00544 return result;
00545 else
00546 return 0;
00547 # else
00548 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00549 ACE_UNUSED_ARG (result);
00550
00551 ACE_NETDBCALL_RETURN (::getprotobyname (name),
00552 struct protoent *, 0,
00553 buffer, sizeof (ACE_PROTOENT_DATA));
00554
00555 # else
00556
00557 ACE_SOCKCALL_RETURN (::getprotobyname_r (name,
00558 result,
00559 buffer,
00560 sizeof (ACE_PROTOENT_DATA)),
00561 struct protoent *, 0);
00562
00563 # endif
00564 # endif
00565 #elif defined (ACE_HAS_NONCONST_GETBY)
00566 ACE_UNUSED_ARG (result);
00567 ACE_UNUSED_ARG (buffer);
00568
00569 ACE_SOCKCALL_RETURN (::getprotobyname (const_cast<char *> (name)),
00570 struct protoent *, 0);
00571
00572 #else
00573 ACE_UNUSED_ARG (buffer);
00574 ACE_UNUSED_ARG (result);
00575
00576
00577 ACE_SOCKCALL_RETURN (::getprotobyname (name),
00578 struct protoent *,
00579 0);
00580
00581 #endif
00582 }
00583
00584 ACE_INLINE struct protoent *
00585 ACE_OS::getprotobynumber (int proto)
00586 {
00587 #if defined (ACE_LACKS_GETPROTOBYNUMBER)
00588 ACE_UNUSED_ARG (proto);
00589 ACE_NOTSUP_RETURN (0);
00590 #else
00591
00592 ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
00593 struct protoent *, 0);
00594
00595 #endif
00596 }
00597
00598 ACE_INLINE struct protoent *
00599 ACE_OS::getprotobynumber_r (int proto,
00600 struct protoent *result,
00601 ACE_PROTOENT_DATA buffer)
00602 {
00603 #if defined (ACE_LACKS_GETPROTOBYNUMBER)
00604 ACE_UNUSED_ARG (proto);
00605 ACE_UNUSED_ARG (result);
00606 ACE_UNUSED_ARG (buffer);
00607 ACE_NOTSUP_RETURN (0);
00608 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00609 # if defined (AIX) || defined (DIGITAL_UNIX)
00610
00611 if (::getprotobynumber_r (proto, result, (struct protoent_data *) buffer) == 0)
00612 return result;
00613
00614 else
00615 return 0;
00616 # elif defined (__GLIBC__)
00617
00618
00619 if (::getprotobynumber_r (proto,
00620 result,
00621 buffer,
00622 sizeof (ACE_PROTOENT_DATA),
00623 &result) == 0)
00624
00625 return result;
00626 else
00627 return 0;
00628 # else
00629 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00630 ACE_UNUSED_ARG (result);
00631
00632 ACE_NETDBCALL_RETURN (::getprotobynumber (proto),
00633 struct protoent *, 0,
00634 buffer, sizeof (ACE_PROTOENT_DATA));
00635
00636 # else
00637
00638 ACE_SOCKCALL_RETURN (::getprotobynumber_r (proto, result, buffer, sizeof (ACE_PROTOENT_DATA)),
00639 struct protoent *, 0);
00640
00641 # endif
00642 # endif
00643 #else
00644 ACE_UNUSED_ARG (buffer);
00645 ACE_UNUSED_ARG (result);
00646
00647
00648 ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
00649 struct protoent *, 0);
00650
00651 #endif
00652 }
00653
00654 ACE_INLINE struct servent *
00655 ACE_OS::getservbyname (const char *svc, const char *proto)
00656 {
00657 ACE_OS_TRACE ("ACE_OS::getservbyname");
00658 #if defined (ACE_LACKS_GETSERVBYNAME)
00659 ACE_UNUSED_ARG (svc);
00660 ACE_UNUSED_ARG (proto);
00661 ACE_NOTSUP_RETURN (0);
00662 #elif defined (ACE_HAS_NONCONST_GETBY)
00663
00664 ACE_SOCKCALL_RETURN (::getservbyname (const_cast<char *> (svc),
00665 const_cast<char *> (proto)),
00666 struct servent *,
00667 0);
00668
00669 #else
00670
00671 ACE_SOCKCALL_RETURN (::getservbyname (svc,
00672 proto),
00673 struct servent *,
00674 0);
00675
00676 #endif
00677 }
00678
00679 ACE_INLINE struct servent *
00680 ACE_OS::getservbyname_r (const char *svc,
00681 const char *proto,
00682 struct servent *result,
00683 ACE_SERVENT_DATA buf)
00684 {
00685 ACE_OS_TRACE ("ACE_OS::getservbyname_r");
00686 #if defined (ACE_LACKS_GETSERVBYNAME)
00687 ACE_UNUSED_ARG (svc);
00688 ACE_UNUSED_ARG (proto);
00689 ACE_UNUSED_ARG (result);
00690 ACE_UNUSED_ARG (buf);
00691 ACE_NOTSUP_RETURN (0);
00692 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00693 # if defined (AIX) || defined (DIGITAL_UNIX)
00694 ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
00695
00696
00697 if (::getservbyname_r (svc, proto, result, (struct servent_data *) buf) == 0)
00698 return result;
00699
00700 else
00701 return (struct servent *) 0;
00702 # elif defined (__GLIBC__)
00703
00704 ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
00705
00706
00707 if (::getservbyname_r (svc,
00708 proto,
00709 result,
00710 buf,
00711 sizeof (ACE_SERVENT_DATA),
00712 &result) == 0)
00713 return result;
00714
00715 else
00716 return (struct servent *) 0;
00717 # else
00718 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00719 ACE_UNUSED_ARG (result);
00720
00721 ACE_NETDBCALL_RETURN (::getservbyname (svc, proto),
00722 struct servent *, 0,
00723 buf, sizeof (ACE_SERVENT_DATA));
00724
00725 # else
00726
00727 ACE_SOCKCALL_RETURN (::getservbyname_r (svc, proto, result, buf,
00728 sizeof (ACE_SERVENT_DATA)),
00729 struct servent *, 0);
00730
00731 # endif
00732 # endif
00733 #elif defined (ACE_HAS_NONCONST_GETBY)
00734 ACE_UNUSED_ARG (buf);
00735 ACE_UNUSED_ARG (result);
00736
00737 ACE_SOCKCALL_RETURN (::getservbyname (const_cast<char *> (svc),
00738 const_cast<char *> (proto)),
00739 struct servent *,
00740 0);
00741
00742 #else
00743 ACE_UNUSED_ARG (buf);
00744 ACE_UNUSED_ARG (result);
00745
00746 ACE_SOCKCALL_RETURN (::getservbyname (svc,
00747 proto),
00748 struct servent *,
00749 0);
00750
00751 #endif
00752 }
00753
00754 ACE_END_VERSIONED_NAMESPACE_DECL