Print this page
remove support for non-ANSI compilation
   1 /*


   2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */
   5 
   6 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
   7 /*        All Rights Reserved   */
   8 
   9 /*
  10  * BIND 4.9.3:
  11  *
  12  * Copyright (c) 1980, 1983, 1988, 1993
  13  *      The Regents of the University of California.  All rights reserved.
  14  *
  15  * Redistribution and use in source and binary forms, with or without
  16  * modification, are permitted provided that the following conditions
  17  * are met:
  18  * 1. Redistributions of source code must retain the above copyright
  19  *    notice, this list of conditions and the following disclaimer.
  20  * 2. Redistributions in binary form must reproduce the above copyright
  21  *    notice, this list of conditions and the following disclaimer in the


 212 struct  netent {
 213         char            *n_name;        /* official name of net */
 214         char            **n_aliases;    /* alias list */
 215         int             n_addrtype;     /* net address type */
 216         in_addr_t       n_net;          /* network # */
 217 };
 218 
 219 struct  protoent {
 220         char    *p_name;        /* official protocol name */
 221         char    **p_aliases;    /* alias list */
 222         int     p_proto;        /* protocol # */
 223 };
 224 
 225 struct  servent {
 226         char    *s_name;        /* official service name */
 227         char    **s_aliases;    /* alias list */
 228         int     s_port;         /* port # */
 229         char    *s_proto;       /* protocol to use */
 230 };
 231 
 232 #ifdef  __STDC__
 233 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 234 struct hostent  *gethostbyname_r
 235         (const char *, struct hostent *, char *, int, int *h_errnop);
 236 struct hostent  *gethostbyaddr_r
 237         (const char *, int, int, struct hostent *, char *, int, int *h_errnop);
 238 struct hostent  *getipnodebyname(const char *, int, int, int *);
 239 struct hostent  *getipnodebyaddr(const void *, size_t, int, int *);
 240 void            freehostent(struct hostent *);
 241 struct hostent  *gethostent_r(struct hostent *, char *, int, int *h_errnop);
 242 
 243 struct servent  *getservbyname_r
 244         (const char *name, const char *, struct servent *, char *, int);
 245 struct servent  *getservbyport_r
 246         (int port, const char *, struct servent *, char *, int);
 247 struct servent  *getservent_r(struct    servent *, char *, int);
 248 
 249 struct netent   *getnetbyname_r
 250         (const char *, struct netent *, char *, int);
 251 struct netent   *getnetbyaddr_r(long, int, struct netent *, char *, int);
 252 struct netent   *getnetent_r(struct netent *, char *, int);


 336         const char *, const char *, const char *, int *);
 337 int rexec_af(char **, unsigned short,
 338         const char *, const char *, const char *, int *, int);
 339 int rresvport(int *);
 340 int ruserok(const char *, int, const char *, const char *);
 341 /* BIND */
 342 struct hostent  *gethostbyname2(const char *, int);
 343 void            herror(const char *);
 344 const char      *hstrerror(int);
 345 /* End BIND */
 346 
 347 /* IPsec algorithm prototype definitions */
 348 struct ipsecalgent *getipsecalgbyname(const char *, int, int *);
 349 struct ipsecalgent *getipsecalgbynum(int, int, int *);
 350 int getipsecprotobyname(const char *doi_name);
 351 char *getipsecprotobynum(int doi_domain);
 352 void freeipsecalgent(struct ipsecalgent *ptr);
 353 /* END IPsec algorithm prototype definitions */
 354 
 355 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
 356 #else   /* __STDC__ */
 357 struct hostent  *gethostbyname_r();
 358 struct hostent  *gethostbyaddr_r();
 359 struct hostent  *getipnodebyname();
 360 struct hostent  *getipnodebyaddr();
 361 void             freehostent();
 362 struct hostent  *gethostent_r();
 363 struct servent  *getservbyname_r();
 364 struct servent  *getservbyport_r();
 365 struct servent  *getservent_r();
 366 struct netent   *getnetbyname_r();
 367 struct netent   *getnetbyaddr_r();
 368 struct netent   *getnetent_r();
 369 struct protoent *getprotobyname_r();
 370 struct protoent *getprotobynumber_r();
 371 struct protoent *getprotoent_r();
 372 int              getnetgrent_r();
 373 int              innetgr();
 374 
 375 /* Old interfaces that return a pointer to a static area;  MT-unsafe */
 376 struct hostent  *gethostbyname();
 377 struct hostent  *gethostbyaddr();
 378 struct hostent  *gethostent();
 379 struct netent   *getnetbyname();
 380 struct netent   *getnetbyaddr();
 381 struct netent   *getnetent();
 382 struct servent  *getservbyname();
 383 struct servent  *getservbyport();
 384 struct servent  *getservent();
 385 struct protoent *getprotobyname();
 386 struct protoent *getprotobynumber();
 387 struct protoent *getprotoent();
 388 int              getnetgrent();
 389 
 390 int sethostent();
 391 int endhostent();
 392 int setnetent();
 393 int endnetent();
 394 int setservent();
 395 int endservent();
 396 int setprotoent();
 397 int endprotoent();
 398 int setnetgrent();
 399 int endnetgrent();
 400 int rcmd();
 401 int rcmd_af();
 402 int rexec();
 403 int rexec_af();
 404 int rresvport();
 405 int rresvport_af();
 406 int rresvport_addr();
 407 int ruserok();
 408 /* BIND */
 409 struct hostent  *gethostbyname2();
 410 void            herror();
 411 char            *hstrerror();
 412 /* IPv6 prototype definitons */
 413 int             getaddrinfo();
 414 void            freeaddrinfo();
 415 const char      *gai_strerror();
 416 int             getnameinfo();
 417 /* END IPv6 prototype definitions */
 418 /* End BIND */
 419 
 420 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 421 /* IPsec algorithm prototype definitions */
 422 struct ipsecalgent *getalgbyname();
 423 struct ipsecalgent *getalgbydoi();
 424 int getdoidomainbyname();
 425 const char *getdoidomainbynum();
 426 void freealgent();
 427 /* END IPsec algorithm prototype definitions */
 428 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
 429 
 430 #endif  /* __STDC__ */
 431 
 432 /*
 433  * Error return codes from gethostbyname() and gethostbyaddr()
 434  * (when using the resolver)
 435  */
 436 
 437 extern  int h_errno;
 438 
 439 #ifdef  _REENTRANT
 440 #ifdef  __STDC__
 441 extern int      *__h_errno(void);
 442 #else
 443 extern int      *__h_errno();
 444 #endif  /* __STDC__ */
 445 
 446 /* Only #define h_errno if there is no conflict with other use */
 447 #ifdef  H_ERRNO_IS_FUNCTION
 448 #define h_errno (*__h_errno())
 449 #endif  /* NO_H_ERRNO_DEFINE */
 450 #endif  /* _REENTRANT */
 451 
 452 /*
 453  * Error return codes from gethostbyname() and gethostbyaddr()
 454  * (left in extern int h_errno).
 455  */
 456 #define HOST_NOT_FOUND  1 /* Authoritive Answer Host not found */
 457 #define TRY_AGAIN       2 /* Non-Authoritive Host not found, or SERVERFAIL */
 458 #define NO_RECOVERY     3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
 459 #define NO_DATA         4 /* Valid name, no data record of requested type */
 460 
 461 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 462 #define NO_ADDRESS      NO_DATA         /* no address, look for MX record */
 463 
 464 /* BIND */
   1 /*
   2  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
   3  *
   4  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   5  * Use is subject to license terms.
   6  */
   7 
   8 /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
   9 /*        All Rights Reserved   */
  10 
  11 /*
  12  * BIND 4.9.3:
  13  *
  14  * Copyright (c) 1980, 1983, 1988, 1993
  15  *      The Regents of the University of California.  All rights reserved.
  16  *
  17  * Redistribution and use in source and binary forms, with or without
  18  * modification, are permitted provided that the following conditions
  19  * are met:
  20  * 1. Redistributions of source code must retain the above copyright
  21  *    notice, this list of conditions and the following disclaimer.
  22  * 2. Redistributions in binary form must reproduce the above copyright
  23  *    notice, this list of conditions and the following disclaimer in the


 214 struct  netent {
 215         char            *n_name;        /* official name of net */
 216         char            **n_aliases;    /* alias list */
 217         int             n_addrtype;     /* net address type */
 218         in_addr_t       n_net;          /* network # */
 219 };
 220 
 221 struct  protoent {
 222         char    *p_name;        /* official protocol name */
 223         char    **p_aliases;    /* alias list */
 224         int     p_proto;        /* protocol # */
 225 };
 226 
 227 struct  servent {
 228         char    *s_name;        /* official service name */
 229         char    **s_aliases;    /* alias list */
 230         int     s_port;         /* port # */
 231         char    *s_proto;       /* protocol to use */
 232 };
 233 

 234 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 235 struct hostent  *gethostbyname_r
 236         (const char *, struct hostent *, char *, int, int *h_errnop);
 237 struct hostent  *gethostbyaddr_r
 238         (const char *, int, int, struct hostent *, char *, int, int *h_errnop);
 239 struct hostent  *getipnodebyname(const char *, int, int, int *);
 240 struct hostent  *getipnodebyaddr(const void *, size_t, int, int *);
 241 void            freehostent(struct hostent *);
 242 struct hostent  *gethostent_r(struct hostent *, char *, int, int *h_errnop);
 243 
 244 struct servent  *getservbyname_r
 245         (const char *name, const char *, struct servent *, char *, int);
 246 struct servent  *getservbyport_r
 247         (int port, const char *, struct servent *, char *, int);
 248 struct servent  *getservent_r(struct    servent *, char *, int);
 249 
 250 struct netent   *getnetbyname_r
 251         (const char *, struct netent *, char *, int);
 252 struct netent   *getnetbyaddr_r(long, int, struct netent *, char *, int);
 253 struct netent   *getnetent_r(struct netent *, char *, int);


 337         const char *, const char *, const char *, int *);
 338 int rexec_af(char **, unsigned short,
 339         const char *, const char *, const char *, int *, int);
 340 int rresvport(int *);
 341 int ruserok(const char *, int, const char *, const char *);
 342 /* BIND */
 343 struct hostent  *gethostbyname2(const char *, int);
 344 void            herror(const char *);
 345 const char      *hstrerror(int);
 346 /* End BIND */
 347 
 348 /* IPsec algorithm prototype definitions */
 349 struct ipsecalgent *getipsecalgbyname(const char *, int, int *);
 350 struct ipsecalgent *getipsecalgbynum(int, int, int *);
 351 int getipsecprotobyname(const char *doi_name);
 352 char *getipsecprotobynum(int doi_domain);
 353 void freeipsecalgent(struct ipsecalgent *ptr);
 354 /* END IPsec algorithm prototype definitions */
 355 
 356 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */


















 357 

























































 358 /*
 359  * Error return codes from gethostbyname() and gethostbyaddr()
 360  * (when using the resolver)
 361  */
 362 
 363 extern  int h_errno;
 364 
 365 #ifdef  _REENTRANT

 366 extern int      *__h_errno(void);



 367 
 368 /* Only #define h_errno if there is no conflict with other use */
 369 #ifdef  H_ERRNO_IS_FUNCTION
 370 #define h_errno (*__h_errno())
 371 #endif  /* NO_H_ERRNO_DEFINE */
 372 #endif  /* _REENTRANT */
 373 
 374 /*
 375  * Error return codes from gethostbyname() and gethostbyaddr()
 376  * (left in extern int h_errno).
 377  */
 378 #define HOST_NOT_FOUND  1 /* Authoritive Answer Host not found */
 379 #define TRY_AGAIN       2 /* Non-Authoritive Host not found, or SERVERFAIL */
 380 #define NO_RECOVERY     3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
 381 #define NO_DATA         4 /* Valid name, no data record of requested type */
 382 
 383 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
 384 #define NO_ADDRESS      NO_DATA         /* no address, look for MX record */
 385 
 386 /* BIND */