Lines Matching refs:crec
19 static struct crec *cache_head = NULL, *cache_tail = NULL, **hash_table = NULL;
21 static struct crec *dhcp_spare = NULL;
23 static struct crec *new_chain = NULL;
67 static void cache_free(struct crec *crecp);
68 static void cache_unlink(struct crec *crecp);
69 static void cache_link(struct crec *crecp);
71 static void cache_hash(struct crec *crecp);
75 struct crec *crecp;
85 crecp = safe_malloc(daemon->cachesize*sizeof(struct crec));
105 struct crec **new, **old, *p, *tmp;
113 new = safe_malloc(new_size * sizeof(struct crec *));
114 else if (new_size <= hash_size || !(new = whine_malloc(new_size * sizeof(struct crec *))))
137 static struct crec **hash_bucket(char *name)
154 static void cache_hash(struct crec *crecp)
161 struct crec **up = hash_bucket(cache_get_name(crecp));
176 static void cache_free(struct crec *crecp)
200 static void cache_link(struct crec *crecp)
212 static void cache_unlink (struct crec *crecp)
225 char *cache_get_name(struct crec *crecp)
235 static int is_outdated_cname_pointer(struct crec *crecp)
246 static int is_expired(time_t now, struct crec *crecp)
272 struct crec *crecp, **up;
351 struct crec *tmp = new_chain->next;
359 struct crec *cache_insert(char *name, struct all_addr *addr,
362 struct crec *new;
480 struct crec *tmp = new_chain->next;
495 struct crec *cache_find_by_name(struct crec *crecp, char *name, time_t now, unsigned short prot)
497 struct crec *ans;
505 struct crec *next, **up, **insert = NULL, **chainp = &ans;
579 struct crec *cache_find_by_addr(struct crec *crecp, struct all_addr *addr,
582 struct crec *ans;
598 struct crec **up, **chainp = &ans;
644 static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrlen,
647 struct crec *lookup = cache_find_by_name(NULL, cache->name.sname, 0, flags & (F_IPV4 | F_IPV6));
696 (lookup = whine_malloc(sizeof(struct crec))))
823 struct crec *cache;
836 (cache = whine_malloc(sizeof(struct crec) +
846 if ((cache = whine_malloc(sizeof(struct crec) + strlen(canon)+1-SMALLDNAME)))
870 struct crec *cache, **up, *tmp;
1020 struct crec *cache, **up;
1038 struct crec *crec = NULL, *aliasc;
1043 while ((crec = cache_find_by_name(crec, host_name, 0, F_IPV4 | F_CNAME)))
1046 if (crec->flags & F_HOSTS)
1048 if (crec->addr.addr.addr.addr4.s_addr != host_address->s_addr)
1050 strcpy(daemon->namebuff, inet_ntoa(crec->addr.addr.addr.addr4));
1055 record_source(crec->uid), daemon->namebuff);
1062 else if (!(crec->flags & F_DHCP))
1064 cache_scan_free(host_name, NULL, 0, crec->flags & (F_IPV4 | F_CNAME | F_FORWARD));
1073 if ((crec = cache_find_by_addr(NULL, (struct all_addr *)host_address, 0, F_IPV4)))
1075 if (crec->flags & F_NEG)
1082 if ((crec = dhcp_spare))
1085 crec = whine_malloc(sizeof(struct crec));
1087 if (crec) /* malloc may fail */
1089 crec->flags = flags;
1091 crec->flags |= F_IMMORTAL;
1093 crec->ttd = ttd;
1094 crec->addr.addr.addr.addr4 = *host_address;
1095 crec->name.namep = host_name;
1096 crec->uid = uid++;
1097 cache_hash(crec);
1105 aliasc = whine_malloc(sizeof(struct crec));
1115 aliasc->addr.cname.cache = crec;
1116 aliasc->addr.cname.uid = crec->uid;
1160 struct crec *cache ;