-
Notifications
You must be signed in to change notification settings - Fork 2
/
util.h
44 lines (39 loc) · 1.7 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* dvpn, a multipoint vpn implementation
* Copyright (C) 2015 Lennert Buytenhek
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version
* 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 2.1 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License version 2.1 along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __UTIL_H
#define __UTIL_H
#include <arpa/inet.h>
#include <iv_avl.h>
#include <stdint.h>
#include "conf.h"
int addrcmp(const struct sockaddr *a, const struct sockaddr *b);
void avl_diff(struct iv_avl_tree *a, struct iv_avl_tree *b, void *cookie,
void (*item_add)(void *cookie, struct iv_avl_node *a),
void (*item_mod)(void *cookie, struct iv_avl_node *a,
struct iv_avl_node *b),
void (*item_del)(void *cookie, struct iv_avl_node *a));
int isdnchar(int c);
int parse_base32_fingerprint(uint8_t *id, const char *fp);
int parse_hostname_fingerprint(uint8_t *id, const char *hostname);
void print_address(FILE *fp, const struct sockaddr *addr);
void print_fingerprint(FILE *fp, const uint8_t *id);
void timespec_add_ms(struct timespec *ts, int minms, int maxms);
void v6_global_addr_from_key_id(uint8_t *addr, const uint8_t *id);
void v6_linklocal_addr_from_key_id(uint8_t *addr, const uint8_t *id);
#endif