45"$Id: tree.c,v 1.10 1997/05/09 08:14:57 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. All rights reserved.\n";
53 struct dns_host_entry *));
55 unsigned char *,
int));
63 error (
"no memory for cons.");
74 tc = new_tree_cache (
"tree_cache");
77 tc ->
value = (
unsigned char *)0;
88 nt = new_tree (
"tree_host_lookup");
90 error (
"No memory for host lookup tree node.");
91 nt ->
op = TREE_HOST_LOOKUP;
99 struct dns_host_entry *dh;
101 if (!(dh = (
struct dns_host_entry *)
dmalloc
102 (
sizeof (
struct dns_host_entry),
"enter_dns_host"))
105 error (
"Can't allocate space for new host.");
107 dh ->
data = (
unsigned char *)0;
119 if (!(
nt = new_tree (
"tree_const"))
120 || !(
nt ->
data.const_val.data =
121 (
unsigned char *)
dmalloc (
len,
"tree_const")))
122 error (
"No memory for constant data tree node.");
123 nt ->
op = TREE_CONST;
148 error (
"No memory to concatenate constants.");
163 if (!(
nt = new_tree (
"tree_concat")))
164 error (
"No memory for data tree concatenation node.");
165 nt ->
op = TREE_CONCAT;
178 if (
tree ->
op == TREE_CONST) {
185 rv = new_tree (
"tree_limit");
187 return (
struct tree *)0;
188 rv ->
op = TREE_LIMIT;
218 if (!(bp = (
unsigned char *)
dmalloc (bufix,
"tree_evaluate")))
242 unsigned char **bufp;
259 case TREE_HOST_LOOKUP:
278 warn (
"Bad node id in tree: %d.");
286 unsigned char **bufp;
288 struct dns_host_entry *dns;
295 debug (
"time: now = %d dns = %d %d diff = %d",
300 if (cur_time <= dns ->
timeout) {
302 debug (
"easy copy: %x %d %x",
303 dns ->
data, dns -> data_len,
304 dns ->
data ? *(
int *)(dns ->
data) : 0);
307 dns ->
data, dns -> data_len);
325 warn (
"%s: temporary name server failure",
332 warn (
"%s: no A record associated with address",
342 debug (
"Lookup succeeded; first address is %x",
352 if (dns -> buf_len <
i) {
354 (
unsigned char *)
dmalloc (new_len,
"do_host_lookup");
357 new_len = dns -> buf_len;
358 if (!dns -> buf_len) {
366 dns -> buf_len = new_len;
377 debug (
"dns -> data: %x h -> h_addr_list [0]: %x",
380 dns -> data_len = new_len;
387 debug (
"hard copy: %x %d %x",
388 dns ->
data, dns -> data_len, *(
int *)(dns ->
data));
396 unsigned char **bufp;
401 int space = *bufcount - *bufix;
ACPI_SIZE strlen(const char *String)
void dfree(void *ptr, char *name)
struct tree * tree_concat(struct tree *left, struct tree *right)
static void do_data_copy(int *bufix, unsigned char **bufp, int *bufcount, unsigned char *data, int len)
struct tree * tree_const(unsigned char *data, int len)
int tree_evaluate(struct tree_cache *tree_cache)
static TIME do_host_lookup(int *bufix, unsigned char **bufp, int *bufcount, struct dns_host_entry *dns)
static TIME tree_evaluate_recurse(int *bufix, unsigned char **bufp, int *bufcount, struct tree *tree)
struct tree * tree_limit(struct tree *tree, int limit)
struct dns_host_entry * enter_dns_host(char *name)
pair cons(caddr_t car, pair cdr)
struct tree * tree_host_lookup(char *name)
void * dmalloc(int size, char *name)
NTSTATUS NTSTATUS void free_tree(tree *t) __attribute__((nonnull(1)))
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memcpy(s1, s2, n)