Lines Matching defs:ref
302 struct lsa_ref *ref;
304 if ((ref = lsa_cache_get(lsa)) == NULL)
310 le->le_ref = ref;
569 struct lsa_ref *ref, *old;
572 if ((ref = calloc(1, sizeof(*ref))) == NULL)
574 memcpy(&ref->hdr, data, sizeof(ref->hdr));
576 if ((old = lsa_cache_look(&ref->hdr))) {
577 free(ref);
582 if ((ref->data = malloc(len)) == NULL)
584 memcpy(ref->data, data, len);
587 ref->stamp = tp.tv_sec;
588 ref->len = len;
589 ref->refcnt = 1;
591 head = &lsacache.hashtbl[lsa_hash_hdr(&ref->hdr) & lsacache.hashmask];
592 LIST_INSERT_HEAD(head, ref, entry);
593 return (ref);
599 struct lsa_ref *ref;
601 ref = lsa_cache_look(lsa_hdr);
602 if (ref)
603 ref->refcnt++;
605 return (ref);
609 lsa_cache_put(struct lsa_ref *ref, struct nbr *nbr)
611 if (--ref->refcnt > 0)
614 if (ntohs(ref->hdr.age) >= MAX_AGE)
616 ref->data, sizeof(struct lsa_hdr));
618 free(ref->data);
619 LIST_REMOVE(ref, entry);
620 free(ref);
627 struct lsa_ref *ref;
631 LIST_FOREACH(ref, head, entry) {
632 if (memcmp(&ref->hdr, lsa_hdr, sizeof(*lsa_hdr)) == 0)
634 return (ref);