mirror of
https://github.com/xtaci/smux.git
synced 2026-10-21 03:36:56 +00:00
upd
This commit is contained in:
@@ -11,28 +11,32 @@ type Frame struct {
|
||||
Timestamp time.Time
|
||||
}
|
||||
|
||||
// Serialize a frame to transmit
|
||||
func Serialize(f *Frame) []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Deserialize a byte slice into a frame
|
||||
func Deserialize(bts []byte) *Frame {
|
||||
return nil
|
||||
}
|
||||
|
||||
type Framer interface {
|
||||
// Split bytestream into frames
|
||||
Split(bts []byte) []Frame
|
||||
}
|
||||
|
||||
// Framer is a frame splitter for byte stream
|
||||
type Framer struct {
|
||||
type DefaultFramer struct {
|
||||
streamId uint32
|
||||
}
|
||||
|
||||
func newFramer(streamId uint32) *Framer {
|
||||
fr := new(Framer)
|
||||
func newFramer(streamId uint32) *DefaultFramer {
|
||||
fr := new(DefaultFramer)
|
||||
fr.streamId = streamId
|
||||
return fr
|
||||
}
|
||||
|
||||
// split bytestream into frames
|
||||
func (fr *Framer) split(bts []byte) []*Frame {
|
||||
return nil
|
||||
}
|
||||
|
||||
// serialize a frame to transmit
|
||||
func (fr *Framer) serialize(f *Frame) []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
// deserialize a byte slice into a frame
|
||||
func (fr *Framer) deserialize(bts []byte) *Frame {
|
||||
func (fr *DefaultFramer) Split(bts []byte) []Frame {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -11,12 +11,14 @@ const (
|
||||
type Stream struct {
|
||||
state int
|
||||
rxQueue []*Frame // receive queue
|
||||
config *Config
|
||||
fr DefaultFramer
|
||||
qdisc Qdisc
|
||||
}
|
||||
|
||||
func newStream(config *Config) *Stream {
|
||||
func newStream(fr DefaultFramer, qdisc Qdisc) *Stream {
|
||||
stream := new(Stream)
|
||||
stream.config = config
|
||||
stream.fr = fr
|
||||
stream.qdisc = qdisc
|
||||
return stream
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user