Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
5.1 KiB

  1. /******************************************************************
  2. *
  3. * SpiderTCP BIND
  4. *
  5. * Copyright 1990 Spider Systems Limited
  6. *
  7. * RESOLV.H
  8. *
  9. ******************************************************************/
  10. /*
  11. * /usr/projects/tcp/SCCS.rel3/rel/src/include/0/s.resolv.h
  12. * @(#)resolv.h 5.3
  13. *
  14. * Last delta created 14:05:35 3/4/91
  15. * This file extracted 11:19:25 3/8/91
  16. *
  17. * Modifications:
  18. *
  19. * GSS 20 Jul 90 New File
  20. */
  21. /*
  22. * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
  23. * All rights reserved.
  24. *
  25. * Redistribution and use in source and binary forms are permitted
  26. * provided that: (1) source distributions retain this entire copyright
  27. * notice and comment, and (2) distributions including binaries display
  28. * the following acknowledgement: ``This product includes software
  29. * developed by the University of California, Berkeley and its contributors''
  30. * in the documentation or other materials provided with the distribution
  31. * and in all advertising materials mentioning features or use of this
  32. * software. Neither the name of the University nor the names of its
  33. * contributors may be used to endorse or promote products derived
  34. * from this software without specific prior written permission.
  35. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  36. * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  37. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  38. *
  39. * @(#)resolv.h 5.10 (Berkeley) 6/1/90
  40. */
  41. #ifndef _RESOLV_INCLUDED
  42. #define _RESOLV_INCLUDED
  43. /*
  44. * Global defines and variables for resolver stub.
  45. */
  46. #define MAXNS 8 /* max # name servers we'll track per list */
  47. #define MAXNSLIST 4 /* max # name servers lists we'll track */
  48. #define MAXDFLSRCH 3 /* # default domain levels to try */
  49. #define MAXDNSRCH 6 /* max # domains in search path */
  50. #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
  51. #define RES_TIMEOUT 5 /* min. seconds between retries */
  52. typedef struct _ADDR_LIST {
  53. u_long ServerCount;
  54. u_long Servers[MAXNS];
  55. } ADDR_LIST, FAR * LPADDR_LIST;
  56. struct state {
  57. long options; /* option flags - see below. */
  58. int retrans; /* retransmition time interval */
  59. u_short retry; /* number of times to retransmit */
  60. u_short id; /* current packet id */
  61. ADDR_LIST nslist[MAXNSLIST]; /* the server lists */
  62. char defdname[MAXDNAME]; /* default domain */
  63. char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
  64. };
  65. /*
  66. * Resolver options
  67. */
  68. #define RES_INIT 0x0001 /* address initialized */
  69. #define RES_DEBUG 0x0002 /* print debug messages */
  70. #define RES_AAONLY 0x0004 /* authoritative answers only */
  71. #define RES_USEVC 0x0008 /* use virtual circuit */
  72. #define RES_PRIMARY 0x0010 /* query primary server only */
  73. #define RES_IGNTC 0x0020 /* ignore trucation errors */
  74. #define RES_RECURSE 0x0040 /* recursion desired */
  75. #define RES_DEFNAMES 0x0080 /* use default domain name */
  76. #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
  77. #define RES_DNSRCH 0x0200 /* search up local domain tree */
  78. #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
  79. //
  80. // Resolver function prototypes
  81. //
  82. int
  83. dn_expand(
  84. IN unsigned char *msg,
  85. IN unsigned char *eomorig,
  86. IN unsigned char *comp_dn,
  87. OUT unsigned char *exp_dn,
  88. IN int length
  89. );
  90. int
  91. dn_comp(
  92. IN unsigned char *exp_dn,
  93. OUT unsigned char *comp_dn,
  94. IN int length,
  95. IN unsigned char **dnptrs, OPTIONAL
  96. IN OUT unsigned char **lastdnptr OPTIONAL
  97. );
  98. int
  99. res_init(
  100. void
  101. );
  102. int
  103. res_send(
  104. IN char *buf,
  105. IN int buflen,
  106. OUT char *answer,
  107. IN int anslen
  108. );
  109. int
  110. res_query(
  111. IN char *name, /* domain name */
  112. IN int class, /* class of query */
  113. IN int type, /* type of query */
  114. OUT unsigned char *answer, /* buffer to put answer */
  115. IN int anslen /* size of answer buffer */
  116. );
  117. int
  118. res_search(
  119. IN char *name, /* domain name */
  120. IN int class, /* class of query */
  121. IN int type, /* type of query */
  122. OUT unsigned char *answer, /* buffer to put answer */
  123. IN int anslen /* size of answer */
  124. );
  125. int
  126. res_mkquery(
  127. IN int op, // opcode of query
  128. IN char *dname, // domain name
  129. IN int class, // class of query
  130. IN int type, // type of query
  131. IN char *data, OPTIONAL // resource record data
  132. IN int datalen, OPTIONAL // length of data
  133. IN struct rrec *newrr, OPTIONAL // new rr for modify or append
  134. OUT char *buf, // buffer to put query
  135. IN int buflen // size of buffer
  136. );
  137. #endif // _RESOLV_INCLUDED