#ifndef INCLUDE_sys_git_transport_h
#define INCLUDE_sys_git_transport_h
#include "git2/net.h"
#include "git2/types.h"
#include "git2/strarray.h"
#include "git2/proxy.h"
GIT_BEGIN_DECL
typedef enum {
GIT_TRANSPORTFLAGS_NONE = 0,
} git_transport_flags_t;
struct git_transport {
unsigned int version;
int (*set_callbacks)(
git_transport *transport,
git_transport_message_cb progress_cb,
git_transport_message_cb error_cb,
git_transport_certificate_check_cb certificate_check_cb,
void *payload);
int (*set_custom_headers)(
git_transport *transport,
const git_strarray *custom_headers);
int (*connect)(
git_transport *transport,
const char *url,
git_cred_acquire_cb cred_acquire_cb,
void *cred_acquire_payload,
const git_proxy_options *proxy_opts,
int direction,
int flags);
int (*ls)(
const git_remote_head ***out,
size_t *size,
git_transport *transport);
int(*push)(git_transport *transport, git_push *push, const git_remote_callbacks *callbacks);
int (*negotiate_fetch)(
git_transport *transport,
git_repository *repo,
const git_remote_head * const *refs,
size_t count);
int (*download_pack)(
git_transport *transport,
git_repository *repo,
git_transfer_progress *stats,
git_transfer_progress_cb progress_cb,
void *progress_payload);
int (*is_connected)(git_transport *transport);
int (*read_flags)(git_transport *transport, int *flags);
void (*cancel)(git_transport *transport);
int (*close)(git_transport *transport);
void (*free)(git_transport *transport);
};
#define GIT_TRANSPORT_VERSION 1
#define GIT_TRANSPORT_INIT {GIT_TRANSPORT_VERSION}
GIT_EXTERN(int) git_transport_init(
git_transport *opts,
unsigned int version);
GIT_EXTERN(int) git_transport_new(git_transport **out, git_remote *owner, const char *url);
GIT_EXTERN(int) git_transport_ssh_with_paths(git_transport **out, git_remote *owner, void *payload);
GIT_EXTERN(int) git_transport_register(
const char *prefix,
git_transport_cb cb,
void *param);
GIT_EXTERN(int) git_transport_unregister(
const char *prefix);
GIT_EXTERN(int) git_transport_dummy(
git_transport **out,
git_remote *owner,
void *payload);
GIT_EXTERN(int) git_transport_local(
git_transport **out,
git_remote *owner,
void *payload);
GIT_EXTERN(int) git_transport_smart(
git_transport **out,
git_remote *owner,
void *payload);
GIT_EXTERN(int) git_transport_smart_certificate_check(git_transport *transport, git_cert *cert, int valid, const char *hostname);
GIT_EXTERN(int) git_transport_smart_credentials(git_cred **out, git_transport *transport, const char *user, int methods);
GIT_EXTERN(int) git_transport_smart_proxy_options(git_proxy_options *out, git_transport *transport);
typedef enum {
GIT_SERVICE_UPLOADPACK_LS = 1,
GIT_SERVICE_UPLOADPACK = 2,
GIT_SERVICE_RECEIVEPACK_LS = 3,
GIT_SERVICE_RECEIVEPACK = 4,
} git_smart_service_t;
typedef struct git_smart_subtransport git_smart_subtransport;
typedef struct git_smart_subtransport_stream git_smart_subtransport_stream;
struct git_smart_subtransport_stream {
git_smart_subtransport *subtransport;
int (*read)(
git_smart_subtransport_stream *stream,
char *buffer,
size_t buf_size,
size_t *bytes_read);
int (*write)(
git_smart_subtransport_stream *stream,
const char *buffer,
size_t len);
void (*free)(
git_smart_subtransport_stream *stream);
};
struct git_smart_subtransport {
int (* action)(
git_smart_subtransport_stream **out,
git_smart_subtransport *transport,
const char *url,
git_smart_service_t action);
int (*close)(git_smart_subtransport *transport);
void (*free)(git_smart_subtransport *transport);
};
typedef int (*git_smart_subtransport_cb)(
git_smart_subtransport **out,
git_transport* owner,
void* param);
typedef struct git_smart_subtransport_definition {
git_smart_subtransport_cb callback;
unsigned rpc;
void* param;
} git_smart_subtransport_definition;
GIT_EXTERN(int) git_smart_subtransport_http(
git_smart_subtransport **out,
git_transport* owner,
void *param);
GIT_EXTERN(int) git_smart_subtransport_git(
git_smart_subtransport **out,
git_transport* owner,
void *param);
GIT_EXTERN(int) git_smart_subtransport_ssh(
git_smart_subtransport **out,
git_transport* owner,
void *param);
GIT_END_DECL
#endif