From 02bb39f448b9ed151a638d22fdcbccc895f4d3cf Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 22 Nov 2018 08:49:09 +0000 Subject: 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. --- include/git2/sys/stream.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'include/git2/sys') 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 @@ -71,6 +71,17 @@ typedef struct { int (*wrap)(git_stream **out, git_stream *in, const char *host); } 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 * @@ -78,13 +89,14 @@ typedef struct { * 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 * -- cgit v1.2.1