control

package
v0.0.0-...-23e6066 Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package control provides internal representations of socket control messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignDown

func AlignDown(length int, align uint) int

AlignDown rounds a down to an alignment. align must be a power of 2.

func AlignUp

func AlignUp(length int, align uint) int

AlignUp rounds a length up to an alignment. align must be a power of 2.

func New

func New(t *kernel.Task, socketOrEndpoint interface{}, rights SCMRights) unix.ControlMessages

New creates default control messages if needed.

func PackCredentials

func PackCredentials(t *kernel.Task, creds SCMCredentials, buf []byte) []byte

PackCredentials packs the credentials in the control message (or default credentials if none) into a buffer.

func PackRights

func PackRights(t *kernel.Task, rights SCMRights, cloexec bool, buf []byte) []byte

PackRights packs as many FDs as will fit into the unused capacity of buf.

func PackTimestamp

func PackTimestamp(t *kernel.Task, timestamp int64, buf []byte) []byte

PackTimestamp packs a SO_TIMESTAMP socket control message.

func Parse

func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte) (unix.ControlMessages, error)

Parse parses a raw socket control message into portable objects.

Types

type RightsFiles

type RightsFiles []*fs.File

RightsFiles represents a SCM_RIGHTS socket control message. A reference is maintained for each fs.File and is release either when an FD is created or when the Release method is called.

func (*RightsFiles) Clone

Clone implements unix.RightsControlMessage.Clone.

func (*RightsFiles) Files

func (fs *RightsFiles) Files(ctx context.Context, max int) RightsFiles

Files implements SCMRights.Files.

func (*RightsFiles) Release

func (fs *RightsFiles) Release()

Release implements unix.RightsControlMessage.Release.

type SCMCredentials

type SCMCredentials interface {
	unix.CredentialsControlMessage

	// Credentials returns properly namespaced values for the sender's pid, uid
	// and gid.
	Credentials(t *kernel.Task) (kernel.ThreadID, auth.UID, auth.GID)
}

SCMCredentials represents a SCM_CREDENTIALS socket control message.

func NewSCMCredentials

func NewSCMCredentials(t *kernel.Task, cred linux.ControlMessageCredentials) (SCMCredentials, error)

NewSCMCredentials creates a new SCM_CREDENTIALS socket control message representation.

type SCMRights

type SCMRights interface {
	unix.RightsControlMessage

	// Files returns up to max RightsFiles.
	Files(ctx context.Context, max int) RightsFiles
}

SCMRights represents a SCM_RIGHTS socket control message.

func NewSCMRights

func NewSCMRights(t *kernel.Task, fds []int32) (SCMRights, error)

NewSCMRights creates a new SCM_RIGHTS socket control message representation using local sentry FDs.

Jump to

Keyboard shortcuts

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