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