github.com/alejandroEsc/spdy@v0.0.0-20200317064415-01a02f0eb389/spdy2/frames/noop.go (about) 1 // Copyright 2014 Jamie Hall. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package frames 6 7 import ( 8 "io" 9 10 "github.com/SlyMarbo/spdy/common" 11 ) 12 13 type NOOP struct{} 14 15 func (frame *NOOP) Compress(comp common.Compressor) error { 16 return nil 17 } 18 19 func (frame *NOOP) Decompress(decomp common.Decompressor) error { 20 return nil 21 } 22 23 func (frame *NOOP) Name() string { 24 return "NOOP" 25 } 26 27 func (frame *NOOP) ReadFrom(reader io.Reader) (int64, error) { 28 c := common.ReadCounter{R: reader} 29 data, err := common.ReadExactly(&c, 8) 30 if err != nil { 31 return c.N, err 32 } 33 34 err = controlFrameCommonProcessing(data[:5], _NOOP, 0) 35 if err != nil { 36 return c.N, err 37 } 38 39 // Get and check length. 40 length := int(common.BytesToUint24(data[5:8])) 41 if length != 0 { 42 return c.N, common.IncorrectDataLength(length, 0) 43 } 44 45 return c.N, nil 46 } 47 48 func (frame *NOOP) String() string { 49 return "NOOP {\n\tVersion: 2\n}\n" 50 } 51 52 func (frame *NOOP) WriteTo(writer io.Writer) (int64, error) { 53 return 0, nil 54 }