PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/gecko_api/include/plresolv.h

http://firefox-mac-pdf.googlecode.com/
C Header | 108 lines | 45 code | 17 blank | 46 comment | 0 complexity | fb6e8b3aeed4499d70d33aa6f565df4a MD5 | raw file
  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. * plresolv.h - asynchronous name resolution using DNS
  39. */
  40. #ifndef _PLRESOLV_H_
  41. #define _PLRESOLV_H_
  42. /*
  43. ** THIS IS WORK IN PROGRESS. DO NOT ATTEMPT TO USE ANY PORTION OF THIS
  44. ** API UNTIL THIS MESSAGE NO LONGER EXISTS. IF YOU DO, THEN YOU SURRENDER
  45. ** THE RIGHT TO COMPLAIN ABOUT ANY CONTENT.
  46. */
  47. #if defined(XP_UNIX)
  48. #include <prtypes.h>
  49. #include <prnetdb.h>
  50. NSPR_BEGIN_EXTERN_C
  51. #define PL_RESOLVE_MAXHOSTENTBUF 1024
  52. #define PL_RESOLVE_DEFAULT_TIMEOUT 0
  53. /* Error return codes */
  54. #define PL_RESOLVE_OK 0
  55. #define PL_RESOLVE_EWINIT 1 /* Failed to initialize window */
  56. #define PL_RESOLVE_EMAKE 2 /* Failed to create request */
  57. #define PL_RESOLVE_ELAUNCH 3 /* Error launching Async request */
  58. #define PL_RESOLVE_ETIMEDOUT 4 /* Request timed-out */
  59. #define PL_RESOLVE_EINVAL 5 /* Invalid argument */
  60. #define PL_RESOLVE_EOVERFLOW 6 /* Buffer Overflow */
  61. #define PL_RESOLVE_EUNKNOWN 7 /* berserk error */
  62. /* ----------- Function Prototypes ----------------*/
  63. PR_EXTERN(PRStatus) PL_ResolveName(
  64. const char *name, unsigned char *buf,
  65. PRIntn bufsize, PRIntervalTime timeout,
  66. PRHostEnt *hostentry, PRIntervalTime *ttl);
  67. PR_EXTERN(PRStatus) PL_ResolveAddr(
  68. const PRNetAddr *address, unsigned char *buf,
  69. PRIntn bufsize, PRIntervalTime timeout,
  70. PRHostEnt *hostentry, PRIntervalTime *ttl);
  71. typedef struct PLResolveStats {
  72. int re_errors;
  73. int re_nu_look;
  74. int re_na_look;
  75. int re_replies;
  76. int re_requests;
  77. int re_resends;
  78. int re_sent;
  79. int re_timeouts;
  80. } PLResolveStats;
  81. typedef struct PLResoveInfo {
  82. PRBool enabled;
  83. PRUint32 numNameLookups;
  84. PRUint32 numAddrLookups;
  85. PRUint32 numLookupsInProgress;
  86. PLResolveStats stats;
  87. } PLResoveInfo;
  88. PR_EXTERN(void) PL_ResolveInfo(PLResoveInfo *info);
  89. NSPR_END_EXTERN_C
  90. #endif /* defined(XP_UNIX) */
  91. #endif /* _PLRESOLV_H_ */