⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ra_serf.h

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* * ra_serf.h :  headers file for ra_serf * * ==================================================================== * Copyright (c) 2006 CollabNet.  All rights reserved. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution.  The terms * are also available at http://subversion.tigris.org/license-1.html. * If newer versions of this license are posted there, you may use a * newer version instead, at your option. * * This software consists of voluntary contributions made by many * individuals.  For exact contribution history, see the revision * history and logs, available at http://subversion.tigris.org/. * ==================================================================== */#include <serf.h>#include <expat.h>#include <apr_uri.h>#include "svn_types.h"#include "svn_string.h"#include "svn_pools.h"#include "svn_ra.h"#include "svn_delta.h"#include "svn_version.h"#include "svn_dav.h"/* A serf connection and optionally associated SSL context.  */typedef struct {  /* Our connection to a server. */  serf_connection_t *conn;  /* Bucket allocator for this connection. */  serf_bucket_alloc_t *bkt_alloc;  /* Host name */  const char *hostinfo;  /* The address where the connections are made to */  apr_sockaddr_t *address;  /* Are we using ssl */  svn_boolean_t using_ssl;  /* Should we ask for compressed responses? */  svn_boolean_t using_compression;  /* What was the last HTTP status code we got on this connection? */  int last_status_code;  /* Current authorization header used for this connection; may be NULL */  const char *auth_header;  /* Current authorization value used for this connection; may be NULL */  char *auth_value;  /* Optional SSL context for this connection. */  serf_ssl_context_t *ssl_context;} svn_ra_serf__connection_t;/* * The master serf RA session. * * This is stored in the ra session ->priv field. */typedef struct {  /* Pool for allocations during this session */  apr_pool_t *pool;  /* The current context */  serf_context_t *context;  /* Bucket allocator for this context. */  serf_bucket_alloc_t *bkt_alloc;  /* Are we using ssl */  svn_boolean_t using_ssl;  /* Should we ask for compressed responses? */  svn_boolean_t using_compression;  /* The current connection */  svn_ra_serf__connection_t **conns;  int num_conns;  int cur_conn;  /* The URL that was passed into _open() */  apr_uri_t repos_url;  const char *repos_url_str;  /* The actual discovered root; may be NULL until we know it. */  apr_uri_t repos_root;  const char *repos_root_str;  /* Our Version-Controlled-Configuration; may be NULL until we know it. */  const char *vcc_url;  /* Cached properties */  apr_hash_t *cached_props;  /* Authentication related properties. */  const char *realm;  const char *auth_header;  char *auth_value;  svn_auth_iterstate_t *auth_state;  int auth_attempts;  /* Callback functions to get info from WC */  const svn_ra_callbacks2_t *wc_callbacks;  void *wc_callback_baton;  /* Error that we've received but not yet returned upstream. */  svn_error_t *pending_error;} svn_ra_serf__session_t;/* * Structure which represents a DAV element with a NAMESPACE and NAME. */typedef struct {  /* Element namespace */  const char *namespace;  /* Element name */  const char *name;} svn_ra_serf__dav_props_t;/* * Structure which represents an XML namespace. */typedef struct ns_t {  /* The assigned name. */  const char *namespace;  /* The full URL for this namespace. */  const char *url;  /* The next namespace in our list. */  struct ns_t *next;} svn_ra_serf__ns_t;/* * An incredibly simple list. */typedef struct ra_serf_list_t {  void *data;  struct ra_serf_list_t *next;} svn_ra_serf__list_t;/** DAV property sets **/static const svn_ra_serf__dav_props_t base_props[] ={  { "DAV:", "version-controlled-configuration" },  { "DAV:", "resourcetype" },  { SVN_DAV_PROP_NS_DAV, "baseline-relative-path" },  { SVN_DAV_PROP_NS_DAV, "repository-uuid" },  { NULL }};static const svn_ra_serf__dav_props_t checked_in_props[] ={  { "DAV:", "checked-in" },  { NULL }};static const svn_ra_serf__dav_props_t baseline_props[] ={  { "DAV:", "baseline-collection" },  { "DAV:", "version-name" },  { NULL }};static const svn_ra_serf__dav_props_t all_props[] ={  { "DAV:", "allprop" },  { NULL }};static const svn_ra_serf__dav_props_t vcc_props[] ={  { "DAV:", "version-controlled-configuration" },  { NULL }};static const svn_ra_serf__dav_props_t check_path_props[] ={  { "DAV:", "resourcetype" },  { NULL }};static const svn_ra_serf__dav_props_t uuid_props[] ={  { SVN_DAV_PROP_NS_DAV, "repository-uuid" },  { NULL }};static const svn_ra_serf__dav_props_t repos_root_props[] ={  { SVN_DAV_PROP_NS_DAV, "baseline-relative-path" },  { NULL }};/* WC props compatibility with ra_dav. */#define SVN_RA_SERF__WC_NAMESPACE SVN_PROP_WC_PREFIX "ra_dav:"#define SVN_RA_SERF__WC_ACTIVITY_URL SVN_RA_SERF__WC_NAMESPACE "activity-url"#define SVN_RA_SERF__WC_CHECKED_IN_URL SVN_RA_SERF__WC_NAMESPACE "version-url"/** Serf utility functions **/serf_bucket_t *svn_ra_serf__conn_setup(apr_socket_t *sock,                        void *baton,                        apr_pool_t *pool);serf_bucket_t*svn_ra_serf__accept_response(serf_request_t *request,                             serf_bucket_t *stream,                             void *acceptor_baton,                             apr_pool_t *pool);voidsvn_ra_serf__conn_closed(serf_connection_t *conn,                         void *closed_baton,                         apr_status_t why,                         apr_pool_t *pool);apr_status_tsvn_ra_serf__is_conn_closing(serf_bucket_t *response);apr_status_tsvn_ra_serf__cleanup_serf_session(void *data);/* * Create a REQUEST with an associated REQ_BKT in the SESSION. * * If HDRS_BKT is not-NULL, it will be set to a headers_bucket that * corresponds to the new request. * * The request will be METHOD at URL. * * If BODY_BKT is not-NULL, it will be sent as the request body. * * If CONTENT_TYPE is not-NULL, it will be sent as the Content-Type header. */voidsvn_ra_serf__setup_serf_req(serf_request_t *request,                            serf_bucket_t **req_bkt, serf_bucket_t **hdrs_bkt,                            svn_ra_serf__connection_t *conn,                            const char *method, const char *url,                            serf_bucket_t *body_bkt, const char *content_type);/* * This function will run the serf context in SESS until *DONE is TRUE. */svn_error_t *svn_ra_serf__context_run_wait(svn_boolean_t *done,                              svn_ra_serf__session_t *sess,                              apr_pool_t *pool);/* Callback for when a request body is needed. */typedef serf_bucket_t*(*svn_ra_serf__request_body_delegate_t)(void *baton,                                        serf_bucket_alloc_t *alloc,                                        apr_pool_t *pool);/* Callback for when request headers are needed. */typedef apr_status_t(*svn_ra_serf__request_header_delegate_t)(serf_bucket_t *headers,                                          void *baton,                                          apr_pool_t *pool);/* Callback for when a response has an error. */typedef apr_status_t(*svn_ra_serf__response_error_t)(serf_request_t *request,                                 serf_bucket_t *response,                                 int status_code,                                 void *baton);/* * Structure that can be passed to our default handler to guide the * execution of the request through its lifecycle. */typedef struct {  /* The HTTP method string of the request */  const char *method;  /* The resource to the execute the method on. */  const char *path;  /* The request's body buckets.   *   * May be NULL if there is no body to send or ->body_delegate is set.   *   * Using the body_delegate function is preferred as it delays the   * creation of the body until we're about to deliver the request   * instead of creating it earlier.   *   * @see svn_ra_serf__request_body_delegate_t   */  serf_bucket_t *body_buckets;  /* The content-type of the request body. */  const char *body_type;  /* The handler and baton pair for our handler. */  serf_response_handler_t response_handler;  void *response_baton;  /* The handler and baton pair to be executed when a non-recoverable error   * is detected.  If it is NULL in the presence of an error, an abort() may   * be triggered.   */  svn_ra_serf__response_error_t response_error;  void *response_error_baton;  /* This function and baton will be executed when the request is about   * to be delivered by serf.   *   * This just passes through serf's raw request creation parameters.   * None of the other parameters will be utilized if this field is set.   */  serf_request_setup_t delegate;  void *delegate_baton;  /* This function and baton pair allows for custom request headers to   * be set.   *   * It will be executed after the request has been set up but before it is   * delivered.   */  svn_ra_serf__request_header_delegate_t header_delegate;  void *header_delegate_baton;  /* This function and baton pair allows a body to be created right before   * delivery.   *   * It will be executed after the request has been set up but before it is   * delivered.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -