serf.h   serf.h 
skipping to change at line 47 skipping to change at line 47
#endif #endif
/* Forward declare some structures */ /* Forward declare some structures */
typedef struct serf_context_t serf_context_t; typedef struct serf_context_t serf_context_t;
typedef struct serf_bucket_t serf_bucket_t; typedef struct serf_bucket_t serf_bucket_t;
typedef struct serf_bucket_type_t serf_bucket_type_t; typedef struct serf_bucket_type_t serf_bucket_type_t;
typedef struct serf_bucket_alloc_t serf_bucket_alloc_t; typedef struct serf_bucket_alloc_t serf_bucket_alloc_t;
typedef struct serf_connection_t serf_connection_t; typedef struct serf_connection_t serf_connection_t;
typedef struct serf_listener_t serf_listener_t;
typedef struct serf_incoming_t serf_incoming_t;
typedef struct serf_incoming_request_t serf_incoming_request_t;
typedef struct serf_request_t serf_request_t; typedef struct serf_request_t serf_request_t;
/** /**
* @defgroup serf high-level constructs * @defgroup serf high-level constructs
* @ingroup serf * @ingroup serf
* @{ * @{
*/ */
/** /**
skipping to change at line 71 skipping to change at line 74
/* This code is for when this is the last response on this connection: /* This code is for when this is the last response on this connection:
* i.e. do not send any more requests on this connection or expect * i.e. do not send any more requests on this connection or expect
* any more responses. * any more responses.
*/ */
#define SERF_ERROR_CLOSING (APR_OS_START_USERERR + SERF_ERROR_RANGE + 1) #define SERF_ERROR_CLOSING (APR_OS_START_USERERR + SERF_ERROR_RANGE + 1)
/* This code is for when the connection terminated before the request /* This code is for when the connection terminated before the request
* could be processed on the other side. * could be processed on the other side.
*/ */
#define SERF_ERROR_REQUEST_LOST (APR_OS_START_USERERR + SERF_ERROR_RANGE + 2) #define SERF_ERROR_REQUEST_LOST (APR_OS_START_USERERR + SERF_ERROR_RANGE + 2)
/* General authentication related errors */
#define SERF_ERROR_AUTHN_FAILED (APR_OS_START_USERERR + SERF_ERROR_RANGE +
90)
/* None of the available authn mechanisms for the request are supported */
#define SERF_ERROR_AUTHN_NOT_SUPPORTED (APR_OS_START_USERERR + SERF_ERROR_R
ANGE + 91)
/* Authn was requested by the server but the header lacked some attribute
*/
#define SERF_ERROR_AUTHN_MISSING_ATTRIBUTE (APR_OS_START_USERERR + SERF_ERR
OR_RANGE + 92)
/* Authentication handler initialization related errors */
#define SERF_ERROR_AUTHN_INITALIZATION_FAILED (APR_OS_START_USERERR +\
SERF_ERROR_RANGE + 93)
/** /**
* Create a new context for serf operations. * Create a new context for serf operations.
* *
* A serf context defines a control loop which processes multiple * A serf context defines a control loop which processes multiple
* connections simultaneously. * connections simultaneously.
* *
* The context will be allocated within @a pool. * The context will be allocated within @a pool.
*/ */
SERF_DECLARE(serf_context_t *) serf_context_create(apr_pool_t *pool); SERF_DECLARE(serf_context_t *) serf_context_create(apr_pool_t *pool);
skipping to change at line 199 skipping to change at line 215
* is based on the @see serf_request_deliver function, where the applicatio n * is based on the @see serf_request_deliver function, where the applicatio n
* can assemble the appropriate bucket(s) before delivery. * can assemble the appropriate bucket(s) before delivery.
* *
* The returned bucket should live at least as long as the connection itsel f. * The returned bucket should live at least as long as the connection itsel f.
* It is assumed that an appropriate allocator is passed in @a setup_baton. * It is assumed that an appropriate allocator is passed in @a setup_baton.
* ### we may want to create a connection-level allocator and pass that * ### we may want to create a connection-level allocator and pass that
* ### along. however, that allocator would *only* be used for this * ### along. however, that allocator would *only* be used for this
* ### callback. it may be wasteful to create a per-conn allocator, so this * ### callback. it may be wasteful to create a per-conn allocator, so this
* ### baton-based, app-responsible form might be best. * ### baton-based, app-responsible form might be best.
* *
* Responsibility for the bucket is passed to the serf library. It will be * Responsibility for the buckets is passed to the serf library. They will be
* destroyed when the connection is closed. * destroyed when the connection is closed.
* *
* All temporary allocations should be made in @a pool. * All temporary allocations should be made in @a pool.
*/ */
typedef serf_bucket_t * (*serf_connection_setup_t)(apr_socket_t *skt, typedef apr_status_t (*serf_connection_setup_t)(apr_socket_t *skt,
serf_bucket_t **read_bkt
,
serf_bucket_t **write_bk
t,
void *setup_baton, void *setup_baton,
apr_pool_t *pool); apr_pool_t *pool);
/** /**
* ### need to update docco w.r.t socket. became "stream" recently. * ### need to update docco w.r.t socket. became "stream" recently.
* ### the stream does not have a barrier, this callback should generally * ### the stream does not have a barrier, this callback should generally
* ### add a barrier around the stream before incorporating it into a * ### add a barrier around the stream before incorporating it into a
* ### response bucket stack. * ### response bucket stack.
* ### should serf add the barrier automatically to protect its data * ### should serf add the barrier automatically to protect its data
* ### structure? i.e. the passed bucket becomes owned rather than * ### structure? i.e. the passed bucket becomes owned rather than
skipping to change at line 292 skipping to change at line 310
* execution, or otherwise), then the connection will be reopened. * execution, or otherwise), then the connection will be reopened.
* *
* All temporary allocations should be made in @a pool. * All temporary allocations should be made in @a pool.
*/ */
typedef apr_status_t (*serf_response_handler_t)(serf_request_t *request, typedef apr_status_t (*serf_response_handler_t)(serf_request_t *request,
serf_bucket_t *response, serf_bucket_t *response,
void *handler_baton, void *handler_baton,
apr_pool_t *pool); apr_pool_t *pool);
/** /**
* Callback function to be implemented by the application, so that serf
* can handle server and proxy authentication.
* code = 401 (server) or 407 (proxy).
* baton = the baton passed to serf_context_run.
* authn_type = one of "Basic", "Digest".
*/
typedef apr_status_t (*serf_credentials_callback_t)(char **username,
char **password,
serf_request_t *request, void *baton,
int code, const char *authn_type,
const char *realm,
apr_pool_t *pool);
/**
* Create a new connection associated with the @a ctx serf context. * Create a new connection associated with the @a ctx serf context.
* *
* A connection will be created to (eventually) connect to the address * A connection will be created to (eventually) connect to the address
* specified by @a address. The address must live at least as long as * specified by @a address. The address must live at least as long as
* @a pool (thus, as long as the connection object). * @a pool (thus, as long as the connection object).
* *
* The connection object will be allocated within @a pool. Clearing or * The connection object will be allocated within @a pool. Clearing or
* destroying this pool will close the connection, and terminate any * destroying this pool will close the connection, and terminate any
* outstanding requests or responses. * outstanding requests or responses.
* *
skipping to change at line 354 skipping to change at line 386
SERF_DECLARE(apr_status_t) serf_connection_create2( SERF_DECLARE(apr_status_t) serf_connection_create2(
serf_connection_t **conn, serf_connection_t **conn,
serf_context_t *ctx, serf_context_t *ctx,
apr_uri_t host_info, apr_uri_t host_info,
serf_connection_setup_t setup, serf_connection_setup_t setup,
void *setup_baton, void *setup_baton,
serf_connection_closed_t closed, serf_connection_closed_t closed,
void *closed_baton, void *closed_baton,
apr_pool_t *pool); apr_pool_t *pool);
typedef apr_status_t (*serf_accept_client_t)(serf_context_t *ctx,
serf_listener_t *l,
void *accept_baton,
apr_socket_t *insock,
apr_pool_t *pool);
SERF_DECLARE(apr_status_t) serf_listener_create(
serf_listener_t **listener,
serf_context_t *ctx,
const char *host,
apr_uint16_t port,
void *accept_baton,
serf_accept_client_t accept_func,
apr_pool_t *pool);
typedef apr_status_t (*serf_incoming_request_cb_t)(serf_context_t *ctx,
serf_incoming_request_t *req,
void *request_baton,
apr_pool_t *pool);
SERF_DECLARE(apr_status_t) serf_incoming_create(
serf_incoming_t **client,
serf_context_t *ctx,
apr_socket_t *insock,
void *request_baton,
serf_incoming_request_cb_t request,
apr_pool_t *pool);
/** /**
* Reset the connection, but re-open the socket again. * Reset the connection, but re-open the socket again.
*/ */
SERF_DECLARE(apr_status_t) serf_connection_reset( SERF_DECLARE(apr_status_t) serf_connection_reset(
serf_connection_t *conn); serf_connection_t *conn);
/** /**
* Close the connection associated with @a conn and cancel all pending requ ests. * Close the connection associated with @a conn and cancel all pending requ ests.
* *
* The closed callback passed to serf_connection_create() will be invoked * The closed callback passed to serf_connection_create() will be invoked
skipping to change at line 379 skipping to change at line 439
/** /**
* Sets the maximum number of outstanding requests @a max_requests on the * Sets the maximum number of outstanding requests @a max_requests on the
* connection @a conn. Setting max_requests to 0 means unlimited (the defau lt). * connection @a conn. Setting max_requests to 0 means unlimited (the defau lt).
* Ex.: setting max_requests to 1 means a request is sent when a response o n the * Ex.: setting max_requests to 1 means a request is sent when a response o n the
* previous request was received and handled. * previous request was received and handled.
*/ */
SERF_DECLARE(void) SERF_DECLARE(void)
serf_connection_set_max_outstanding_requests(serf_connection_t *conn, serf_connection_set_max_outstanding_requests(serf_connection_t *conn,
unsigned int max_requests); unsigned int max_requests);
SERF_DECLARE(void)
serf_connection_set_async_responses(serf_connection_t *conn,
serf_response_acceptor_t acceptor,
void *acceptor_baton,
serf_response_handler_t handler,
void *handler_baton);
/** /**
* Setup the @a request for delivery on its connection. * Setup the @a request for delivery on its connection.
* *
* Right before this is invoked, @a pool will be built within the * Right before this is invoked, @a pool will be built within the
* connection's pool for the request to use. The associated response will * connection's pool for the request to use. The associated response will
* be allocated within that subpool. An associated bucket allocator will * be allocated within that subpool. An associated bucket allocator will
* be built. These items may be fetched from the request object through * be built. These items may be fetched from the request object through
* @see serf_request_get_pool or @see serf_request_get_alloc. * @see serf_request_get_pool or @see serf_request_get_alloc.
* *
* The content of the request is specified by the @a req_bkt bucket. When * The content of the request is specified by the @a req_bkt bucket. When
skipping to change at line 500 skipping to change at line 567
* with the @a ctx serf context. * with the @a ctx serf context.
* *
* The next connection will be created to connect to the proxy server * The next connection will be created to connect to the proxy server
* specified by @a address. The address must live at least as long as the * specified by @a address. The address must live at least as long as the
* serf context. * serf context.
*/ */
SERF_DECLARE(void) serf_config_proxy( SERF_DECLARE(void) serf_config_proxy(
serf_context_t *ctx, serf_context_t *ctx,
apr_sockaddr_t *address); apr_sockaddr_t *address);
/* Supported authentication types. */
#define SERF_AUTHN_NONE 0x00
#define SERF_AUTHN_BASIC 0x01
#define SERF_AUTHN_DIGEST 0x02
#define SERF_AUTHN_NTLM 0x04
#define SERF_AUTHN_NEGOTIATE 0x08
#define SERF_AUTHN_ALL 0xFF
/**
* Define the authentication handlers that serf will try on incoming reques
ts.
*/
SERF_DECLARE(void) serf_config_authn_types(
serf_context_t *ctx,
int authn_types);
/**
* Set the credentials callback handler.
*/
SERF_DECLARE(void) serf_config_credentials_callback(
serf_context_t *ctx,
serf_credentials_callback_t cred_cb);
/* ### maybe some connection control functions for flood? */ /* ### maybe some connection control functions for flood? */
/*** Special bucket creation functions ***/ /*** Special bucket creation functions ***/
/** /**
* Create a bucket of type 'socket bucket'. * Create a bucket of type 'socket bucket'.
* This is basically a wrapper around @a serf_bucket_socket_create, which * This is basically a wrapper around @a serf_bucket_socket_create, which
* initializes the bucket using connection and/or context specific settings . * initializes the bucket using connection and/or context specific settings .
*/ */
SERF_DECLARE(serf_bucket_t *) serf_context_bucket_socket_create( SERF_DECLARE(serf_bucket_t *) serf_context_bucket_socket_create(
skipping to change at line 902 skipping to change at line 991
SERF_DECLARE(apr_status_t) serf_debug__record_read( SERF_DECLARE(apr_status_t) serf_debug__record_read(
const serf_bucket_t *bucket, const serf_bucket_t *bucket,
apr_status_t status); apr_status_t status);
SERF_DECLARE(void) serf_debug__entered_loop(serf_bucket_alloc_t *allocator) ; SERF_DECLARE(void) serf_debug__entered_loop(serf_bucket_alloc_t *allocator) ;
SERF_DECLARE(void) serf_debug__closed_conn(serf_bucket_alloc_t *allocator); SERF_DECLARE(void) serf_debug__closed_conn(serf_bucket_alloc_t *allocator);
SERF_DECLARE(void) serf_debug__bucket_destroy(const serf_bucket_t *bucket); SERF_DECLARE(void) serf_debug__bucket_destroy(const serf_bucket_t *bucket);
SERF_DECLARE(void) serf_debug__bucket_alloc_check(serf_bucket_alloc_t *allo cator); SERF_DECLARE(void) serf_debug__bucket_alloc_check(serf_bucket_alloc_t *allo cator);
/* Version info */ /* Version info */
#define SERF_MAJOR_VERSION 0 #define SERF_MAJOR_VERSION 0
#define SERF_MINOR_VERSION 3 #define SERF_MINOR_VERSION 5
#define SERF_PATCH_VERSION 1 #define SERF_PATCH_VERSION 0
/* Version number string */ /* Version number string */
#define SERF_VERSION_STRING APR_STRINGIFY(SERF_MAJOR_VERSION) "." \ #define SERF_VERSION_STRING APR_STRINGIFY(SERF_MAJOR_VERSION) "." \
APR_STRINGIFY(SERF_MINOR_VERSION) "." \ APR_STRINGIFY(SERF_MINOR_VERSION) "." \
APR_STRINGIFY(SERF_PATCH_VERSION) APR_STRINGIFY(SERF_PATCH_VERSION)
/** /**
* Check at compile time if the Serf version is at least a certain * Check at compile time if the Serf version is at least a certain
* level. * level.
* @param major The major version component of the version checked * @param major The major version component of the version checked
skipping to change at line 926 skipping to change at line 1015
* for (e.g., the "3" of "1.3.0"). * for (e.g., the "3" of "1.3.0").
* @param patch The patch level component of the version checked * @param patch The patch level component of the version checked
* for (e.g., the "0" of "1.3.0"). * for (e.g., the "0" of "1.3.0").
*/ */
#define SERF_VERSION_AT_LEAST(major,minor,patch) \ #define SERF_VERSION_AT_LEAST(major,minor,patch) \
(((major) < SERF_MAJOR_VERSION) \ (((major) < SERF_MAJOR_VERSION) \
|| ((major) == SERF_MAJOR_VERSION && (minor) < SERF_MINOR_VERSION) \ || ((major) == SERF_MAJOR_VERSION && (minor) < SERF_MINOR_VERSION) \
|| ((major) == SERF_MAJOR_VERSION && (minor) == SERF_MINOR_VERSION && \ || ((major) == SERF_MAJOR_VERSION && (minor) == SERF_MINOR_VERSION && \
(patch) <= SERF_PATCH_VERSION)) (patch) <= SERF_PATCH_VERSION))
/**
* Returns the version of the library the application has linked/loaded.
* Values are returned in @a major, @a minor, and @a patch.
*
* Applications will want to use this function to verify compatibility,
* expecially while serf has not reached a 1.0 milestone. APIs and
* semantics may change drastically until the library hits 1.0.
*/
SERF_DECLARE(void) serf_lib_version(int *major, int *minor, int *patch);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* /*
* Every user of serf will want to deal with our various bucket types. * Every user of serf will want to deal with our various bucket types.
* Go ahead and include that header right now. * Go ahead and include that header right now.
* *
* Note: make sure this occurs outside of the C++ namespace block * Note: make sure this occurs outside of the C++ namespace block
*/ */
#include "serf_bucket_types.h" #include "serf_bucket_types.h"
#endif /* !SERF_H */ #endif /* !SERF_H */
 End of changes. 11 change blocks. 
4 lines changed or deleted 110 lines changed or added


 serf_bucket_types.h   serf_bucket_types.h 
skipping to change at line 122 skipping to change at line 122
serf_bucket_t *response); serf_bucket_t *response);
/** /**
* Advise the response @a bucket that this was from a HEAD request and * Advise the response @a bucket that this was from a HEAD request and
* that it should not expect to see a response body. * that it should not expect to see a response body.
*/ */
SERF_DECLARE(void) serf_bucket_response_set_head(serf_bucket_t *bucket); SERF_DECLARE(void) serf_bucket_response_set_head(serf_bucket_t *bucket);
/* ==================================================================== */ /* ==================================================================== */
SERF_DECLARE_DATA extern const serf_bucket_type_t serf_bucket_type_bwtp_fra
me;
#define SERF_BUCKET_IS_BWTP_FRAME(b) SERF_BUCKET_CHECK((b), bwtp_frame)
SERF_DECLARE_DATA extern const serf_bucket_type_t serf_bucket_type_bwtp_inc
oming_frame;
#define SERF_BUCKET_IS_BWTP_INCOMING_FRAME(b) SERF_BUCKET_CHECK((b), bwtp_i
ncoming_frame)
SERF_DECLARE(int) serf_bucket_bwtp_frame_get_channel(serf_bucket_t *hdr);
SERF_DECLARE(int) serf_bucket_bwtp_frame_get_type(serf_bucket_t *hdr);
SERF_DECLARE(const char *) serf_bucket_bwtp_frame_get_phrase(serf_bucket_t
*hdr);
SERF_DECLARE(serf_bucket_t *) serf_bucket_bwtp_frame_get_headers(
serf_bucket_t *hdr);
SERF_DECLARE(serf_bucket_t *) serf_bucket_bwtp_channel_open(
int channel,
const char *URI,
serf_bucket_alloc_t *allocator);
SERF_DECLARE(serf_bucket_t *) serf_bucket_bwtp_channel_close(
int channel,
serf_bucket_alloc_t *allocator);
SERF_DECLARE(serf_bucket_t *) serf_bucket_bwtp_header_create(
int channel,
const char *phrase,
serf_bucket_alloc_t *allocator);
SERF_DECLARE(serf_bucket_t *) serf_bucket_bwtp_message_create(
int channel,
serf_bucket_t *body,
serf_bucket_alloc_t *allocator);
SERF_DECLARE(serf_bucket_t *) serf_bucket_bwtp_incoming_frame_create(
serf_bucket_t *bkt,
serf_bucket_alloc_t *allocator);
SERF_DECLARE(apr_status_t) serf_bucket_bwtp_incoming_frame_wait_for_headers
(
serf_bucket_t *bkt);
/* ==================================================================== */
SERF_DECLARE_DATA extern const serf_bucket_type_t serf_bucket_type_aggregat e; SERF_DECLARE_DATA extern const serf_bucket_type_t serf_bucket_type_aggregat e;
#define SERF_BUCKET_IS_AGGREGATE(b) SERF_BUCKET_CHECK((b), aggregate) #define SERF_BUCKET_IS_AGGREGATE(b) SERF_BUCKET_CHECK((b), aggregate)
/** serf_bucket_aggregate_cleanup will instantly destroy all buckets in
the aggregate bucket that have been read completely. Whereas normally,
these buckets are destroyed on every read operation. */
SERF_DECLARE(void) serf_bucket_aggregate_cleanup(
serf_bucket_t *bucket, serf_bucket_alloc_t *allocator);
SERF_DECLARE(serf_bucket_t *) serf_bucket_aggregate_create( SERF_DECLARE(serf_bucket_t *) serf_bucket_aggregate_create(
serf_bucket_alloc_t *allocator); serf_bucket_alloc_t *allocator);
/** Transform @a bucket in-place into an aggregate bucket. */ /** Transform @a bucket in-place into an aggregate bucket. */
SERF_DECLARE(void) serf_bucket_aggregate_become(serf_bucket_t *bucket); SERF_DECLARE(void) serf_bucket_aggregate_become(serf_bucket_t *bucket);
SERF_DECLARE(void) serf_bucket_aggregate_prepend( SERF_DECLARE(void) serf_bucket_aggregate_prepend(
serf_bucket_t *aggregate_bucket, serf_bucket_t *aggregate_bucket,
serf_bucket_t *prepend_bucket); serf_bucket_t *prepend_bucket);
SERF_DECLARE(void) serf_bucket_aggregate_append( SERF_DECLARE(void) serf_bucket_aggregate_append(
serf_bucket_t *aggregate_bucket, serf_bucket_t *aggregate_bucket,
serf_bucket_t *append_bucket); serf_bucket_t *append_bucket);
typedef apr_status_t (*serf_bucket_aggregate_eof_t)(void *baton, serf_bucke
t_t *aggregate_bucket);
SERF_DECLARE(void) serf_bucket_aggregate_hold_open(serf_bucket_t *aggregate
_bucket,
serf_bucket_aggregate_eo
f_t fn,
void *baton);
SERF_DECLARE(void) serf_bucket_aggregate_prepend_iovec( SERF_DECLARE(void) serf_bucket_aggregate_prepend_iovec(
serf_bucket_t *aggregate_bucket, serf_bucket_t *aggregate_bucket,
struct iovec *vecs, struct iovec *vecs,
int vecs_count); int vecs_count);
SERF_DECLARE(void) serf_bucket_aggregate_append_iovec( SERF_DECLARE(void) serf_bucket_aggregate_append_iovec(
serf_bucket_t *aggregate_bucket, serf_bucket_t *aggregate_bucket,
struct iovec *vecs, struct iovec *vecs,
int vecs_count); int vecs_count);
skipping to change at line 302 skipping to change at line 357
* @param baton opaque baton as passed to @see serf_bucket_headers_do * @param baton opaque baton as passed to @see serf_bucket_headers_do
* @param key The header key from this iteration through the table * @param key The header key from this iteration through the table
* @param value The header value from this iteration through the table * @param value The header value from this iteration through the table
*/ */
typedef int (serf_bucket_headers_do_callback_fn_t)( typedef int (serf_bucket_headers_do_callback_fn_t)(
void *baton, void *baton,
const char *key, const char *key,
const char *value); const char *value);
/** /**
* Iterates over all headers of the message and invokes the callback
* function with header key and value. Stop iterating when no more
* headers are available or when the callback function returned a
* non-0 value.
*
* @param headers_bucket headers to iterate over * @param headers_bucket headers to iterate over
* @param func callback routine to invoke for every header in the bucket * @param func callback routine to invoke for every header in the bucket
* @param baton baton to pass on each invocation to func * @param baton baton to pass on each invocation to func
*/ */
SERF_DECLARE(void) serf_bucket_headers_do( SERF_DECLARE(void) serf_bucket_headers_do(
serf_bucket_t *headers_bucket, serf_bucket_t *headers_bucket,
serf_bucket_headers_do_callback_fn_t func, serf_bucket_headers_do_callback_fn_t func,
void *baton); void *baton);
/* ==================================================================== */ /* ==================================================================== */
 End of changes. 4 change blocks. 
0 lines changed or deleted 68 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/