mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Helper function to walk through keydata chained blocks.
This commit is contained in:
committed by
Simon Kelley
parent
a7338645d7
commit
458824dcb4
17
src/cache.c
17
src/cache.c
@@ -1364,6 +1364,23 @@ struct keydata *keydata_alloc(char *data, size_t len)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t keydata_walk(struct keydata **key, unsigned char **p, size_t cnt)
|
||||||
|
{
|
||||||
|
size_t ret;
|
||||||
|
|
||||||
|
if (*p == NULL)
|
||||||
|
*p = (*key)->key;
|
||||||
|
else if (*p == (*key)->key + KEYBLOCK_LEN)
|
||||||
|
{
|
||||||
|
*key = (*key)->next;
|
||||||
|
if (*key == NULL)
|
||||||
|
return 0;
|
||||||
|
*p = (*key)->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MIN(cnt, (*key)->key + KEYBLOCK_LEN - (*p));
|
||||||
|
}
|
||||||
|
|
||||||
void keydata_free(struct keydata *blocks)
|
void keydata_free(struct keydata *blocks)
|
||||||
{
|
{
|
||||||
struct keydata *tmp;
|
struct keydata *tmp;
|
||||||
|
|||||||
@@ -925,6 +925,7 @@ char *cache_get_name(struct crec *crecp);
|
|||||||
struct crec *cache_enumerate(int init);
|
struct crec *cache_enumerate(int init);
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
struct keydata *keydata_alloc(char *data, size_t len);
|
struct keydata *keydata_alloc(char *data, size_t len);
|
||||||
|
size_t keydata_walk(struct keydata **key, unsigned char **p, size_t cnt);
|
||||||
void keydata_free(struct keydata *blocks);
|
void keydata_free(struct keydata *blocks);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user