Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-developer:ubus [2020/01/10 19:49] – wan stokitodocs:guide-developer:ubus [2020/01/11 13:16] (current) – removed duplicated description stokito
Line 3: Line 3:
 ===== uBus - IPC/RPC ===== ===== uBus - IPC/RPC =====
  
-[[docs:techref:ubus|uBus]] is the interconnect system used by most services running on a //OpenWrt// setup. Services can connect to the bus and provide methods that can be called by other services or clients.+uBus is the interconnect system used by most services running on a //OpenWrt// setup. Services can connect to the bus and provide methods that can be called by other services or clients.
  
-There is a CLI that can be used to communicate with services on the bus.+See [[docs:techref:ubus|uBus Technical Reference]]
  
-<code> 
-root@OpenWrt:/# ubus 
-Usage: ubus [<options>] <command> [arguments...] 
-Options: 
- -s <socket>:           Set the unix domain socket to connect to 
- -t <timeout>:          Set the timeout (in seconds) for a command to complete 
- -S:                    Use simplified output (for scripts) 
- -v:                    More verbose output 
- -m <type>:             (for monitor): include a specific message type 
-                        (can be used more than once) 
- -M <r|t>               (for monitor): only capture received or transmitted traffic 
- 
-Commands: 
- - list [<path>                       List objects 
- - call <path> <method> [<message>    Call an object method 
- - listen [<path>...]                   Listen for events 
- - send <type> [<message>             Send an event 
- - wait_for <object> [<object>...]      Wait for multiple objects to appear on ubus 
- - monitor                              Monitor ubus traffic 
-</code> 
- 
- 
-To find out which services are currently running on the bus simply use the list command. This will show a complete list. 
- 
- 
-<code> 
-root@OpenWrt:/# ubus list 
-dhcp 
-dnsmasq 
-file 
-iwinfo 
-log 
-luci 
-luci-rpc 
-network 
-network.device 
-network.interface 
-network.interface.lan 
-network.interface.loopback 
-network.interface.wan 
-network.interface.wan6 
-network.rrdns 
-network.wireless 
-service 
-session 
-system 
-uci 
-</code> 
- 
- 
-To find out which methods a specific service provides also use the list command but add a few more parameters to see a complete list 
- 
- 
-<code> 
-root@OpenWrt:/# ubus -v list system 
-'system' @651f206c 
-        "board":{} 
-        "info":{} 
-        "reboot":{} 
-        "watchdog":{"frequency":"Integer","timeout":"Integer","magicclose":"Boolean","stop":"Boolean"} 
-        "signal":{"pid":"Integer","signum":"Integer"} 
-        "validate_firmware_image":{"path":"String"} 
-        "sysupgrade":{"path":"String","force":"Boolean","backup":"String","prefix":"String","command":"String","options":"Table"} 
-</code> 
- 
- 
-You can now call a remote method and receive a reply. A reply may be a simple integer return code or a more complete reply. Internally the bus uses a blob format, the CLI conveniently converts this to JSON. 
- 
- 
-<code> 
-root@OpenWrt:/# ubus call system board 
-{ 
-        "kernel": "4.9.198", 
-        "hostname": "OpenWrt", 
-        "system": "Qualcomm Atheros QCA956X ver 1 rev 0", 
-        "model": "TP-Link TL-WR1043N\/ND v4", 
-        "board_name": "tl-wr1043nd-v4", 
-        "release": { 
-                "distribution": "OpenWrt", 
-                "version": "18.06.5", 
-                "revision": "r7897-9d401013fc", 
-                "target": "ar71xx\/generic", 
-                "description": "OpenWrt 18.06.5 r7897-9d401013fc" 
-        } 
-} 
-</code> 
- 
- 
-You can call a method and pass it some parameters by simply appending a JSON structure to the CLI command. 
- 
- 
-<code> 
-root@OpenWrt:/# ubus call system signal '{ "pid": 123, "signum": 9 }' 
-root@OpenWrt:/# echo $? 
-0 
-</code> 
  
  
Line 110: Line 14:
  
 ^ path ^ Description ^ Package ^ ^ path ^ Description ^ Package ^
-| [[doc:ubus:dhcp]] | dhcp server | odhcpd | +| [[docs:guide-developer:ubus:dhcp]] | dhcp server | odhcpd | 
-| [[doc:ubus:file]] | file | rpcd | +| [[docs:guide-developer:ubus:file]] | file | rpcd | 
-| [[doc:ubus:hostapd]] | acesspoints | wpad/hostapd | +| [[docs:guide-developer:ubus:hostapd]] | acesspoints | wpad/hostapd | 
-| [[docs:guide-developer:iwinfo]] | wireless informations | rpcd iwinfo | +| [[docs:guide-developer:ubus:iwinfo]] | wireless informations | rpcd iwinfo | 
-| [[doc:ubus:log]] | logging | procd | +| [[docs:guide-developer:ubus:log]] | logging | procd | 
-| [[doc:ubus:mdns]] | mdns avahi replacement | mdnsd | +| [[docs:guide-developer:ubus:mdns]] | mdns avahi replacement | mdnsd | 
-| [[docs:guide-developer:network]] | network | netifd | +| [[docs:guide-developer:ubus:network]] | network | netifd | 
-| [[docs:guide-developer:service]] | init/service | procd | +| [[docs:guide-developer:ubus:service]] | init/service | procd | 
-| [[doc:ubus:session]] | Session management | rpcd |+| [[docs:guide-developer:ubus:session]] | Session management | rpcd |
 | [[docs:guide-developer:ubus:system]] | system misc | procd | | [[docs:guide-developer:ubus:system]] | system misc | procd |
 | [[docs:guide-developer:ubus:uci]] | Unified Configuration Interface | rpcd | | [[docs:guide-developer:ubus:uci]] | Unified Configuration Interface | rpcd |
  • Last modified: 2020/01/10 19:49
  • by stokito