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