comparison src/http/v2/ngx_http_v2.h @ 7229:87e9e4aabf1b

HTTP/2: externalized various constants and interfaces.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 17 Mar 2018 23:04:20 +0300
parents 3d2b0b02bd3d
children d4448892a294
comparison
equal deleted inserted replaced
7228:0f811890f2f0 7229:87e9e4aabf1b
16 #define NGX_HTTP_V2_ALPN_ADVERTISE "\x02h2" 16 #define NGX_HTTP_V2_ALPN_ADVERTISE "\x02h2"
17 #define NGX_HTTP_V2_NPN_ADVERTISE NGX_HTTP_V2_ALPN_ADVERTISE 17 #define NGX_HTTP_V2_NPN_ADVERTISE NGX_HTTP_V2_ALPN_ADVERTISE
18 18
19 #define NGX_HTTP_V2_STATE_BUFFER_SIZE 16 19 #define NGX_HTTP_V2_STATE_BUFFER_SIZE 16
20 20
21 #define NGX_HTTP_V2_DEFAULT_FRAME_SIZE (1 << 14)
21 #define NGX_HTTP_V2_MAX_FRAME_SIZE ((1 << 24) - 1) 22 #define NGX_HTTP_V2_MAX_FRAME_SIZE ((1 << 24) - 1)
22 23
23 #define NGX_HTTP_V2_INT_OCTETS 4 24 #define NGX_HTTP_V2_INT_OCTETS 4
24 #define NGX_HTTP_V2_MAX_FIELD \ 25 #define NGX_HTTP_V2_MAX_FIELD \
25 (127 + (1 << (NGX_HTTP_V2_INT_OCTETS - 1) * 7) - 1) 26 (127 + (1 << (NGX_HTTP_V2_INT_OCTETS - 1) * 7) - 1)
289 void ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc); 290 void ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc);
290 291
291 ngx_int_t ngx_http_v2_send_output_queue(ngx_http_v2_connection_t *h2c); 292 ngx_int_t ngx_http_v2_send_output_queue(ngx_http_v2_connection_t *h2c);
292 293
293 294
295 ngx_str_t *ngx_http_v2_get_static_name(ngx_uint_t index);
296 ngx_str_t *ngx_http_v2_get_static_value(ngx_uint_t index);
297
294 ngx_int_t ngx_http_v2_get_indexed_header(ngx_http_v2_connection_t *h2c, 298 ngx_int_t ngx_http_v2_get_indexed_header(ngx_http_v2_connection_t *h2c,
295 ngx_uint_t index, ngx_uint_t name_only); 299 ngx_uint_t index, ngx_uint_t name_only);
296 ngx_int_t ngx_http_v2_add_header(ngx_http_v2_connection_t *h2c, 300 ngx_int_t ngx_http_v2_add_header(ngx_http_v2_connection_t *h2c,
297 ngx_http_v2_header_t *header); 301 ngx_http_v2_header_t *header);
298 ngx_int_t ngx_http_v2_table_size(ngx_http_v2_connection_t *h2c, size_t size); 302 ngx_int_t ngx_http_v2_table_size(ngx_http_v2_connection_t *h2c, size_t size);
355 #define ngx_http_v2_write_len_and_type(p, l, t) \ 359 #define ngx_http_v2_write_len_and_type(p, l, t) \
356 ngx_http_v2_write_uint32_aligned(p, (l) << 8 | (t)) 360 ngx_http_v2_write_uint32_aligned(p, (l) << 8 | (t))
357 361
358 #define ngx_http_v2_write_sid ngx_http_v2_write_uint32 362 #define ngx_http_v2_write_sid ngx_http_v2_write_uint32
359 363
364
365 #define ngx_http_v2_indexed(i) (128 + (i))
366 #define ngx_http_v2_inc_indexed(i) (64 + (i))
367
368 #define ngx_http_v2_write_name(dst, src, len, tmp) \
369 ngx_http_v2_string_encode(dst, src, len, tmp, 1)
370 #define ngx_http_v2_write_value(dst, src, len, tmp) \
371 ngx_http_v2_string_encode(dst, src, len, tmp, 0)
372
373 #define NGX_HTTP_V2_ENCODE_RAW 0
374 #define NGX_HTTP_V2_ENCODE_HUFF 0x80
375
376 #define NGX_HTTP_V2_AUTHORITY_INDEX 1
377
378 #define NGX_HTTP_V2_METHOD_INDEX 2
379 #define NGX_HTTP_V2_METHOD_GET_INDEX 2
380 #define NGX_HTTP_V2_METHOD_POST_INDEX 3
381
382 #define NGX_HTTP_V2_PATH_INDEX 4
383 #define NGX_HTTP_V2_PATH_ROOT_INDEX 4
384
385 #define NGX_HTTP_V2_SCHEME_HTTP_INDEX 6
386 #define NGX_HTTP_V2_SCHEME_HTTPS_INDEX 7
387
388 #define NGX_HTTP_V2_STATUS_INDEX 8
389 #define NGX_HTTP_V2_STATUS_200_INDEX 8
390 #define NGX_HTTP_V2_STATUS_204_INDEX 9
391 #define NGX_HTTP_V2_STATUS_206_INDEX 10
392 #define NGX_HTTP_V2_STATUS_304_INDEX 11
393 #define NGX_HTTP_V2_STATUS_400_INDEX 12
394 #define NGX_HTTP_V2_STATUS_404_INDEX 13
395 #define NGX_HTTP_V2_STATUS_500_INDEX 14
396
397 #define NGX_HTTP_V2_ACCEPT_ENCODING_INDEX 16
398 #define NGX_HTTP_V2_ACCEPT_LANGUAGE_INDEX 17
399 #define NGX_HTTP_V2_CONTENT_LENGTH_INDEX 28
400 #define NGX_HTTP_V2_CONTENT_TYPE_INDEX 31
401 #define NGX_HTTP_V2_DATE_INDEX 33
402 #define NGX_HTTP_V2_LAST_MODIFIED_INDEX 44
403 #define NGX_HTTP_V2_LOCATION_INDEX 46
404 #define NGX_HTTP_V2_SERVER_INDEX 54
405 #define NGX_HTTP_V2_USER_AGENT_INDEX 58
406 #define NGX_HTTP_V2_VARY_INDEX 59
407
408
409 u_char *ngx_http_v2_string_encode(u_char *dst, u_char *src, size_t len,
410 u_char *tmp, ngx_uint_t lower);
411
412
360 #endif /* _NGX_HTTP_V2_H_INCLUDED_ */ 413 #endif /* _NGX_HTTP_V2_H_INCLUDED_ */