Loading res_cache.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -1643,6 +1643,17 @@ void resolv_delete_cache_for_net(unsigned netid) { } } std::vector<unsigned> resolv_list_caches() { std::lock_guard guard(cache_mutex); struct resolv_cache_info* cache_info = res_cache_list.next; std::vector<unsigned> result; while (cache_info) { result.push_back(cache_info->netid); cache_info = cache_info->next; } return result; } static resolv_cache_info* create_cache_info() { return (struct resolv_cache_info*) calloc(sizeof(struct resolv_cache_info), 1); } Loading resolv_cache.h +4 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ #include <stddef.h> #include <vector> struct __res_state; /* sets the name server addresses to the provided res_state structure. The Loading @@ -39,6 +41,8 @@ struct __res_state; * with the network to which the res_state structure is associated */ void _resolv_populate_res_for_net(struct __res_state* statp); std::vector<unsigned> resolv_list_caches(); typedef enum { RESOLV_CACHE_UNSUPPORTED, /* the cache can't handle that kind of queries */ /* or the answer buffer is too small */ Loading Loading
res_cache.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -1643,6 +1643,17 @@ void resolv_delete_cache_for_net(unsigned netid) { } } std::vector<unsigned> resolv_list_caches() { std::lock_guard guard(cache_mutex); struct resolv_cache_info* cache_info = res_cache_list.next; std::vector<unsigned> result; while (cache_info) { result.push_back(cache_info->netid); cache_info = cache_info->next; } return result; } static resolv_cache_info* create_cache_info() { return (struct resolv_cache_info*) calloc(sizeof(struct resolv_cache_info), 1); } Loading
resolv_cache.h +4 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ #include <stddef.h> #include <vector> struct __res_state; /* sets the name server addresses to the provided res_state structure. The Loading @@ -39,6 +41,8 @@ struct __res_state; * with the network to which the res_state structure is associated */ void _resolv_populate_res_for_net(struct __res_state* statp); std::vector<unsigned> resolv_list_caches(); typedef enum { RESOLV_CACHE_UNSUPPORTED, /* the cache can't handle that kind of queries */ /* or the answer buffer is too small */ Loading