#ifndef HTTP_CLIENT_PRIVATE_H
#define HTTP_CLIENT_PRIVATE_H
#include "connection.h"
#include "http-url.h"
#include "http-client.h"
/*
* Defaults
*/
/*
* Types
*/
struct http_client_connection;
struct http_client_peer_pool;
struct http_client_peer_shared;
struct http_client_peer;
struct http_client_queue;
struct http_client_host_shared;
struct http_client_host;
struct http_client_request *);
struct http_client_connection *);
struct http_client_peer *);
struct http_client_peer_shared *);
struct http_client_peer_pool *);
struct http_client_queue *);
struct http_client_host_shared *);
const struct http_client_peer_addr *,
struct http_client_peer_shared *);
const char *, struct http_client_host_shared *);
enum http_client_peer_addr_type {
};
struct http_client_peer_addr {
union {
struct {
} tcp;
struct {
const char *path;
} un;
} a;
};
/*
* Objects
*/
struct http_client_request {
unsigned int refcount;
const char *label;
unsigned int id;
const char *host_socket;
const char *authority;
unsigned int last_status;
unsigned int timeout_msecs;
unsigned int attempt_timeout_msecs;
unsigned int max_attempts;
unsigned int redirects;
unsigned int delayed_error_status;
const char *delayed_error;
void *context;
void (*destroy_callback)(void *);
void *destroy_context;
};
struct http_client_connection {
unsigned int refcount;
char *label;
int connect_errno;
/* requests that have been sent, waiting for response */
connection into tunnel */
};
struct http_client_peer_shared {
unsigned int refcount;
char *addr_name;
char *label;
unsigned int peers_count;
/* connection retry */
unsigned int backoff_initial_time_msecs;
unsigned int backoff_current_time_msecs;
unsigned int backoff_max_time_msecs;
connections */
};
struct http_client_peer_pool {
unsigned int refcount;
/* all connections to this peer */
/* pending connections (not ready connecting) */
/* available connections to this peer */
/* distinguishing settings for these connections */
char *rawlog_dir;
};
struct http_client_peer {
unsigned int refcount;
/* queues using this peer */
/* active connections to this peer */
/* zero time-out for consolidating request handling */
};
struct http_client_queue {
char *name;
char *addr_name;
/* current index in host->ips */
unsigned int ips_connect_idx;
/* the first IP that started the current round of connection attempts.
initially 0, and later set to the ip index of the last successful
connected IP */
unsigned int ips_connect_start_idx;
unsigned int connect_attempts;
/* peers we are trying to connect to;
this can be more than one when soft connect timeouts are enabled */
/* currently active peer */
/* all requests associated to this queue
(ordered by earliest timeout first) */
/* delayed requests waiting to be released after delay */
/* requests pending in queue to be picked up by connections */
};
struct http_client_host_shared {
char *name;
/* the ip addresses DNS returned for this host */
unsigned int ips_count;
/* private instance for each client that uses this host */
/* active DNS lookup */
/* timeouts */
};
struct http_client_host {
/* separate queue for each host port */
};
struct http_client {
/* list of failed requests that are waiting for ioloop */
unsigned int requests_count;
};
struct http_client_context {
unsigned int refcount;
const char *dns_client_socket_path;
unsigned int dns_ttl_msecs;
unsigned int dns_lookup_timeout_msecs;
};
/*
* Peer address
*/
static inline bool
{
return TRUE;
default:
break;
}
return FALSE;
}
static inline const char *
{
default:
break;
}
return NULL;
}
static inline const char *
{
return t_strdup_printf("[%s]:%u",
}
return t_strdup_printf("%s:%u",
default:
break;
}
i_unreached();
return "";
}
/*
* Request
*/
static inline bool
{
}
const char *
/* Returns FALSE if unrefing destroyed the request entirely */
const struct http_response *response);
struct http_client_peer_addr *addr);
bool pipelined);
bool pipelined);
struct http_response *response);
const struct http_client_tunnel *tunnel,
struct http_response *response);
/*
* Connection
*/
struct connection_list *http_client_connection_list_init(void);
struct http_client_connection *
/* Returns FALSE if unrefing destroyed the connection entirely */
struct http_client_connection *conn);
struct http_client_connection *conn);
struct http_client_connection *conn);
struct http_client_connection *conn);
unsigned int
struct http_client_tunnel *tunnel);
struct http_client_peer *peer);
/*
* Peer
*/
/* address */
unsigned int http_client_peer_addr_hash
(const struct http_client_peer_addr *peer1,
/* connection pool */
/* peer (shared) */
const char *
unsigned int
/* peer */
struct http_client_peer *
const struct http_client_peer_addr *addr);
struct http_client_queue *queue);
struct http_client_queue *queue);
struct http_client_queue *queue);
struct http_client_request *
bool no_urgent);
const char *reason);
bool premature);
unsigned int
unsigned int
unsigned int
/*
* Queue
*/
struct http_client_queue *
const struct http_client_peer_addr *addr);
unsigned int
struct http_client_request *req);
struct http_client_request *req);
struct http_client_request *
unsigned int
unsigned int
struct http_client_peer *peer);
struct http_client_peer *peer);
/*
* Host
*/
/* host (shared) */
struct http_client_host_shared **_hshared);
struct http_client_host_shared *hshared);
/* host */
static inline unsigned int
{
}
static inline const struct ip_addr *
unsigned int idx)
{
}
static inline bool
{
}
struct http_client_host *
struct http_client_request *req);
/*
* Client
*/
const char **error_r);
struct http_client_request *req);
struct http_client_request *req);
/*
* Client shared context
*/
#endif