Leaked source code of windows server 2003
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.

159 lines
5.5 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 3 /* max # name servers we'll track */
  47. #define MAXDFLSRCH 3 /* # default domain levels to try */
  48. #define MAXDNSRCH 6 /* max # domains in search path */
  49. #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
  50. #define RES_TIMEOUT 4 /* min. seconds between retries */
  51. struct state {
  52. int retrans; /* retransmition time interval */
  53. int retry; /* number of times to retransmit */
  54. long options; /* option flags - see below. */
  55. int nscount; /* number of name servers */
  56. struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
  57. #define nsaddr nsaddr_list[0] /* for backward compatibility */
  58. unsigned short id; /* current packet id */
  59. char defdname[MAXDNAME]; /* default domain */
  60. char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
  61. };
  62. /*
  63. * Resolver options
  64. */
  65. #define RES_INIT 0x0001 /* address initialized */
  66. #define RES_DEBUG 0x0002 /* print debug messages */
  67. #define RES_AAONLY 0x0004 /* authoritative answers only */
  68. #define RES_USEVC 0x0008 /* use virtual circuit */
  69. #define RES_PRIMARY 0x0010 /* query primary server only */
  70. #define RES_IGNTC 0x0020 /* ignore trucation errors */
  71. #define RES_RECURSE 0x0040 /* recursion desired */
  72. #define RES_DEFNAMES 0x0080 /* use default domain name */
  73. #define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
  74. #define RES_DNSRCH 0x0200 /* search up local domain tree */
  75. #define RES_MODE_HOST_ONLY 0x0400 /* use the host file only */
  76. #define RES_MODE_DNS_ONLY 0x0800 /* use the DNS only */
  77. #define RES_MODE_HOST_DNS 0x1000 /* use the host file then the DNS */
  78. #define RES_MODE_DNS_HOST 0x2000 /* use the DNS then the host file */
  79. #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
  80. extern struct state _res;
  81. extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time();
  82. //
  83. // Resolver function prototypes
  84. //
  85. int
  86. dn_expand(
  87. IN unsigned char *msg,
  88. IN unsigned char *eomorig,
  89. IN unsigned char *comp_dn,
  90. OUT unsigned char *exp_dn,
  91. IN int length
  92. );
  93. int
  94. dn_comp(
  95. IN unsigned char *exp_dn,
  96. OUT unsigned char *comp_dn,
  97. IN int length,
  98. IN unsigned char **dnptrs, OPTIONAL
  99. IN OUT unsigned char **lastdnptr OPTIONAL
  100. );
  101. int
  102. res_init(
  103. void
  104. );
  105. int
  106. res_send(
  107. IN char *buf,
  108. IN int buflen,
  109. OUT char *answer,
  110. IN int anslen
  111. );
  112. int
  113. res_query(
  114. IN char *name, /* domain name */
  115. IN int Class, /* class of query */
  116. IN int type, /* type of query */
  117. OUT unsigned char *answer, /* buffer to put answer */
  118. IN int anslen /* size of answer buffer */
  119. );
  120. int
  121. res_search(
  122. IN char *name, /* domain name */
  123. IN int Class, /* class of query */
  124. IN int type, /* type of query */
  125. OUT unsigned char *answer, /* buffer to put answer */
  126. IN int anslen /* size of answer */
  127. );
  128. int
  129. res_mkquery(
  130. IN int op, // opcode of query
  131. IN char *dname, // domain name
  132. IN int Class, // class of query
  133. IN int type, // type of query
  134. IN char *data, OPTIONAL // resource record data
  135. IN int datalen, OPTIONAL // length of data
  136. IN struct rrec *newrr, OPTIONAL // new rr for modify or append
  137. OUT char *buf, // buffer to put query
  138. IN int buflen // size of buffer
  139. );
  140. #endif // _RESOLV_INCLUDED