summaryrefslogtreecommitdiff
path: root/include/git2/sys
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-10-13 11:25:41 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-11-03 08:10:29 -0800
commit7fafde632580f75ff3647ddf9e1e92ee388f317e (patch)
treed5ca0c2de9d73d24313366d89110c2d7c0b17a7a /include/git2/sys
parentd39f643a0a09336ad77f04b7037cbc1c486bdd50 (diff)
downloadlibgit2-7fafde632580f75ff3647ddf9e1e92ee388f317e.tar.gz
stream: allow registering a user-provided TLS constructorcmn/tls-register
This allows the application to use their own TLS stream, regardless of the capabilities of libgit2 itself.
Diffstat (limited to 'include/git2/sys')
-rw-r--r--include/git2/sys/stream.h13
1 files changed, 13 insertions, 0 deletions
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