summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-05-16 22:07:08 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-06-26 18:18:11 +0200
commit8f866daee5a0a43702f349c7fa46d3274542650c (patch)
treeb9988e5566c79f5ec9b6a064ddb1d7706a51e109 /include/git2
parentc5b2622d6810eed5a4b90123ab0e7fc6d4583831 (diff)
downloadlibgit2-8f866daee5a0a43702f349c7fa46d3274542650c.tar.gz
Lay down the fundations for the network code
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/net.h33
-rw-r--r--include/git2/transport.h56
-rw-r--r--include/git2/types.h11
3 files changed, 100 insertions, 0 deletions
diff --git a/include/git2/net.h b/include/git2/net.h
new file mode 100644
index 000000000..869309f9d
--- /dev/null
+++ b/include/git2/net.h
@@ -0,0 +1,33 @@
+#ifndef INCLUDE_net_h__
+#define INCLUDE_net_h__
+
+#include "common.h"
+#include "oid.h"
+#include "types.h"
+
+/*
+ * We need this because we need to know whether we should call
+ * git-upload-pack or git-receive-pack on the remote end when get_refs
+ * gets called.
+ */
+
+enum git_net_direction {
+ INTENT_PUSH,
+ INTENT_PULL
+};
+
+/*
+ * This is what we give out on ->ls()
+ */
+
+struct git_remote_head {
+ git_oid oid;
+ char *name;
+};
+
+struct git_headarray {
+ unsigned int len;
+ struct git_remote_head *heads;
+};
+
+#endif
diff --git a/include/git2/transport.h b/include/git2/transport.h
new file mode 100644
index 000000000..dfbc1a84c
--- /dev/null
+++ b/include/git2/transport.h
@@ -0,0 +1,56 @@
+/*
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2,
+ * as published by the Free Software Foundation.
+ *
+ * In addition to the permissions in the GNU General Public License,
+ * the authors give you unlimited permission to link the compiled
+ * version of this file into combinations with other programs,
+ * and to distribute those combinations without any restriction
+ * coming from the use of this file. (The General Public License
+ * restrictions do apply in other respects; for example, they cover
+ * modification of the file, and distribution when not linked into
+ * a combined executable.)
+ *
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef INCLUDE_git_transport_h__
+#define INCLUDE_git_transport_h__
+
+#include "common.h"
+#include "types.h"
+#include "net.h"
+
+/**
+ * @file git2/transport.h
+ * @brief Git protocol transport abstraction
+ * @defgroup git_transport Git protocol transport abstraction
+ * @ingroup Git
+ * @{
+ */
+GIT_BEGIN_DECL
+
+/**
+ * Get the appropriate transport for an URL.
+ * @param tranport the transport for the url
+ * @param url the url of the repo
+ */
+GIT_EXTERN(int) git_transport_get(git_transport *transport, const char *url);
+
+GIT_EXTERN(int) git_transport_connect(git_transport *transport, git_net_direction direction);
+/*
+GIT_EXTERN(const git_vector *) git_transport_get_refs(git_transport *transport);
+*/
+GIT_EXTERN(int) git_transport_add(git_transport *transport, const char *prefix);
+
+/** @} */
+GIT_END_DECL
+#endif
diff --git a/include/git2/types.h b/include/git2/types.h
index 963156f85..69aa28955 100644
--- a/include/git2/types.h
+++ b/include/git2/types.h
@@ -167,9 +167,20 @@ typedef enum {
GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED,
} git_rtype;
+
typedef struct git_refspec git_refspec;
typedef struct git_remote git_remote;
+/** A transport to use */
+typedef struct git_transport git_transport;
+
+/** Whether to push or pull */
+typedef enum git_net_direction git_net_direction;
+
+typedef int (*git_transport_cb)(git_transport *transport);
+
+typedef struct git_headarray git_headarray;
+
/** @} */
GIT_END_DECL