Blame include/git2/proxy.h

Packit Service 20376f
/*
Packit Service 20376f
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit Service 20376f
 *
Packit Service 20376f
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit Service 20376f
 * a Linking Exception. For full terms see the included COPYING file.
Packit Service 20376f
 */
Packit Service 20376f
#ifndef INCLUDE_git_proxy_h__
Packit Service 20376f
#define INCLUDE_git_proxy_h__
Packit Service 20376f
Packit Service 20376f
#include "common.h"
Packit Service 20376f
#include "transport.h"
Packit Service 20376f
Packit Service 20376f
GIT_BEGIN_DECL
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * The type of proxy to use.
Packit Service 20376f
 */
Packit Service 20376f
typedef enum {
Packit Service 20376f
	/**
Packit Service 20376f
	 * Do not attempt to connect through a proxy
Packit Service 20376f
	 *
Packit Service 20376f
	 * If built against libcurl, it itself may attempt to connect
Packit Service 20376f
	 * to a proxy if the environment variables specify it.
Packit Service 20376f
	 */
Packit Service 20376f
	GIT_PROXY_NONE,
Packit Service 20376f
	/**
Packit Service 20376f
	 * Try to auto-detect the proxy from the git configuration.
Packit Service 20376f
	 */
Packit Service 20376f
	GIT_PROXY_AUTO,
Packit Service 20376f
	/**
Packit Service 20376f
	 * Connect via the URL given in the options
Packit Service 20376f
	 */
Packit Service 20376f
	GIT_PROXY_SPECIFIED,
Packit Service 20376f
} git_proxy_t;
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Options for connecting through a proxy
Packit Service 20376f
 *
Packit Service 20376f
 * Note that not all types may be supported, depending on the platform
Packit Service 20376f
 * and compilation options.
Packit Service 20376f
 */
Packit Service 20376f
typedef struct {
Packit Service 20376f
	unsigned int version;
Packit Service 20376f
Packit Service 20376f
	/**
Packit Service 20376f
	 * The type of proxy to use, by URL, auto-detect.
Packit Service 20376f
	 */
Packit Service 20376f
	git_proxy_t type;
Packit Service 20376f
Packit Service 20376f
	/**
Packit Service 20376f
	 * The URL of the proxy.
Packit Service 20376f
	 */
Packit Service 20376f
	const char *url;
Packit Service 20376f
Packit Service 20376f
	/**
Packit Service 20376f
	 * This will be called if the remote host requires
Packit Service 20376f
	 * authentication in order to connect to it.
Packit Service 20376f
	 *
Packit Service 20376f
	 * Returning GIT_PASSTHROUGH will make libgit2 behave as
Packit Service 20376f
	 * though this field isn't set.
Packit Service 20376f
	 */
Packit Service 20376f
	git_cred_acquire_cb credentials;
Packit Service 20376f
Packit Service 20376f
	/**
Packit Service 20376f
	 * If cert verification fails, this will be called to let the
Packit Service 20376f
	 * user make the final decision of whether to allow the
Packit Service 20376f
	 * connection to proceed. Returns 1 to allow the connection, 0
Packit Service 20376f
	 * to disallow it or a negative value to indicate an error.
Packit Service 20376f
	 */
Packit Service 20376f
        git_transport_certificate_check_cb certificate_check;
Packit Service 20376f
Packit Service 20376f
	/**
Packit Service 20376f
	 * Payload to be provided to the credentials and certificate
Packit Service 20376f
	 * check callbacks.
Packit Service 20376f
	 */
Packit Service 20376f
	void *payload;
Packit Service 20376f
} git_proxy_options;
Packit Service 20376f
Packit Service 20376f
#define GIT_PROXY_OPTIONS_VERSION 1
Packit Service 20376f
#define GIT_PROXY_OPTIONS_INIT {GIT_PROXY_OPTIONS_VERSION}
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Initialize a proxy options structure
Packit Service 20376f
 *
Packit Service 20376f
 * @param opts the options struct to initialize
Packit Service 20376f
 * @param version the version of the struct, use `GIT_PROXY_OPTIONS_VERSION`
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_proxy_init_options(git_proxy_options *opts, unsigned int version);
Packit Service 20376f
Packit Service 20376f
GIT_END_DECL
Packit Service 20376f
Packit Service 20376f
#endif