message

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	Decode(buf []byte, m *secoapcore.Message) (int, error)
}

type Encoder

type Encoder interface {
	Size(m secoapcore.Message) (int, error)
	Encode(m secoapcore.Message, buf []byte) (int, error)
}

type Message

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

func NewMessage

func NewMessage(ctx context.Context) *Message

func (*Message) Accept

func (r *Message) Accept() (secoapcore.MediaType, error)

Accept get's accept option.

func (*Message) AddETag

func (r *Message) AddETag(value []byte) error

AddETag appends value to existing ETags.

Option definition: - format: opaque, length: 1-8, repeatable

func (*Message) AddOptionBytes

func (r *Message) AddOptionBytes(opt secoapcore.OptionID, value []byte)

func (*Message) AddOptionUint32

func (r *Message) AddOptionUint32(opt secoapcore.OptionID, value uint32)

func (*Message) AddOptstring

func (r *Message) AddOptstring(opt secoapcore.OptionID, value string)

func (*Message) AddQuery

func (r *Message) AddQuery(query string)

func (*Message) Analyse added in v1.0.5

func (r *Message) Analyse() string

func (*Message) Body

func (r *Message) Body() io.ReadSeeker

func (*Message) BodySize

func (r *Message) BodySize() (int64, error)

func (*Message) Clone

func (r *Message) Clone(msg *Message) error

func (*Message) Code

func (r *Message) Code() secoapcore.Code

func (*Message) ContentFormat

func (r *Message) ContentFormat() (secoapcore.MediaType, error)

func (*Message) Context

func (r *Message) Context() context.Context

func (*Message) ETag

func (r *Message) ETag() ([]byte, error)

ETag returns first ETag value

func (*Message) ETags

func (r *Message) ETags(b [][]byte) (int, error)

ETags returns all ETag values

Writes ETag values to output array, returns number of written values or error.

func (*Message) EncoderID added in v1.0.5

func (r *Message) EncoderID() int32

func (*Message) EncoderType added in v1.0.5

func (r *Message) EncoderType() int32

func (*Message) GetOptionAllBytes

func (r *Message) GetOptionAllBytes(id secoapcore.OptionID, b [][]byte) (int, error)

GetOptionAllBytes gets array of bytes of all opts with given ID.

func (*Message) GetOptionBytes

func (r *Message) GetOptionBytes(id secoapcore.OptionID) ([]byte, error)

GetOptionBytes gets bytes of the first option with given ID.

func (*Message) GetOptionUint32

func (r *Message) GetOptionUint32(id secoapcore.OptionID) (uint32, error)

func (*Message) HasOption

func (r *Message) HasOption(id secoapcore.OptionID) bool

func (*Message) Hijack

func (r *Message) Hijack()

func (*Message) IsHijacked

func (r *Message) IsHijacked() bool

func (*Message) IsModified

func (r *Message) IsModified() bool

func (*Message) IsSeparateMessage

func (r *Message) IsSeparateMessage() bool

func (*Message) MarshalWithEncoder

func (r *Message) MarshalWithEncoder(encoder Encoder) ([]byte, error)

func (*Message) MessageID

func (r *Message) MessageID() int32

MessageID returns 0 to 2^16-1 otherwise it contains invalid value.

func (*Message) MustSetPath

func (r *Message) MustSetPath(p string)

MustSetPath calls SetPath and panics if it returns an error.

func (*Message) Observe

func (r *Message) Observe() (uint32, error)

func (*Message) Opts

func (r *Message) Opts() secoapcore.Options

func (*Message) Path

func (r *Message) Path() (string, error)

func (*Message) Queries

func (r *Message) Queries() ([]string, error)

func (*Message) ReadBody

func (r *Message) ReadBody() ([]byte, error)

func (*Message) Remove

func (r *Message) Remove(opt secoapcore.OptionID)

func (*Message) Reset

func (r *Message) Reset()

Reset clear message for next reuse

func (*Message) ResetOptsTo

func (r *Message) ResetOptsTo(in secoapcore.Options)

func (*Message) Sequence

func (r *Message) Sequence() uint64

func (*Message) SetAccept

func (r *Message) SetAccept(contentFormat secoapcore.MediaType)

SetAccept set's accept option.

func (*Message) SetBody

