1 #ifndef TINC_ADDRESS_CACHE_H
2 #define TINC_ADDRESS_CACHE_H
5 address_cache.h -- header for address_cache.c
6 Copyright (C) 2018 Guus Sliepen <guus@tinc-vpn.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #define MAX_CACHED_ADDRESSES 8
26 #define ADDRESS_CACHE_VERSION 1
28 typedef struct address_cache_t {
30 struct splay_tree_t *config_tree;
39 sockaddr_t address[MAX_CACHED_ADDRESSES];
43 void add_recent_address(address_cache_t *cache, const sockaddr_t *sa);
44 const sockaddr_t *get_recent_address(address_cache_t *cache);
46 void close_address_cache(address_cache_t *cache);
47 address_cache_t *open_address_cache(node_t *node) ATTR_DEALLOCATOR(close_address_cache);
48 void reset_address_cache(address_cache_t *cache);