formatvariadic-functionsdbusmethod-signaturenetworkmanager

What the heck is a dbus argument of type a{sa{sv}} in the Network Manager API?


I'm looking through the dbus api for Network Manager and there are methods with inputs of type a{sa{sv}}. I'm still new to dbus but if I'm interpreting the definition of signature specifiers in https://www.freedesktop.org/software/systemd/man/sd_bus_message_read.html# correctly this is:

What practically is this for? A name-paginated list of named settings? I'm seeing it all over the place in this API.


Solution

  • It turns out this is what I guess should be called a "Settings" in Network Manager. For several methods instead of building a connection setting by setting an entire set of settings are added all at once. Here's a tabbed and commented version of the settings of my current connection as queried for example:

    5
        "connection" 5
            "id" s "Profile 1"
            "permissions" as o //<empty array of strings>
            "timestamp" t 1661376049
            "type" s "802-3-ethernet"
            "uuid" s <not posting for privacy>
        "802-3-ethernet" 3
            "auto-negotiate" b false
            "mac-address-blacklist" as 0
            "s390-options" a{ss} 0
        "ipv4" 6
            "address-data" aa{sv} 0
            "addresses" aau 0
            "dns-search" as 0
            "method" s "auto"
            "route-data" aa{sv} 0
            "routes" aau 0
        "ipv6" 7
            "addr-gen-mode" i 1
            "address-data" aa{sv} 0
            "addresses" a(ayuay) 0
            "dns-search" as 0
            "method" s "auto"
            "route-data" aa{sv} 0
            "routes" a(ayuayu) 0
        "proxy" 0
    

    I think most of these are defaults so the real settings you might set when creating a connection are probably something like:

    4
        "connection" 4
            "id" s "Profile Foo"
            "timestamp" t <whatever, maybe this is autogenerated>
            "type" s "802-3-ethernet"
            "uuid" s <might be auto generated too>
        "802-3-ethernet" 0
        "ipv4" 1
            "method" s "auto"
        "ipv6" 1
            "addr-gen-mode" i 1
            "method" s "auto"