revert between 56095 -> 55830 in arch
[AROS.git] / workbench / network / stacks / AROSTCP / bsdsocket / api / resolv.h
blob545b6842b11c643319704967bcec9f12418a76f3
1 /*
2 * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
3 * All rights reserved.
4 * Copyright (C) 2005 - 2007 The AROS Dev Team
6 * Redistribution and use in source and binary forms are permitted
7 * provided that: (1) source distributions retain this entire copyright
8 * notice and comment, and (2) distributions including binaries display
9 * the following acknowledgement: ``This product includes software
10 * developed by the University of California, Berkeley and its contributors''
11 * in the documentation or other materials provided with the distribution
12 * and in all advertising materials mentioning features or use of this
13 * software. Neither the name of the University nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 * @(#)resolv.h 5.10 (Berkeley) 6/1/90
23 #ifndef API_RESOLV_H
24 #define API_RESOLV_H
26 #include <arpa/nameser.h>
29 * Global defines and variables for resolver stub. (INSIDE AmiTCP/IP)
31 #define MAXDFLSRCH 3 /* # default domain levels to try */
32 #define LOCALDOMAINPARTS 2 /* min levels in name that is "local"*/
34 #define RES_TIMEOUT 5 /* min. seconds between retries */
37 * defines to hook variables to the library base.
39 #define h_errno (*libPtr->hErrnoPtr)
40 #define _res (libPtr->res_state)
41 #define res_sock (libPtr->res_socket)
44 * Resolver options
46 #define RES_INIT 0x0001 /* address initialized */
47 #ifndef AMITCP /* IMPORTANT TO HAVE RES_DEBUG NOT DEFINED IF NOT DEBUGGING */
48 #define RES_DEBUG 0x0002 /* print debug messages */
49 #endif
50 #define RES_AAONLY 0x0004 /* authoritative answers only */
51 #define RES_USEVC 0x0008 /* use virtual circuit */
52 #define RES_PRIMARY 0x0010 /* query primary server only */
53 #define RES_IGNTC 0x0020 /* ignore trucation errors */
54 #define RES_RECURSE 0x0040 /* recursion desired */
55 #define RES_DEFNAMES 0x0080 /* use default domain name */
56 #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
57 #define RES_DNSRCH 0x0200 /* search up local domain tree */
59 #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_INIT)
61 #define AROSTCP_RES_DISABLED 0x8000 /* Implements MiamiDisallowDNS() */
63 /* Resolver state */
64 struct state {
65 int retrans; /* retransmition time interval */
66 int retry; /* number of times to retransmit */
67 long options; /* option flags - see below. */
68 u_short id; /* current packet id */
69 ULONG dbserial;
70 char **dnsrch;
71 struct in_addr *nsaddr_list;
74 #ifndef AMITCP /* AmiTCP has this in the SocketBase */
75 extern struct state _res;
76 #endif
79 * Prototypes
81 extern int res_init(struct state *state);
82 extern int res_update_db(struct state *state);
83 extern void res_cleanup_db(struct state *state);
84 extern int res_query(struct SocketBase *,
85 const char *, int, int, u_char *, int);
86 extern int res_search(struct SocketBase *,
87 const char *, int, int, u_char *, int);
88 extern int dn_expand(const u_char *, const u_char *, const u_char *, u_char *,
89 int);
90 extern int dn_comp(const u_char *, u_char *, int, u_char **, u_char **);
91 extern int __dn_skipname(const u_char *, const u_char *);
93 /* struct rrec; */
94 extern int res_mkquery(struct SocketBase *,
95 int, const char *, int, int, const char *,
96 int, const struct rrec *, char *, int);
97 extern int res_querydomain(struct SocketBase *, const char *, const char *,
98 int, int, u_char *, int);
99 extern int res_send(struct SocketBase *, const char *, int, char *, int);
100 extern void _res_close(struct SocketBase *);
102 extern u_short _getshort(u_char *);
103 extern u_long _getlong(u_char *);
104 extern void __putshort(u_short, u_char *);
105 extern void __putlong(u_long, u_char *);
107 #endif /* API_RESOLV_H */