func (r *Message) SetBody(s io.ReadSeeker)

func (*Message) SetCode

func (r *Message) SetCode(code secoapcore.Code)

func (*Message) SetContentFormat

func (r *Message) SetContentFormat(contentFormat secoapcore.MediaType)

func (*Message) SetContext

func (r *Message) SetContext(ctx context.Context)

func (*Message) SetETag

func (r *Message) SetETag(value []byte) error

SetETag inserts/replaces ETag option(s).

After a successful call only a single ETag value will remain.

func (*Message) SetEncoderID added in v1.0.5

func (r *Message) SetEncoderID(eid int32)

func (*Message) SetEncoderType added in v1.0.5

func (r *Message) SetEncoderType(etp int32)

func (*Message) SetMessage

func (r *Message) SetMessage(message secoapcore.Message)

func (*Message) SetMessageID

func (r *Message) SetMessageID(mid int32)

SetMessageID only 0 to 2^16-1 are valid.

func (*Message) SetModified

func (r *Message) SetModified(b bool)

func (*Message) SetObserve

func (r *Message) SetObserve(observe uint32)

func (*Message) SetOptionBytes

func (r *Message) SetOptionBytes(opt secoapcore.OptionID, value []byte)

func (*Message) SetOptionUint32

func (r *Message) SetOptionUint32(opt secoapcore.OptionID, value uint32)

func (*Message) SetOptstring

func (r *Message) SetOptstring(opt secoapcore.OptionID, value string)

func (*Message) SetPath

func (r *Message) SetPath(p string) error

SetPath stores the given path within URI-Path opts.

The value is stored by the algorithm described in RFC7252 and using the internal buffer. If the path is too long, but valid (URI-Path segments must have maximal length of 255) the internal buffer is expanded. If the path is too long, but not valid then the function returns ErrInvalidValueLength error.

func (*Message) SetSequence

func (r *Message) SetSequence(seq uint64)

func (*Message) SetToken

func (r *Message) SetToken(token secoapcore.Token)

func (*Message) SetType

func (r *Message) SetType(typ secoapcore.Type)

func (*Message) SetVersion added in v1.0.5

func (r *Message) SetVersion(ver secoapcore.Ver)

SetVersion only 0 to 2^2-1 are valid.

func (*Message) SetupDelete

func (r *Message) SetupDelete(path string, token secoapcore.Token, opts ...secoapcore.Option) error

func (*Message) SetupGet

func (r *Message) SetupGet(path string, token secoapcore.Token, opts ...secoapcore.Option) error

func (*Message) SetupPost

func (r *Message) SetupPost(path string, token secoapcore.Token, contentFormat secoapcore.MediaType, payload io.ReadSeeker, opts ...secoapcore.Option) error

func (*Message) SetupPut

func (r *Message) SetupPut(path string, token secoapcore.Token, contentFormat secoapcore.MediaType, payload io.ReadSeeker, opts ...secoapcore.Option) error

func (*Message) String

func (r *Message) String() string

func (*Message) ToSecoapCoreMessage added in v1.0.8

func (r *Message) ToSecoapCoreMessage() (secoapcore.Message, error)

func (*Message) Token

func (r *Message) Token() secoapcore.Token

func (*Message) Type

func (r *Message) Type() secoapcore.Type

func (*Message) UnmarshalWithDecoder

func (r *Message) UnmarshalWithDecoder(decoder Decoder, data []byte) (int, error)

func (*Message) UpsertEncoderID added in v1.0.5

func (r *Message) UpsertEncoderID(eid int32)

func (*Message) UpsertEncoderType added in v1.0.5

func (r *Message) UpsertEncoderType(etp int32)

func (*Message) UpsertMessageID

func (r *Message) UpsertMessageID(mid int32)

UpsertMessageID set value only when origin value is invalid. Only 0 to 2^16-1 values are valid.

func (*Message) UpsertType

func (r *Message) UpsertType(typ secoapcore.Type)

UpsertType set value only when origin value is invalid. Only 0 to 2^8-1 values are valid.

func (*Message) UpsertVersion added in v1.0.5

func (r *Message) UpsertVersion(ver secoapcore.Ver)

func (*Message) Version added in v1.0.5

func (r *Message) Version() secoapcore.Ver

Jump to

Keyboard shortcuts

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