luci.model.uci.html 19 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html>
  4. <head>
  5. <title>Reference</title>
  6. <link rel="stylesheet" href="../luadoc.css" type="text/css" />
  7. <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
  8. </head>
  9. <body>
  10. <div id="container">
  11. <div id="product">
  12. <div id="product_logo"></div>
  13. <div id="product_name"><big><b></b></big></div>
  14. <div id="product_description"></div>
  15. </div> <!-- id="product" -->
  16. <div id="main">
  17. <div id="navigation">
  18. <h1>LuaDoc</h1>
  19. <ul>
  20. <li><a href="../index.html">Index</a></li>
  21. </ul>
  22. <!-- Module list -->
  23. <h1>Modules</h1>
  24. <ul>
  25. <li>
  26. <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
  27. </li>
  28. <li>
  29. <a href="../modules/luci.http.html">luci.http</a>
  30. </li>
  31. <li>
  32. <a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
  33. </li>
  34. <li>
  35. <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
  36. </li>
  37. <li>
  38. <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
  39. </li>
  40. <li>
  41. <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
  42. </li>
  43. <li>
  44. <a href="../modules/luci.i18n.html">luci.i18n</a>
  45. </li>
  46. <li>
  47. <a href="../modules/luci.ip.html">luci.ip</a>
  48. </li>
  49. <li>
  50. <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
  51. </li>
  52. <li>
  53. <a href="../modules/luci.json.html">luci.json</a>
  54. </li>
  55. <li>
  56. <a href="../modules/luci.jsonc.html">luci.jsonc</a>
  57. </li>
  58. <li>
  59. <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
  60. </li>
  61. <li>
  62. <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
  63. </li>
  64. <li><strong>luci.model.uci</strong></li>
  65. <li>
  66. <a href="../modules/luci.rpcc.html">luci.rpcc</a>
  67. </li>
  68. <li>
  69. <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
  70. </li>
  71. <li>
  72. <a href="../modules/luci.sys.html">luci.sys</a>
  73. </li>
  74. <li>
  75. <a href="../modules/luci.sys.init.html">luci.sys.init</a>
  76. </li>
  77. <li>
  78. <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
  79. </li>
  80. <li>
  81. <a href="../modules/luci.sys.net.html">luci.sys.net</a>
  82. </li>
  83. <li>
  84. <a href="../modules/luci.sys.process.html">luci.sys.process</a>
  85. </li>
  86. <li>
  87. <a href="../modules/luci.sys.user.html">luci.sys.user</a>
  88. </li>
  89. <li>
  90. <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
  91. </li>
  92. <li>
  93. <a href="../modules/luci.util.html">luci.util</a>
  94. </li>
  95. <li>
  96. <a href="../modules/nixio.html">nixio</a>
  97. </li>
  98. <li>
  99. <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
  100. </li>
  101. <li>
  102. <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
  103. </li>
  104. <li>
  105. <a href="../modules/nixio.File.html">nixio.File</a>
  106. </li>
  107. <li>
  108. <a href="../modules/nixio.README.html">nixio.README</a>
  109. </li>
  110. <li>
  111. <a href="../modules/nixio.Socket.html">nixio.Socket</a>
  112. </li>
  113. <li>
  114. <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
  115. </li>
  116. <li>
  117. <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
  118. </li>
  119. <li>
  120. <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
  121. </li>
  122. <li>
  123. <a href="../modules/nixio.bin.html">nixio.bin</a>
  124. </li>
  125. <li>
  126. <a href="../modules/nixio.bit.html">nixio.bit</a>
  127. </li>
  128. <li>
  129. <a href="../modules/nixio.crypto.html">nixio.crypto</a>
  130. </li>
  131. <li>
  132. <a href="../modules/nixio.fs.html">nixio.fs</a>
  133. </li>
  134. </ul>
  135. <!-- File list -->
  136. </div><!-- id="navigation" -->
  137. <div id="content">
  138. <h1>Object Instance <code>luci.model.uci</code></h1>
  139. <p></p>
  140. <h2>Functions</h2>
  141. <table class="function_list">
  142. <tr>
  143. <td class="name" nowrap><a href="#Cursor.add">Cursor:add</a>&nbsp;(config, type)</td>
  144. <td class="summary">
  145. Add an anonymous section.</td>
  146. </tr>
  147. <tr>
  148. <td class="name" nowrap><a href="#Cursor.apply">Cursor:apply</a>&nbsp;(configlist, command)</td>
  149. <td class="summary">
  150. Applies UCI configuration changes
  151. </td>
  152. </tr>
  153. <tr>
  154. <td class="name" nowrap><a href="#Cursor.changes">Cursor:changes</a>&nbsp;(config)</td>
  155. <td class="summary">
  156. Get a table of saved but uncommitted changes.</td>
  157. </tr>
  158. <tr>
  159. <td class="name" nowrap><a href="#Cursor.commit">Cursor:commit</a>&nbsp;(config)</td>
  160. <td class="summary">
  161. Commit saved changes.</td>
  162. </tr>
  163. <tr>
  164. <td class="name" nowrap><a href="#Cursor.delete">Cursor:delete</a>&nbsp;(config, section, option)</td>
  165. <td class="summary">
  166. Deletes a section or an option.</td>
  167. </tr>
  168. <tr>
  169. <td class="name" nowrap><a href="#Cursor.delete_all">Cursor:delete_all</a>&nbsp;(config, type, comparator)</td>
  170. <td class="summary">
  171. Delete all sections of a given type that match certain criteria.</td>
  172. </tr>
  173. <tr>
  174. <td class="name" nowrap><a href="#Cursor.foreach">Cursor:foreach</a>&nbsp;(config, type, callback)</td>
  175. <td class="summary">
  176. Call a function for every section of a certain type.</td>
  177. </tr>
  178. <tr>
  179. <td class="name" nowrap><a href="#Cursor.get">Cursor:get</a>&nbsp;(config, section, option)</td>
  180. <td class="summary">
  181. Get a section type or an option
  182. </td>
  183. </tr>
  184. <tr>
  185. <td class="name" nowrap><a href="#Cursor.get_all">Cursor:get_all</a>&nbsp;(config, section)</td>
  186. <td class="summary">
  187. Get all sections of a config or all values of a section.</td>
  188. </tr>
  189. <tr>
  190. <td class="name" nowrap><a href="#Cursor.get_bool">Cursor:get_bool</a>&nbsp;(config, section, option)</td>
  191. <td class="summary">
  192. Get a boolean option and return it's value as true or false.</td>
  193. </tr>
  194. <tr>
  195. <td class="name" nowrap><a href="#Cursor.get_confdir">Cursor:get_confdir</a>&nbsp;()</td>
  196. <td class="summary">
  197. Get the configuration directory.</td>
  198. </tr>
  199. <tr>
  200. <td class="name" nowrap><a href="#Cursor.get_first">Cursor:get_first</a>&nbsp;(config, type, option, default)</td>
  201. <td class="summary">
  202. Get the given option from the first section with the given type.</td>
  203. </tr>
  204. <tr>
  205. <td class="name" nowrap><a href="#Cursor.get_list">Cursor:get_list</a>&nbsp;(config, section, option)</td>
  206. <td class="summary">
  207. Get an option or list and return values as table.</td>
  208. </tr>
  209. <tr>
  210. <td class="name" nowrap><a href="#Cursor.get_savedir">Cursor:get_savedir</a>&nbsp;()</td>
  211. <td class="summary">
  212. Get the directory for uncomitted changes.</td>
  213. </tr>
  214. <tr>
  215. <td class="name" nowrap><a href="#Cursor.load">Cursor:load</a>&nbsp;(config)</td>
  216. <td class="summary">
  217. Manually load a config.</td>
  218. </tr>
  219. <tr>
  220. <td class="name" nowrap><a href="#Cursor.revert">Cursor:revert</a>&nbsp;(config)</td>
  221. <td class="summary">
  222. Revert saved but uncommitted changes.</td>
  223. </tr>
  224. <tr>
  225. <td class="name" nowrap><a href="#Cursor.save">Cursor:save</a>&nbsp;(config)</td>
  226. <td class="summary">
  227. Saves changes made to a config to make them committable.</td>
  228. </tr>
  229. <tr>
  230. <td class="name" nowrap><a href="#Cursor.section">Cursor:section</a>&nbsp;(config, type, name, values)</td>
  231. <td class="summary">
  232. Create a new section and initialize it with data.</td>
  233. </tr>
  234. <tr>
  235. <td class="name" nowrap><a href="#Cursor.set">Cursor:set</a>&nbsp;(config, section, option, value)</td>
  236. <td class="summary">
  237. Set a value or create a named section.</td>
  238. </tr>
  239. <tr>
  240. <td class="name" nowrap><a href="#Cursor.set_confdir">Cursor:set_confdir</a>&nbsp;(directory)</td>
  241. <td class="summary">
  242. Set the configuration directory.</td>
  243. </tr>
  244. <tr>
  245. <td class="name" nowrap><a href="#Cursor.set_list">Cursor:set_list</a>&nbsp;(config, section, option, value)</td>
  246. <td class="summary">
  247. Set given values as list.</td>
  248. </tr>
  249. <tr>
  250. <td class="name" nowrap><a href="#Cursor.set_savedir">Cursor:set_savedir</a>&nbsp;(directory)</td>
  251. <td class="summary">
  252. Set the directory for uncommited changes.</td>
  253. </tr>
  254. <tr>
  255. <td class="name" nowrap><a href="#Cursor.substate">Cursor:substate</a>&nbsp;()</td>
  256. <td class="summary">
  257. Create a sub-state of this cursor.</td>
  258. </tr>
  259. <tr>
  260. <td class="name" nowrap><a href="#Cursor.tset">Cursor:tset</a>&nbsp;(config, section, values)</td>
  261. <td class="summary">
  262. Updated the data of a section using data from a table.</td>
  263. </tr>
  264. <tr>
  265. <td class="name" nowrap><a href="#Cursor.unload">Cursor:unload</a>&nbsp;(config)</td>
  266. <td class="summary">
  267. Discard changes made to a config.</td>
  268. </tr>
  269. <tr>
  270. <td class="name" nowrap><a href="#cursor">cursor</a>&nbsp;()</td>
  271. <td class="summary">
  272. Create a new UCI-Cursor.</td>
  273. </tr>
  274. <tr>
  275. <td class="name" nowrap><a href="#cursor_state">cursor_state</a>&nbsp;()</td>
  276. <td class="summary">
  277. Create a new Cursor initialized to the state directory.</td>
  278. </tr>
  279. </table>
  280. <br/>
  281. <br/>
  282. <h2><a name="functions"></a>Functions</h2>
  283. <dl class="function">
  284. <dt><a name="Cursor.add"></a><strong>Cursor:add</strong>&nbsp;(config, type)</dt>
  285. <dd>
  286. Add an anonymous section.
  287. <h3>Parameters</h3>
  288. <ul>
  289. <li>
  290. config: UCI config
  291. </li>
  292. <li>
  293. type: UCI section type
  294. </li>
  295. </ul>
  296. <h3>Return value:</h3>
  297. Name of created section
  298. </dd>
  299. <dt><a name="Cursor.apply"></a><strong>Cursor:apply</strong>&nbsp;(configlist, command)</dt>
  300. <dd>
  301. Applies UCI configuration changes
  302. <h3>Parameters</h3>
  303. <ul>
  304. <li>
  305. configlist: List of UCI configurations
  306. </li>
  307. <li>
  308. command: Don't apply only return the command
  309. </li>
  310. </ul>
  311. </dd>
  312. <dt><a name="Cursor.changes"></a><strong>Cursor:changes</strong>&nbsp;(config)</dt>
  313. <dd>
  314. Get a table of saved but uncommitted changes.
  315. <h3>Parameters</h3>
  316. <ul>
  317. <li>
  318. config: UCI config
  319. </li>
  320. </ul>
  321. <h3>Return value:</h3>
  322. Table of changes
  323. <h3>See also:</h3>
  324. <ul>
  325. <li><a href="#Cursor.save">
  326. Cursor:save
  327. </a>
  328. </ul>
  329. </dd>
  330. <dt><a name="Cursor.commit"></a><strong>Cursor:commit</strong>&nbsp;(config)</dt>
  331. <dd>
  332. Commit saved changes.
  333. <h3>Parameters</h3>
  334. <ul>
  335. <li>
  336. config: UCI config
  337. </li>
  338. </ul>
  339. <h3>Return value:</h3>
  340. Boolean whether operation succeeded
  341. <h3>See also:</h3>
  342. <ul>
  343. <li><a href="#Cursor.revert">
  344. Cursor:revert
  345. </a>
  346. <li><a href="#Cursor.save">
  347. Cursor:save
  348. </a>
  349. </ul>
  350. </dd>
  351. <dt><a name="Cursor.delete"></a><strong>Cursor:delete</strong>&nbsp;(config, section, option)</dt>
  352. <dd>
  353. Deletes a section or an option.
  354. <h3>Parameters</h3>
  355. <ul>
  356. <li>
  357. config: UCI config
  358. </li>
  359. <li>
  360. section: UCI section name
  361. </li>
  362. <li>
  363. option: UCI option (optional)
  364. </li>
  365. </ul>
  366. <h3>Return value:</h3>
  367. Boolean whether operation succeeded
  368. </dd>
  369. <dt><a name="Cursor.delete_all"></a><strong>Cursor:delete_all</strong>&nbsp;(config, type, comparator)</dt>
  370. <dd>
  371. Delete all sections of a given type that match certain criteria.
  372. <h3>Parameters</h3>
  373. <ul>
  374. <li>
  375. config: UCI config
  376. </li>
  377. <li>
  378. type: UCI section type
  379. </li>
  380. <li>
  381. comparator: Function that will be called for each section and
  382. returns a boolean whether to delete the current section (optional)
  383. </li>
  384. </ul>
  385. </dd>
  386. <dt><a name="Cursor.foreach"></a><strong>Cursor:foreach</strong>&nbsp;(config, type, callback)</dt>
  387. <dd>
  388. Call a function for every section of a certain type.
  389. <h3>Parameters</h3>
  390. <ul>
  391. <li>
  392. config: UCI config
  393. </li>
  394. <li>
  395. type: UCI section type
  396. </li>
  397. <li>
  398. callback: Function to be called
  399. </li>
  400. </ul>
  401. <h3>Return value:</h3>
  402. Boolean whether operation succeeded
  403. </dd>
  404. <dt><a name="Cursor.get"></a><strong>Cursor:get</strong>&nbsp;(config, section, option)</dt>
  405. <dd>
  406. Get a section type or an option
  407. <h3>Parameters</h3>
  408. <ul>
  409. <li>
  410. config: UCI config
  411. </li>
  412. <li>
  413. section: UCI section name
  414. </li>
  415. <li>
  416. option: UCI option (optional)
  417. </li>
  418. </ul>
  419. <h3>Return value:</h3>
  420. UCI value
  421. </dd>
  422. <dt><a name="Cursor.get_all"></a><strong>Cursor:get_all</strong>&nbsp;(config, section)</dt>
  423. <dd>
  424. Get all sections of a config or all values of a section.
  425. <h3>Parameters</h3>
  426. <ul>
  427. <li>
  428. config: UCI config
  429. </li>
  430. <li>
  431. section: UCI section name (optional)
  432. </li>
  433. </ul>
  434. <h3>Return value:</h3>
  435. Table of UCI sections or table of UCI values
  436. </dd>
  437. <dt><a name="Cursor.get_bool"></a><strong>Cursor:get_bool</strong>&nbsp;(config, section, option)</dt>
  438. <dd>
  439. Get a boolean option and return it's value as true or false.
  440. <h3>Parameters</h3>
  441. <ul>
  442. <li>
  443. config: UCI config
  444. </li>
  445. <li>
  446. section: UCI section name
  447. </li>
  448. <li>
  449. option: UCI option
  450. </li>
  451. </ul>
  452. <h3>Return value:</h3>
  453. Boolean
  454. </dd>
  455. <dt><a name="Cursor.get_confdir"></a><strong>Cursor:get_confdir</strong>&nbsp;()</dt>
  456. <dd>
  457. Get the configuration directory.
  458. <h3>Return value:</h3>
  459. Configuration directory
  460. </dd>
  461. <dt><a name="Cursor.get_first"></a><strong>Cursor:get_first</strong>&nbsp;(config, type, option, default)</dt>
  462. <dd>
  463. Get the given option from the first section with the given type.
  464. <h3>Parameters</h3>
  465. <ul>
  466. <li>
  467. config: UCI config
  468. </li>
  469. <li>
  470. type: UCI section type
  471. </li>
  472. <li>
  473. option: UCI option (optional)
  474. </li>
  475. <li>
  476. default: Default value (optional)
  477. </li>
  478. </ul>
  479. <h3>Return value:</h3>
  480. UCI value
  481. </dd>
  482. <dt><a name="Cursor.get_list"></a><strong>Cursor:get_list</strong>&nbsp;(config, section, option)</dt>
  483. <dd>
  484. Get an option or list and return values as table.
  485. <h3>Parameters</h3>
  486. <ul>
  487. <li>
  488. config: UCI config
  489. </li>
  490. <li>
  491. section: UCI section name
  492. </li>
  493. <li>
  494. option: UCI option
  495. </li>
  496. </ul>
  497. <h3>Return value:</h3>
  498. table. If the option was not found, you will simply get
  499. an empty table.
  500. </dd>
  501. <dt><a name="Cursor.get_savedir"></a><strong>Cursor:get_savedir</strong>&nbsp;()</dt>
  502. <dd>
  503. Get the directory for uncomitted changes.
  504. <h3>Return value:</h3>
  505. Save directory
  506. </dd>
  507. <dt><a name="Cursor.load"></a><strong>Cursor:load</strong>&nbsp;(config)</dt>
  508. <dd>
  509. Manually load a config.
  510. <h3>Parameters</h3>
  511. <ul>
  512. <li>
  513. config: UCI config
  514. </li>
  515. </ul>
  516. <h3>Return value:</h3>
  517. Boolean whether operation succeeded
  518. <h3>See also:</h3>
  519. <ul>
  520. <li><a href="#Cursor.save">
  521. Cursor:save
  522. </a>
  523. <li><a href="#Cursor.unload">
  524. Cursor:unload
  525. </a>
  526. </ul>
  527. </dd>
  528. <dt><a name="Cursor.revert"></a><strong>Cursor:revert</strong>&nbsp;(config)</dt>
  529. <dd>
  530. Revert saved but uncommitted changes.
  531. <h3>Parameters</h3>
  532. <ul>
  533. <li>
  534. config: UCI config
  535. </li>
  536. </ul>
  537. <h3>Return value:</h3>
  538. Boolean whether operation succeeded
  539. <h3>See also:</h3>
  540. <ul>
  541. <li><a href="#Cursor.commit">
  542. Cursor:commit
  543. </a>
  544. <li><a href="#Cursor.save">
  545. Cursor:save
  546. </a>
  547. </ul>
  548. </dd>
  549. <dt><a name="Cursor.save"></a><strong>Cursor:save</strong>&nbsp;(config)</dt>
  550. <dd>
  551. Saves changes made to a config to make them committable.
  552. <h3>Parameters</h3>
  553. <ul>
  554. <li>
  555. config: UCI config
  556. </li>
  557. </ul>
  558. <h3>Return value:</h3>
  559. Boolean whether operation succeeded
  560. <h3>See also:</h3>
  561. <ul>
  562. <li><a href="#Cursor.load">
  563. Cursor:load
  564. </a>
  565. <li><a href="#Cursor.unload">
  566. Cursor:unload
  567. </a>
  568. </ul>
  569. </dd>
  570. <dt><a name="Cursor.section"></a><strong>Cursor:section</strong>&nbsp;(config, type, name, values)</dt>
  571. <dd>
  572. Create a new section and initialize it with data.
  573. <h3>Parameters</h3>
  574. <ul>
  575. <li>
  576. config: UCI config
  577. </li>
  578. <li>
  579. type: UCI section type
  580. </li>
  581. <li>
  582. name: UCI section name (optional)
  583. </li>
  584. <li>
  585. values: Table of key - value pairs to initialize the section with
  586. </li>
  587. </ul>
  588. <h3>Return value:</h3>
  589. Name of created section
  590. </dd>
  591. <dt><a name="Cursor.set"></a><strong>Cursor:set</strong>&nbsp;(config, section, option, value)</dt>
  592. <dd>
  593. Set a value or create a named section.
  594. When invoked with three arguments <code>config</code>, <code>sectionname</code>, <code>sectiontype</code>,
  595. then a named section of the given type is created.
  596. When invoked with four arguments <code>config</code>, <code>sectionname</code>, <code>optionname</code> and
  597. <code>optionvalue</code> then the value of the specified option is set to the given value.
  598. <h3>Parameters</h3>
  599. <ul>
  600. <li>
  601. config: UCI config
  602. </li>
  603. <li>
  604. section: UCI section name
  605. </li>
  606. <li>
  607. option: UCI option or UCI section type
  608. </li>
  609. <li>
  610. value: UCI value or nothing if you want to create a section
  611. </li>
  612. </ul>
  613. <h3>Return value:</h3>
  614. Boolean whether operation succeeded
  615. </dd>
  616. <dt><a name="Cursor.set_confdir"></a><strong>Cursor:set_confdir</strong>&nbsp;(directory)</dt>
  617. <dd>
  618. Set the configuration directory.
  619. <h3>Parameters</h3>
  620. <ul>
  621. <li>
  622. directory: UCI configuration directory
  623. </li>
  624. </ul>
  625. <h3>Return value:</h3>
  626. Boolean whether operation succeeded
  627. </dd>
  628. <dt><a name="Cursor.set_list"></a><strong>Cursor:set_list</strong>&nbsp;(config, section, option, value)</dt>
  629. <dd>
  630. Set given values as list. Setting a list option to an empty list
  631. has the same effect as deleting the option.
  632. <h3>Parameters</h3>
  633. <ul>
  634. <li>
  635. config: UCI config
  636. </li>
  637. <li>
  638. section: UCI section name
  639. </li>
  640. <li>
  641. option: UCI option
  642. </li>
  643. <li>
  644. value: value or table. Raw values will become a single item table.
  645. </li>
  646. </ul>
  647. <h3>Return value:</h3>
  648. Boolean whether operation succeeded
  649. </dd>
  650. <dt><a name="Cursor.set_savedir"></a><strong>Cursor:set_savedir</strong>&nbsp;(directory)</dt>
  651. <dd>
  652. Set the directory for uncommited changes.
  653. <h3>Parameters</h3>
  654. <ul>
  655. <li>
  656. directory: UCI changes directory
  657. </li>
  658. </ul>
  659. <h3>Return value:</h3>
  660. Boolean whether operation succeeded
  661. </dd>
  662. <dt><a name="Cursor.substate"></a><strong>Cursor:substate</strong>&nbsp;()</dt>
  663. <dd>
  664. Create a sub-state of this cursor. The sub-state is tied to the parent
  665. curser, means it the parent unloads or loads configs, the sub state will
  666. do so as well.
  667. <h3>Return value:</h3>
  668. UCI state cursor tied to the parent cursor
  669. </dd>
  670. <dt><a name="Cursor.tset"></a><strong>Cursor:tset</strong>&nbsp;(config, section, values)</dt>
  671. <dd>
  672. Updated the data of a section using data from a table.
  673. <h3>Parameters</h3>
  674. <ul>
  675. <li>
  676. config: UCI config
  677. </li>
  678. <li>
  679. section: UCI section name (optional)
  680. </li>
  681. <li>
  682. values: Table of key - value pairs to update the section with
  683. </li>
  684. </ul>
  685. </dd>
  686. <dt><a name="Cursor.unload"></a><strong>Cursor:unload</strong>&nbsp;(config)</dt>
  687. <dd>
  688. Discard changes made to a config.
  689. <h3>Parameters</h3>
  690. <ul>
  691. <li>
  692. config: UCI config
  693. </li>
  694. </ul>
  695. <h3>Return value:</h3>
  696. Boolean whether operation succeeded
  697. <h3>See also:</h3>
  698. <ul>
  699. <li><a href="#Cursor.load">
  700. Cursor:load
  701. </a>
  702. <li><a href="#Cursor.save">
  703. Cursor:save
  704. </a>
  705. </ul>
  706. </dd>
  707. <dt><a name="cursor"></a><strong>cursor</strong>&nbsp;()</dt>
  708. <dd>
  709. Create a new UCI-Cursor.
  710. <h3>Return value:</h3>
  711. UCI-Cursor
  712. </dd>
  713. <dt><a name="cursor_state"></a><strong>cursor_state</strong>&nbsp;()</dt>
  714. <dd>
  715. Create a new Cursor initialized to the state directory.
  716. <h3>Return value:</h3>
  717. UCI cursor
  718. </dd>
  719. </dl>
  720. </div> <!-- id="content" -->
  721. </div> <!-- id="main" -->
  722. <div id="about">
  723. <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
  724. </div> <!-- id="about" -->
  725. </div> <!-- id="container" -->
  726. </body>
  727. </html>