* https://www.openssl.org/source/license.html
*/
-#include "internal/packet.h"
+#include "internal/packet_quic.h"
#include "internal/nelem.h"
#include "internal/quic_wire.h"
#include "internal/quic_record_rx.h"
ackm_data->is_ack_eliciting = 1;
stream = ossl_quic_stream_map_get_by_id(&ch->qsm, frame_data.stream_id);
- if (stream == NULL || stream->rstream == NULL) {
+ if (stream == NULL) {
ossl_quic_channel_raise_protocol_error(ch,
QUIC_ERR_STREAM_STATE_ERROR,
OSSL_QUIC_FRAME_TYPE_RESET_STREAM,
- "RESET_STREAM frame for nonexistent or "
+ "RESET_STREAM frame for "
+ "nonexistent stream");
+ return 0;
+ }
+
+ if (stream->rstream == NULL) {
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_STREAM_STATE_ERROR,
+ OSSL_QUIC_FRAME_TYPE_RESET_STREAM,
+ "RESET_STREAM frame for "
"TX only stream");
return 0;
}
ackm_data->is_ack_eliciting = 1;
stream = ossl_quic_stream_map_get_by_id(&ch->qsm, frame_data.stream_id);
- if (stream == NULL || stream->sstream == NULL) {
+ if (stream == NULL) {
ossl_quic_channel_raise_protocol_error(ch,
QUIC_ERR_STREAM_STATE_ERROR,
OSSL_QUIC_FRAME_TYPE_STOP_SENDING,
- "STOP_SENDING frame for nonexistent or "
+ "STOP_SENDING frame for "
+ "nonexistent stream");
+ return 0;
+ }
+
+ if (stream->sstream == NULL) {
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_STREAM_STATE_ERROR,
+ OSSL_QUIC_FRAME_TYPE_STOP_SENDING,
+ "STOP_SENDING frame for "
"RX only stream");
return 0;
}
ackm_data->is_ack_eliciting = 1;
stream = ossl_quic_stream_map_get_by_id(&ch->qsm, frame_data.stream_id);
- if (stream == NULL || stream->rstream == NULL) {
+ if (stream == NULL) {
ossl_quic_channel_raise_protocol_error(ch,
QUIC_ERR_STREAM_STATE_ERROR,
frame_type,
- "STREAM frame for nonexistent or"
- " TX only stream");
+ "STREAM frame for nonexistent "
+ "stream");
+ return 0;
+ }
+
+ if (stream->rstream == NULL) {
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_STREAM_STATE_ERROR,
+ frame_type,
+ "STREAM frame for TX only "
+ "stream");
return 0;
}
ackm_data->is_ack_eliciting = 1;
stream = ossl_quic_stream_map_get_by_id(&ch->qsm, stream_id);
- if (stream == NULL || stream->sstream == NULL) {
+ if (stream == NULL) {
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_STREAM_STATE_ERROR,
+ OSSL_QUIC_FRAME_TYPE_MAX_STREAM_DATA,
+ "MAX_STREAM_DATA for nonexistent "
+ "stream");
+ return 0;
+ }
+
+ if (stream->sstream == NULL) {
ossl_quic_channel_raise_protocol_error(ch,
QUIC_ERR_STREAM_STATE_ERROR,
OSSL_QUIC_FRAME_TYPE_MAX_STREAM_DATA,
- "MAX_STREAM_DATA for nonexistent"
- " or TX only stream");
+ "MAX_STREAM_DATA for TX only "
+ "stream");
return 0;
}
}
switch (frame_type) {
- case OSSL_QUIC_FRAME_TYPE_MAX_STREAMS_BIDI:
- if (max_streams > ch->max_local_streams_bidi)
- ch->max_local_streams_bidi = max_streams;
+ case OSSL_QUIC_FRAME_TYPE_MAX_STREAMS_BIDI:
+ if (max_streams > ch->max_local_streams_bidi)
+ ch->max_local_streams_bidi = max_streams;
- /* Stream may now be able to send */
- ossl_quic_stream_map_update_state(&ch->qsm,
- ch->stream0);
- break;
- case OSSL_QUIC_FRAME_TYPE_MAX_STREAMS_UNI:
- if (max_streams > ch->max_local_streams_uni)
- ch->max_local_streams_uni = max_streams;
+ /* Stream may now be able to send */
+ ossl_quic_stream_map_update_state(&ch->qsm,
+ ch->stream0);
+ break;
+ case OSSL_QUIC_FRAME_TYPE_MAX_STREAMS_UNI:
+ if (max_streams > ch->max_local_streams_uni)
+ ch->max_local_streams_uni = max_streams;
- /* Stream may now be able to send */
- ossl_quic_stream_map_update_state(&ch->qsm,
- ch->stream0);
- break;
- default:
- ossl_quic_channel_raise_protocol_error(ch,
- QUIC_ERR_FRAME_ENCODING_ERROR,
- frame_type,
- "decode error");
- return 0;
+ /* Stream may now be able to send */
+ ossl_quic_stream_map_update_state(&ch->qsm,
+ ch->stream0);
+ break;
+ default:
+ ossl_quic_channel_raise_protocol_error(ch,
+ QUIC_ERR_FRAME_ENCODING_ERROR,
+ frame_type,
+ "decode error");
+ return 0;
}
return 1;