package wire

import (
	
	
	
)

// A StopSendingFrame is a STOP_SENDING frame
type StopSendingFrame struct {
	StreamID  protocol.StreamID
	ErrorCode qerr.StreamErrorCode
}

// parseStopSendingFrame parses a STOP_SENDING frame
func parseStopSendingFrame( []byte,  protocol.Version) (*StopSendingFrame, int, error) {
	 := len()
	, ,  := quicvarint.Parse()
	if  != nil {
		return nil, 0, replaceUnexpectedEOF()
	}
	 = [:]
	, ,  := quicvarint.Parse()
	if  != nil {
		return nil, 0, replaceUnexpectedEOF()
	}
	 = [:]

	return &StopSendingFrame{
		StreamID:  protocol.StreamID(),
		ErrorCode: qerr.StreamErrorCode(),
	},  - len(), nil
}

// Length of a written frame
func ( *StopSendingFrame) ( protocol.Version) protocol.ByteCount {
	return 1 + protocol.ByteCount(quicvarint.Len(uint64(.StreamID))+quicvarint.Len(uint64(.ErrorCode)))
}

func ( *StopSendingFrame) ( []byte,  protocol.Version) ([]byte, error) {
	 = append(, byte(FrameTypeStopSending))
	 = quicvarint.Append(, uint64(.StreamID))
	 = quicvarint.Append(, uint64(.ErrorCode))
	return , nil
}