From 7fafde632580f75ff3647ddf9e1e92ee388f317e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 13 Oct 2015 11:25:41 +0200 Subject: stream: allow registering a user-provided TLS constructor This allows the application to use their own TLS stream, regardless of the capabilities of libgit2 itself. --- include/git2/sys/stream.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/git2') diff --git a/include/git2/sys/stream.h b/include/git2/sys/stream.h index 55a714bbb..2b4ff7fd8 100644 --- a/include/git2/sys/stream.h +++ b/include/git2/sys/stream.h @@ -39,6 +39,19 @@ typedef struct git_stream { void (*free)(struct git_stream *); } git_stream; +typedef int (*git_stream_cb)(git_stream **out, const char *host, const char *port); + +/** + * Register a TLS stream constructor for the library to use + * + * If a constructor is already set, it will be overwritten. Pass + * `NULL` in order to deregister the current constructor. + * + * @param ctor the constructor to use + * @return 0 or an error code + */ +GIT_EXTERN(int) git_stream_register_tls(git_stream_cb ctor); + GIT_END_DECL #endif -- cgit v1.2.1