@@ -54,12 +54,6 @@ typedef struct serf_incoming_request_t serf_incoming_request_t;
5454
5555typedef struct serf_request_t serf_request_t ;
5656
57- #if 0
58- typedef struct serf_connection_type_t serf_connection_type_t ;
59- typedef struct serf_protocol_t serf_protocol_t ;
60- typedef struct serf_protocol_type_t serf_protocol_type_t ;
61- #endif /* Connection and protocol API v2 */
62-
6357typedef struct serf_config_t serf_config_t ;
6458
6559/**
@@ -1887,241 +1881,6 @@ apr_status_t serf_logging_add_output(serf_context_t *ctx,
18871881 const serf_log_output_t * output );
18881882
18891883
1890- /*** Connection and protocol API v2 ***/
1891- #if 0
1892- /* ### docco. */
1893- apr_status_t serf_connection_switch_protocol (
1894- serf_connection_t * conn ,
1895- serf_protocol_t * proto
1896- /* ### other params? */
1897- );
1898-
1899-
1900- /* ### docco. */
1901- typedef struct serf_queue_item_t serf_queue_item_t ;
1902-
1903-
1904- /**
1905- * Present a response to the application.
1906- *
1907- * Called when a response has been processed by the current protocol (to any
1908- * extent necessary) and is ready for the application to handle.
1909- *
1910- * Note: @a request may be NULL if this response is server-pushed rather than
1911- * specifically requested.
1912- *
1913- * @since New in 1.4.
1914- */
1915- typedef apr_status_t (* serf_begin_response_t )(
1916- /* ### args not settled */
1917- void * * handler_baton ,
1918- serf_request_t * request ,
1919- serf_bucket_t * response ,
1920- apr_pool_t * scratch_pool );
1921-
1922-
1923- /* ### better name? */
1924- typedef apr_status_t (* serf_handler_t )(
1925- /* ### args not settled */
1926- void * handler_baton ,
1927- serf_bucket_t * response ,
1928- apr_pool_t * scratch_pool );
1929-
1930-
1931- struct serf_protocol_type_t {
1932- /** Name of this protocol type. */
1933- const char * name ;
1934-
1935- /** Vtable version. */
1936- int version ;
1937- #define SERF_PROTOCOL_TYPE_VERSION 1
1938-
1939- /**
1940- * When a pending request reaches the front of the queue, then it becomes
1941- * "active". This callback is used to build/provide the protocol-specific
1942- * request bucket.
1943- *
1944- * ### more docco
1945- */
1946- apr_status_t (* serf_request_activate_t )(
1947- serf_bucket_t * * request_bkt ,
1948- serf_queue_item_t * request_qi ,
1949- void * request_baton ,
1950- serf_bucket_alloc_t * request_bktalloc ,
1951- apr_pool_t * scratch_pool );
1952-
1953- /**
1954- * Construct a protocol parsing bucket, for passing to the process_data
1955- * vtable entry.
1956- *
1957- * When data arrives on the connection, and a parser is not already
1958- * processing the connection's data, then build a new bucket to parse
1959- * this incoming data (according to the protocol).
1960- */
1961- serf_bucket_t * (* build_parser )(serf_protocol_t * proto ,
1962- apr_pool_t * scratch_pool );
1963-
1964- /**
1965- * The protocol should parse all available response data, per the protocol.
1966- *
1967- * This is called when data has become available to the parser. The protocol
1968- * should read all available data before returning.
1969- */
1970- apr_status_t (* process_data )(serf_protocol_t * proto ,
1971- serf_bucket_t * parser ,
1972- apr_pool_t * scratch_pool );
1973- };
1974-
1975-
1976- /**
1977- * Activate an HTTP request when it reaches the front of the queue.
1978- *
1979- * ### more docco
1980- *
1981- * @since New in 1.4.
1982- */
1983- typedef apr_status_t (* serf_http_activate_t )(
1984- serf_bucket_t * * body_bkt ,
1985- serf_bucket_t * request_bkt , /* type REQUEST */
1986- serf_queue_item_t * request_qi ,
1987- void * request_baton ,
1988- serf_bucket_alloc_t * request_bktalloc ,
1989- apr_pool_t * scratch_pool );
1990-
1991-
1992- /**
1993- * Create a new connection and associated HTTP protocol parser.
1994- *
1995- * The new connection/protocol will be associated with @a ctx. It will be
1996- * opened once a request is placed into its outgoing queue. The connection
1997- * will use @a hostname and @a port for the origin server. If
1998- * @a proxy_hostname is not NULL, then all requests will go through the
1999- * proxy specified by @a proxy_hostname and @a proxy_port.
2000- *
2001- * DNS lookups for @a hostname and @a proxy_hostname will be performed
2002- * when the connection first opened, then cached in case the connection
2003- * ever needs to be re-opened.
2004- *
2005- * When a queued request reaches the front of the queue, and is ready for
2006- * delivery, then @a activate_cb will be called to prepare the request.
2007- *
2008- * @a authn_types specifies the types of authentication allowed on this
2009- * connection. Normally, it should be SERF_AUTHN_ALL. When authentication
2010- * credentials are required (for the origin server or the proxy), then
2011- * @a creds_cb will be called with @a app_baton.
2012- *
2013- * When the connection is closed (upon request or because of an error),
2014- * then @a closed_cb will be called with @a app_baton.
2015- *
2016- * The connection and protocol paresr will be allocated in @a result_pool.
2017- * This function will use @a scratch_pool for temporary allocations.
2018- *
2019- * @since New in 1.4.
2020- */
2021- apr_status_t serf_http_protocol_create (
2022- serf_protocol_t * * proto ,
2023- serf_context_t * ctx ,
2024- const char * hostname ,
2025- int port ,
2026- const char * proxy_hostname ,
2027- int proxy_port ,
2028- int authn_types ,
2029- serf_http_activate_t activate_cb ,
2030- /* ### do we need different params for CREDS_CB and CLOSED_CB ? */
2031- serf_credentials_callback_t creds_cb ,
2032- serf_connection_closed_t closed_cb ,
2033- void * app_baton ,
2034- apr_pool_t * result_pool ,
2035- apr_pool_t * scratch_pool );
2036-
2037-
2038- /* ### docco. create http proto parser with an encrypted connection. */
2039- apr_status_t serf_https_protocol_create (
2040- serf_protocol_t * * proto ,
2041- serf_context_t * ctx ,
2042- const char * hostname ,
2043- int port ,
2044- /* ### client certs, credential validation callbacks, etc */
2045- serf_connection_closed_t closed ,
2046- void * closed_baton ,
2047- apr_pool_t * result_pool ,
2048- apr_pool_t * scratch_pool );
2049-
2050-
2051- /* ### docco. queue up an http request. */
2052- serf_queue_item_t * serf_http_request_queue (
2053- serf_protocol_t * proto ,
2054- int priority ,
2055- void * request_baton );
2056-
2057- /**
2058- * ### rationalize against "serf connections and request" group above
2059- *
2060- * @defgroup serf connections
2061- * @ingroup serf
2062- * @{
2063- */
2064-
2065- struct serf_connection_type_t {
2066- /** Name of this connection type. */
2067- const char * name ;
2068-
2069- /** Vtable version. */
2070- int version ;
2071- #define SERF_CONNECTION_TYPE_VERSION 1
2072-
2073- /**
2074- * Initiate a connection to the server.
2075- *
2076- * ### docco. note async. note that request(s) may be queued.
2077- * ### can we somehow defer the SSL tunnel's CONNECT to the higher
2078- * ### layer? then have the HTTP protocol layer wrap a CONN_PLAIN
2079- * ### into a CONN_TLS connection once the tunnel is established?
2080- */
2081- apr_status_t (* connect )(serf_connection_t * conn );
2082-
2083- /**
2084- * Returns a bucket for reading from this connection.
2085- *
2086- * This bucket remains constant for the lifetime of the connection. It has
2087- * built-in BARRIER bucket protection, so it can safely be "destroyed"
2088- * without problem (and a later call to this vtable function will return
2089- * the same bucket again).
2090- *
2091- * For all intents and purposes, this bucket is borrowed by the caller.
2092- *
2093- * This bucket effectively maps to the underlying socket, or possibly to
2094- * a decrypting bucket layered over the socket.
2095- */
2096- serf_bucket_t * (* get_read_bucket )(serf_connection_t * conn );
2097-
2098- /**
2099- * Write some data into into the connection.
2100- *
2101- * Attempt to write a number of iovecs into the connection. The number of
2102- * vectors *completely* written will be returned in @a vecs_written. If that
2103- * equals @a vecs_size, then @a last_written will be set to 0. If it is less
2104- * (not all iovecs were written), then the amount written from the next,
2105- * incompletely written iovec is returned in @a last_written.
2106- *
2107- * In other words, the first byte of unwritten content is located at:
2108- *
2109- * <pre>
2110- * first = vecs[vecs_written][last_written];
2111- * </pre>
2112- *
2113- * If all bytes are written, then APR_SUCCESS is returned. If only a portion
2114- * was written, then APR_EAGAIN will be returned.
2115- */
2116- apr_status_t (* writev )(serf_connection_t * conn ,
2117- int vecs_size , struct iovec * vecs ,
2118- int * vecs_written , apr_size_t * last_written );
2119- };
2120-
2121- #endif /* Connection and protocol API v2 */
2122- /** @} */
2123-
2124-
21251884/* Internal functions for bucket use and lifecycle tracking.
21261885 ### Some of these are directly or via Macros used by third party
21271886 ### applications, such as Apache Subversion */
0 commit comments