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);
253
254 struct protoent *getprotobyname_r
255 (const char *, struct protoent *, char *, int);
256 struct protoent *getprotobynumber_r
257 (int, struct protoent *, char *, int);
258 struct protoent *getprotoent_r(struct protoent *, char *, int);
259
260 int getnetgrent_r(char **, char **, char **, char *, int);
261 int innetgr(const char *, const char *, const char *, const char *);
262 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
263
264 /* Old interfaces that return a pointer to a static area; MT-unsafe */
265 struct hostent *gethostbyname(const char *);
266 struct hostent *gethostent(void);
267 struct netent *getnetbyaddr(in_addr_t, int);
268 struct netent *getnetbyname(const char *);
269 struct netent *getnetent(void);
270 struct protoent *getprotobyname(const char *);
271 struct protoent *getprotobynumber(int);
272 struct protoent *getprotoent(void);
273 struct servent *getservbyname(const char *, const char *);
274 struct servent *getservbyport(int, const char *);
275 struct servent *getservent(void);
276
277 /* gethostbyaddr() second argument is a size_t only in unix95/unix98 */
278 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
279 struct hostent *gethostbyaddr(const void *, socklen_t, int);
280 #else
281 struct hostent *gethostbyaddr(const void *, size_t, int);
282 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
283
284 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
285 int endhostent(void);
286 int endnetent(void);
287 int endprotoent(void);
288 int endservent(void);
289 int sethostent(int);
290 int setnetent(int);
291 int setprotoent(int);
292 int setservent(int);
293 #else
294 void endhostent(void);
295 void endnetent(void);
296 void endprotoent(void);
297 void endservent(void);
298 void sethostent(int);
299 void setnetent(int);
300 void setprotoent(int);
301 void setservent(int);
302 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
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 */
465 #define NETDB_INTERNAL -1 /* see errno */
466 #define NETDB_SUCCESS 0 /* no problem */
467 /* End BIND */
468
469 #define MAXHOSTNAMELEN 256
470
471 #define MAXALIASES 35
472 #define MAXADDRS 35
473 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
474
475 #ifdef __cplusplus
476 }
477 #endif
478
479 #endif /* _NETDB_H */
|
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 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
233 struct hostent *gethostbyname_r
234 (const char *, struct hostent *, char *, int, int *h_errnop);
235 struct hostent *gethostbyaddr_r
236 (const char *, int, int, struct hostent *, char *, int, int *h_errnop);
237 struct hostent *getipnodebyname(const char *, int, int, int *);
238 struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
239 void freehostent(struct hostent *);
240 struct hostent *gethostent_r(struct hostent *, char *, int, int *h_errnop);
241
242 struct servent *getservbyname_r
243 (const char *name, const char *, struct servent *, char *, int);
244 struct servent *getservbyport_r
245 (int port, const char *, struct servent *, char *, int);
246 struct servent *getservent_r(struct servent *, char *, int);
247
248 struct netent *getnetbyname_r
249 (const char *, struct netent *, char *, int);
250 struct netent *getnetbyaddr_r(long, int, struct netent *, char *, int);
251 struct netent *getnetent_r(struct netent *, char *, int);
252
253 struct protoent *getprotobyname_r
254 (const char *, struct protoent *, char *, int);
255 struct protoent *getprotobynumber_r
256 (int, struct protoent *, char *, int);
257 struct protoent *getprotoent_r(struct protoent *, char *, int);
258
259 int getnetgrent_r(char **, char **, char **, char *, int);
260 int innetgr(const char *, const char *, const char *, const char *);
261 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
262
263 /* Old interfaces that return a pointer to a static area; MT-unsafe */
264 #ifndef _STRICT_XPG7
265 struct hostent *gethostbyname(const char *);
266 #endif
267 struct hostent *gethostent(void);
268 struct netent *getnetbyaddr(in_addr_t, int);
269 struct netent *getnetbyname(const char *);
270 struct netent *getnetent(void);
271 struct protoent *getprotobyname(const char *);
272 struct protoent *getprotobynumber(int);
273 struct protoent *getprotoent(void);
274 struct servent *getservbyname(const char *, const char *);
275 struct servent *getservbyport(int, const char *);
276 struct servent *getservent(void);
277
278 /*
279 * gethostbyaddr() second argument is a size_t only in unix95/unix98,
280 * removed in XPG issue 7
281 */
282 #if !defined(_STRICT_XPG7)
283 #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
284 struct hostent *gethostbyaddr(const void *, socklen_t, int);
285 #else
286 struct hostent *gethostbyaddr(const void *, size_t, int);
287 #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
288 #endif /* !defined(_STRICT_XPG7) */
289
290 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
291 int endhostent(void);
292 int endnetent(void);
293 int endprotoent(void);
294 int endservent(void);
295 int sethostent(int);
296 int setnetent(int);
297 int setprotoent(int);
298 int setservent(int);
299 #else
300 void endhostent(void);
301 void endnetent(void);
302 void endprotoent(void);
303 void endservent(void);
304 void sethostent(int);
305 void setnetent(int);
306 void setprotoent(int);
307 void setservent(int);
308 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
342 const char *, const char *, const char *, int *);
343 int rexec_af(char **, unsigned short,
344 const char *, const char *, const char *, int *, int);
345 int rresvport(int *);
346 int ruserok(const char *, int, const char *, const char *);
347 /* BIND */
348 struct hostent *gethostbyname2(const char *, int);
349 void herror(const char *);
350 const char *hstrerror(int);
351 /* End BIND */
352
353 /* IPsec algorithm prototype definitions */
354 struct ipsecalgent *getipsecalgbyname(const char *, int, int *);
355 struct ipsecalgent *getipsecalgbynum(int, int, int *);
356 int getipsecprotobyname(const char *doi_name);
357 char *getipsecprotobynum(int doi_domain);
358 void freeipsecalgent(struct ipsecalgent *ptr);
359 /* END IPsec algorithm prototype definitions */
360
361 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
362
363 /*
364 * Error return codes from gethostbyname() and gethostbyaddr()
365 * (when using the resolver)
366 */
367
368 /* h_errno was removed in Issue 7 */
369 #if !defined(_STRICT_XPG7)
370 extern int h_errno;
371
372 #ifdef _REENTRANT
373 extern int *__h_errno(void);
374
375 /* Only #define h_errno if there is no conflict with other use */
376 #ifdef H_ERRNO_IS_FUNCTION
377 #define h_errno (*__h_errno())
378 #endif /* NO_H_ERRNO_DEFINE */
379 #endif /* _REENTRANT */
380
381 /*
382 * Error return codes from gethostbyname() and gethostbyaddr()
383 * (left in extern int h_errno).
384 */
385 #define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
386 #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
387 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
388 #define NO_DATA 4 /* Valid name, no data record of requested type */
389
390 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
391 #define NO_ADDRESS NO_DATA /* no address, look for MX record */
392
393 /* BIND */
394 #define NETDB_INTERNAL -1 /* see errno */
395 #define NETDB_SUCCESS 0 /* no problem */
396 /* End BIND */
397
398 #endif /* !defined(_STRICT_XPG7) */
399
400 #define MAXHOSTNAMELEN 256
401
402 #define MAXALIASES 35
403 #define MAXADDRS 35
404 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
405
406 #ifdef __cplusplus
407 }
408 #endif
409
410 #endif /* _NETDB_H */
|