Documentation ¶
Overview ¶
Package control provides internal representations of socket control messages.
Index ¶
- func CmsgsSpace(t *kernel.Task, cmsgs socket.ControlMessages) int
- func New(t *kernel.Task, socketOrEndpoint interface{}, rights SCMRights) transport.ControlMessages
- func NewVFS2(t *kernel.Task, socketOrEndpoint interface{}, rights SCMRightsVFS2) transport.ControlMessages
- func PackControlMessages(t *kernel.Task, cmsgs socket.ControlMessages, buf []byte) []byte
- func PackCredentials(t *kernel.Task, creds SCMCredentials, buf []byte, flags int) ([]byte, int)
- func PackIPPacketInfo(t *kernel.Task, packetInfo *linux.ControlMessageIPPacketInfo, buf []byte) []byte
- func PackInq(t *kernel.Task, inq int32, buf []byte) []byte
- func PackOriginalDstAddress(t *kernel.Task, originalDstAddress linux.SockAddr, buf []byte) []byte
- func PackRights(t *kernel.Task, rights SCMRights, cloexec bool, buf []byte, flags int) ([]byte, int)
- func PackRightsVFS2(t *kernel.Task, rights SCMRightsVFS2, cloexec bool, buf []byte, flags int) ([]byte, int)
- func PackSockExtendedErr(t *kernel.Task, sockErr linux.SockErrCMsg, buf []byte) []byte
- func PackTClass(t *kernel.Task, tClass uint32, buf []byte) []byte
- func PackTOS(t *kernel.Task, tos uint8, buf []byte) []byte
- func PackTimestamp(t *kernel.Task, timestamp int64, buf []byte) []byte
- func Parse(t *kernel.Task, socketOrEndpoint interface{}, buf []byte, width uint) (socket.ControlMessages, error)
- type RightsFiles
- type RightsFilesVFS2
- func (fs *RightsFilesVFS2) Clone() transport.RightsControlMessage
- func (fs *RightsFilesVFS2) Files(ctx context.Context, max int) (RightsFilesVFS2, bool)
- func (fs *RightsFilesVFS2) Release(ctx context.Context)
- func (fs *RightsFilesVFS2) StateFields() []string
- func (fs *RightsFilesVFS2) StateTypeName() string
- type SCMCredentials
- type SCMRights
- type SCMRightsVFS2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmsgsSpace ¶
func CmsgsSpace(t *kernel.Task, cmsgs socket.ControlMessages) int
CmsgsSpace returns the number of bytes needed to fit the control messages represented in cmsgs.
func New ¶
func New(t *kernel.Task, socketOrEndpoint interface{}, rights SCMRights) transport.ControlMessages
New creates default control messages if needed.
func NewVFS2 ¶
func NewVFS2(t *kernel.Task, socketOrEndpoint interface{}, rights SCMRightsVFS2) transport.ControlMessages
NewVFS2 creates default control messages if needed.
func PackControlMessages ¶
PackControlMessages packs control messages into the given buffer.
We skip control messages specific to Unix domain sockets.
Note that some control messages may be truncated if they do not fit under the capacity of buf.
func PackCredentials ¶
PackCredentials packs the credentials in the control message (or default credentials if none) into a buffer.
func PackIPPacketInfo ¶
func PackIPPacketInfo(t *kernel.Task, packetInfo *linux.ControlMessageIPPacketInfo, buf []byte) []byte
PackIPPacketInfo packs an IP_PKTINFO socket control message.
func PackOriginalDstAddress ¶
PackOriginalDstAddress packs an IP_RECVORIGINALDSTADDR socket control message.
func PackRights ¶
func PackRights(t *kernel.Task, rights SCMRights, cloexec bool, buf []byte, flags int) ([]byte, int)
PackRights packs as many FDs as will fit into the unused capacity of buf.
func PackRightsVFS2 ¶
func PackRightsVFS2(t *kernel.Task, rights SCMRightsVFS2, cloexec bool, buf []byte, flags int) ([]byte, int)
PackRightsVFS2 packs as many FDs as will fit into the unused capacity of buf.
func PackSockExtendedErr ¶
PackSockExtendedErr packs an IP*_RECVERR socket control message.
func PackTClass ¶
PackTClass packs an IPV6_TCLASS socket control message.
func PackTimestamp ¶
PackTimestamp packs a SO_TIMESTAMP socket control message.
Types ¶
type RightsFiles ¶
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.
+stateify savable
func (*RightsFiles) Clone ¶
func (fs *RightsFiles) Clone() transport.RightsControlMessage
Clone implements transport.RightsControlMessage.Clone.
func (*RightsFiles) Files ¶
func (fs *RightsFiles) Files(ctx context.Context, max int) (RightsFiles, bool)
Files implements SCMRights.Files.
func (*RightsFiles) Release ¶
func (fs *RightsFiles) Release(ctx context.Context)
Release implements transport.RightsControlMessage.Release.
func (*RightsFiles) StateFields ¶
func (fs *RightsFiles) StateFields() []string
func (*RightsFiles) StateTypeName ¶
func (fs *RightsFiles) StateTypeName() string
type RightsFilesVFS2 ¶
type RightsFilesVFS2 []*vfs.FileDescription
RightsFilesVFS2 represents a SCM_RIGHTS socket control message. A reference is maintained for each vfs.FileDescription and is release either when an FD is created or when the Release method is called.
+stateify savable
func (*RightsFilesVFS2) Clone ¶
func (fs *RightsFilesVFS2) Clone() transport.RightsControlMessage
Clone implements transport.RightsControlMessage.Clone.
func (*RightsFilesVFS2) Files ¶
func (fs *RightsFilesVFS2) Files(ctx context.Context, max int) (RightsFilesVFS2, bool)
Files implements SCMRights.Files.
func (*RightsFilesVFS2) Release ¶
func (fs *RightsFilesVFS2) Release(ctx context.Context)
Release implements transport.RightsControlMessage.Release.
func (*RightsFilesVFS2) StateFields ¶
func (fs *RightsFilesVFS2) StateFields() []string
func (*RightsFilesVFS2) StateTypeName ¶
func (fs *RightsFilesVFS2) StateTypeName() string
type SCMCredentials ¶
type SCMCredentials interface { transport.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 MakeCreds ¶
func MakeCreds(t *kernel.Task) SCMCredentials
MakeCreds creates default SCMCredentials.
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 { transport.RightsControlMessage // Files returns up to max RightsFiles. // // Returned files are consumed and ownership is transferred to the caller. // Subsequent calls to Files will return the next files. Files(ctx context.Context, max int) (rf RightsFiles, truncated bool) }
SCMRights represents a SCM_RIGHTS socket control message.
type SCMRightsVFS2 ¶
type SCMRightsVFS2 interface { transport.RightsControlMessage // Files returns up to max RightsFiles. // // Returned files are consumed and ownership is transferred to the caller. // Subsequent calls to Files will return the next files. Files(ctx context.Context, max int) (rf RightsFilesVFS2, truncated bool) }
SCMRightsVFS2 represents a SCM_RIGHTS socket control message.
+stateify savable
func NewSCMRightsVFS2 ¶
func NewSCMRightsVFS2(t *kernel.Task, fds []int32) (SCMRightsVFS2, error)
NewSCMRightsVFS2 creates a new SCM_RIGHTS socket control message representation using local sentry FDs.