summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_upstream.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_upstream.h')
-rw-r--r--src/nxt_upstream.h80
1 files changed, 57 insertions, 23 deletions
diff --git a/src/nxt_upstream.h b/src/nxt_upstream.h
index d1fca2a5..afc53774 100644
--- a/src/nxt_upstream.h
+++ b/src/nxt_upstream.h
@@ -8,40 +8,74 @@
#define _NXT_UPSTREAM_H_INCLUDED_
-typedef struct nxt_upstream_peer_s nxt_upstream_peer_t;
+typedef struct nxt_upstream_proxy_s nxt_upstream_proxy_t;
+typedef struct nxt_upstream_round_robin_s nxt_upstream_round_robin_t;
+typedef struct nxt_upstream_round_robin_server_s
+ nxt_upstream_round_robin_server_t;
-struct nxt_upstream_peer_s {
- /* STUB */
- void *upstream;
- void *data;
- /**/
+typedef void (*nxt_upstream_peer_ready_t)(nxt_task_t *task,
+ nxt_upstream_server_t *us);
+typedef void (*nxt_upstream_peer_error_t)(nxt_task_t *task,
+ nxt_upstream_server_t *us);
- nxt_sockaddr_t *sockaddr;
- nxt_nsec_t delay;
- uint32_t tries;
- in_port_t port;
+typedef struct {
+ nxt_upstream_peer_ready_t ready;
+ nxt_upstream_peer_error_t error;
+} nxt_upstream_peer_state_t;
- nxt_str_t addr;
- nxt_mp_t *mem_pool;
- void (*ready_handler)(nxt_task_t *task, nxt_upstream_peer_t *up);
- void (*protocol_handler)(nxt_upstream_source_t *us);
-};
+typedef nxt_upstream_t *(*nxt_upstream_joint_create_t)(
+ nxt_router_temp_conf_t *tmcf, nxt_upstream_t *upstream);
+typedef void (*nxt_upstream_server_get_t)(nxt_task_t *task,
+ nxt_upstream_server_t *us);
typedef struct {
- void (*ready_handler)(void *data);
- nxt_work_handler_t completion_handler;
- nxt_work_handler_t error_handler;
-} nxt_upstream_state_t;
+ nxt_upstream_joint_create_t joint_create;
+ nxt_upstream_server_get_t get;
+} nxt_upstream_server_proto_t;
+
+
+struct nxt_upstream_s {
+ const nxt_upstream_server_proto_t *proto;
+
+ union {
+ nxt_upstream_proxy_t *proxy;
+ nxt_upstream_round_robin_t *round_robin;
+ } type;
+
+ nxt_str_t name;
+};
+
+
+struct nxt_upstreams_s {
+ uint32_t items;
+ nxt_upstream_t upstream[0];
+};
+
+
+struct nxt_upstream_server_s {
+ nxt_sockaddr_t *sockaddr;
+ const nxt_upstream_peer_state_t *state;
+ nxt_upstream_t *upstream;
+
+ uint8_t protocol;
+
+ union {
+ nxt_upstream_round_robin_server_t *round_robin;
+ } server;
+
+ union {
+ nxt_http_peer_t *http;
+ } peer;
+};
-/* STUB */
-NXT_EXPORT void nxt_upstream_round_robin_peer(nxt_task_t *task,
- nxt_upstream_peer_t *up);
-/**/
+nxt_int_t nxt_upstream_round_robin_create(nxt_task_t *task,
+ nxt_router_temp_conf_t *tmcf, nxt_conf_value_t *upstream_conf,
+ nxt_upstream_t *upstream);
#endif /* _NXT_UPSTREAM_H_INCLUDED_ */