frames

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpIncoming

func DumpIncoming(frame Frame)

func DumpOutgoing

func DumpOutgoing(frame Frame)

func FindDecoder

func FindDecoder(frameType Type) func(flags byte, streamId uint32, payload []byte, context *DecodingContext) (Frame, error)

Types

type DataFrame

type DataFrame struct {
	StreamId  uint32
	Data      []byte
	EndStream bool
}

func NewDataFrame

func NewDataFrame(streamId uint32, data []byte, endStream bool) *DataFrame

func (*DataFrame) Encode

func (f *DataFrame) Encode(context *EncodingContext) ([]byte, error)

func (*DataFrame) GetStreamId added in v0.0.6

func (f *DataFrame) GetStreamId() uint32

func (*DataFrame) Type

func (f *DataFrame) Type() Type

type DecodingContext

type DecodingContext struct {
	// contains filtered or unexported fields
}

func NewDecodingContext

func NewDecodingContext() *DecodingContext

type EncodingContext

type EncodingContext struct {
	// contains filtered or unexported fields
}

func NewEncodingContext

func NewEncodingContext() *EncodingContext

type ErrorCode added in v0.0.6

type ErrorCode uint32
const (
	NO_ERROR            ErrorCode = 0x0
	PROTOCOL_ERROR      ErrorCode = 0x1
	INTERNAL_ERROR      ErrorCode = 0x2
	FLOW_CONTROL_ERROR  ErrorCode = 0x3
	SETTINGS_TIMEOUT    ErrorCode = 0x4
	STREAM_CLOSED       ErrorCode = 0x5
	FRAME_SIZE_ERROR    ErrorCode = 0x6
	REFUSED_STREAM      ErrorCode = 0x7
	CANCEL              ErrorCode = 0x8
	COMPRESSION_ERROR   ErrorCode = 0x9
	CONNECT_ERROR       ErrorCode = 0xa
	ENHANCE_YOUR_CALM   ErrorCode = 0xb
	INADEQUATE_SECURITY ErrorCode = 0xc
	HTTP_1_1_REQUIRED   ErrorCode = 0xd
)

func (ErrorCode) String added in v0.0.6

func (e ErrorCode) String() string

type Flag

type Flag byte
const (
	DATA_FLAG_END_STREAM Flag = 0x01
	DATA_FLAG_PADDED     Flag = 0x08
)
const (
	HEADERS_FLAG_END_STREAM  Flag = 0x01
	HEADERS_FLAG_END_HEADERS Flag = 0x04
	HEADERS_FLAG_PADDED      Flag = 0x08
	HEADERS_FLAG_PRIORITY    Flag = 0x20
)
const (
	PUSH_PROMISE_FLAG_END_HEADERS Flag = 0x04
	PUSH_PROMISE_FLAG_PADDED      Flag = 0x08
)
const (
	SETTINGS_FLAG_ACK Flag = 0x01
)

type Frame

type Frame interface {
	Encode(*EncodingContext) ([]byte, error)
	Type() Type
	GetStreamId() uint32
}

func DecodeDataFrame

func DecodeDataFrame(flags byte, streamId uint32, framePayload []byte, context *DecodingContext) (Frame, error)

func DecodeGoAwayFrame added in v0.0.6

func DecodeGoAwayFrame(flags byte, streamId uint32, payload []byte, context *DecodingContext) (Frame, error)

func DecodeHeadersFrame

func DecodeHeadersFrame(flags byte, streamId uint32, payload []byte, context *DecodingContext) (Frame, error)

func DecodePriorityFrame added in v0.0.7

func DecodePriorityFrame(flags byte, streamId uint32, payload []byte, context *DecodingContext) (Frame, error)

func DecodePushPromiseFrame added in v0.0.7

func DecodePushPromiseFrame(flags byte, streamId uint32, payload []byte, context *DecodingContext) (Frame, error)

func DecodeRstStreamFrame added in v0.0.6

func DecodeRstStreamFrame(flags byte, streamId uint32, payload []byte, context *DecodingContext) (Frame, error)

func DecodeSettingsFrame

func DecodeSettingsFrame(flags byte, streamId uint32, payload []byte, context *DecodingContext) (Frame, error)

func DecodeWindowUpdateFrame added in v0.0.6

func DecodeWindowUpdateFrame(flags byte, streamId uint32, payload []byte, context *DecodingContext) (Frame, error)

type FrameHeader

type FrameHeader struct {
	Length     uint32
	HeaderType Type
	Flags      byte
	StreamId   uint32
}

func DecodeHeader

func DecodeHeader(data []byte) *FrameHeader

type GoAwayFrame added in v0.0.6

type GoAwayFrame struct {
	StreamId     uint32
	LastStreamId uint32
	ErrorCode    ErrorCode
}

func NewGoAwayFrame added in v0.0.6

func NewGoAwayFrame(streamId uint32, lastStreamId uint32, errorCode ErrorCode) *GoAwayFrame

func (*GoAwayFrame) Encode added in v0.0.6

func (f *GoAwayFrame) Encode(context *EncodingContext) ([]byte, error)

func (*GoAwayFrame) GetStreamId added in v0.0.6

func (f *GoAwayFrame) GetStreamId() uint32

func (*GoAwayFrame) Type added in v0.0.6

func (f *GoAwayFrame) Type() Type

type HeadersFrame

