diff options
author | Luis Ressel <aranea@aixah.de> | 2019-03-25 14:53:09 +0100 |
---|---|---|
committer | Luis Ressel <aranea@aixah.de> | 2019-03-28 15:03:05 +0100 |
commit | f50ef1676fe5861c9071910d2caf64593a28d837 (patch) | |
tree | e7efdc112f08cb56c204c2a9daec46607b51891d /src/tools/peer_names.h | |
parent | tools: avoid unneccessary next_peer assignments in sort_peers() (diff) | |
download | wireguard-monolithic-historical-lr/peer-names.tar.xz wireguard-monolithic-historical-lr/peer-names.zip |
[WIP] wg: Support human-readable peer nameslr/peer-names
TODO:
* Refactor the inflatable_buffer code from ipc.c and use it for both
the wgpeer_name array and the names.
* ugly_print, dumb_print
* Make wgpeer_names part of wgdevice?
* Check for dupes?
* Test!
Signed-off-by: Luis Ressel <aranea@aixah.de>
Diffstat (limited to 'src/tools/peer_names.h')
-rw-r--r-- | src/tools/peer_names.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tools/peer_names.h b/src/tools/peer_names.h new file mode 100644 index 0000000..5ba73fe --- /dev/null +++ b/src/tools/peer_names.h @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2019 Luis Ressel <aranea@aixah.de>. All Rights Reserved. + */ + +#ifndef PEER_NAMES_H +#define PEER_NAMES_H + +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> + +#include "containers.h" + +struct wgpeer_name { + char *name; + uint8_t public_key[WG_KEY_LEN]; +}; + +struct wgpeer_names { + size_t len; + struct wgpeer_name *arr; +}; + +bool peer_names_open(struct wgpeer_names *names, struct wgdevice *device); +void peer_names_free(struct wgpeer_names *names); +char *peer_names_get(struct wgpeer_names *names, uint8_t key[static WG_KEY_LEN]); + +#endif // PEER_NAMES_H |