1
0

luci.model.uci.html 19 KB

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