User Tools

Site Tools


docs:guide-developer:ubus:uci

ubus uci

Path Procedure Signature Description
uci get { “package”: “package”, “section”: “sname”, “type”: “type”, “option”: “oname” }

Return the requested uci value(s), all arguments are optional.

  1. When called without argument or with empty object: return an array of package names in the packages field
  2. When called with package set: return an object containing all sections containing all options in a field named after the package
  3. When called with package and type set: return an object containing all sections of type type containing all options in a field named after the package
  4. When called with package and sname set: return an object containing all options of the section in a field named after the section
  5. When called with package and type and oname set: return an object containing the value of each option named oname within a section of type type in a field named after the matched section
  6. When called with package and sname and oname set: return the result string in a field named oname in case of options or an array of result strings in a field named oname in case of list options

Return messages:

  1. { “packages”: [ “package1”, … ] }
  2. { “package”: { “sname1”: { “.type”: “type1”, “option1”: “value1”, “option2”: [ “value2.1”, … ], … }, … } }
  3. { “package”: { “sname1”: { “.type”: “type”, “option1”: “value1”, “option2”: [ “value2.1”, … ], … }, … } }
  4. { “sname”: { “.type”: “type”, “option1”: “value1”, “option2”: [ “value2.1”, … ], … } }
  5. { “sectionname1”: “value1”, “sectionname2”: [ “value2.1”, … ], … }
    1. { “oname”: “value1” }
    2. { “oname”: [ “value1.1”, … ] }
uci set { “package”: “package”, “section”: “sname”, “option”: “oname”, “value”: “value” }

Set the given value(s), the option argument is optional.

  1. When called with package and sname and value set: add a new section sname in package and set it to the type given in value
  2. When called with package and sname, oname and value set:
    1. If value is of type array: set strings in the value array as list option oname
    2. If value is of type string: set value as normal option oname

The call does not produce any data, instead it returns with the following status codes:

  1. If there already is a section called sname: UBUS_STATUS_INVALID_ARGUMENT else: UBUS_STATUS_OK
  2. If there is no section sname or if value is neither a string nor an array: UBUS_STATUS_INVALID_ARGUMENT else: UBUS_STATUS_OK
uci add { “package”: “package”, “type”: “type” }

Add new anonymous section of given type.

  1. When called with package and type set: Add a new anonymous section of type type.

Return message:

  1. { “section”: “sectionname” }
uci delete { “package”: “package”, “section”: “sname”, “type”: “type”, “option”: “oname” }

Delete the given value(s) or section(s), the option and type arguments are optional.

  1. When called with package and type set: delete all sections of type type in package
  2. When called with package and sname set: delete the section named sname in package
  3. When called with package, type and oname set: delete the option named oname within each section of type type in package
  4. When called with package, sname and oname set: delete the option named oname in section sname of package

The call does not result in any data, instead it returns the following status codes:

  1. If no section of type type was found: UBUS_STATUS_NOT_FOUND else: UBUS_STATUS_OK
  2. If no section named sname was found: UBUS_STATUS_NOT_FOUND else: UBUS_STATUS_OK
  3. If no options named oname within sections of type type where found: UBUS_STATUS_NOT_FOUND else: UBUS_STATUS_OK
  4. If the option named oname within named section sname was not found: UBUS_STATUS_NOT_FOUND else: UBUS_STATUS_OK
docs/guide-developer/ubus/uci.txt · Last modified: 2018/02/17 17:13 by bobafetthotmail