Documentation ¶
Index ¶
- Constants
- Variables
- func SetLogLevel(lvl slog.Level)
- func UbusError(code int) error
- type UBus
- func (u *UBus) Call(ubusObj, ubusMethod string, args map[string]interface{}) (string, error)
- func (u *UBus) List(ubusObj, ubusMethod string, args map[string]interface{}) (map[string]gjson.Result, error)
- func (u *UBus) LogWrite(id int, event string) error
- func (u *UBus) Login(username, password string) (*authData, error)
- func (u *UBus) Logined() error
- func (u *UBus) RPCRequest(method, ubusObj, ubusMethod string, args map[string]interface{}) (string, error)
- type UbusLog
- type UbusLogData
- type UbusParamMap
- type UbusResponseCode
Constants ¶
View Source
const ( EmptySession = "00000000000000000000000000000000" DefaultSocketPath = "/var/run/ubus/ubus.sock" DefaultInvokeTimeout = time.Second * 3 )
Variables ¶
View Source
var ( SysErrorIDMismatch = errors.New("response id mismatch") SysErrorNotImplemented = errors.New("function not implemented") )
View Source
var ( UbusErrorPermissionDenied = ubusError{UbusStatusPermissionDenied, "Permission Denied"} UbusErrorInvalidCommand = ubusError{UbusStatusInvalidCommand, "Invalid Command"} UbusErrorInvalidArgument = ubusError{UbusStatusInvalidArgument, "Invalid Argument"} UbusErrorUnknown = ubusError{UbusStatusUnknown, "Unknown Error"} UbusErrorAccessDenied = ubusError{UbusStatusAccessDenied, "Access denied"} )
Functions ¶
func SetLogLevel ¶
Types ¶
type UBus ¶
type UBus struct {
// contains filtered or unexported fields
}
UBus represents information to JSON-RPC Interaction with router
type UbusLog ¶
type UbusLog struct {
Log []UbusLogData
}
type UbusParamMap ¶
type UbusParamMap map[string]interface{}
type UbusResponseCode ¶
type UbusResponseCode = int
const ( UbusStatusOK UbusResponseCode = 0 UbusStatusInvalidCommand UbusResponseCode = 1 UbusStatusInvalidArgument UbusResponseCode = 2 UbusStatusMethodNotFound UbusResponseCode = 3 UbusStatusNotFound UbusResponseCode = 4 UbusStatusNoData UbusResponseCode = 5 UbusStatusPermissionDenied UbusResponseCode = 6 UbusStatusTimeout UbusResponseCode = 7 UbusStatusNotSupported UbusResponseCode = 8 UbusStatusUnknown UbusResponseCode = 9 UbusStatusConnectionFailed UbusResponseCode = 10 UbusStatusLast UbusResponseCode = 11 UbusStatusAccessDenied = -32002 )
Represents enum ubus_msg_status from https://git.openwrt.org/?p=project/ubus.git;a=blob;f=ubusmsg.h;h=398b126b6dc01833937749a110181ea0debb1476;hb=HEAD
Click to show internal directories.
Click to hide internal directories.