1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is the Netscape Portable Runtime (NSPR).
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998-2000
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | *
|
---|
24 | * Alternatively, the contents of this file may be used under the terms of
|
---|
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
28 | * of those above. If you wish to allow use of your version of this file only
|
---|
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
30 | * use your version of this file under the terms of the MPL, indicate your
|
---|
31 | * decision by deleting the provisions above and replace them with the notice
|
---|
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
33 | * the provisions above, a recipient may use your version of this file under
|
---|
34 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | /*
|
---|
39 | * plresolv.h - asynchronous name resolution using DNS
|
---|
40 | */
|
---|
41 |
|
---|
42 | #ifndef _PLRESOLV_H_
|
---|
43 | #define _PLRESOLV_H_
|
---|
44 |
|
---|
45 | /*
|
---|
46 | ** THIS IS WORK IN PROGRESS. DO NOT ATTEMPT TO USE ANY PORTION OF THIS
|
---|
47 | ** API UNTIL THIS MESSAGE NO LONGER EXISTS. IF YOU DO, THEN YOU SURRENDER
|
---|
48 | ** THE RIGHT TO COMPLAIN ABOUT ANY CONTENT.
|
---|
49 | */
|
---|
50 |
|
---|
51 | #if defined(XP_UNIX)
|
---|
52 |
|
---|
53 | #include <prtypes.h>
|
---|
54 | #include <prnetdb.h>
|
---|
55 |
|
---|
56 | NSPR_BEGIN_EXTERN_C
|
---|
57 |
|
---|
58 | #define PL_RESOLVE_MAXHOSTENTBUF 1024
|
---|
59 | #define PL_RESOLVE_DEFAULT_TIMEOUT 0
|
---|
60 |
|
---|
61 | /* Error return codes */
|
---|
62 | #define PL_RESOLVE_OK 0
|
---|
63 | #define PL_RESOLVE_EWINIT 1 /* Failed to initialize window */
|
---|
64 | #define PL_RESOLVE_EMAKE 2 /* Failed to create request */
|
---|
65 | #define PL_RESOLVE_ELAUNCH 3 /* Error launching Async request */
|
---|
66 | #define PL_RESOLVE_ETIMEDOUT 4 /* Request timed-out */
|
---|
67 | #define PL_RESOLVE_EINVAL 5 /* Invalid argument */
|
---|
68 | #define PL_RESOLVE_EOVERFLOW 6 /* Buffer Overflow */
|
---|
69 | #define PL_RESOLVE_EUNKNOWN 7 /* berzerk error */
|
---|
70 |
|
---|
71 | /* ----------- Function Prototypes ----------------*/
|
---|
72 |
|
---|
73 | PR_EXTERN(PRStatus) PL_ResolveName(
|
---|
74 | const char *name, unsigned char *buf,
|
---|
75 | PRIntn bufsize, PRIntervalTime timeout,
|
---|
76 | PRHostEnt *hostentry, PRIntervalTime *ttl);
|
---|
77 |
|
---|
78 | PR_EXTERN(PRStatus) PL_ResolveAddr(
|
---|
79 | const PRNetAddr *address, unsigned char *buf,
|
---|
80 | PRIntn bufsize, PRIntervalTime timeout,
|
---|
81 | PRHostEnt *hostentry, PRIntervalTime *ttl);
|
---|
82 |
|
---|
83 | typedef struct PLResolveStats {
|
---|
84 | int re_errors;
|
---|
85 | int re_nu_look;
|
---|
86 | int re_na_look;
|
---|
87 | int re_replies;
|
---|
88 | int re_requests;
|
---|
89 | int re_resends;
|
---|
90 | int re_sent;
|
---|
91 | int re_timeouts;
|
---|
92 | } PLResolveStats;
|
---|
93 |
|
---|
94 | typedef struct PLResoveInfo {
|
---|
95 | PRBool enabled;
|
---|
96 | PRUint32 numNameLookups;
|
---|
97 | PRUint32 numAddrLookups;
|
---|
98 | PRUint32 numLookupsInProgress;
|
---|
99 | PLResolveStats stats;
|
---|
100 | } PLResoveInfo;
|
---|
101 |
|
---|
102 | PR_EXTERN(void) PL_ResolveInfo(PLResoveInfo *info);
|
---|
103 |
|
---|
104 | NSPR_END_EXTERN_C
|
---|
105 |
|
---|
106 | #endif /* defined(XP_UNIX) */
|
---|
107 |
|
---|
108 | #endif /* _PLRESOLV_H_ */
|
---|