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 ACE_UNUSED_ARG (h_errnop);
00414
00415
00416 ACE_SOCKCALL_RETURN (::gethostbyname (name),
00417 struct hostent *,
00418 0);
00419
00420 # endif
00421 }
00422
00423 #endif
00424
00425 ACE_INLINE struct hostent *
00426 ACE_OS::getipnodebyaddr (const void *src, size_t len, int family)
00427 {
00428 #if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
00429 # if defined (ACE_LACKS_GETIPNODEBYADDR)
00430 ACE_UNUSED_ARG (src);
00431 ACE_UNUSED_ARG (len);
00432 ACE_UNUSED_ARG (family);
00433 ACE_NOTSUP_RETURN (0);
00434 # else
00435 struct hostent *hptr = 0;
00436 int errnum;
00437
00438 if ((hptr = ::getipnodebyaddr (src, len, family, &errnum)) == 0)
00439 {
00440 errno = errnum;
00441 }
00442
00443 return hptr;
00444 # endif
00445 #else
00446
00447 if (family == AF_INET)
00448 return ACE_OS::gethostbyaddr (static_cast<const char *> (src),
00449 static_cast<int> (len),
00450 family);
00451
00452 ACE_NOTSUP_RETURN (0);
00453 # endif
00454 }
00455
00456 ACE_INLINE struct hostent *
00457 ACE_OS::getipnodebyname (const char *name, int family, int flags)
00458 {
00459 ACE_OS_TRACE ("ACE_OS::getipnodebyname");
00460 # if defined (ACE_HAS_IPV6) && !defined (ACE_LACKS_GETIPNODEBYNAME_IPV6)
00461 # if defined (ACE_LACKS_GETIPNODEBYNAME)
00462 ACE_UNUSED_ARG (flags);
00463 # if defined (ACE_HAS_NONCONST_GETBY)
00464 ACE_SOCKCALL_RETURN (::gethostbyname2 (const_cast<char *> (name),
00465 family),
00466 struct hostent *, 0);
00467 # else
00468 ACE_SOCKCALL_RETURN (::gethostbyname2 (name, family),
00469 struct hostent *, 0);
00470 # endif
00471 # else
00472 struct hostent *hptr = 0;
00473 int errnum;
00474
00475 if ((hptr = ::getipnodebyname (name, family, flags, &errnum)) == 0)
00476 {
00477 errno = errnum;
00478 }
00479
00480 return hptr;
00481 # endif
00482 # else
00483
00484 ACE_UNUSED_ARG (flags);
00485 if (family == AF_INET)
00486 return ACE_OS::gethostbyname (name);
00487
00488 ACE_NOTSUP_RETURN (0);
00489 # endif
00490 }
00491
00492 ACE_INLINE struct protoent *
00493 ACE_OS::getprotobyname (const char *name)
00494 {
00495 #if defined (ACE_LACKS_GETPROTOBYNAME)
00496 ACE_UNUSED_ARG (name);
00497 ACE_NOTSUP_RETURN (0);
00498 #elif defined (ACE_HAS_NONCONST_GETBY)
00499
00500 ACE_SOCKCALL_RETURN (::getprotobyname (const_cast<char *> (name)),
00501 struct protoent *,
00502 0);
00503
00504 #else
00505
00506 ACE_SOCKCALL_RETURN (::getprotobyname (name),
00507 struct protoent *,
00508 0);
00509
00510 #endif
00511 }
00512
00513 ACE_INLINE struct protoent *
00514 ACE_OS::getprotobyname_r (const char *name,
00515 struct protoent *result,
00516 ACE_PROTOENT_DATA buffer)
00517 {
00518 #if defined (ACE_LACKS_GETPROTOBYNAME)
00519 ACE_UNUSED_ARG (name);
00520 ACE_UNUSED_ARG (result);
00521 ACE_UNUSED_ARG (buffer);
00522 ACE_NOTSUP_RETURN (0);
00523 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00524 # if defined (AIX) || defined (DIGITAL_UNIX)
00525
00526 if (::getprotobyname_r (name, result, (struct protoent_data *) buffer) == 0)
00527 return result;
00528 else
00529 return 0;
00530
00531 # elif defined (__GLIBC__)
00532
00533
00534 if (::getprotobyname_r (name,
00535 result,
00536 buffer,
00537 sizeof (ACE_PROTOENT_DATA),
00538 &result) == 0)
00539
00540 return result;
00541 else
00542 return 0;
00543 # else
00544 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00545 ACE_UNUSED_ARG (result);
00546
00547 ACE_NETDBCALL_RETURN (::getprotobyname (name),
00548 struct protoent *, 0,
00549 buffer, sizeof (ACE_PROTOENT_DATA));
00550
00551 # else
00552
00553 ACE_SOCKCALL_RETURN (::getprotobyname_r (name,
00554 result,
00555 buffer,
00556 sizeof (ACE_PROTOENT_DATA)),
00557 struct protoent *, 0);
00558
00559 # endif
00560 # endif
00561 #elif defined (ACE_HAS_NONCONST_GETBY)
00562 ACE_UNUSED_ARG (result);
00563 ACE_UNUSED_ARG (buffer);
00564
00565 ACE_SOCKCALL_RETURN (::getprotobyname (const_cast<char *> (name)),
00566 struct protoent *, 0);
00567
00568 #else
00569 ACE_UNUSED_ARG (buffer);
00570 ACE_UNUSED_ARG (result);
00571
00572
00573 ACE_SOCKCALL_RETURN (::getprotobyname (name),
00574 struct protoent *,
00575 0);
00576
00577 #endif
00578 }
00579
00580 ACE_INLINE struct protoent *
00581 ACE_OS::getprotobynumber (int proto)
00582 {
00583 #if defined (ACE_LACKS_GETPROTOBYNUMBER)
00584 ACE_UNUSED_ARG (proto);
00585 ACE_NOTSUP_RETURN (0);
00586 #else
00587
00588 ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
00589 struct protoent *, 0);
00590
00591 #endif
00592 }
00593
00594 ACE_INLINE struct protoent *
00595 ACE_OS::getprotobynumber_r (int proto,
00596 struct protoent *result,
00597 ACE_PROTOENT_DATA buffer)
00598 {
00599 #if defined (ACE_LACKS_GETPROTOBYNUMBER)
00600 ACE_UNUSED_ARG (proto);
00601 ACE_UNUSED_ARG (result);
00602 ACE_UNUSED_ARG (buffer);
00603 ACE_NOTSUP_RETURN (0);
00604 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00605 # if defined (AIX) || defined (DIGITAL_UNIX)
00606
00607 if (::getprotobynumber_r (proto, result, (struct protoent_data *) buffer) == 0)
00608 return result;
00609
00610 else
00611 return 0;
00612 # elif defined (__GLIBC__)
00613
00614
00615 if (::getprotobynumber_r (proto,
00616 result,
00617 buffer,
00618 sizeof (ACE_PROTOENT_DATA),
00619 &result) == 0)
00620
00621 return result;
00622 else
00623 return 0;
00624 # else
00625 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00626 ACE_UNUSED_ARG (result);
00627
00628 ACE_NETDBCALL_RETURN (::getprotobynumber (proto),
00629 struct protoent *, 0,
00630 buffer, sizeof (ACE_PROTOENT_DATA));
00631
00632 # else
00633
00634 ACE_SOCKCALL_RETURN (::getprotobynumber_r (proto, result, buffer, sizeof (ACE_PROTOENT_DATA)),
00635 struct protoent *, 0);
00636
00637 # endif
00638 # endif
00639 #else
00640 ACE_UNUSED_ARG (buffer);
00641 ACE_UNUSED_ARG (result);
00642
00643
00644 ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
00645 struct protoent *, 0);
00646
00647 #endif
00648 }
00649
00650 ACE_INLINE struct servent *
00651 ACE_OS::getservbyname (const char *svc, const char *proto)
00652 {
00653 ACE_OS_TRACE ("ACE_OS::getservbyname");
00654 #if defined (ACE_LACKS_GETSERVBYNAME)
00655 ACE_UNUSED_ARG (svc);
00656 ACE_UNUSED_ARG (proto);
00657 ACE_NOTSUP_RETURN (0);
00658 #elif defined (ACE_HAS_NONCONST_GETBY)
00659
00660 ACE_SOCKCALL_RETURN (::getservbyname (const_cast<char *> (svc),
00661 const_cast<char *> (proto)),
00662 struct servent *,
00663 0);
00664
00665 #else
00666
00667 ACE_SOCKCALL_RETURN (::getservbyname (svc,
00668 proto),
00669 struct servent *,
00670 0);
00671
00672 #endif
00673 }
00674
00675 ACE_INLINE struct servent *
00676 ACE_OS::getservbyname_r (const char *svc,
00677 const char *proto,
00678 struct servent *result,
00679 ACE_SERVENT_DATA buf)
00680 {
00681 ACE_OS_TRACE ("ACE_OS::getservbyname_r");
00682 #if defined (ACE_LACKS_GETSERVBYNAME)
00683 ACE_UNUSED_ARG (svc);
00684 ACE_UNUSED_ARG (proto);
00685 ACE_UNUSED_ARG (result);
00686 ACE_UNUSED_ARG (buf);
00687 ACE_NOTSUP_RETURN (0);
00688 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00689 # if defined (AIX) || defined (DIGITAL_UNIX)
00690 ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
00691
00692
00693 if (::getservbyname_r (svc, proto, result, (struct servent_data *) buf) == 0)
00694 return result;
00695
00696 else
00697 return (struct servent *) 0;
00698 # elif defined (__GLIBC__)
00699
00700 ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
00701
00702
00703 if (::getservbyname_r (svc,
00704 proto,
00705 result,
00706 buf,
00707 sizeof (ACE_SERVENT_DATA),
00708 &result) == 0)
00709 return result;
00710
00711 else
00712 return (struct servent *) 0;
00713 # else
00714 # if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00715 ACE_UNUSED_ARG (result);
00716
00717 ACE_NETDBCALL_RETURN (::getservbyname (svc, proto),
00718 struct servent *, 0,
00719 buf, sizeof (ACE_SERVENT_DATA));
00720
00721 # else
00722
00723 ACE_SOCKCALL_RETURN (::getservbyname_r (svc, proto, result, buf,
00724 sizeof (ACE_SERVENT_DATA)),
00725 struct servent *, 0);
00726
00727 # endif
00728 # endif
00729 #elif defined (ACE_HAS_NONCONST_GETBY)
00730 ACE_UNUSED_ARG (buf);
00731 ACE_UNUSED_ARG (result);
00732
00733 ACE_SOCKCALL_RETURN (::getservbyname (const_cast<char *> (svc),
00734 const_cast<char *> (proto)),
00735 struct servent *,
00736 0);
00737
00738 #else
00739 ACE_UNUSED_ARG (buf);
00740 ACE_UNUSED_ARG (result);
00741
00742 ACE_SOCKCALL_RETURN (::getservbyname (svc,
00743 proto),
00744 struct servent *,
00745 0);
00746
00747 #endif
00748 }
00749
00750 ACE_END_VERSIONED_NAMESPACE_DECL