Documentation
¶
Overview ¶
Package wire encodes and decodes Wayland protocol messages on a Unix socket.
Index ¶
- Variables
- func AppendArgs(dst []byte, args []Arg, body []byte) []byte
- func ArgWalk(data []byte, args []Arg, f func(a Arg, off int)) error
- func CheckVersion(iface *Interface, version uint32) error
- func CloseUnclaimed(err error, fds ...int) error
- func Halves(v uint64) (hi, lo uint32)
- func Int32(v int) (int32, error)
- func Join(hi, lo uint32) uint64
- func Millis(t time.Duration) uint32
- func NoHandler(iface *Interface) error
- func ObjectArg[T Resource](m *Message, p Peer, nullable bool) T
- func Point(p image.Point) (x, y int32, err error)
- func SetObjectAt(data []byte, off int, id ObjectID)
- func Size(p image.Point) (w, h int32, err error)
- func StringAt(data []byte, off int) string
- func Uint32(v int) (uint32, error)
- type Arg
- type ArgType
- type Conn
- func (c *Conn) Begin(object ObjectID, opcode Opcode) *Encoder
- func (c *Conn) Close() error
- func (c *Conn) DeferSendErrors()
- func (c *Conn) Err() error
- func (c *Conn) FD() int
- func (c *Conn) Feed(in []byte, fds []int) error
- func (c *Conn) Fill() error
- func (c *Conn) Flush() error
- func (c *Conn) Mute()
- func (c *Conn) Next() (*Message, error)
- func (c *Conn) Pending() (in []byte, inFDs []int, out []byte, outFDs []int)
- func (c *Conn) Raw(data []byte, fds []int) error
- func (c *Conn) Recorded() ([]byte, []int)
- func (c *Conn) SetTracer(t Tracer)
- func (c *Conn) Unmute(keep func(id ObjectID, opcode Opcode) (bool, int), prefix []byte, ...) error
- type Encoder
- type Fixed
- type Interface
- type Message
- func (m *Message) Array() []byte
- func (m *Message) FD() int
- func (m *Message) Finish() error
- func (m *Message) Fixed() Fixed
- func (m *Message) Int() int32
- func (m *Message) NewID() ObjectID
- func (m *Message) Object() ObjectID
- func (m *Message) OptStr() (string, bool)
- func (m *Message) PeekFDs(n int) []int
- func (m *Message) Raw() []byte
- func (m *Message) Skip()
- func (m *Message) Str() string
- func (m *Message) Uint() uint32
- type MessageError
- type MessageSpec
- type Object
- func (o *Object) Begin(opcode Opcode) *Encoder
- func (o *Object) Expect(m *Message, specs []MessageSpec) int
- func (o *Object) ID() ObjectID
- func (o *Object) Interface() *Interface
- func (o *Object) MarkRemoved()
- func (o *Object) NullArg(message, arg string) error
- func (o *Object) Owns(r Resource) error
- func (o *Object) Peer() Peer
- func (o *Object) Removed() bool
- func (o *Object) Require(message string, since uint32) error
- func (o *Object) Version() uint32
- type ObjectID
- type Opcode
- type Peer
- type ProtocolError
- type Resource
- type Timespec
- type Tracer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidOpcode = errors.New("invalid opcode") ErrVersion = errors.New("not supported by the bound version") ErrUnknownObject = errors.New("unknown object") ErrWrongInterface = errors.New("object has the wrong interface") ErrNullObject = errors.New("null object for a non-nullable argument") ErrInvalidNewID = errors.New("invalid new object id") ErrNoHandler = errors.New("no handler for a new object") )
View Source
var ( ErrTruncated = errors.New("argument runs past the end of the message") ErrNullString = errors.New("null string for a non-nullable argument") ErrUnterminatedString = errors.New("string is not NUL-terminated") ErrEmbeddedNUL = errors.New("string contains a NUL byte") ErrMissingFD = errors.New("file descriptor expected but none received") ErrTrailingBytes = errors.New("bytes left after the last argument") ErrMessageSize = errors.New("invalid message size") ErrMessageTooLarge = errors.New("message exceeds the maximum size") ErrTooManyFDs = errors.New("too many file descriptors") ErrOutputFull = errors.New("output buffer full: the peer is not reading") ErrWouldBlock = errors.New("socket buffer full") )
View Source
var ErrOutOfRange = errors.New("wire: the value does not fit the protocol")
Functions ¶
func CheckVersion ¶
func CloseUnclaimed ¶
func SetObjectAt ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func NewRecorder ¶
func NewRecorder() *Conn
func (*Conn) DeferSendErrors ¶
func (c *Conn) DeferSendErrors()
type Interface ¶
type Interface struct {
Name string
Version uint32
Requests []MessageSpec
Events []MessageSpec
}
type MessageError ¶
func (*MessageError) Error ¶
func (e *MessageError) Error() string
func (*MessageError) Unwrap ¶
func (e *MessageError) Unwrap() error
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func (*Object) MarkRemoved ¶
func (o *Object) MarkRemoved()
type ProtocolError ¶
func NewProtocolError ¶
func NewProtocolError(object ObjectID, code uint32, format string, args ...any) *ProtocolError
func (*ProtocolError) Error ¶
func (e *ProtocolError) Error() string
Click to show internal directories.
Click to hide internal directories.