Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:38

0001 /*
0002  * Copyright (C) the libgit2 contributors. All rights reserved.
0003  *
0004  * This file is part of libgit2, distributed under the GNU GPL v2 with
0005  * a Linking Exception. For full terms see the included COPYING file.
0006  */
0007 #ifndef INCLUDE_git_proxy_h__
0008 #define INCLUDE_git_proxy_h__
0009 
0010 #include "common.h"
0011 
0012 #include "cert.h"
0013 #include "credential.h"
0014 
0015 GIT_BEGIN_DECL
0016 
0017 /**
0018  * The type of proxy to use.
0019  */
0020 typedef enum {
0021     /**
0022      * Do not attempt to connect through a proxy
0023      *
0024      * If built against libcurl, it itself may attempt to connect
0025      * to a proxy if the environment variables specify it.
0026      */
0027     GIT_PROXY_NONE,
0028     /**
0029      * Try to auto-detect the proxy from the git configuration.
0030      */
0031     GIT_PROXY_AUTO,
0032     /**
0033      * Connect via the URL given in the options
0034      */
0035     GIT_PROXY_SPECIFIED
0036 } git_proxy_t;
0037 
0038 /**
0039  * Options for connecting through a proxy
0040  *
0041  * Note that not all types may be supported, depending on the platform
0042  * and compilation options.
0043  */
0044 typedef struct {
0045     unsigned int version;
0046 
0047     /**
0048      * The type of proxy to use, by URL, auto-detect.
0049      */
0050     git_proxy_t type;
0051 
0052     /**
0053      * The URL of the proxy.
0054      */
0055     const char *url;
0056 
0057     /**
0058      * This will be called if the remote host requires
0059      * authentication in order to connect to it.
0060      *
0061      * Returning GIT_PASSTHROUGH will make libgit2 behave as
0062      * though this field isn't set.
0063      */
0064     git_credential_acquire_cb credentials;
0065 
0066     /**
0067      * If cert verification fails, this will be called to let the
0068      * user make the final decision of whether to allow the
0069      * connection to proceed. Returns 0 to allow the connection
0070      * or a negative value to indicate an error.
0071      */
0072     git_transport_certificate_check_cb certificate_check;
0073 
0074     /**
0075      * Payload to be provided to the credentials and certificate
0076      * check callbacks.
0077      */
0078     void *payload;
0079 } git_proxy_options;
0080 
0081 #define GIT_PROXY_OPTIONS_VERSION 1
0082 #define GIT_PROXY_OPTIONS_INIT {GIT_PROXY_OPTIONS_VERSION}
0083 
0084 /**
0085  * Initialize git_proxy_options structure
0086  *
0087  * Initializes a `git_proxy_options` with default values. Equivalent to
0088  * creating an instance with `GIT_PROXY_OPTIONS_INIT`.
0089  *
0090  * @param opts The `git_proxy_options` struct to initialize.
0091  * @param version The struct version; pass `GIT_PROXY_OPTIONS_VERSION`.
0092  * @return Zero on success; -1 on failure.
0093  */
0094 GIT_EXTERN(int) git_proxy_options_init(git_proxy_options *opts, unsigned int version);
0095 
0096 GIT_END_DECL
0097 
0098 #endif