home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / lib / libc / include / plresolv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.8 KB  |  90 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /*
  20.  * plresolv.h - asynchronous name resolution using DNS 
  21.  */
  22.  
  23. #ifndef _PLRESOLV_H_
  24. #define _PLRESOLV_H_
  25.  
  26. /*
  27. ** THIS IS WORK IN PROGRESS. DO NOT ATTEMPT TO USE ANY PORTION OF THIS
  28. ** API UNTIL THIS MESSAGE NO LONGER EXISTS. IF YOU DO, THEN YOU SURRENDER
  29. ** THE RIGHT TO COMPLAIN ABOUT ANY CONTENT.
  30. */
  31.  
  32. #if defined(XP_UNIX)
  33.  
  34. #include <prtypes.h>
  35. #include <prnetdb.h>
  36.  
  37. NSPR_BEGIN_EXTERN_C
  38.  
  39. #define PL_RESOLVE_MAXHOSTENTBUF        1024
  40. #define PL_RESOLVE_DEFAULT_TIMEOUT      0
  41.  
  42. /* Error return codes */
  43. #define PL_RESOLVE_OK            0
  44. #define PL_RESOLVE_EWINIT        1           /* Failed to initialize window */
  45. #define PL_RESOLVE_EMAKE         2           /* Failed to create request */
  46. #define PL_RESOLVE_ELAUNCH       3           /* Error launching Async request */
  47. #define PL_RESOLVE_ETIMEDOUT     4           /* Request timed-out */
  48. #define PL_RESOLVE_EINVAL        5           /* Invalid argument */
  49. #define PL_RESOLVE_EOVERFLOW     6           /* Buffer Overflow */
  50. #define PL_RESOLVE_EUNKNOWN      7           /* berzerk error */
  51.  
  52. /* ----------- Function Prototypes ----------------*/
  53.  
  54. PR_EXTERN(PRStatus) PL_ResolveName(
  55.     const char *name, unsigned char *buf,
  56.     PRIntn bufsize, PRIntervalTime timeout,
  57.     PRHostEnt *hostentry, PRIntervalTime *ttl);
  58.  
  59. PR_EXTERN(PRStatus) PL_ResolveAddr(
  60.     const PRNetAddr *address, unsigned char *buf,
  61.     PRIntn bufsize, PRIntervalTime timeout,
  62.     PRHostEnt *hostentry, PRIntervalTime *ttl);
  63.  
  64. typedef struct PLResolveStats {
  65.     int re_errors;
  66.     int re_nu_look;
  67.     int re_na_look;
  68.     int re_replies;
  69.     int re_requests;
  70.     int re_resends;
  71.     int re_sent;
  72.     int re_timeouts;
  73. } PLResolveStats;
  74.  
  75. typedef struct PLResoveInfo {
  76.     PRBool enabled;
  77.     PRUint32 numNameLookups;
  78.     PRUint32 numAddrLookups;
  79.     PRUint32 numLookupsInProgress;
  80.     PLResolveStats stats;
  81. } PLResoveInfo;
  82.  
  83. PR_EXTERN(void) PL_ResolveInfo(PLResoveInfo *info);
  84.  
  85. NSPR_END_EXTERN_C
  86.  
  87. #endif /* defined(XP_UNIX) */
  88.  
  89. #endif /* _PLRESOLV_H_ */
  90.