blob: 61245b364774fd6c45a5956f274f0034d1b69e28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
* Copyright (C) Yichun Zhang (agentzh)
*/
#ifndef _NGX_HTTP_LUA_SOCKET_UDP_H_INCLUDED_
#define _NGX_HTTP_LUA_SOCKET_UDP_H_INCLUDED_
#include "ngx_http_lua_common.h"
typedef struct ngx_http_lua_socket_udp_upstream_s
ngx_http_lua_socket_udp_upstream_t;
typedef
int (*ngx_http_lua_socket_udp_retval_handler)(ngx_http_request_t *r,
ngx_http_lua_socket_udp_upstream_t *u, lua_State *L);
typedef void (*ngx_http_lua_socket_udp_upstream_handler_pt)
(ngx_http_request_t *r, ngx_http_lua_socket_udp_upstream_t *u);
typedef struct {
ngx_connection_t *connection;
struct sockaddr *sockaddr;
socklen_t socklen;
ngx_str_t server;
ngx_log_t log;
} ngx_http_lua_udp_connection_t;
struct ngx_http_lua_socket_udp_upstream_s {
ngx_http_lua_socket_udp_retval_handler prepare_retvals;
ngx_http_lua_socket_udp_upstream_handler_pt read_event_handler;
ngx_http_lua_loc_conf_t *conf;
ngx_http_cleanup_pt *cleanup;
ngx_http_request_t *request;
ngx_http_lua_udp_connection_t udp_connection;
ngx_addr_t *local;
ngx_msec_t read_timeout;
ngx_http_upstream_resolved_t *resolved;
ngx_uint_t ft_type;
ngx_err_t socket_errno;
size_t received; /* for receive */
size_t recv_buf_size;
ngx_http_lua_co_ctx_t *co_ctx;
unsigned waiting:1; /* :1 */
};
void ngx_http_lua_inject_socket_udp_api(ngx_log_t *log, lua_State *L);
#endif /* _NGX_HTTP_LUA_SOCKET_UDP_H_INCLUDED_ */
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|