lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, write to the Free |
| 16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 17 | 02111-1307 USA. */ |
| 18 | |
| 19 | /* All data returned by the network data base library are supplied in |
| 20 | host order and returned in network order (suitable for use in |
| 21 | system calls). */ |
| 22 | |
| 23 | #ifndef _NETDB_H |
| 24 | #define _NETDB_H 1 |
| 25 | |
| 26 | #include <features.h> |
| 27 | |
| 28 | #include <netinet/in.h> |
| 29 | #include <stdint.h> |
| 30 | #if defined __USE_MISC && defined __UCLIBC_HAS_RPC__ |
| 31 | /* This is necessary to make this include file properly replace the |
| 32 | Sun version. */ |
| 33 | # include <rpc/netdb.h> |
| 34 | #endif |
| 35 | |
| 36 | #ifdef __USE_GNU |
| 37 | # define __need_sigevent_t |
| 38 | # include <bits/siginfo.h> |
| 39 | # define __need_timespec |
| 40 | # include <time.h> |
| 41 | #endif |
| 42 | |
| 43 | #include <bits/netdb.h> |
| 44 | |
| 45 | /* Absolute file name for network data base files. */ |
| 46 | #define _PATH_HEQUIV "/etc/hosts.equiv" |
| 47 | #define _PATH_HOSTS "/etc/hosts" |
| 48 | #define _PATH_NETWORKS "/etc/networks" |
| 49 | #define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" |
| 50 | #define _PATH_PROTOCOLS "/etc/protocols" |
| 51 | #define _PATH_SERVICES "/etc/services" |
| 52 | |
| 53 | |
| 54 | __BEGIN_DECLS |
| 55 | |
| 56 | /* Error status for non-reentrant lookup functions. |
| 57 | We use a macro to access always the thread-specific `h_errno' variable. */ |
| 58 | #define h_errno (*__h_errno_location ()) |
| 59 | |
| 60 | /* Function to get address of global `h_errno' variable. */ |
| 61 | extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); |
| 62 | libc_hidden_proto(__h_errno_location) |
| 63 | |
| 64 | /* Macros for accessing h_errno from inside libc. */ |
| 65 | #ifdef _LIBC |
| 66 | # ifdef __UCLIBC_HAS_THREADS__ |
| 67 | # if defined __UCLIBC_HAS_TLS__ \ |
| 68 | && (!defined NOT_IN_libc || defined IS_IN_libpthread) |
| 69 | # undef h_errno |
| 70 | # ifndef NOT_IN_libc |
| 71 | # define h_errno __libc_h_errno |
| 72 | # else |
| 73 | # define h_errno h_errno /* For #ifndef h_errno tests. */ |
| 74 | # endif |
| 75 | extern __thread int h_errno attribute_tls_model_ie; |
| 76 | # define __set_h_errno(x) (h_errno = (x)) |
| 77 | # else |
| 78 | static inline int __set_h_errno (int __err) |
| 79 | { |
| 80 | return *__h_errno_location () = __err; |
| 81 | } |
| 82 | # endif /* __UCLIBC_HAS_TLS__ */ |
| 83 | # else |
| 84 | # undef h_errno |
| 85 | # define __set_h_errno(x) (h_errno = (x)) |
| 86 | extern int h_errno; |
| 87 | # endif /* __UCLIBC_HAS_THREADS__ */ |
| 88 | #endif /* _LIBC */ |
| 89 | |
| 90 | /* Possible values left in `h_errno'. */ |
| 91 | #define NETDB_INTERNAL -1 /* See errno. */ |
| 92 | #define NETDB_SUCCESS 0 /* No problem. */ |
| 93 | #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */ |
| 94 | #define TRY_AGAIN 2 /* Non-Authoritative Host not found, |
| 95 | or SERVERFAIL. */ |
| 96 | #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, |
| 97 | NOTIMP. */ |
| 98 | #define NO_DATA 4 /* Valid name, no data record of requested |
| 99 | type. */ |
| 100 | #define NO_ADDRESS NO_DATA /* No address, look for MX record. */ |
| 101 | |
| 102 | #ifdef __USE_XOPEN2K |
| 103 | /* Highest reserved Internet port number. */ |
| 104 | # define IPPORT_RESERVED 1024 |
| 105 | #endif |
| 106 | |
| 107 | #ifdef __USE_GNU |
| 108 | /* Scope delimiter for getaddrinfo(), getnameinfo(). */ |
| 109 | # define SCOPE_DELIMITER '%' |
| 110 | #endif |
| 111 | |
| 112 | /* Print error indicated by `h_errno' variable on standard error. STR |
| 113 | if non-null is printed before the error string. */ |
| 114 | extern void herror (__const char *__str) __THROW; |
| 115 | libc_hidden_proto(herror) |
| 116 | |
| 117 | /* Return string associated with error ERR_NUM. */ |
| 118 | extern __const char *hstrerror (int __err_num) __THROW; |
| 119 | |
| 120 | |
| 121 | /* Description of data base entry for a single host. */ |
| 122 | struct hostent |
| 123 | { |
| 124 | char *h_name; /* Official name of host. */ |
| 125 | char **h_aliases; /* Alias list. */ |
| 126 | int h_addrtype; /* Host address type. */ |
| 127 | int h_length; /* Length of address. */ |
| 128 | char **h_addr_list; /* List of addresses from name server. */ |
| 129 | #define h_addr h_addr_list[0] /* Address, for backward compatibility. */ |
| 130 | }; |
| 131 | |
| 132 | /* Open host data base files and mark them as staying open even after |
| 133 | a later search if STAY_OPEN is non-zero. |
| 134 | |
| 135 | This function is a possible cancellation point and therefore not |
| 136 | marked with __THROW. */ |
| 137 | extern void sethostent (int __stay_open); |
| 138 | |
| 139 | /* Close host data base files and clear `stay open' flag. |
| 140 | |
| 141 | This function is a possible cancellation point and therefore not |
| 142 | marked with __THROW. */ |
| 143 | extern void endhostent (void); |
| 144 | |
| 145 | /* Get next entry from host data base file. Open data base if |
| 146 | necessary. |
| 147 | |
| 148 | This function is a possible cancellation point and therefore not |
| 149 | marked with __THROW. */ |
| 150 | extern struct hostent *gethostent (void); |
| 151 | |
| 152 | /* Return entry from host data base which address match ADDR with |
| 153 | length LEN and type TYPE. |
| 154 | |
| 155 | This function is a possible cancellation point and therefore not |
| 156 | marked with __THROW. */ |
| 157 | extern struct hostent *gethostbyaddr (__const void *__addr, __socklen_t __len, |
| 158 | int __type); |
| 159 | libc_hidden_proto(gethostbyaddr) |
| 160 | |
| 161 | /* Return entry from host data base for host with NAME. |
| 162 | |
| 163 | This function is a possible cancellation point and therefore not |
| 164 | marked with __THROW. */ |
| 165 | extern struct hostent *gethostbyname (__const char *__name); |
| 166 | libc_hidden_proto(gethostbyname) |
| 167 | |
| 168 | #ifdef __USE_MISC |
| 169 | /* Return entry from host data base for host with NAME. AF must be |
| 170 | set to the address type which is `AF_INET' for IPv4 or `AF_INET6' |
| 171 | for IPv6. |
| 172 | |
| 173 | This function is not part of POSIX and therefore no official |
| 174 | cancellation point. But due to similarity with an POSIX interface |
| 175 | or due to the implementation it is a cancellation point and |
| 176 | therefore not marked with __THROW. */ |
| 177 | extern struct hostent *gethostbyname2 (__const char *__name, int __af); |
| 178 | libc_hidden_proto(gethostbyname2) |
| 179 | |
| 180 | /* Reentrant versions of the functions above. The additional |
| 181 | arguments specify a buffer of BUFLEN starting at BUF. The last |
| 182 | argument is a pointer to a variable which gets the value which |
| 183 | would be stored in the global variable `herrno' by the |
| 184 | non-reentrant functions. |
| 185 | |
| 186 | These functions are not part of POSIX and therefore no official |
| 187 | cancellation point. But due to similarity with an POSIX interface |
| 188 | or due to the implementation they are cancellation points and |
| 189 | therefore not marked with __THROW. */ |
| 190 | extern int gethostent_r (struct hostent *__restrict __result_buf, |
| 191 | char *__restrict __buf, size_t __buflen, |
| 192 | struct hostent **__restrict __result, |
| 193 | int *__restrict __h_errnop); |
| 194 | libc_hidden_proto(gethostent_r) |
| 195 | |
| 196 | extern int gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len, |
| 197 | int __type, |
| 198 | struct hostent *__restrict __result_buf, |
| 199 | char *__restrict __buf, size_t __buflen, |
| 200 | struct hostent **__restrict __result, |
| 201 | int *__restrict __h_errnop); |
| 202 | libc_hidden_proto(gethostbyaddr_r) |
| 203 | |
| 204 | extern int gethostbyname_r (__const char *__restrict __name, |
| 205 | struct hostent *__restrict __result_buf, |
| 206 | char *__restrict __buf, size_t __buflen, |
| 207 | struct hostent **__restrict __result, |
| 208 | int *__restrict __h_errnop); |
| 209 | libc_hidden_proto(gethostbyname_r) |
| 210 | |
| 211 | extern int gethostbyname2_r (__const char *__restrict __name, int __af, |
| 212 | struct hostent *__restrict __result_buf, |
| 213 | char *__restrict __buf, size_t __buflen, |
| 214 | struct hostent **__restrict __result, |
| 215 | int *__restrict __h_errnop); |
| 216 | libc_hidden_proto(gethostbyname2_r) |
| 217 | #endif /* misc */ |
| 218 | |
| 219 | |
| 220 | /* Open network data base files and mark them as staying open even |
| 221 | after a later search if STAY_OPEN is non-zero. |
| 222 | |
| 223 | This function is a possible cancellation point and therefore not |
| 224 | marked with __THROW. */ |
| 225 | extern void setnetent (int __stay_open); |
| 226 | libc_hidden_proto(setnetent) |
| 227 | |
| 228 | /* Close network data base files and clear `stay open' flag. |
| 229 | |
| 230 | This function is a possible cancellation point and therefore not |
| 231 | marked with __THROW. */ |
| 232 | extern void endnetent (void); |
| 233 | libc_hidden_proto(endnetent) |
| 234 | |
| 235 | /* Get next entry from network data base file. Open data base if |
| 236 | necessary. |
| 237 | |
| 238 | This function is a possible cancellation point and therefore not |
| 239 | marked with __THROW. */ |
| 240 | extern struct netent *getnetent (void); |
| 241 | |
| 242 | /* Return entry from network data base which address match NET and |
| 243 | type TYPE. |
| 244 | |
| 245 | This function is a possible cancellation point and therefore not |
| 246 | marked with __THROW. */ |
| 247 | extern struct netent *getnetbyaddr (uint32_t __net, int __type); |
| 248 | |
| 249 | /* Return entry from network data base for network with NAME. |
| 250 | |
| 251 | This function is a possible cancellation point and therefore not |
| 252 | marked with __THROW. */ |
| 253 | extern struct netent *getnetbyname (__const char *__name); |
| 254 | |
| 255 | #ifdef __USE_MISC |
| 256 | /* Reentrant versions of the functions above. The additional |
| 257 | arguments specify a buffer of BUFLEN starting at BUF. The last |
| 258 | argument is a pointer to a variable which gets the value which |
| 259 | would be stored in the global variable `herrno' by the |
| 260 | non-reentrant functions. |
| 261 | |
| 262 | These functions are not part of POSIX and therefore no official |
| 263 | cancellation point. But due to similarity with an POSIX interface |
| 264 | or due to the implementation they are cancellation points and |
| 265 | therefore not marked with __THROW. */ |
| 266 | extern int getnetent_r (struct netent *__restrict __result_buf, |
| 267 | char *__restrict __buf, size_t __buflen, |
| 268 | struct netent **__restrict __result, |
| 269 | int *__restrict __h_errnop); |
| 270 | libc_hidden_proto(getnetent_r) |
| 271 | extern int getnetbyaddr_r (uint32_t __net, int __type, |
| 272 | struct netent *__restrict __result_buf, |
| 273 | char *__restrict __buf, size_t __buflen, |
| 274 | struct netent **__restrict __result, |
| 275 | int *__restrict __h_errnop); |
| 276 | libc_hidden_proto(getnetbyaddr_r) |
| 277 | extern int getnetbyname_r (__const char *__restrict __name, |
| 278 | struct netent *__restrict __result_buf, |
| 279 | char *__restrict __buf, size_t __buflen, |
| 280 | struct netent **__restrict __result, |
| 281 | int *__restrict __h_errnop); |
| 282 | libc_hidden_proto(getnetbyname_r) |
| 283 | #endif /* __USE_MISC */ |
| 284 | |
| 285 | |
| 286 | /* Description of data base entry for a single service. */ |
| 287 | struct servent |
| 288 | { |
| 289 | char *s_name; /* Official service name. */ |
| 290 | char **s_aliases; /* Alias list. */ |
| 291 | int s_port; /* Port number. */ |
| 292 | char *s_proto; /* Protocol to use. */ |
| 293 | }; |
| 294 | |
| 295 | /* Open service data base files and mark them as staying open even |
| 296 | after a later search if STAY_OPEN is non-zero. |
| 297 | |
| 298 | This function is a possible cancellation point and therefore not |
| 299 | marked with __THROW. */ |
| 300 | extern void setservent (int __stay_open); |
| 301 | libc_hidden_proto(setservent) |
| 302 | |
| 303 | /* Close service data base files and clear `stay open' flag. |
| 304 | |
| 305 | This function is a possible cancellation point and therefore not |
| 306 | marked with __THROW. */ |
| 307 | extern void endservent (void); |
| 308 | libc_hidden_proto(endservent) |
| 309 | |
| 310 | /* Get next entry from service data base file. Open data base if |
| 311 | necessary. |
| 312 | |
| 313 | This function is a possible cancellation point and therefore not |
| 314 | marked with __THROW. */ |
| 315 | extern struct servent *getservent (void); |
| 316 | |
| 317 | /* Return entry from network data base for network with NAME and |
| 318 | protocol PROTO. |
| 319 | |
| 320 | This function is a possible cancellation point and therefore not |
| 321 | marked with __THROW. */ |
| 322 | extern struct servent *getservbyname (__const char *__name, |
| 323 | __const char *__proto); |
| 324 | |
| 325 | /* Return entry from service data base which matches port PORT and |
| 326 | protocol PROTO. |
| 327 | |
| 328 | This function is a possible cancellation point and therefore not |
| 329 | marked with __THROW. */ |
| 330 | extern struct servent *getservbyport (int __port, __const char *__proto); |
| 331 | libc_hidden_proto(getservbyport) |
| 332 | |
| 333 | |
| 334 | #ifdef __USE_MISC |
| 335 | /* Reentrant versions of the functions above. The additional |
| 336 | arguments specify a buffer of BUFLEN starting at BUF. |
| 337 | |
| 338 | These functions are not part of POSIX and therefore no official |
| 339 | cancellation point. But due to similarity with an POSIX interface |
| 340 | or due to the implementation they are cancellation points and |
| 341 | therefore not marked with __THROW. */ |
| 342 | extern int getservent_r (struct servent *__restrict __result_buf, |
| 343 | char *__restrict __buf, size_t __buflen, |
| 344 | struct servent **__restrict __result); |
| 345 | libc_hidden_proto(getservent_r) |
| 346 | |
| 347 | extern int getservbyname_r (__const char *__restrict __name, |
| 348 | __const char *__restrict __proto, |
| 349 | struct servent *__restrict __result_buf, |
| 350 | char *__restrict __buf, size_t __buflen, |
| 351 | struct servent **__restrict __result); |
| 352 | libc_hidden_proto(getservbyname_r) |
| 353 | |
| 354 | extern int getservbyport_r (int __port, __const char *__restrict __proto, |
| 355 | struct servent *__restrict __result_buf, |
| 356 | char *__restrict __buf, size_t __buflen, |
| 357 | struct servent **__restrict __result); |
| 358 | libc_hidden_proto(getservbyport_r) |
| 359 | #endif /* misc */ |
| 360 | |
| 361 | |
| 362 | /* Description of data base entry for a single service. */ |
| 363 | struct protoent |
| 364 | { |
| 365 | char *p_name; /* Official protocol name. */ |
| 366 | char **p_aliases; /* Alias list. */ |
| 367 | int p_proto; /* Protocol number. */ |
| 368 | }; |
| 369 | |
| 370 | /* Open protocol data base files and mark them as staying open even |
| 371 | after a later search if STAY_OPEN is non-zero. |
| 372 | |
| 373 | This function is a possible cancellation point and therefore not |
| 374 | marked with __THROW. */ |
| 375 | extern void setprotoent (int __stay_open); |
| 376 | libc_hidden_proto(setprotoent) |
| 377 | |
| 378 | /* Close protocol data base files and clear `stay open' flag. |
| 379 | |
| 380 | This function is a possible cancellation point and therefore not |
| 381 | marked with __THROW. */ |
| 382 | extern void endprotoent (void); |
| 383 | libc_hidden_proto(endprotoent) |
| 384 | |
| 385 | /* Get next entry from protocol data base file. Open data base if |
| 386 | necessary. |
| 387 | |
| 388 | This function is a possible cancellation point and therefore not |
| 389 | marked with __THROW. */ |
| 390 | extern struct protoent *getprotoent (void); |
| 391 | |
| 392 | /* Return entry from protocol data base for network with NAME. |
| 393 | |
| 394 | This function is a possible cancellation point and therefore not |
| 395 | marked with __THROW. */ |
| 396 | extern struct protoent *getprotobyname (__const char *__name); |
| 397 | |
| 398 | /* Return entry from protocol data base which number is PROTO. |
| 399 | |
| 400 | This function is a possible cancellation point and therefore not |
| 401 | marked with __THROW. */ |
| 402 | extern struct protoent *getprotobynumber (int __proto); |
| 403 | |
| 404 | |
| 405 | #ifdef __USE_MISC |
| 406 | /* Reentrant versions of the functions above. The additional |
| 407 | arguments specify a buffer of BUFLEN starting at BUF. |
| 408 | |
| 409 | These functions are not part of POSIX and therefore no official |
| 410 | cancellation point. But due to similarity with an POSIX interface |
| 411 | or due to the implementation they are cancellation points and |
| 412 | therefore not marked with __THROW. */ |
| 413 | extern int getprotoent_r (struct protoent *__restrict __result_buf, |
| 414 | char *__restrict __buf, size_t __buflen, |
| 415 | struct protoent **__restrict __result); |
| 416 | libc_hidden_proto(getprotoent_r) |
| 417 | |
| 418 | extern int getprotobyname_r (__const char *__restrict __name, |
| 419 | struct protoent *__restrict __result_buf, |
| 420 | char *__restrict __buf, size_t __buflen, |
| 421 | struct protoent **__restrict __result); |
| 422 | libc_hidden_proto(getprotobyname_r) |
| 423 | |
| 424 | extern int getprotobynumber_r (int __proto, |
| 425 | struct protoent *__restrict __result_buf, |
| 426 | char *__restrict __buf, size_t __buflen, |
| 427 | struct protoent **__restrict __result); |
| 428 | libc_hidden_proto(getprotobynumber_r) |
| 429 | |
| 430 | |
| 431 | #ifdef __UCLIBC_HAS_NETGROUP__ |
| 432 | /* Establish network group NETGROUP for enumeration. |
| 433 | |
| 434 | This function is not part of POSIX and therefore no official |
| 435 | cancellation point. But due to similarity with an POSIX interface |
| 436 | or due to the implementation it is a cancellation point and |
| 437 | therefore not marked with __THROW. */ |
| 438 | extern int setnetgrent (__const char *__netgroup); |
| 439 | |
| 440 | /* Free all space allocated by previous `setnetgrent' call. |
| 441 | |
| 442 | This function is not part of POSIX and therefore no official |
| 443 | cancellation point. But due to similarity with an POSIX interface |
| 444 | or due to the implementation it is a cancellation point and |
| 445 | therefore not marked with __THROW. */ |
| 446 | extern void endnetgrent (void); |
| 447 | |
| 448 | /* Get next member of netgroup established by last `setnetgrent' call |
| 449 | and return pointers to elements in HOSTP, USERP, and DOMAINP. |
| 450 | |
| 451 | This function is not part of POSIX and therefore no official |
| 452 | cancellation point. But due to similarity with an POSIX interface |
| 453 | or due to the implementation it is a cancellation point and |
| 454 | therefore not marked with __THROW. */ |
| 455 | extern int getnetgrent (char **__restrict __hostp, |
| 456 | char **__restrict __userp, |
| 457 | char **__restrict __domainp); |
| 458 | |
| 459 | |
| 460 | /* Test whether NETGROUP contains the triple (HOST,USER,DOMAIN). |
| 461 | |
| 462 | This function is not part of POSIX and therefore no official |
| 463 | cancellation point. But due to similarity with an POSIX interface |
| 464 | or due to the implementation it is a cancellation point and |
| 465 | therefore not marked with __THROW. */ |
| 466 | extern int innetgr (__const char *__netgroup, __const char *__host, |
| 467 | __const char *__user, __const char *domain); |
| 468 | |
| 469 | /* Reentrant version of `getnetgrent' where result is placed in BUFFER. |
| 470 | |
| 471 | This function is not part of POSIX and therefore no official |
| 472 | cancellation point. But due to similarity with an POSIX interface |
| 473 | or due to the implementation it is a cancellation point and |
| 474 | therefore not marked with __THROW. */ |
| 475 | extern int getnetgrent_r (char **__restrict __hostp, |
| 476 | char **__restrict __userp, |
| 477 | char **__restrict __domainp, |
| 478 | char *__restrict __buffer, size_t __buflen); |
| 479 | #endif /* UCLIBC_HAS_NETGROUP */ |
| 480 | #endif /* misc */ |
| 481 | |
| 482 | |
| 483 | /* ruserpass - remote password check. |
| 484 | This function also exists in glibc but is undocumented */ |
| 485 | extern int ruserpass(const char *host, const char **aname, const char **apass); |
| 486 | libc_hidden_proto(ruserpass) |
| 487 | |
| 488 | |
| 489 | #ifdef __USE_BSD |
| 490 | /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. |
| 491 | The local user is LOCUSER, on the remote machine the command is |
| 492 | executed as REMUSER. In *FD2P the descriptor to the socket for the |
| 493 | connection is returned. The caller must have the right to use a |
| 494 | reserved port. When the function returns *AHOST contains the |
| 495 | official host name. |
| 496 | |
| 497 | This function is not part of POSIX and therefore no official |
| 498 | cancellation point. But due to similarity with an POSIX interface |
| 499 | or due to the implementation it is a cancellation point and |
| 500 | therefore not marked with __THROW. */ |
| 501 | extern int rcmd (char **__restrict __ahost, unsigned short int __rport, |
| 502 | __const char *__restrict __locuser, |
| 503 | __const char *__restrict __remuser, |
| 504 | __const char *__restrict __cmd, int *__restrict __fd2p); |
| 505 | |
| 506 | #if 0 |
| 507 | /* FIXME */ |
| 508 | /* This is the equivalent function where the protocol can be selected |
| 509 | and which therefore can be used for IPv6. |
| 510 | |
| 511 | This function is not part of POSIX and therefore no official |
| 512 | cancellation point. But due to similarity with an POSIX interface |
| 513 | or due to the implementation it is a cancellation point and |
| 514 | therefore not marked with __THROW. */ |
| 515 | extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport, |
| 516 | __const char *__restrict __locuser, |
| 517 | __const char *__restrict __remuser, |
| 518 | __const char *__restrict __cmd, int *__restrict __fd2p, |
| 519 | sa_family_t __af); |
| 520 | #endif |
| 521 | |
| 522 | /* Call `rexecd' at port RPORT on remote machine *AHOST to execute |
| 523 | CMD. The process runs at the remote machine using the ID of user |
| 524 | NAME whose cleartext password is PASSWD. In *FD2P the descriptor |
| 525 | to the socket for the connection is returned. When the function |
| 526 | returns *AHOST contains the official host name. |
| 527 | |
| 528 | This function is not part of POSIX and therefore no official |
| 529 | cancellation point. But due to similarity with an POSIX interface |
| 530 | or due to the implementation it is a cancellation point and |
| 531 | therefore not marked with __THROW. */ |
| 532 | extern int rexec (char **__restrict __ahost, int __rport, |
| 533 | __const char *__restrict __name, |
| 534 | __const char *__restrict __pass, |
| 535 | __const char *__restrict __cmd, int *__restrict __fd2p); |
| 536 | |
| 537 | /* This is the equivalent function where the protocol can be selected |
| 538 | and which therefore can be used for IPv6. |
| 539 | |
| 540 | This function is not part of POSIX and therefore no official |
| 541 | cancellation point. But due to similarity with an POSIX interface |
| 542 | or due to the implementation it is a cancellation point and |
| 543 | therefore not marked with __THROW. */ |
| 544 | extern int rexec_af (char **__restrict __ahost, int __rport, |
| 545 | __const char *__restrict __name, |
| 546 | __const char *__restrict __pass, |
| 547 | __const char *__restrict __cmd, int *__restrict __fd2p, |
| 548 | sa_family_t __af); |
| 549 | libc_hidden_proto(rexec_af) |
| 550 | |
| 551 | /* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER. |
| 552 | If SUSER is not zero the user tries to become superuser. Return 0 if |
| 553 | it is possible. |
| 554 | |
| 555 | This function is not part of POSIX and therefore no official |
| 556 | cancellation point. But due to similarity with an POSIX interface |
| 557 | or due to the implementation it is a cancellation point and |
| 558 | therefore not marked with __THROW. */ |
| 559 | extern int ruserok (__const char *__rhost, int __suser, |
| 560 | __const char *__remuser, __const char *__locuser); |
| 561 | |
| 562 | #if 0 |
| 563 | /* FIXME */ |
| 564 | /* This is the equivalent function where the protocol can be selected |
| 565 | and which therefore can be used for IPv6. |
| 566 | |
| 567 | This function is not part of POSIX and therefore no official |
| 568 | cancellation point. But due to similarity with an POSIX interface |
| 569 | or due to the implementation it is a cancellation point and |
| 570 | therefore not marked with __THROW. */ |
| 571 | extern int ruserok_af (__const char *__rhost, int __suser, |
| 572 | __const char *__remuser, __const char *__locuser, |
| 573 | sa_family_t __af); |
| 574 | #endif |
| 575 | |
| 576 | /* Try to allocate reserved port, returning a descriptor for a socket opened |
| 577 | at this port or -1 if unsuccessful. The search for an available port |
| 578 | will start at ALPORT and continues with lower numbers. |
| 579 | |
| 580 | This function is not part of POSIX and therefore no official |
| 581 | cancellation point. But due to similarity with an POSIX interface |
| 582 | or due to the implementation it is a cancellation point and |
| 583 | therefore not marked with __THROW. */ |
| 584 | extern int rresvport (int *__alport); |
| 585 | libc_hidden_proto(rresvport) |
| 586 | |
| 587 | #if 0 |
| 588 | /* FIXME */ |
| 589 | /* This is the equivalent function where the protocol can be selected |
| 590 | and which therefore can be used for IPv6. |
| 591 | |
| 592 | This function is not part of POSIX and therefore no official |
| 593 | cancellation point. But due to similarity with an POSIX interface |
| 594 | or due to the implementation it is a cancellation point and |
| 595 | therefore not marked with __THROW. */ |
| 596 | extern int rresvport_af (int *__alport, sa_family_t __af); |
| 597 | #endif |
| 598 | #endif |
| 599 | |
| 600 | |
| 601 | /* Extension from POSIX.1g. */ |
| 602 | #ifdef __USE_POSIX |
| 603 | /* Structure to contain information about address of a service provider. */ |
| 604 | struct addrinfo |
| 605 | { |
| 606 | int ai_flags; /* Input flags. */ |
| 607 | int ai_family; /* Protocol family for socket. */ |
| 608 | int ai_socktype; /* Socket type. */ |
| 609 | int ai_protocol; /* Protocol for socket. */ |
| 610 | socklen_t ai_addrlen; /* Length of socket address. */ |
| 611 | struct sockaddr *ai_addr; /* Socket address for socket. */ |
| 612 | char *ai_canonname; /* Canonical name for service location. */ |
| 613 | struct addrinfo *ai_next; /* Pointer to next in list. */ |
| 614 | }; |
| 615 | |
| 616 | /* Possible values for `ai_flags' field in `addrinfo' structure. */ |
| 617 | # define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ |
| 618 | # define AI_CANONNAME 0x0002 /* Request for canonical name. */ |
| 619 | # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ |
| 620 | # define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ |
| 621 | # define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ |
| 622 | # define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose |
| 623 | returned address type.. */ |
| 624 | # ifdef __USE_GNU |
| 625 | # define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded |
| 626 | in the current locale's character set) |
| 627 | before looking it up. */ |
| 628 | # define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */ |
| 629 | # define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode |
| 630 | code points. */ |
| 631 | # define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to |
| 632 | STD3 rules. */ |
| 633 | # endif |
| 634 | # define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ |
| 635 | |
| 636 | /* Error values for `getaddrinfo' function. */ |
| 637 | # define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ |
| 638 | # define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ |
| 639 | # define EAI_AGAIN -3 /* Temporary failure in name resolution. */ |
| 640 | # define EAI_FAIL -4 /* Non-recoverable failure in name res. */ |
| 641 | # define EAI_NODATA -5 /* No address associated with NAME. */ |
| 642 | # define EAI_FAMILY -6 /* `ai_family' not supported. */ |
| 643 | # define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ |
| 644 | # define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ |
| 645 | # define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ |
| 646 | # define EAI_MEMORY -10 /* Memory allocation failure. */ |
| 647 | # define EAI_SYSTEM -11 /* System error returned in `errno'. */ |
| 648 | # define EAI_OVERFLOW -12 /* Argument buffer overflow. */ |
| 649 | # ifdef __USE_GNU |
| 650 | # define EAI_INPROGRESS -100 /* Processing request in progress. */ |
| 651 | # define EAI_CANCELED -101 /* Request canceled. */ |
| 652 | # define EAI_NOTCANCELED -102 /* Request not canceled. */ |
| 653 | # define EAI_ALLDONE -103 /* All requests done. */ |
| 654 | # define EAI_INTR -104 /* Interrupted by a signal. */ |
| 655 | # define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ |
| 656 | # endif |
| 657 | |
| 658 | # define NI_MAXHOST 1025 |
| 659 | # define NI_MAXSERV 32 |
| 660 | |
| 661 | # define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ |
| 662 | # define NI_NUMERICSERV 2 /* Don't convert port number to name. */ |
| 663 | # define NI_NOFQDN 4 /* Only return nodename portion. */ |
| 664 | # define NI_NAMEREQD 8 /* Don't return numeric addresses. */ |
| 665 | # define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ |
| 666 | # ifdef __USE_GNU |
| 667 | # define NI_IDN 32 /* Convert name from IDN format. */ |
| 668 | # define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode |
| 669 | code points. */ |
| 670 | # define NI_IDN_USE_STD3_ASCII_RULES 128 /* Validate strings according to |
| 671 | STD3 rules. */ |
| 672 | # endif |
| 673 | |
| 674 | /* Translate name of a service location and/or a service name to set of |
| 675 | socket addresses. |
| 676 | |
| 677 | This function is a possible cancellation point and therefore not |
| 678 | marked with __THROW. */ |
| 679 | extern int getaddrinfo (__const char *__restrict __name, |
| 680 | __const char *__restrict __service, |
| 681 | __const struct addrinfo *__restrict __req, |
| 682 | struct addrinfo **__restrict __pai); |
| 683 | libc_hidden_proto(getaddrinfo) |
| 684 | |
| 685 | /* Free `addrinfo' structure AI including associated storage. */ |
| 686 | extern void freeaddrinfo (struct addrinfo *__ai) __THROW; |
| 687 | libc_hidden_proto(freeaddrinfo) |
| 688 | |
| 689 | /* Convert error return from getaddrinfo() to a string. */ |
| 690 | extern __const char *gai_strerror (int __ecode) __THROW; |
| 691 | |
| 692 | /* Translate a socket address to a location and service name. |
| 693 | |
| 694 | This function is a possible cancellation point and therefore not |
| 695 | marked with __THROW. */ |
| 696 | extern int getnameinfo (__const struct sockaddr *__restrict __sa, |
| 697 | socklen_t __salen, char *__restrict __host, |
| 698 | socklen_t __hostlen, char *__restrict __serv, |
| 699 | socklen_t __servlen, unsigned int __flags); |
| 700 | libc_hidden_proto(getnameinfo) |
| 701 | #endif /* POSIX */ |
| 702 | |
| 703 | __END_DECLS |
| 704 | |
| 705 | #endif /* netdb.h */ |