summaryrefslogtreecommitdiff
path: root/include/git2/transport.h
diff options
context:
space:
mode:
authorPhilip Kelley <phkelley@hotmail.com>2013-01-04 14:39:05 -0500
committerEdward Thomson <ethomson@microsoft.com>2013-10-01 16:49:41 -0400
commit8378695671cec5d45464cea65aa5199ecf242212 (patch)
treecf48a1a4c1f6a7fe632457f2e9c9e26e2a14ad20 /include/git2/transport.h
parent816d28e7bc9473482664d374786dac484c0e1156 (diff)
downloadlibgit2-8378695671cec5d45464cea65aa5199ecf242212.tar.gz
Add git_transport_register, git_transport_unregister
Diffstat (limited to 'include/git2/transport.h')
-rw-r--r--include/git2/transport.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/git2/transport.h b/include/git2/transport.h
index e61b10423..9901b15de 100644
--- a/include/git2/transport.h
+++ b/include/git2/transport.h
@@ -253,6 +253,40 @@ GIT_EXTERN(int) git_transport_new(git_transport **out, git_remote *owner, const
/* Signature of a function which creates a transport */
typedef int (*git_transport_cb)(git_transport **out, git_remote *owner, void *param);
+/**
+ * Add a custom transport definition, to be used in addition to the built-in
+ * set of transports that come with libgit2.
+ *
+ * The caller is responsible for synchronizing calls to git_transport_register
+ * and git_transport_unregister with other calls to the library that
+ * instantiate transports.
+ *
+ * @param prefix The scheme (ending in "://") to match, i.e. "git://"
+ * @param priority The priority of this transport relative to others with
+ * the same prefix. Built-in transports have a priority of 1.
+ * @param cb The callback used to create an instance of the transport
+ * @param param A fixed parameter to pass to cb at creation time
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_transport_register(
+ const char *prefix,
+ unsigned priority,
+ git_transport_cb cb,
+ void *param);
+
+/**
+ *
+ * Unregister a custom transport definition which was previously registered
+ * with git_transport_register.
+ *
+ * @param prefix From the previous call to git_transport_register
+ * @param priority From the previous call to git_transport_register
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_transport_unregister(
+ const char *prefix,
+ unsigned priority);
+
/* Transports which come with libgit2 (match git_transport_cb). The expected
* value for "param" is listed in-line below. */