Lines Matching refs:e
1161 entry_free( Entry* e ) in entry_free() argument
1164 if (e) { in entry_free()
1165 free(e); in entry_free()
1170 entry_mru_remove( Entry* e ) in entry_mru_remove() argument
1172 e->mru_prev->mru_next = e->mru_next; in entry_mru_remove()
1173 e->mru_next->mru_prev = e->mru_prev; in entry_mru_remove()
1177 entry_mru_add( Entry* e, Entry* list ) in entry_mru_add() argument
1181 e->mru_next = first; in entry_mru_add()
1182 e->mru_prev = list; in entry_mru_add()
1184 list->mru_next = e; in entry_mru_add()
1185 first->mru_prev = e; in entry_mru_add()
1191 entry_hash( const Entry* e ) in entry_hash() argument
1195 _dnsPacket_init(pack, e->query, e->querylen); in entry_hash()
1202 entry_init_key( Entry* e, const void* query, int querylen ) in entry_init_key() argument
1206 memset(e, 0, sizeof(*e)); in entry_init_key()
1208 e->query = query; in entry_init_key()
1209 e->querylen = querylen; in entry_init_key()
1210 e->hash = entry_hash(e); in entry_init_key()
1221 Entry* e; in entry_alloc() local
1224 size = sizeof(*e) + init->querylen + answerlen; in entry_alloc()
1225 e = calloc(size, 1); in entry_alloc()
1226 if (e == NULL) in entry_alloc()
1227 return e; in entry_alloc()
1229 e->hash = init->hash; in entry_alloc()
1230 e->query = (const uint8_t*)(e+1); in entry_alloc()
1231 e->querylen = init->querylen; in entry_alloc()
1233 memcpy( (char*)e->query, init->query, e->querylen ); in entry_alloc()
1235 e->answer = e->query + e->querylen; in entry_alloc()
1236 e->answerlen = answerlen; in entry_alloc()
1238 memcpy( (char*)e->answer, answer, e->answerlen ); in entry_alloc()
1240 return e; in entry_alloc()
1507 Entry* e; in _cache_dump_mru() local
1510 for (e = cache->mru_list.mru_next; e != &cache->mru_list; e = e->mru_next) in _cache_dump_mru()
1511 p = _bprint(p, end, " %d", e->id); in _cache_dump_mru()
1602 Entry* e ) in _cache_add_p() argument
1604 *lookup = e; in _cache_add_p()
1605 e->id = ++cache->last_id; in _cache_add_p()
1606 entry_mru_add(e, &cache->mru_list); in _cache_add_p()
1610 e->id, cache->num_entries); in _cache_add_p()
1621 Entry* e = *lookup; in _cache_remove_p() local
1624 e->id, cache->num_entries-1); in _cache_remove_p()
1626 entry_mru_remove(e); in _cache_remove_p()
1627 *lookup = e->hlink; in _cache_remove_p()
1628 entry_free(e); in _cache_remove_p()
1654 Entry* e; in _cache_remove_expired() local
1657 for (e = cache->mru_list.mru_next; e != &cache->mru_list;) { in _cache_remove_expired()
1659 if (now >= e->expires) { in _cache_remove_expired()
1660 Entry** lookup = _cache_lookup_p(cache, e); in _cache_remove_expired()
1665 e = e->mru_next; in _cache_remove_expired()
1668 e = e->mru_next; in _cache_remove_expired()
1683 Entry* e; in _resolv_cache_lookup() local
1711 e = *lookup; in _resolv_cache_lookup()
1713 if (e == NULL) { in _resolv_cache_lookup()
1721 e = *lookup; in _resolv_cache_lookup()
1722 if (e == NULL) { in _resolv_cache_lookup()
1731 if (now >= e->expires) { in _resolv_cache_lookup()
1733 XLOG_QUERY(e->query, e->querylen); in _resolv_cache_lookup()
1738 *answerlen = e->answerlen; in _resolv_cache_lookup()
1739 if (e->answerlen > answersize) { in _resolv_cache_lookup()
1746 memcpy( answer, e->answer, e->answerlen ); in _resolv_cache_lookup()
1749 if (e != cache->mru_list.mru_next) { in _resolv_cache_lookup()
1750 entry_mru_remove( e ); in _resolv_cache_lookup()
1751 entry_mru_add( e, &cache->mru_list ); in _resolv_cache_lookup()
1754 XLOG( "FOUND IN CACHE entry=%p", e ); in _resolv_cache_lookup()
1771 Entry* e; in _resolv_cache_add() local
1799 e = *lookup; in _resolv_cache_add()
1801 if (e != NULL) { /* should not happen */ in _resolv_cache_add()
1803 __FUNCTION__, e); in _resolv_cache_add()
1814 e = *lookup; in _resolv_cache_add()
1815 if (e != NULL) { in _resolv_cache_add()
1817 __FUNCTION__, e); in _resolv_cache_add()
1824 e = entry_alloc(key, answer, answerlen); in _resolv_cache_add()
1825 if (e != NULL) { in _resolv_cache_add()
1826 e->expires = ttl + _time_now(); in _resolv_cache_add()
1827 _cache_add_p(cache, lookup, e); in _resolv_cache_add()