netd

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: CC0-1.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionINetdAddInterfaceToOemNetwork       = binder.FirstCallTransaction + 0
	TransactionINetdAddRouteToOemNetwork           = binder.FirstCallTransaction + 1
	TransactionINetdCreateOemNetwork               = binder.FirstCallTransaction + 2
	TransactionINetdDestroyOemNetwork              = binder.FirstCallTransaction + 3
	TransactionINetdRemoveInterfaceFromOemNetwork  = binder.FirstCallTransaction + 4
	TransactionINetdRemoveRouteFromOemNetwork      = binder.FirstCallTransaction + 5
	TransactionINetdSetForwardingBetweenInterfaces = binder.FirstCallTransaction + 6
	TransactionINetdSetIpForwardEnable             = binder.FirstCallTransaction + 7
)
View Source
const (
	MethodINetdAddInterfaceToOemNetwork       = "addInterfaceToOemNetwork"
	MethodINetdAddRouteToOemNetwork           = "addRouteToOemNetwork"
	MethodINetdCreateOemNetwork               = "createOemNetwork"
	MethodINetdDestroyOemNetwork              = "destroyOemNetwork"
	MethodINetdRemoveInterfaceFromOemNetwork  = "removeInterfaceFromOemNetwork"
	MethodINetdRemoveRouteFromOemNetwork      = "removeRouteFromOemNetwork"
	MethodINetdSetForwardingBetweenInterfaces = "setForwardingBetweenInterfaces"
	MethodINetdSetIpForwardEnable             = "setIpForwardEnable"
)
View Source
const (
	INetdStatusInvalidArguments int32 = 1
	INetdStatusNoNetwork        int32 = 2
	INetdStatusAlreadyExists    int32 = 3
	INetdStatusPermissionDenied int32 = 4
	INetdStatusUnknownError     int32 = 5
)
View Source
const DescriptorINetd = "android.system.net.netd.INetd"

Variables

This section is empty.

Functions

This section is empty.

Types

type INetd

type INetd interface {
	AsBinder() binder.IBinder
	AddInterfaceToOemNetwork(ctx context.Context, networkHandle int64, ifname string) error
	AddRouteToOemNetwork(ctx context.Context, networkHandle int64, ifname string, destination string, nexthop string) error
	CreateOemNetwork(ctx context.Context) (INetdOemNetwork, error)
	DestroyOemNetwork(ctx context.Context, networkHandle int64) error
	RemoveInterfaceFromOemNetwork(ctx context.Context, networkHandle int64, ifname string) error
	RemoveRouteFromOemNetwork(ctx context.Context, networkHandle int64, ifname string, destination string, nexthop string) error
	SetForwardingBetweenInterfaces(ctx context.Context, inputIfName string, outputIfName string, enable bool) error
	SetIpForwardEnable(ctx context.Context, enable bool) error
}

func NewNetdStub

func NewNetdStub(
	impl INetdServer,
) INetd

NewNetdStub creates a server-side INetd wrapping the given server implementation. The returned value satisfies INetd and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type INetdOemNetwork

type INetdOemNetwork struct {
	NetworkHandle int64
	PacketMark    int32
}

func (*INetdOemNetwork) MarshalParcel

func (s *INetdOemNetwork) MarshalParcel(
	p *parcel.Parcel,
) error

func (*INetdOemNetwork) UnmarshalParcel

func (s *INetdOemNetwork) UnmarshalParcel(
	p *parcel.Parcel,
) error

type INetdServer

type INetdServer interface {
	AddInterfaceToOemNetwork(ctx context.Context, networkHandle int64, ifname string) error
	AddRouteToOemNetwork(ctx context.Context, networkHandle int64, ifname string, destination string, nexthop string) error
	CreateOemNetwork(ctx context.Context) (INetdOemNetwork, error)
	DestroyOemNetwork(ctx context.Context, networkHandle int64) error
	RemoveInterfaceFromOemNetwork(ctx context.Context, networkHandle int64, ifname string) error
	RemoveRouteFromOemNetwork(ctx context.Context, networkHandle int64, ifname string, destination string, nexthop string) error
	SetForwardingBetweenInterfaces(ctx context.Context, inputIfName string, outputIfName string, enable bool) error
	SetIpForwardEnable(ctx context.Context, enable bool) error
}

INetdServer is the server-side interface that user implementations provide to NewNetdStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type NetdProxy

type NetdProxy struct {
	Remote binder.IBinder
}

func NewNetdProxy

func NewNetdProxy(
	remote binder.IBinder,
) *NetdProxy

func (*NetdProxy) AddInterfaceToOemNetwork

func (p *NetdProxy) AddInterfaceToOemNetwork(
	ctx context.Context,
	networkHandle int64,
	ifname string,
) error

func (*NetdProxy) AddRouteToOemNetwork

func (p *NetdProxy) AddRouteToOemNetwork(
	ctx context.Context,
	networkHandle int64,
	ifname string,
	destination string,
	nexthop string,
) error

func (*NetdProxy) AsBinder

func (p *NetdProxy) AsBinder() binder.IBinder

func (*NetdProxy) CreateOemNetwork

func (p *NetdProxy) CreateOemNetwork(
	ctx context.Context,
) (INetdOemNetwork, error)

func (*NetdProxy) DestroyOemNetwork

func (p *NetdProxy) DestroyOemNetwork(
	ctx context.Context,
	networkHandle int64,
) error

func (*NetdProxy) RemoveInterfaceFromOemNetwork

func (p *NetdProxy) RemoveInterfaceFromOemNetwork(
	ctx context.Context,
	networkHandle int64,
	ifname string,
) error

func (*NetdProxy) RemoveRouteFromOemNetwork

func (p *NetdProxy) RemoveRouteFromOemNetwork(
	ctx context.Context,
	networkHandle int64,
	ifname string,
	destination string,
	nexthop string,
) error

func (*NetdProxy) SetForwardingBetweenInterfaces

func (p *NetdProxy) SetForwardingBetweenInterfaces(
	ctx context.Context,
	inputIfName string,
	outputIfName string,
	enable bool,
) error

func (*NetdProxy) SetIpForwardEnable

func (p *NetdProxy) SetIpForwardEnable(
	ctx context.Context,
	enable bool,
) error

type NetdStub

type NetdStub struct {
	Impl      INetd
	Transport binder.VersionAwareTransport
}

NetdStub dispatches incoming binder transactions to a typed INetd implementation.

func (*NetdStub) Descriptor

func (s *NetdStub) Descriptor() string

func (*NetdStub) OnTransaction

func (s *NetdStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

Jump to

Keyboard shortcuts

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