[9] | 1 | /*
|
---|
| 2 | * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms are permitted
|
---|
| 6 | * provided that: (1) source distributions retain this entire copyright
|
---|
| 7 | * notice and comment, and (2) distributions including binaries display
|
---|
| 8 | * the following acknowledgement: ``This product includes software
|
---|
| 9 | * developed by the University of California, Berkeley and its contributors''
|
---|
| 10 | * in the documentation or other materials provided with the distribution
|
---|
| 11 | * and in all advertising materials mentioning features or use of this
|
---|
| 12 | * software. Neither the name of the University nor the names of its
|
---|
| 13 | * contributors may be used to endorse or promote products derived
|
---|
| 14 | * from this software without specific prior written permission.
|
---|
| 15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
---|
| 16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
---|
| 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 18 | *
|
---|
| 19 | * @(#)resolv.h 5.10 (Berkeley) 6/1/90
|
---|
| 20 | */
|
---|
| 21 | #ifndef _NET__GEN__RESOLV_H
|
---|
| 22 | #define _NET__GEN__RESOLV_H
|
---|
| 23 |
|
---|
| 24 | /*
|
---|
| 25 | * Resolver configuration file.
|
---|
| 26 | * Normally not present, but may contain the address of the
|
---|
| 27 | * inital name server(s) to query and the domain search list.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | #ifndef _PATH_RESCONF
|
---|
| 31 | #define _PATH_RESCONF "/etc/resolv.conf"
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | /*
|
---|
| 35 | * Global defines and variables for resolver stub.
|
---|
| 36 | */
|
---|
| 37 | #define MAXNS 3 /* max # name servers we'll track */
|
---|
| 38 | #define MAXDFLSRCH 3 /* # default domain levels to try */
|
---|
| 39 | #define MAXDNSRCH 6 /* max # domains in search path */
|
---|
| 40 | #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
|
---|
| 41 |
|
---|
| 42 | #define RES_TIMEOUT 5 /* min. seconds between retries */
|
---|
| 43 |
|
---|
| 44 | #define NAMESERVER_PORT 53
|
---|
| 45 |
|
---|
| 46 | struct state {
|
---|
| 47 | int retrans; /* retransmition time interval */
|
---|
| 48 | int retry; /* number of times to retransmit */
|
---|
| 49 | long options; /* option flags - see below. */
|
---|
| 50 | int nscount; /* number of name servers */
|
---|
| 51 | ipaddr_t nsaddr_list[MAXNS]; /* address of name server */
|
---|
| 52 | #define nsaddr nsaddr_list[0] /* for backward compatibility */
|
---|
| 53 | u16_t nsport_list[MAXNS]; /* port of name server */
|
---|
| 54 | u16_t id; /* current packet id */
|
---|
| 55 | char defdname[MAXDNAME]; /* default domain */
|
---|
| 56 | char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | /*
|
---|
| 60 | * Resolver options
|
---|
| 61 | */
|
---|
| 62 | #define RES_INIT 0x0001 /* address initialized */
|
---|
| 63 | #define RES_DEBUG 0x0002 /* print debug messages */
|
---|
| 64 | #define RES_AAONLY 0x0004 /* authoritative answers only */
|
---|
| 65 | #define RES_USEVC 0x0008 /* use virtual circuit */
|
---|
| 66 | #define RES_PRIMARY 0x0010 /* query primary server only */
|
---|
| 67 | #define RES_IGNTC 0x0020 /* ignore trucation errors */
|
---|
| 68 | #define RES_RECURSE 0x0040 /* recursion desired */
|
---|
| 69 | #define RES_DEFNAMES 0x0080 /* use default domain name */
|
---|
| 70 | #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
|
---|
| 71 | #define RES_DNSRCH 0x0200 /* search up local domain tree */
|
---|
| 72 |
|
---|
| 73 | #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH )
|
---|
| 74 |
|
---|
| 75 | extern struct state _res;
|
---|
| 76 |
|
---|
| 77 | struct rrec;
|
---|
| 78 |
|
---|
| 79 | int res_init _ARGS(( void ));
|
---|
| 80 | int res_mkquery _ARGS(( int op, const char *dname, int class, int type,
|
---|
| 81 | const char *data, int datalen, const struct rrec *newrr,
|
---|
| 82 | char *buf, int buflen ));
|
---|
| 83 | int res_query _ARGS(( char *name, int class, int type, u8_t *answer,
|
---|
| 84 | int anslen ));
|
---|
| 85 | int res_querydomain _ARGS(( char *name, char *domain, int class, int type,
|
---|
| 86 | u8_t *answer, int anslen ));
|
---|
| 87 | int res_search _ARGS(( char *name, int class, int type, u8_t *answer,
|
---|
| 88 | int anslen ));
|
---|
| 89 | int res_send _ARGS(( const char *buf, int buflen, char *answer, int anslen ));
|
---|
| 90 | void _res_close _ARGS(( void ));
|
---|
| 91 |
|
---|
| 92 | int dn_comp _ARGS(( const u8_t *exp_dn, u8_t *comp_dn, int length,
|
---|
| 93 | u8_t **dnptrs, u8_t **lastdnptr ));
|
---|
| 94 | int dn_expand _ARGS(( const u8_t *msg, const u8_t *eomorig,
|
---|
| 95 | const u8_t *comp_dn, u8_t *exp_dn, int length ));
|
---|
| 96 | int dn_skipname _ARGS(( const u8_t *comp_dn, const u8_t *eom ));
|
---|
| 97 |
|
---|
| 98 | char *__hostalias _ARGS(( const char *name ));
|
---|
| 99 |
|
---|
| 100 | u16_t _getshort _ARGS(( const u8_t *msgp ));
|
---|
| 101 | u32_t _getlong _ARGS(( const u8_t *msgp ));
|
---|
| 102 | void __putshort _ARGS(( U16_t s, u8_t *msgp ));
|
---|
| 103 | void __putlong _ARGS(( u32_t l, u8_t *msgp ));
|
---|
| 104 |
|
---|
| 105 | void p_query _ARGS(( char *msg ));
|
---|
| 106 |
|
---|
| 107 | #endif /* _NET__GEN__RESOLV_H */
|
---|