summaryrefslogtreecommitdiff
path: root/include/git2/sys
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-11-22 08:49:09 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2018-11-28 15:50:15 +0000
commit02bb39f448b9ed151a638d22fdcbccc895f4d3cf (patch)
tree5b17db72f1b12951e08d6ae2e5179eb40fcac2eb /include/git2/sys
parent52478d7dc323ad1768bc5c6fc03c031b7adc5d20 (diff)
downloadlibgit2-02bb39f448b9ed151a638d22fdcbccc895f4d3cf.tar.gz
stream registration: take an enum type
Accept an enum (`git_stream_t`) during custom stream registration that indicates whether the registration structure should be used for standard (non-TLS) streams or TLS streams.
Diffstat (limited to 'include/git2/sys')
-rw-r--r--include/git2/sys/stream.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/git2/sys/stream.h b/include/git2/sys/stream.h
index edbe66ff8..938793124 100644
--- a/include/git2/sys/stream.h
+++ b/include/git2/sys/stream.h
@@ -72,19 +72,31 @@ typedef struct {
} git_stream_registration;
/**
+ * The type of stream to register.
+ */
+typedef enum {
+ /** A standard (non-TLS) socket. */
+ GIT_STREAM_STANDARD = 1,
+
+ /** A TLS-encrypted socket. */
+ GIT_STREAM_TLS = 2,
+} git_stream_t;
+
+/**
* Register stream constructors for the library to use
*
* If a registration structure is already set, it will be overwritten.
* Pass `NULL` in order to deregister the current constructor and return
* to the system defaults.
*
+ * The type parameter may be a bitwise AND of types.
+ *
+ * @param type the type or types of stream to register
* @param registration the registration data
- * @param tls 1 if the registration is for TLS streams, 0 for regular
- * (insecure) sockets
* @return 0 or an error code
*/
GIT_EXTERN(int) git_stream_register(
- int tls, git_stream_registration *registration);
+ git_stream_t type, git_stream_registration *registration);
/** @name Deprecated TLS Stream Registration Functions
*