Mercurial > hg > nginx
comparison src/event/ngx_event_udp.h @ 8810:2dfd313f22f2 quic
Core: made the ngx_sendmsg() function non-static.
Additionally, the ngx_init_srcaddr_cmsg() function is introduced which
initializes control message with connection local address.
The NGX_HAVE_ADDRINFO_CMSG macro is defined when at least one of methods
to deal with corresponding control message is available.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 15 Jul 2021 14:21:39 +0300 |
parents | 6f434af59257 |
children | e7a2d3914877 |
comparison
equal
deleted
inserted
replaced
8809:6f434af59257 | 8810:2dfd313f22f2 |
---|---|
12 #include <ngx_core.h> | 12 #include <ngx_core.h> |
13 | 13 |
14 | 14 |
15 #if !(NGX_WIN32) | 15 #if !(NGX_WIN32) |
16 | 16 |
17 #if ((NGX_HAVE_MSGHDR_MSG_CONTROL) \ | |
18 && (NGX_HAVE_IP_SENDSRCADDR || NGX_HAVE_IP_RECVDSTADDR \ | |
19 || NGX_HAVE_IP_PKTINFO \ | |
20 || (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO))) | |
21 #define NGX_HAVE_ADDRINFO_CMSG 1 | |
22 #endif | |
23 | |
24 | |
17 typedef struct { | 25 typedef struct { |
18 ngx_buf_t *buffer; | 26 ngx_buf_t *buffer; |
19 struct sockaddr *sockaddr; | 27 struct sockaddr *sockaddr; |
20 socklen_t socklen; | 28 socklen_t socklen; |
21 } ngx_udp_dgram_t; | 29 } ngx_udp_dgram_t; |
27 ngx_str_t key; | 35 ngx_str_t key; |
28 ngx_udp_dgram_t *dgram; | 36 ngx_udp_dgram_t *dgram; |
29 }; | 37 }; |
30 | 38 |
31 | 39 |
40 #if (NGX_HAVE_ADDRINFO_CMSG) | |
41 | |
42 typedef union { | |
43 #if (NGX_HAVE_IP_SENDSRCADDR || NGX_HAVE_IP_RECVDSTADDR) | |
44 struct in_addr addr; | |
45 #endif | |
46 | |
47 #if (NGX_HAVE_IP_PKTINFO) | |
48 struct in_pktinfo pkt; | |
49 #endif | |
50 | |
51 #if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO) | |
52 struct in6_pktinfo pkt6; | |
53 #endif | |
54 } ngx_addrinfo_t; | |
55 | |
56 size_t ngx_set_srcaddr_cmsg(struct cmsghdr *cmsg, | |
57 struct sockaddr *local_sockaddr); | |
58 | |
59 #endif | |
60 | |
61 | |
32 void ngx_event_recvmsg(ngx_event_t *ev); | 62 void ngx_event_recvmsg(ngx_event_t *ev); |
63 ssize_t ngx_sendmsg(ngx_connection_t *c, struct msghdr *msg, int flags); | |
33 void ngx_udp_rbtree_insert_value(ngx_rbtree_node_t *temp, | 64 void ngx_udp_rbtree_insert_value(ngx_rbtree_node_t *temp, |
34 ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel); | 65 ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel); |
35 void ngx_insert_udp_connection(ngx_connection_t *c, ngx_udp_connection_t *udp, | 66 void ngx_insert_udp_connection(ngx_connection_t *c, ngx_udp_connection_t *udp, |
36 ngx_str_t *key); | 67 ngx_str_t *key); |
37 | 68 |