documentation: change JS docs template
[project/luci.git] / documentation / api / modules / luci.model.uci.html
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
10 <body>
11 <div id="container">
12
13 <div id="product">
14 <div id="product_logo"></div>
15 <div id="product_name"><big><b></b></big></div>
16 <div id="product_description"></div>
17 </div> <!-- id="product" -->
18
19 <div id="main">
20
21 <div id="navigation">
22
23
24 <h1>LuaDoc</h1>
25 <ul>
26
27 <li><a href="../index.html">Index</a></li>
28
29 </ul>
30
31
32 <!-- Module list -->
33
34 <h1>Modules</h1>
35 <ul>
36
37 <li>
38 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
39 </li>
40
41 <li>
42 <a href="../modules/luci.http.html">luci.http</a>
43 </li>
44
45 <li>
46 <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
47 </li>
48
49 <li>
50 <a href="../modules/luci.http.date.html">luci.http.date</a>
51 </li>
52
53 <li>
54 <a href="../modules/luci.http.mime.html">luci.http.mime</a>
55 </li>
56
57 <li>
58 <a href="../modules/luci.i18n.html">luci.i18n</a>
59 </li>
60
61 <li>
62 <a href="../modules/luci.ip.html">luci.ip</a>
63 </li>
64
65 <li>
66 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
67 </li>
68
69 <li>
70 <a href="../modules/luci.json.html">luci.json</a>
71 </li>
72
73 <li>
74 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
75 </li>
76
77 <li>
78 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
79 </li>
80
81 <li>
82 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
83 </li>
84
85 <li><strong>luci.model.uci</strong></li>
86
87 <li>
88 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
89 </li>
90
91 <li>
92 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
93 </li>
94
95 <li>
96 <a href="../modules/luci.sys.html">luci.sys</a>
97 </li>
98
99 <li>
100 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
101 </li>
102
103 <li>
104 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
105 </li>
106
107 <li>
108 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
109 </li>
110
111 <li>
112 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
113 </li>
114
115 <li>
116 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
117 </li>
118
119 <li>
120 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
121 </li>
122
123 <li>
124 <a href="../modules/luci.util.html">luci.util</a>
125 </li>
126
127 <li>
128 <a href="../modules/nixio.html">nixio</a>
129 </li>
130
131 <li>
132 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
133 </li>
134
135 <li>
136 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
137 </li>
138
139 <li>
140 <a href="../modules/nixio.File.html">nixio.File</a>
141 </li>
142
143 <li>
144 <a href="../modules/nixio.README.html">nixio.README</a>
145 </li>
146
147 <li>
148 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
149 </li>
150
151 <li>
152 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
153 </li>
154
155 <li>
156 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
157 </li>
158
159 <li>
160 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
161 </li>
162
163 <li>
164 <a href="../modules/nixio.bin.html">nixio.bin</a>
165 </li>
166
167 <li>
168 <a href="../modules/nixio.bit.html">nixio.bit</a>
169 </li>
170
171 <li>
172 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
173 </li>
174
175 <li>
176 <a href="../modules/nixio.fs.html">nixio.fs</a>
177 </li>
178
179 </ul>
180
181
182
183 <!-- File list -->
184
185
186
187
188
189
190
191 </div><!-- id="navigation" -->
192
193 <div id="content">
194
195 <h1>Object Instance <code>luci.model.uci</code></h1>
196
197 <p></p>
198
199
200
201
202
203
204
205 <h2>Functions</h2>
206 <table class="function_list">
207
208 <tr>
209 <td class="name" nowrap><a href="#Cursor.add">Cursor:add</a>&nbsp;(config, type)</td>
210 <td class="summary">
211
212 Add an anonymous section.</td>
213 </tr>
214
215 <tr>
216 <td class="name" nowrap><a href="#Cursor.apply">Cursor:apply</a>&nbsp;(rollback)</td>
217 <td class="summary">
218
219 Applies UCI configuration changes.</td>
220 </tr>
221
222 <tr>
223 <td class="name" nowrap><a href="#Cursor.changes">Cursor:changes</a>&nbsp;(config)</td>
224 <td class="summary">
225
226 Get a table of saved but uncommitted changes.</td>
227 </tr>
228
229 <tr>
230 <td class="name" nowrap><a href="#Cursor.commit">Cursor:commit</a>&nbsp;(config)</td>
231 <td class="summary">
232
233 Commit saved changes.</td>
234 </tr>
235
236 <tr>
237 <td class="name" nowrap><a href="#Cursor.confirm">Cursor:confirm</a>&nbsp;()</td>
238 <td class="summary">
239
240 Confirms UCI apply process.</td>
241 </tr>
242
243 <tr>
244 <td class="name" nowrap><a href="#Cursor.delete">Cursor:delete</a>&nbsp;(config, section, option)</td>
245 <td class="summary">
246
247 Deletes a section or an option.</td>
248 </tr>
249
250 <tr>
251 <td class="name" nowrap><a href="#Cursor.delete_all">Cursor:delete_all</a>&nbsp;(config, type, comparator)</td>
252 <td class="summary">
253
254 Delete all sections of a given type that match certain criteria.</td>
255 </tr>
256
257 <tr>
258 <td class="name" nowrap><a href="#Cursor.foreach">Cursor:foreach</a>&nbsp;(config, type, callback)</td>
259 <td class="summary">
260
261 Call a function for every section of a certain type.</td>
262 </tr>
263
264 <tr>
265 <td class="name" nowrap><a href="#Cursor.get">Cursor:get</a>&nbsp;(config, section, option)</td>
266 <td class="summary">
267
268 Get a section type or an option
269 </td>
270 </tr>
271
272 <tr>
273 <td class="name" nowrap><a href="#Cursor.get_all">Cursor:get_all</a>&nbsp;(config, section)</td>
274 <td class="summary">
275
276 Get all sections of a config or all values of a section.</td>
277 </tr>
278
279 <tr>
280 <td class="name" nowrap><a href="#Cursor.get_bool">Cursor:get_bool</a>&nbsp;(config, section, option)</td>
281 <td class="summary">
282
283 Get a boolean option and return it's value as true or false.</td>
284 </tr>
285
286 <tr>
287 <td class="name" nowrap><a href="#Cursor.get_confdir">Cursor:get_confdir</a>&nbsp;()</td>
288 <td class="summary">
289
290 Get the configuration directory.</td>
291 </tr>
292
293 <tr>
294 <td class="name" nowrap><a href="#Cursor.get_first">Cursor:get_first</a>&nbsp;(config, type, option, default)</td>
295 <td class="summary">
296
297 Get the given option from the first section with the given type.</td>
298 </tr>
299
300 <tr>
301 <td class="name" nowrap><a href="#Cursor.get_list">Cursor:get_list</a>&nbsp;(config, section, option)</td>
302 <td class="summary">
303
304 Get an option or list and return values as table.</td>
305 </tr>
306
307 <tr>
308 <td class="name" nowrap><a href="#Cursor.get_savedir">Cursor:get_savedir</a>&nbsp;()</td>
309 <td class="summary">
310
311 Get the directory for uncomitted changes.</td>
312 </tr>
313
314 <tr>
315 <td class="name" nowrap><a href="#Cursor.get_session_id">Cursor:get_session_id</a>&nbsp;()</td>
316 <td class="summary">
317
318 Get the effective session ID.</td>
319 </tr>
320
321 <tr>
322 <td class="name" nowrap><a href="#Cursor.load">Cursor:load</a>&nbsp;(config)</td>
323 <td class="summary">
324
325 Manually load a config.</td>
326 </tr>
327
328 <tr>
329 <td class="name" nowrap><a href="#Cursor.revert">Cursor:revert</a>&nbsp;(config)</td>
330 <td class="summary">
331
332 Revert saved but uncommitted changes.</td>
333 </tr>
334
335 <tr>
336 <td class="name" nowrap><a href="#Cursor.rollback">Cursor:rollback</a>&nbsp;()</td>
337 <td class="summary">
338
339 Cancels UCI apply process.</td>
340 </tr>
341
342 <tr>
343 <td class="name" nowrap><a href="#Cursor.rollback_pending">Cursor:rollback_pending</a>&nbsp;()</td>
344 <td class="summary">
345
346 Checks whether a pending rollback is scheduled.</td>
347 </tr>
348
349 <tr>
350 <td class="name" nowrap><a href="#Cursor.save">Cursor:save</a>&nbsp;(config)</td>
351 <td class="summary">
352
353 Saves changes made to a config to make them committable.</td>
354 </tr>
355
356 <tr>
357 <td class="name" nowrap><a href="#Cursor.section">Cursor:section</a>&nbsp;(config, type, name, values)</td>
358 <td class="summary">
359
360 Create a new section and initialize it with data.</td>
361 </tr>
362
363 <tr>
364 <td class="name" nowrap><a href="#Cursor.set">Cursor:set</a>&nbsp;(config, section, option, value)</td>
365 <td class="summary">
366
367 Set a value or create a named section.</td>
368 </tr>
369
370 <tr>
371 <td class="name" nowrap><a href="#Cursor.set_confdir">Cursor:set_confdir</a>&nbsp;(directory)</td>
372 <td class="summary">
373
374 Set the configuration directory.</td>
375 </tr>
376
377 <tr>
378 <td class="name" nowrap><a href="#Cursor.set_list">Cursor:set_list</a>&nbsp;(config, section, option, value)</td>
379 <td class="summary">
380
381 Set given values as list.</td>
382 </tr>
383
384 <tr>
385 <td class="name" nowrap><a href="#Cursor.set_savedir">Cursor:set_savedir</a>&nbsp;(directory)</td>
386 <td class="summary">
387
388 Set the directory for uncommitted changes.</td>
389 </tr>
390
391 <tr>
392 <td class="name" nowrap><a href="#Cursor.set_session_id">Cursor:set_session_id</a>&nbsp;(id)</td>
393 <td class="summary">
394
395 Set the effective session ID.</td>
396 </tr>
397
398 <tr>
399 <td class="name" nowrap><a href="#Cursor.substate">Cursor:substate</a>&nbsp;()</td>
400 <td class="summary">
401
402 Create a sub-state of this cursor.</td>
403 </tr>
404
405 <tr>
406 <td class="name" nowrap><a href="#Cursor.tset">Cursor:tset</a>&nbsp;(config, section, values)</td>
407 <td class="summary">
408
409 Updated the data of a section using data from a table.</td>
410 </tr>
411
412 <tr>
413 <td class="name" nowrap><a href="#Cursor.unload">Cursor:unload</a>&nbsp;(config)</td>
414 <td class="summary">
415
416 Discard changes made to a config.</td>
417 </tr>
418
419 <tr>
420 <td class="name" nowrap><a href="#cursor">cursor</a>&nbsp;()</td>
421 <td class="summary">
422
423 Create a new UCI-Cursor.</td>
424 </tr>
425
426 <tr>
427 <td class="name" nowrap><a href="#cursor_state">cursor_state</a>&nbsp;()</td>
428 <td class="summary">
429
430 Create a new Cursor initialized to the state directory.</td>
431 </tr>
432
433 </table>
434
435
436
437
438
439
440 <br/>
441 <br/>
442
443
444 <h2><a name="functions"></a>Functions</h2>
445 <dl class="function">
446
447
448
449 <dt><a name="Cursor.add"></a><strong>Cursor:add</strong>&nbsp;(config, type)</dt>
450 <dd>
451
452
453 Add an anonymous section.
454
455
456
457 <h3>Parameters</h3>
458 <ul>
459
460 <li>
461 config: UCI config
462 </li>
463
464 <li>
465 type: UCI section type
466 </li>
467
468 </ul>
469
470
471
472
473
474
475 <h3>Return value:</h3>
476 Name of created section
477
478
479
480 </dd>
481
482
483
484
485 <dt><a name="Cursor.apply"></a><strong>Cursor:apply</strong>&nbsp;(rollback)</dt>
486 <dd>
487
488
489 Applies UCI configuration changes.
490
491 If the rollback parameter is set to true, the apply function will invoke the
492 rollback mechanism which causes the configuration to be automatically reverted
493 if no confirm() call occurs within a certain timeout.
494
495 The current default timeout is 30s and can be increased using the
496 "luci.apply.timeout" uci configuration key.
497
498
499
500 <h3>Parameters</h3>
501 <ul>
502
503 <li>
504 rollback: Enable rollback mechanism
505 </li>
506
507 </ul>
508
509
510
511
512
513
514 <h3>Return value:</h3>
515 Boolean whether operation succeeded
516
517
518
519 </dd>
520
521
522
523
524 <dt><a name="Cursor.changes"></a><strong>Cursor:changes</strong>&nbsp;(config)</dt>
525 <dd>
526
527
528 Get a table of saved but uncommitted changes.
529
530
531
532 <h3>Parameters</h3>
533 <ul>
534
535 <li>
536 config: UCI config
537 </li>
538
539 </ul>
540
541
542
543
544
545
546 <h3>Return value:</h3>
547 Table of changes
548
549
550
551 <h3>See also:</h3>
552 <ul>
553
554 <li><a href="#Cursor.save">
555 Cursor:save
556 </a>
557
558 </ul>
559
560 </dd>
561
562
563
564
565 <dt><a name="Cursor.commit"></a><strong>Cursor:commit</strong>&nbsp;(config)</dt>
566 <dd>
567
568
569 Commit saved changes.
570
571
572
573 <h3>Parameters</h3>
574 <ul>
575
576 <li>
577 config: UCI config
578 </li>
579
580 </ul>
581
582
583
584
585
586
587 <h3>Return value:</h3>
588 Boolean whether operation succeeded
589
590
591
592 <h3>See also:</h3>
593 <ul>
594
595 <li><a href="#Cursor.revert">
596 Cursor:revert
597 </a>
598
599 <li><a href="#Cursor.save">
600 Cursor:save
601 </a>
602
603 </ul>
604
605 </dd>
606
607
608
609
610 <dt><a name="Cursor.confirm"></a><strong>Cursor:confirm</strong>&nbsp;()</dt>
611 <dd>
612
613
614 Confirms UCI apply process.
615
616 If a previous UCI apply with rollback has been invoked using apply(true),
617 this function confirms the process and cancels the pending rollback timer.
618
619 If no apply with rollback session is active, the function has no effect and
620 returns with a "No data" error.
621
622
623
624
625
626
627
628
629 <h3>Return value:</h3>
630 Boolean whether operation succeeded
631
632
633
634 </dd>
635
636
637
638
639 <dt><a name="Cursor.delete"></a><strong>Cursor:delete</strong>&nbsp;(config, section, option)</dt>
640 <dd>
641
642
643 Deletes a section or an option.
644
645
646
647 <h3>Parameters</h3>
648 <ul>
649
650 <li>
651 config: UCI config
652 </li>
653
654 <li>
655 section: UCI section name
656 </li>
657
658 <li>
659 option: UCI option (optional)
660 </li>
661
662 </ul>
663
664
665
666
667
668
669 <h3>Return value:</h3>
670 Boolean whether operation succeeded
671
672
673
674 </dd>
675
676
677
678
679 <dt><a name="Cursor.delete_all"></a><strong>Cursor:delete_all</strong>&nbsp;(config, type, comparator)</dt>
680 <dd>
681
682
683 Delete all sections of a given type that match certain criteria.
684
685
686
687 <h3>Parameters</h3>
688 <ul>
689
690 <li>
691 config: UCI config
692 </li>
693
694 <li>
695 type: UCI section type
696 </li>
697
698 <li>
699 comparator: Function that will be called for each section and returns
700 a boolean whether to delete the current section (optional)
701 </li>
702
703 </ul>
704
705
706
707
708
709
710
711
712 </dd>
713
714
715
716
717 <dt><a name="Cursor.foreach"></a><strong>Cursor:foreach</strong>&nbsp;(config, type, callback)</dt>
718 <dd>
719
720
721 Call a function for every section of a certain type.
722
723
724
725 <h3>Parameters</h3>
726 <ul>
727
728 <li>
729 config: UCI config
730 </li>
731
732 <li>
733 type: UCI section type
734 </li>
735
736 <li>
737 callback: Function to be called
738 </li>
739
740 </ul>
741
742
743
744
745
746
747 <h3>Return value:</h3>
748 Boolean whether operation succeeded
749
750
751
752 </dd>
753
754
755
756
757 <dt><a name="Cursor.get"></a><strong>Cursor:get</strong>&nbsp;(config, section, option)</dt>
758 <dd>
759
760
761 Get a section type or an option
762
763
764
765 <h3>Parameters</h3>
766 <ul>
767
768 <li>
769 config: UCI config
770 </li>
771
772 <li>
773 section: UCI section name
774 </li>
775
776 <li>
777 option: UCI option (optional)
778 </li>
779
780 </ul>
781
782
783
784
785
786
787 <h3>Return value:</h3>
788 UCI value
789
790
791
792 </dd>
793
794
795
796
797 <dt><a name="Cursor.get_all"></a><strong>Cursor:get_all</strong>&nbsp;(config, section)</dt>
798 <dd>
799
800
801 Get all sections of a config or all values of a section.
802
803
804
805 <h3>Parameters</h3>
806 <ul>
807
808 <li>
809 config: UCI config
810 </li>
811
812 <li>
813 section: UCI section name (optional)
814 </li>
815
816 </ul>
817
818
819
820
821
822
823 <h3>Return value:</h3>
824 Table of UCI sections or table of UCI values
825
826
827
828 </dd>
829
830
831
832
833 <dt><a name="Cursor.get_bool"></a><strong>Cursor:get_bool</strong>&nbsp;(config, section, option)</dt>
834 <dd>
835
836
837 Get a boolean option and return it's value as true or false.
838
839
840
841 <h3>Parameters</h3>
842 <ul>
843
844 <li>
845 config: UCI config
846 </li>
847
848 <li>
849 section: UCI section name
850 </li>
851
852 <li>
853 option: UCI option
854 </li>
855
856 </ul>
857
858
859
860
861
862
863 <h3>Return value:</h3>
864 Boolean
865
866
867
868 </dd>
869
870
871
872
873 <dt><a name="Cursor.get_confdir"></a><strong>Cursor:get_confdir</strong>&nbsp;()</dt>
874 <dd>
875
876
877 Get the configuration directory.
878
879
880
881
882
883
884
885
886 <h3>Return value:</h3>
887 Configuration directory
888
889
890
891 </dd>
892
893
894
895
896 <dt><a name="Cursor.get_first"></a><strong>Cursor:get_first</strong>&nbsp;(config, type, option, default)</dt>
897 <dd>
898
899
900 Get the given option from the first section with the given type.
901
902
903
904 <h3>Parameters</h3>
905 <ul>
906
907 <li>
908 config: UCI config
909 </li>
910
911 <li>
912 type: UCI section type
913 </li>
914
915 <li>
916 option: UCI option (optional)
917 </li>
918
919 <li>
920 default: Default value (optional)
921 </li>
922
923 </ul>
924
925
926
927
928
929
930 <h3>Return value:</h3>
931 UCI value
932
933
934
935 </dd>
936
937
938
939
940 <dt><a name="Cursor.get_list"></a><strong>Cursor:get_list</strong>&nbsp;(config, section, option)</dt>
941 <dd>
942
943
944 Get an option or list and return values as table.
945
946
947
948 <h3>Parameters</h3>
949 <ul>
950
951 <li>
952 config: UCI config
953 </li>
954
955 <li>
956 section: UCI section name
957 </li>
958
959 <li>
960 option: UCI option
961 </li>
962
963 </ul>
964
965
966
967
968
969
970 <h3>Return value:</h3>
971 table. If the option was not found, you will simply get an empty
972 table.
973
974
975
976 </dd>
977
978
979
980
981 <dt><a name="Cursor.get_savedir"></a><strong>Cursor:get_savedir</strong>&nbsp;()</dt>
982 <dd>
983
984
985 Get the directory for uncomitted changes.
986
987
988
989
990
991
992
993
994 <h3>Return value:</h3>
995 Save directory
996
997
998
999 </dd>
1000
1001
1002
1003
1004 <dt><a name="Cursor.get_session_id"></a><strong>Cursor:get_session_id</strong>&nbsp;()</dt>
1005 <dd>
1006
1007
1008 Get the effective session ID.
1009
1010
1011
1012
1013
1014
1015
1016
1017 <h3>Return value:</h3>
1018 String containing the session ID
1019
1020
1021
1022 </dd>
1023
1024
1025
1026
1027 <dt><a name="Cursor.load"></a><strong>Cursor:load</strong>&nbsp;(config)</dt>
1028 <dd>
1029
1030
1031 Manually load a config.
1032
1033
1034
1035 <h3>Parameters</h3>
1036 <ul>
1037
1038 <li>
1039 config: UCI config
1040 </li>
1041
1042 </ul>
1043
1044
1045
1046
1047
1048
1049 <h3>Return value:</h3>
1050 Boolean whether operation succeeded
1051
1052
1053
1054 <h3>See also:</h3>
1055 <ul>
1056
1057 <li><a href="#Cursor.save">
1058 Cursor:save
1059 </a>
1060
1061 <li><a href="#Cursor.unload">
1062 Cursor:unload
1063 </a>
1064
1065 </ul>
1066
1067 </dd>
1068
1069
1070
1071
1072 <dt><a name="Cursor.revert"></a><strong>Cursor:revert</strong>&nbsp;(config)</dt>
1073 <dd>
1074
1075
1076 Revert saved but uncommitted changes.
1077
1078
1079
1080 <h3>Parameters</h3>
1081 <ul>
1082
1083 <li>
1084 config: UCI config
1085 </li>
1086
1087 </ul>
1088
1089
1090
1091
1092
1093
1094 <h3>Return value:</h3>
1095 Boolean whether operation succeeded
1096
1097
1098
1099 <h3>See also:</h3>
1100 <ul>
1101
1102 <li><a href="#Cursor.commit">
1103 Cursor:commit
1104 </a>
1105
1106 <li><a href="#Cursor.save">
1107 Cursor:save
1108 </a>
1109
1110 </ul>
1111
1112 </dd>
1113
1114
1115
1116
1117 <dt><a name="Cursor.rollback"></a><strong>Cursor:rollback</strong>&nbsp;()</dt>
1118 <dd>
1119
1120
1121 Cancels UCI apply process.
1122
1123 If a previous UCI apply with rollback has been invoked using apply(true),
1124 this function cancels the process and rolls back the configuration to the
1125 pre-apply state.
1126
1127 If no apply with rollback session is active, the function has no effect and
1128 returns with a "No data" error.
1129
1130
1131
1132
1133
1134
1135
1136
1137 <h3>Return value:</h3>
1138 Boolean whether operation succeeded
1139
1140
1141
1142 </dd>
1143
1144
1145
1146
1147 <dt><a name="Cursor.rollback_pending"></a><strong>Cursor:rollback_pending</strong>&nbsp;()</dt>
1148 <dd>
1149
1150
1151 Checks whether a pending rollback is scheduled.
1152
1153 If a previous UCI apply with rollback has been invoked using apply(true),
1154 and has not been confirmed or rolled back yet, this function returns true
1155 and the remaining time until rollback in seconds. If no rollback is pending,
1156 the function returns false. On error, the function returns false and an
1157 additional string describing the error.
1158
1159
1160
1161
1162
1163
1164
1165
1166 <h3>Return values:</h3>
1167 <ol>
1168
1169 <li>Boolean whether rollback is pending
1170
1171 <li>Remaining time in seconds
1172
1173 </ol>
1174
1175
1176
1177 </dd>
1178
1179
1180
1181
1182 <dt><a name="Cursor.save"></a><strong>Cursor:save</strong>&nbsp;(config)</dt>
1183 <dd>
1184
1185
1186 Saves changes made to a config to make them committable.
1187
1188
1189
1190 <h3>Parameters</h3>
1191 <ul>
1192
1193 <li>
1194 config: UCI config
1195 </li>
1196
1197 </ul>
1198
1199
1200
1201
1202
1203
1204 <h3>Return value:</h3>
1205 Boolean whether operation succeeded
1206
1207
1208
1209 <h3>See also:</h3>
1210 <ul>
1211
1212 <li><a href="#Cursor.load">
1213 Cursor:load
1214 </a>
1215
1216 <li><a href="#Cursor.unload">
1217 Cursor:unload
1218 </a>
1219
1220 </ul>
1221
1222 </dd>
1223
1224
1225
1226
1227 <dt><a name="Cursor.section"></a><strong>Cursor:section</strong>&nbsp;(config, type, name, values)</dt>
1228 <dd>
1229
1230
1231 Create a new section and initialize it with data.
1232
1233
1234
1235 <h3>Parameters</h3>
1236 <ul>
1237
1238 <li>
1239 config: UCI config
1240 </li>
1241
1242 <li>
1243 type: UCI section type
1244 </li>
1245
1246 <li>
1247 name: UCI section name (optional)
1248 </li>
1249
1250 <li>
1251 values: Table of key - value pairs to initialize the section with
1252 </li>
1253
1254 </ul>
1255
1256
1257
1258
1259
1260
1261 <h3>Return value:</h3>
1262 Name of created section
1263
1264
1265
1266 </dd>
1267
1268
1269
1270
1271 <dt><a name="Cursor.set"></a><strong>Cursor:set</strong>&nbsp;(config, section, option, value)</dt>
1272 <dd>
1273
1274
1275 Set a value or create a named section.
1276
1277 When invoked with three arguments <code>config</code>, <code>sectionname</code>, <code>sectiontype</code>,
1278 then a named section of the given type is created.
1279
1280 When invoked with four arguments <code>config</code>, <code>sectionname</code>, <code>optionname</code> and
1281 <code>optionvalue</code> then the value of the specified option is set to the given value.
1282
1283
1284
1285 <h3>Parameters</h3>
1286 <ul>
1287
1288 <li>
1289 config: UCI config
1290 </li>
1291
1292 <li>
1293 section: UCI section name
1294 </li>
1295
1296 <li>
1297 option: UCI option or UCI section type
1298 </li>
1299
1300 <li>
1301 value: UCI value or nothing if you want to create a section
1302 </li>
1303
1304 </ul>
1305
1306
1307
1308
1309
1310
1311 <h3>Return value:</h3>
1312 Boolean whether operation succeeded
1313
1314
1315
1316 </dd>
1317
1318
1319
1320
1321 <dt><a name="Cursor.set_confdir"></a><strong>Cursor:set_confdir</strong>&nbsp;(directory)</dt>
1322 <dd>
1323
1324
1325 Set the configuration directory.
1326
1327
1328
1329 <h3>Parameters</h3>
1330 <ul>
1331
1332 <li>
1333 directory: UCI configuration directory
1334 </li>
1335
1336 </ul>
1337
1338
1339
1340
1341
1342
1343 <h3>Return value:</h3>
1344 Boolean whether operation succeeded
1345
1346
1347
1348 </dd>
1349
1350
1351
1352
1353 <dt><a name="Cursor.set_list"></a><strong>Cursor:set_list</strong>&nbsp;(config, section, option, value)</dt>
1354 <dd>
1355
1356
1357 Set given values as list. Setting a list option to an empty list
1358 has the same effect as deleting the option.
1359
1360
1361
1362 <h3>Parameters</h3>
1363 <ul>
1364
1365 <li>
1366 config: UCI config
1367 </li>
1368
1369 <li>
1370 section: UCI section name
1371 </li>
1372
1373 <li>
1374 option: UCI option
1375 </li>
1376
1377 <li>
1378 value: Value or table. Non-table values will be set as single
1379 item UCI list.
1380 </li>
1381
1382 </ul>
1383
1384
1385
1386
1387
1388
1389 <h3>Return value:</h3>
1390 Boolean whether operation succeeded
1391
1392
1393
1394 </dd>
1395
1396
1397
1398
1399 <dt><a name="Cursor.set_savedir"></a><strong>Cursor:set_savedir</strong>&nbsp;(directory)</dt>
1400 <dd>
1401
1402
1403 Set the directory for uncommitted changes.
1404
1405
1406
1407 <h3>Parameters</h3>
1408 <ul>
1409
1410 <li>
1411 directory: UCI changes directory
1412 </li>
1413
1414 </ul>
1415
1416
1417
1418
1419
1420
1421 <h3>Return value:</h3>
1422 Boolean whether operation succeeded
1423
1424
1425
1426 </dd>
1427
1428
1429
1430
1431 <dt><a name="Cursor.set_session_id"></a><strong>Cursor:set_session_id</strong>&nbsp;(id)</dt>
1432 <dd>
1433
1434
1435 Set the effective session ID.
1436
1437
1438
1439 <h3>Parameters</h3>
1440 <ul>
1441
1442 <li>
1443 id: String containing the session ID to set
1444 </li>
1445
1446 </ul>
1447
1448
1449
1450
1451
1452
1453 <h3>Return value:</h3>
1454 Boolean whether operation succeeded
1455
1456
1457
1458 </dd>
1459
1460
1461
1462
1463 <dt><a name="Cursor.substate"></a><strong>Cursor:substate</strong>&nbsp;()</dt>
1464 <dd>
1465
1466
1467 Create a sub-state of this cursor.
1468
1469 The sub-state is tied to the parent cursor, means it the parent unloads or
1470 loads configs, the sub state will do so as well.
1471
1472
1473
1474
1475
1476
1477
1478
1479 <h3>Return value:</h3>
1480 UCI state cursor tied to the parent cursor
1481
1482
1483
1484 </dd>
1485
1486
1487
1488
1489 <dt><a name="Cursor.tset"></a><strong>Cursor:tset</strong>&nbsp;(config, section, values)</dt>
1490 <dd>
1491
1492
1493 Updated the data of a section using data from a table.
1494
1495
1496
1497 <h3>Parameters</h3>
1498 <ul>
1499
1500 <li>
1501 config: UCI config
1502 </li>
1503
1504 <li>
1505 section: UCI section name (optional)
1506 </li>
1507
1508 <li>
1509 values: Table of key - value pairs to update the section with
1510 </li>
1511
1512 </ul>
1513
1514
1515
1516
1517
1518
1519
1520
1521 </dd>
1522
1523
1524
1525
1526 <dt><a name="Cursor.unload"></a><strong>Cursor:unload</strong>&nbsp;(config)</dt>
1527 <dd>
1528
1529
1530 Discard changes made to a config.
1531
1532
1533
1534 <h3>Parameters</h3>
1535 <ul>
1536
1537 <li>
1538 config: UCI config
1539 </li>
1540
1541 </ul>
1542
1543
1544
1545
1546
1547
1548 <h3>Return value:</h3>
1549 Boolean whether operation succeeded
1550
1551
1552
1553 <h3>See also:</h3>
1554 <ul>
1555
1556 <li><a href="#Cursor.load">
1557 Cursor:load
1558 </a>
1559
1560 <li><a href="#Cursor.save">
1561 Cursor:save
1562 </a>
1563
1564 </ul>
1565
1566 </dd>
1567
1568
1569
1570
1571 <dt><a name="cursor"></a><strong>cursor</strong>&nbsp;()</dt>
1572 <dd>
1573
1574
1575 Create a new UCI-Cursor.
1576
1577
1578
1579
1580
1581
1582
1583
1584 <h3>Return value:</h3>
1585 UCI-Cursor
1586
1587
1588
1589 </dd>
1590
1591
1592
1593
1594 <dt><a name="cursor_state"></a><strong>cursor_state</strong>&nbsp;()</dt>
1595 <dd>
1596
1597
1598 Create a new Cursor initialized to the state directory.
1599
1600
1601
1602
1603
1604
1605
1606
1607 <h3>Return value:</h3>
1608 UCI cursor
1609
1610
1611
1612 </dd>
1613
1614
1615 </dl>
1616
1617
1618
1619
1620
1621 </div> <!-- id="content" -->
1622
1623 </div> <!-- id="main" -->
1624
1625 <div id="about">
1626 <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>
1627 </div> <!-- id="about" -->
1628
1629 </div> <!-- id="container" -->
1630 </body>
1631 </html>