ipc

package
v0.0.0-...-e9d5adc Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BufferFamilyA BufferFamily = 0
	BufferFamilyB BufferFamily = 1
	BufferFamilyC BufferFamily = 2
	BufferFamilyX BufferFamily = 3

	DirectionInput  Direction = 1 // 0b01
	DirectionOutput Direction = 2 // 0b10

	FamilyA Family = 1 // 0b01
	FamilyB Family = 1 // 0b01
	FamilyX Family = 2 // 0b10
	FamilyC Family = 2 // 0b10
)

Variables

This section is empty.

Functions

func Close

func Close(object *Object) error

func CloseSession

func CloseSession(session nxtypes.SessionHandle) error

func PackIPCRequest

func PackIPCRequest(rq *Request, object Object, marshalBuffer *[0x40]uint32) error

PackIPCRequest is equivalent to libtransistor ipc_pack_request call

func PackMessage

func PackMessage(msg *PackedMessage, buffer *[0x40]uint32) error

PackMessage is equivalent to libtransistor ipc_pack_message call

func Send

func Send(object Object, rq *Request, rs *ResponseFmt) error

func UnflattenResponse

func UnflattenResponse(msg *Message, rs *ResponseFmt, object Object) error

UnflattenResponse is equivalent to libtransistor ipc_unflatten_response

func UnpackIPCMessage

func UnpackIPCMessage(msg *Message, buffer *[0x40]uint32) error

UnpackIPCMessage is equivalent to libtransistor ipc_unpack call

Types

type Buffer

type Buffer struct {
	Addr uintptr
	Size uint64
	Type uint32
}

func (Buffer) Direction

func (i Buffer) Direction() Direction

func (Buffer) Family

func (i Buffer) Family() Family

type BufferFamily

type BufferFamily int

type Direction

type Direction uint8

type Domain

type Domain struct {
	Session nxtypes.SessionHandle
}

func ConvertToDomain

func ConvertToDomain(object *Object) (*Domain, error)

type Family

type Family uint8

type Message

type Message struct {
	MessageType        uint16
	RawDataSectionSize uint32 // in Words
	NumXDescriptors    uint32
	NumADescriptors    uint32
	NumBDescriptors    uint32
	NumWDescriptors    uint32
	CDescriptorFlags   uint32
	XDescriptors       []uint32
	ADescriptors       []uint32
	BDescriptors       []uint32
	WDescriptors       []uint32
	CDescriptors       []uint32
	NumCopyHandles     uint32
	NumMoveHandles     uint32
	CopyHandles        []uint32
	MoveHandles        []uint32
	HasPID             bool
	PID                uint64
	PrePadding         int
	PostPadding        int
	DataSection        []uint32
}

Message Describes an incoming IPC message. Used as an intermediate during unpacking.

type Object

type Object struct {
	ObjectID   int32 // -1 if this represents a session, >= 0 if this represents a domain object
	Content    uint64
	IsBorrowed bool
}

IPCObject Represents either an object within an IPC domain or a standalone object

func (Object) GetDomain

func (o Object) GetDomain() *Domain

func (Object) GetSession

func (o Object) GetSession() nxtypes.SessionHandle

func (*Object) Recycle

func (o *Object) Recycle()

func (Object) SetDomain

func (o Object) SetDomain(domain *Domain)

func (*Object) SetSession

func (o *Object) SetSession(session nxtypes.Handle)

type PackedMessage

type PackedMessage struct {
	Type Type

	Buffers []*Buffer

	DataSection []byte

	CopyHandles []nxtypes.Handle
	MoveHandles []nxtypes.Handle
	SendPID     bool
}

PackedMessage represents a IPC Message Data to be packed

type Request

type Request struct {
	Type        Type
	Buffers     []*Buffer
	RequestID   uint32
	RawData     []byte
	SendPID     bool
	CopyHandles []nxtypes.Handle
	MoveHandles []nxtypes.Handle
	Objects     []Object
	CloseObject bool
}

Request Represents an unmarshalled outgoing IPC request see http://switchbrew.org/index.php?title=IPC_Marshalling#IPC_Command_Structure

func MakeDefaultRequest

func MakeDefaultRequest(requestId uint32) Request

func (*Request) SetRawDataFromUint32Slice

func (i *Request) SetRawDataFromUint32Slice(data []uint32)

func (*Request) SetRawDataFromUint64

func (i *Request) SetRawDataFromUint64(data uint64)

type ResponseFmt

type ResponseFmt struct {
	CopyHandles []nxtypes.Handle
	MoveHandles []nxtypes.Handle
	Objects     []Object
	RawData     []byte
	HasPID      bool
	PID         *uint64
}

ResponseFmt Describes format expectations for an incoming IPC response

Represents the expectations for an IPC response and contains pointers to buffers for response data to be written to.

type Type

type Type uint32
const (
	TypeIPCInvalid            Type = 0
	TypeIPCLegacyRequest      Type = 1
	TypeIPCClose              Type = 2
	TypeIPCLegacyControl      Type = 3
	TypeIPCRequest            Type = 4
	TypeIPCControl            Type = 5
	TypeIPCRequestWithContext Type = 6
	TypeIPCControlWithContext Type = 7
)

Jump to

Keyboard shortcuts

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