nxt_upstream.h (1393:c2a2867bb5e5) nxt_upstream.h (1394:20b41ebfff79)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_UPSTREAM_H_INCLUDED_
8#define _NXT_UPSTREAM_H_INCLUDED_
9
10
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_UPSTREAM_H_INCLUDED_
8#define _NXT_UPSTREAM_H_INCLUDED_
9
10
11typedef struct nxt_upstream_proxy_s nxt_upstream_proxy_t;
12typedef struct nxt_upstream_round_robin_s nxt_upstream_round_robin_t;
13typedef struct nxt_upstream_round_robin_server_s
14 nxt_upstream_round_robin_server_t;
15
16
17typedef void (*nxt_upstream_peer_ready_t)(nxt_task_t *task,
18 nxt_upstream_server_t *us);
19typedef void (*nxt_upstream_peer_error_t)(nxt_task_t *task,
20 nxt_upstream_server_t *us);
21
22
23typedef struct {
24 nxt_upstream_peer_ready_t ready;
25 nxt_upstream_peer_error_t error;
26} nxt_upstream_peer_state_t;
27
28
29typedef nxt_upstream_t *(*nxt_upstream_joint_create_t)(
30 nxt_router_temp_conf_t *tmcf, nxt_upstream_t *upstream);
31typedef void (*nxt_upstream_server_get_t)(nxt_task_t *task,
32 nxt_upstream_server_t *us);
33
34
35typedef struct {
36 nxt_upstream_joint_create_t joint_create;
37 nxt_upstream_server_get_t get;
38} nxt_upstream_server_proto_t;
39
40
41struct nxt_upstream_s {
42 const nxt_upstream_server_proto_t *proto;
43
44 union {
45 nxt_upstream_proxy_t *proxy;
46 nxt_upstream_round_robin_t *round_robin;
47 } type;
48
49 nxt_str_t name;
50};
51
52
53struct nxt_upstreams_s {
54 uint32_t items;
55 nxt_upstream_t upstream[0];
56};
57
58
59struct nxt_upstream_server_s {
60 nxt_sockaddr_t *sockaddr;
61 const nxt_upstream_peer_state_t *state;
62 nxt_upstream_t *upstream;
63
64 uint8_t protocol;
65
66 union {
67 nxt_upstream_round_robin_server_t *round_robin;
68 } server;
69
70 union {
71 nxt_http_peer_t *http;
72 } peer;
73};
74
75
76nxt_int_t nxt_upstream_round_robin_create(nxt_task_t *task,
77 nxt_router_temp_conf_t *tmcf, nxt_conf_value_t *upstream_conf,
78 nxt_upstream_t *upstream);
79
80
11#endif /* _NXT_UPSTREAM_H_INCLUDED_ */
81#endif /* _NXT_UPSTREAM_H_INCLUDED_ */