summaryrefslogtreecommitdiffstats
path: root/src/wireguard.h
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@mail.noconroy.net>2019-06-16 22:46:37 +1000
committerMatt Dunwoodie <ncon@mail.noconroy.net>2019-06-16 22:46:37 +1000
commit40fe54f146dd7c9e9bd021a07ed55ad492ea4b6a (patch)
tree7ccf973efe1273d45394041f9d3711d328bede35 /src/wireguard.h
parentstaging5 (diff)
downloadwireguard-openbsd-40fe54f146dd7c9e9bd021a07ed55ad492ea4b6a.tar.xz
wireguard-openbsd-40fe54f146dd7c9e9bd021a07ed55ad492ea4b6a.zip
staging6
Diffstat (limited to 'src/wireguard.h')
-rw-r--r--src/wireguard.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/wireguard.h b/src/wireguard.h
index 63da41fd67d..61ac7475f83 100644
--- a/src/wireguard.h
+++ b/src/wireguard.h
@@ -54,7 +54,6 @@ enum wg_pkt_type {
};
struct wg_conn {
- void *c_arg;
struct rwlock c_lock;
uint8_t c_psk[WG_KEY_SIZE];
uint8_t c_pubkey[WG_KEY_SIZE];
@@ -96,6 +95,14 @@ struct wg_conn {
struct wg_timestamp {
uint8_t ts_bytes[WG_TIMESTAMP_SIZE];
} c_ts;
+
+ struct wg_upcall {
+ void *u_arg;
+ uint32_t (*u_getid)(void *, struct wg_conn *);
+ void (*u_dropid)(void *, uint32_t);
+ struct wg_conn *(*u_keylookup)(void *, uint8_t *);
+ uint8_t *u_pubkey, *u_privkey;
+ } *c_upcall;
};
struct wg_msg_unknown {
@@ -136,14 +143,7 @@ struct wg_msg_transport {
uint8_t data [];
} __packed;
-struct wg_msg_initiation_helper {
- void *ih_arg;
- struct wg_conn *(*ih_keylookup)(void *, uint8_t *);
- uint8_t *ih_pubkey, *ih_privkey;
- struct wg_conn *ih_conn;
-};
-
-void wg_conn_init(struct wg_conn *);
+void wg_conn_init(struct wg_conn *, struct wg_upcall *);
void wg_conn_reset(struct wg_conn *);
void wg_conn_setkey(struct wg_conn *, enum wg_keytype, uint8_t *);
@@ -152,7 +152,7 @@ int wg_conn_make_response(struct wg_conn *, struct wg_msg_response *);
int wg_conn_make_cookie(struct wg_conn *, struct wg_msg_cookie *);
int wg_conn_encrypt(struct wg_conn *, struct wg_msg_transport *, size_t);
-int wg_conn_recv_initiation(struct wg_msg_initiation_helper *, struct wg_msg_initiation *);
+struct wg_conn *wg_conn_recv_initiation(struct wg_upcall *, struct wg_msg_initiation *);
int wg_conn_recv_response(struct wg_conn *, struct wg_msg_response *);
int wg_conn_recv_cookie(struct wg_conn *, struct wg_msg_cookie *);
int wg_conn_decrypt(struct wg_conn *, struct wg_msg_transport *, size_t);