comparison src/event/quic/ngx_event_quic_transport.c @ 8738:47e0009e53a7 quic

QUIC: PATH_CHALLENGE frame creation.
author Vladimir Homutov <vl@nginx.com>
date Tue, 23 Mar 2021 11:58:43 +0300
parents 44b4c6180106
children 168cc2a0f0b6
comparison
equal deleted inserted replaced
8737:76f476ce4d31 8738:47e0009e53a7
111 ngx_quic_max_streams_frame_t *ms); 111 ngx_quic_max_streams_frame_t *ms);
112 static size_t ngx_quic_create_max_stream_data(u_char *p, 112 static size_t ngx_quic_create_max_stream_data(u_char *p,
113 ngx_quic_max_stream_data_frame_t *ms); 113 ngx_quic_max_stream_data_frame_t *ms);
114 static size_t ngx_quic_create_max_data(u_char *p, 114 static size_t ngx_quic_create_max_data(u_char *p,
115 ngx_quic_max_data_frame_t *md); 115 ngx_quic_max_data_frame_t *md);
116 static size_t ngx_quic_create_path_challenge(u_char *p,
117 ngx_quic_path_challenge_frame_t *pc);
116 static size_t ngx_quic_create_path_response(u_char *p, 118 static size_t ngx_quic_create_path_response(u_char *p,
117 ngx_quic_path_challenge_frame_t *pc); 119 ngx_quic_path_challenge_frame_t *pc);
118 static size_t ngx_quic_create_new_connection_id(u_char *p, 120 static size_t ngx_quic_create_new_connection_id(u_char *p,
119 ngx_quic_new_conn_id_frame_t *rcid); 121 ngx_quic_new_conn_id_frame_t *rcid);
120 static size_t ngx_quic_create_retire_connection_id(u_char *p, 122 static size_t ngx_quic_create_retire_connection_id(u_char *p,
1256 return ngx_quic_create_max_stream_data(p, &f->u.max_stream_data); 1258 return ngx_quic_create_max_stream_data(p, &f->u.max_stream_data);
1257 1259
1258 case NGX_QUIC_FT_MAX_DATA: 1260 case NGX_QUIC_FT_MAX_DATA:
1259 return ngx_quic_create_max_data(p, &f->u.max_data); 1261 return ngx_quic_create_max_data(p, &f->u.max_data);
1260 1262
1263 case NGX_QUIC_FT_PATH_CHALLENGE:
1264 return ngx_quic_create_path_challenge(p, &f->u.path_challenge);
1265
1261 case NGX_QUIC_FT_PATH_RESPONSE: 1266 case NGX_QUIC_FT_PATH_RESPONSE:
1262 return ngx_quic_create_path_response(p, &f->u.path_response); 1267 return ngx_quic_create_path_response(p, &f->u.path_response);
1263 1268
1264 case NGX_QUIC_FT_NEW_CONNECTION_ID: 1269 case NGX_QUIC_FT_NEW_CONNECTION_ID:
1265 return ngx_quic_create_new_connection_id(p, &f->u.ncid); 1270 return ngx_quic_create_new_connection_id(p, &f->u.ncid);
1785 return p - start; 1790 return p - start;
1786 } 1791 }
1787 1792
1788 1793
1789 static size_t 1794 static size_t
1795 ngx_quic_create_path_challenge(u_char *p, ngx_quic_path_challenge_frame_t *pc)
1796 {
1797 size_t len;
1798 u_char *start;
1799
1800 if (p == NULL) {
1801 len = ngx_quic_varint_len(NGX_QUIC_FT_PATH_CHALLENGE);
1802 len += sizeof(pc->data);
1803 return len;
1804 }
1805
1806 start = p;
1807
1808 ngx_quic_build_int(&p, NGX_QUIC_FT_PATH_CHALLENGE);
1809 p = ngx_cpymem(p, &pc->data, sizeof(pc->data));
1810
1811 return p - start;
1812 }
1813
1814
1815 static size_t
1790 ngx_quic_create_path_response(u_char *p, ngx_quic_path_challenge_frame_t *pc) 1816 ngx_quic_create_path_response(u_char *p, ngx_quic_path_challenge_frame_t *pc)
1791 { 1817 {
1792 size_t len; 1818 size_t len;
1793 u_char *start; 1819 u_char *start;
1794 1820