diff --git a/include/neatvnc.h b/include/neatvnc.h index 9e68085..4a61124 100644 --- a/include/neatvnc.h +++ b/include/neatvnc.h @@ -154,10 +154,17 @@ void nvnc_set_client_cleanup_fn(struct nvnc_client* self, nvnc_client_fn fn); void nvnc_set_cut_text_fn(struct nvnc*, nvnc_cut_text_fn fn); void nvnc_set_desktop_layout_fn(struct nvnc* self, nvnc_desktop_layout_fn); +/* TODO: Changes this interface so that we have enable_auth(auth_fn), + * set_tls_creds(key, cert), and has_tls() -> bool + */ + bool nvnc_has_auth(void); + int nvnc_enable_auth(struct nvnc* self, const char* privkey_path, const char* cert_path, nvnc_auth_fn, void* userdata); +int nvnc_enable_auth2(struct nvnc* self, nvnc_auth_fn, void* userdata); + struct nvnc_fb* nvnc_fb_new(uint16_t width, uint16_t height, uint32_t fourcc_format, uint16_t stride); struct nvnc_fb* nvnc_fb_from_buffer(void* buffer, uint16_t width, diff --git a/src/server.c b/src/server.c index bf57fb7..6a9b0b3 100644 --- a/src/server.c +++ b/src/server.c @@ -2326,6 +2326,16 @@ cert_alloc_failure: return -1; } +EXPORT +int nvnc_enable_auth2(struct nvnc* self, nvnc_auth_fn auth_fn, void* userdata) +{ +#ifdef HAVE_CRYPTO + self->auth_fn = auth_fn; + return 0; +#endif + return -1; +} + EXPORT void nvnc_set_cursor(struct nvnc* self, struct nvnc_fb* fb, uint16_t width, uint16_t height, uint16_t hotspot_x, uint16_t hotspot_y,