Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.c @ 8257:085fd6e68367 quic
Implemented parsing of remaining frame types.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Sat, 21 Mar 2020 20:49:55 +0300 |
parents | 0a18893299fe |
children | f388c0ad3477 |
comparison
equal
deleted
inserted
replaced
8256:0a18893299fe | 8257:085fd6e68367 |
---|---|
854 | 854 |
855 f->u.streams_blocked.bidi = | 855 f->u.streams_blocked.bidi = |
856 (f->type == NGX_QUIC_FT_STREAMS_BLOCKED) ? 1 : 0; | 856 (f->type == NGX_QUIC_FT_STREAMS_BLOCKED) ? 1 : 0; |
857 | 857 |
858 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | 858 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, |
859 "STREAMS BLOCKED frame { limit %i bidi: %d }", | 859 "STREAMS BLOCKED frame { limit %ui bidi: %d }", |
860 f->u.streams_blocked.limit, | 860 f->u.streams_blocked.limit, |
861 f->u.streams_blocked.bidi); | 861 f->u.streams_blocked.bidi); |
862 | 862 |
863 break; | 863 break; |
864 | 864 |
875 | 875 |
876 break; | 876 break; |
877 | 877 |
878 case NGX_QUIC_FT_MAX_STREAMS: | 878 case NGX_QUIC_FT_MAX_STREAMS: |
879 case NGX_QUIC_FT_MAX_STREAMS2: | 879 case NGX_QUIC_FT_MAX_STREAMS2: |
880 | |
881 if (!(ngx_quic_short_pkt(flags) || ngx_quic_pkt_zrtt(flags))) { | |
882 goto not_allowed; | |
883 } | |
884 | |
885 p = ngx_quic_parse_int(p, end, &f->u.max_streams.limit); | |
886 if (p == NULL) { | |
887 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
888 "failed to parse max streams frame limit"); | |
889 return NGX_ERROR; | |
890 } | |
891 | |
892 f->u.max_streams.bidi = (f->type == NGX_QUIC_FT_MAX_STREAMS) ? 1 : 0; | |
893 | |
894 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | |
895 "MAX STREAMS frame { limit %ui bidi: %d }", | |
896 f->u.max_streams.limit, | |
897 f->u.max_streams.bidi); | |
898 break; | |
899 | |
880 case NGX_QUIC_FT_MAX_STREAM_DATA: | 900 case NGX_QUIC_FT_MAX_STREAM_DATA: |
901 | |
902 if (!(ngx_quic_short_pkt(flags) || ngx_quic_pkt_zrtt(flags))) { | |
903 goto not_allowed; | |
904 } | |
905 | |
906 p = ngx_quic_parse_int_multi(p, end, &f->u.max_stream_data.id, | |
907 &f->u.max_stream_data.limit, NULL); | |
908 if (p == NULL) { | |
909 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
910 "failed to parse max stream data frame"); | |
911 return NGX_ERROR; | |
912 } | |
913 | |
914 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | |
915 "MAX STREAM DATA frame { id: %ui limit: %ui }", | |
916 f->u.max_stream_data.id, | |
917 f->u.max_stream_data.limit); | |
918 break; | |
919 | |
881 case NGX_QUIC_FT_DATA_BLOCKED: | 920 case NGX_QUIC_FT_DATA_BLOCKED: |
921 | |
922 if (!(ngx_quic_short_pkt(flags) || ngx_quic_pkt_zrtt(flags))) { | |
923 goto not_allowed; | |
924 } | |
925 | |
926 p = ngx_quic_parse_int(p, end, &f->u.data_blocked.limit); | |
927 if (p == NULL) { | |
928 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
929 "failed to parse data blocked frame limit"); | |
930 return NGX_ERROR; | |
931 } | |
932 | |
933 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | |
934 "DATA BLOCKED frame { limit %ui }", | |
935 f->u.data_blocked.limit); | |
936 break; | |
937 | |
882 case NGX_QUIC_FT_STREAM_DATA_BLOCKED: | 938 case NGX_QUIC_FT_STREAM_DATA_BLOCKED: |
939 | |
940 if (!(ngx_quic_short_pkt(flags) || ngx_quic_pkt_zrtt(flags))) { | |
941 goto not_allowed; | |
942 } | |
943 | |
944 p = ngx_quic_parse_int_multi(p, end, &f->u.stream_data_blocked.id, | |
945 &f->u.stream_data_blocked.limit, NULL); | |
946 if (p == NULL) { | |
947 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
948 "failed to parse tream data blocked frame"); | |
949 return NGX_ERROR; | |
950 } | |
951 | |
952 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | |
953 "STREAM DATA BLOCKED frame { id: %ui limit: %ui }", | |
954 f->u.stream_data_blocked.id, | |
955 f->u.stream_data_blocked.limit); | |
956 break; | |
957 | |
883 case NGX_QUIC_FT_RETIRE_CONNECTION_ID: | 958 case NGX_QUIC_FT_RETIRE_CONNECTION_ID: |
959 | |
960 if (!(ngx_quic_short_pkt(flags) || ngx_quic_pkt_zrtt(flags))) { | |
961 goto not_allowed; | |
962 } | |
963 | |
964 p = ngx_quic_parse_int(p, end, &f->u.retire_cid.sequence_number); | |
965 if (p == NULL) { | |
966 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
967 "failed to parse retire connection id" | |
968 " frame sequence number"); | |
969 return NGX_ERROR; | |
970 } | |
971 | |
972 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | |
973 "RETIRE CONNECTION ID frame { sequence_number %ui }", | |
974 f->u.retire_cid.sequence_number); | |
975 break; | |
976 | |
884 case NGX_QUIC_FT_PATH_CHALLENGE: | 977 case NGX_QUIC_FT_PATH_CHALLENGE: |
978 | |
979 if (!(ngx_quic_short_pkt(flags) || ngx_quic_pkt_zrtt(flags))) { | |
980 goto not_allowed; | |
981 } | |
982 | |
983 p = ngx_quic_copy_bytes(p, end, 8, f->u.path_challenge.data); | |
984 if (p == NULL) { | |
985 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
986 "failed to get path challenge frame data"); | |
987 return NGX_ERROR; | |
988 } | |
989 | |
990 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | |
991 "PATH CHALLENGE frame"); | |
992 | |
993 ngx_quic_hexdump0(pkt->log, "path challenge data", | |
994 f->u.path_challenge.data, 8); | |
995 break; | |
996 | |
885 case NGX_QUIC_FT_PATH_RESPONSE: | 997 case NGX_QUIC_FT_PATH_RESPONSE: |
886 | 998 |
887 if (!(ngx_quic_short_pkt(flags) || ngx_quic_pkt_zrtt(flags))) { | 999 if (!(ngx_quic_short_pkt(flags) || ngx_quic_pkt_zrtt(flags))) { |
888 goto not_allowed; | 1000 goto not_allowed; |
889 } | 1001 } |
890 | 1002 |
891 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | 1003 p = ngx_quic_copy_bytes(p, end, 8, f->u.path_response.data); |
892 "unimplemented frame type 0x%xi in packet", f->type); | 1004 if (p == NULL) { |
1005 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | |
1006 "failed to get path response frame data"); | |
1007 return NGX_ERROR; | |
1008 } | |
1009 | |
1010 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, pkt->log, 0, | |
1011 "PATH RESPONSE frame"); | |
1012 | |
1013 ngx_quic_hexdump0(pkt->log, "path response data", | |
1014 f->u.path_response.data, 8); | |
893 break; | 1015 break; |
894 | 1016 |
895 default: | 1017 default: |
896 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, | 1018 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, |
897 "unknown frame type 0x%xi in packet", f->type); | 1019 "unknown frame type 0x%xi in packet", f->type); |