type HeadersFrame struct {
	StreamId   uint32
	EndStream  bool
	EndHeaders bool
	Priority   bool
	Headers    []hpack.HeaderField
}

func NewHeadersFrame

func NewHeadersFrame(streamId uint32, headers []hpack.HeaderField) *HeadersFrame

func (*HeadersFrame) Encode

func (f *HeadersFrame) Encode(context *EncodingContext) ([]byte, error)

func (*HeadersFrame) GetStreamId added in v0.0.6

func (f *HeadersFrame) GetStreamId() uint32

func (*HeadersFrame) Type

func (f *HeadersFrame) Type() Type

type PriorityFrame added in v0.0.7

type PriorityFrame struct {
	StreamId           uint32
	StreamDependencyId uint32
	// contains filtered or unexported fields
}

func NewPriorityFrame added in v0.0.7

func NewPriorityFrame(streamId uint32, streamDependencyId uint32, weight uint8, exclusive bool) *PriorityFrame

func (*PriorityFrame) Encode added in v0.0.7

func (f *PriorityFrame) Encode(context *EncodingContext) ([]byte, error)

func (*PriorityFrame) GetStreamId added in v0.0.7

func (f *PriorityFrame) GetStreamId() uint32

func (*PriorityFrame) Type added in v0.0.7

func (f *PriorityFrame) Type() Type

type PushPromiseFrame added in v0.0.7

type PushPromiseFrame struct {
	StreamId         uint32
	EndHeaders       bool
	PromisedStreamId uint32
	Headers          []hpack.HeaderField
}

func NewPushPromiseFrame added in v0.0.7

func NewPushPromiseFrame(streamId uint32, promisedStreamId uint32, headers []hpack.HeaderField) *PushPromiseFrame

func (*PushPromiseFrame) Encode added in v0.0.7

func (f *PushPromiseFrame) Encode(context *EncodingContext) ([]byte, error)

func (*PushPromiseFrame) GetStreamId added in v0.0.7

func (f *PushPromiseFrame) GetStreamId() uint32

func (*PushPromiseFrame) Type added in v0.0.7

func (f *PushPromiseFrame) Type() Type

type RstStreamFrame added in v0.0.6

type RstStreamFrame struct {
	StreamId  uint32
	ErrorCode ErrorCode
}

func NewRstStreamFrame added in v0.0.6

func NewRstStreamFrame(streamId uint32, errorCode ErrorCode) *RstStreamFrame

func (*RstStreamFrame) Encode added in v0.0.6

func (f *RstStreamFrame) Encode(context *EncodingContext) ([]byte, error)

func (*RstStreamFrame) GetStreamId added in v0.0.6

func (f *RstStreamFrame) GetStreamId() uint32

func (*RstStreamFrame) Type added in v0.0.6

func (f *RstStreamFrame) Type() Type

type Setting

type Setting uint16
const (
	SETTINGS_HEADER_TABLE_SIZE      Setting = 0x01
	SETTINGS_ENABLE_PUSH            Setting = 0x02
	SETTINGS_MAX_CONCURRENT_STREAMS Setting = 0x03
	SETTINGS_INITIAL_WINDOW_SIZE    Setting = 0x04
	SETTINGS_MAX_FRAME_SIZE         Setting = 0x05
	SETTINGS_MAX_HEADER_LIST_SIZE   Setting = 0x06
)

func (Setting) Get added in v0.0.6

func (s Setting) Get(f *SettingsFrame) uint32

func (Setting) IsSet added in v0.0.6

func (s Setting) IsSet(f *SettingsFrame) bool

func (Setting) String

func (s Setting) String() string

type SettingsFrame

type SettingsFrame struct {
	StreamId uint32
	Ack      bool
	Settings map[Setting]uint32
}

func NewSettingsFrame

func NewSettingsFrame(streamId uint32) *SettingsFrame

func (*SettingsFrame) Encode

func (f *SettingsFrame) Encode(context *EncodingContext) ([]byte, error)

func (*SettingsFrame) GetStreamId added in v0.0.6

func (f *SettingsFrame) GetStreamId() uint32

func (*SettingsFrame) Type

func (f *SettingsFrame) Type() Type

type Type

type Type byte
const (
	DATA_TYPE          Type = 0x00
	HEADERS_TYPE       Type = 0x01
	PRIORITY_TYPE      Type = 0x02
	RST_STREAM_TYPE    Type = 0x03
	SETTINGS_TYPE      Type = 0x04
	PUSH_PROMISE_TYPE  Type = 0x05
	GOAWAY_TYPE        Type = 0x07
	WINDOW_UPDATE_TYPE Type = 0x08
)

type WindowUpdateFrame added in v0.0.6

type WindowUpdateFrame struct {
	StreamId            uint32
	WindowSizeIncrement uint32
}

func NewWindowUpdateFrame added in v0.0.6

func NewWindowUpdateFrame(streamId uint32, windowSizeIncrement uint32) *WindowUpdateFrame

func (*WindowUpdateFrame) Encode added in v0.0.6

func (f *WindowUpdateFrame) Encode(context *EncodingContext) ([]byte, error)

func (*WindowUpdateFrame) GetStreamId added in v0.0.6

func (f *WindowUpdateFrame) GetStreamId() uint32

func (*WindowUpdateFrame) Type added in v0.0.6

func (f *WindowUpdateFrame) Type() Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL