Documentation
¶
Overview ¶
Package native contains the private libubus bridge used by the public module.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupported is returned when native libubus support was not compiled. ErrUnsupported = errors.New("native ubus is unavailable") // ErrClosed is returned after the native event loop has begun shutting down. ErrClosed = errors.New("native ubus engine is closed") )
Functions ¶
This section is empty.
Types ¶
type Callbacks ¶
type Callbacks interface {
ConnectionState(connected bool, status int)
Incoming(Incoming)
Event(listenerID uint64, name, body string)
SubscriptionState(subscriptionID uint64, connected bool, targetID uint32, status int)
SubscribersChanged(publicationID uint64, active bool)
MonitorRecord(MonitorRecord)
}
Callbacks receives copied native events. Implementations must return quickly and must not run user code on the uloop thread.
type Engine ¶
type Engine interface {
Close() error
Lookup(context.Context, string) ([]LookupObject, error)
Invoke(context.Context, string, string, string, int) (InvokeResult, error)
AddObject(context.Context, uint64, string, []MethodSpec) error
RemoveObject(context.Context, uint64) error
CompleteIncoming(context.Context, uint64, int, string, int) error
AddEvent(context.Context, uint64, string) error
RemoveEvent(context.Context, uint64) error
SendEvent(context.Context, string, string) error
AddSubscription(context.Context, uint64, string) error
RemoveSubscription(context.Context, uint64) error
Notify(context.Context, uint64, string, string, bool) (NotifyReport, error)
StartMonitor(context.Context) error
StopMonitor(context.Context) error
}
Engine is the internal, platform-specific native connection.
type Incoming ¶
type Incoming struct {
ID uint64
OwnerID uint64
Kind IncomingKind
Object string
Method string
Peer uint32
User string
Group string
ACLObj string
JSON string
FD int
}
Incoming is a fully copied request awaiting deferred completion.
type IncomingKind ¶
type IncomingKind uint8
IncomingKind identifies the owner and semantics of an incoming request.
const ( // IncomingMethod is a call to a published object method. IncomingMethod IncomingKind = iota // IncomingNotification is a notification delivered to a subscriber. IncomingNotification )
type InvokeResult ¶
InvokeResult contains copied response JSON and an owned descriptor.
type LookupObject ¶
LookupObject is one copied native lookup result.
type MethodSpec ¶
MethodSpec is one method registered on a native object.
type MonitorRecord ¶
type MonitorRecord struct {
Sequence uint32
Client uint32
Peer uint32
Send bool
Type uint32
JSON string
}
MonitorRecord is one parsed native monitor envelope.
type NotifyReport ¶
type NotifyReport struct {
Results []NotifyResult
Replies []string
}
NotifyReport separates attributable statuses from unattributed reply data.
type NotifyResult ¶
NotifyResult contains one subscriber's native completion status.
type StatusError ¶
StatusError carries a native ubus status from the bridge.
func (*StatusError) Error ¶
func (e *StatusError) Error() string