2
0

uci.js.html 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Source: uci.js</title>
  6. <script src="scripts/prettify/prettify.js"></script>
  7. <script src="scripts/prettify/lang-css.js"></script>
  8. <script src="scripts/jquery.min.js"></script>
  9. <!--[if lt IE 9]>
  10. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  11. <![endif]-->
  12. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  13. <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
  14. <link type="text/css" rel="stylesheet" href="styles/jaguar.css">
  15. <script>
  16. var config = {"monospaceLinks":true,"cleverLinks":true,"default":{"outputSourceFiles":true}};
  17. </script>
  18. </head>
  19. <body>
  20. <div id="wrap" class="clearfix">
  21. <div class="navigation">
  22. <h3 class="applicationName"><a href="index.html"></a></h3>
  23. <div class="search">
  24. <input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations">
  25. </div>
  26. <ul class="list">
  27. <li class="item" data-name="LuCI">
  28. <span class="title">
  29. <a href="LuCI.html">LuCI</a>
  30. </span>
  31. <ul class="members itemMembers">
  32. <span class="subtitle">Members</span>
  33. <li data-name="LuCI#env"><a href="LuCI.html#env">env</a></li>
  34. </ul>
  35. <ul class="typedefs itemMembers">
  36. <span class="subtitle">Typedefs</span>
  37. <li data-name="LuCI.requestCallbackFn"><a href="LuCI.html#.requestCallbackFn">requestCallbackFn</a></li>
  38. </ul>
  39. <ul class="typedefs itemMembers">
  40. </ul>
  41. <ul class="methods itemMembers">
  42. <span class="subtitle">Methods</span>
  43. <li data-name="LuCI#bind"><a href="LuCI.html#bind">bind</a></li>
  44. <li data-name="LuCI#error"><a href="LuCI.html#error">error</a></li>
  45. <li data-name="LuCI#get"><a href="LuCI.html#get">get</a></li>
  46. <li data-name="LuCI#halt"><a href="LuCI.html#halt">halt</a></li>
  47. <li data-name="LuCI#hasSystemFeature"><a href="LuCI.html#hasSystemFeature">hasSystemFeature</a></li>
  48. <li data-name="LuCI#isObject"><a href="LuCI.html#isObject">isObject</a></li>
  49. <li data-name="LuCI#location"><a href="LuCI.html#location">location</a></li>
  50. <li data-name="LuCI#path"><a href="LuCI.html#path">path</a></li>
  51. <li data-name="LuCI#poll"><a href="LuCI.html#poll">poll</a></li>
  52. <li data-name="LuCI#post"><a href="LuCI.html#post">post</a></li>
  53. <li data-name="LuCI#raise"><a href="LuCI.html#raise">raise</a></li>
  54. <li data-name="LuCI#require"><a href="LuCI.html#require">require</a></li>
  55. <li data-name="LuCI#resolveDefault"><a href="LuCI.html#resolveDefault">resolveDefault</a></li>
  56. <li data-name="LuCI#resource"><a href="LuCI.html#resource">resource</a></li>
  57. <li data-name="LuCI#run"><a href="LuCI.html#run">run</a></li>
  58. <li data-name="LuCI#sortedKeys"><a href="LuCI.html#sortedKeys">sortedKeys</a></li>
  59. <li data-name="LuCI#stop"><a href="LuCI.html#stop">stop</a></li>
  60. <li data-name="LuCI#toArray"><a href="LuCI.html#toArray">toArray</a></li>
  61. <li data-name="LuCI#url"><a href="LuCI.html#url">url</a></li>
  62. </ul>
  63. <ul class="events itemMembers">
  64. </ul>
  65. </li>
  66. <li class="item" data-name="LuCI.Class">
  67. <span class="title">
  68. <a href="LuCI.Class.html">LuCI.Class</a>
  69. </span>
  70. <ul class="members itemMembers">
  71. </ul>
  72. <ul class="typedefs itemMembers">
  73. </ul>
  74. <ul class="typedefs itemMembers">
  75. </ul>
  76. <ul class="methods itemMembers">
  77. <span class="subtitle">Methods</span>
  78. <li data-name="LuCI.Class.extend"><a href="LuCI.Class.html#.extend">extend</a></li>
  79. <li data-name="LuCI.Class.instantiate"><a href="LuCI.Class.html#.instantiate">instantiate</a></li>
  80. <li data-name="LuCI.Class.isSubclass"><a href="LuCI.Class.html#.isSubclass">isSubclass</a></li>
  81. <li data-name="LuCI.Class.singleton"><a href="LuCI.Class.html#.singleton">singleton</a></li>
  82. <li data-name="LuCI.Class#super"><a href="LuCI.Class.html#super">super</a></li>
  83. <li data-name="LuCI.Class#varargs"><a href="LuCI.Class.html#varargs">varargs</a></li>
  84. </ul>
  85. <ul class="events itemMembers">
  86. </ul>
  87. </li>
  88. <li class="item" data-name="LuCI.dom">
  89. <span class="title">
  90. <a href="LuCI.dom.html">LuCI.dom</a>
  91. </span>
  92. <ul class="members itemMembers">
  93. </ul>
  94. <ul class="typedefs itemMembers">
  95. <span class="subtitle">Typedefs</span>
  96. <li data-name="LuCI.dom~ignoreCallbackFn"><a href="LuCI.dom.html#~ignoreCallbackFn">ignoreCallbackFn</a></li>
  97. </ul>
  98. <ul class="typedefs itemMembers">
  99. </ul>
  100. <ul class="methods itemMembers">
  101. <span class="subtitle">Methods</span>
  102. <li data-name="LuCI.dom#append"><a href="LuCI.dom.html#append">append</a></li>
  103. <li data-name="LuCI.dom#attr"><a href="LuCI.dom.html#attr">attr</a></li>
  104. <li data-name="LuCI.dom#bindClassInstance"><a href="LuCI.dom.html#bindClassInstance">bindClassInstance</a></li>
  105. <li data-name="LuCI.dom#callClassMethod"><a href="LuCI.dom.html#callClassMethod">callClassMethod</a></li>
  106. <li data-name="LuCI.dom#content"><a href="LuCI.dom.html#content">content</a></li>
  107. <li data-name="LuCI.dom#create"><a href="LuCI.dom.html#create">create</a></li>
  108. <li data-name="LuCI.dom#data"><a href="LuCI.dom.html#data">data</a></li>
  109. <li data-name="LuCI.dom#elem"><a href="LuCI.dom.html#elem">elem</a></li>
  110. <li data-name="LuCI.dom#findClassInstance"><a href="LuCI.dom.html#findClassInstance">findClassInstance</a></li>
  111. <li data-name="LuCI.dom#isEmpty"><a href="LuCI.dom.html#isEmpty">isEmpty</a></li>
  112. <li data-name="LuCI.dom#matches"><a href="LuCI.dom.html#matches">matches</a></li>
  113. <li data-name="LuCI.dom#parent"><a href="LuCI.dom.html#parent">parent</a></li>
  114. <li data-name="LuCI.dom#parse"><a href="LuCI.dom.html#parse">parse</a></li>
  115. </ul>
  116. <ul class="events itemMembers">
  117. </ul>
  118. </li>
  119. <li class="item" data-name="LuCI.fs">
  120. <span class="title">
  121. <a href="LuCI.fs.html">LuCI.fs</a>
  122. </span>
  123. <ul class="members itemMembers">
  124. </ul>
  125. <ul class="typedefs itemMembers">
  126. <span class="subtitle">Typedefs</span>
  127. <li data-name="LuCI.fs.FileExecResult"><a href="LuCI.fs.html#.FileExecResult">FileExecResult</a></li>
  128. <li data-name="LuCI.fs.FileStatEntry"><a href="LuCI.fs.html#.FileStatEntry">FileStatEntry</a></li>
  129. </ul>
  130. <ul class="typedefs itemMembers">
  131. </ul>
  132. <ul class="methods itemMembers">
  133. <span class="subtitle">Methods</span>
  134. <li data-name="LuCI.fs#exec"><a href="LuCI.fs.html#exec">exec</a></li>
  135. <li data-name="LuCI.fs#lines"><a href="LuCI.fs.html#lines">lines</a></li>
  136. <li data-name="LuCI.fs#list"><a href="LuCI.fs.html#list">list</a></li>
  137. <li data-name="LuCI.fs#read"><a href="LuCI.fs.html#read">read</a></li>
  138. <li data-name="LuCI.fs#remove"><a href="LuCI.fs.html#remove">remove</a></li>
  139. <li data-name="LuCI.fs#stat"><a href="LuCI.fs.html#stat">stat</a></li>
  140. <li data-name="LuCI.fs#trimmed"><a href="LuCI.fs.html#trimmed">trimmed</a></li>
  141. <li data-name="LuCI.fs#write"><a href="LuCI.fs.html#write">write</a></li>
  142. </ul>
  143. <ul class="events itemMembers">
  144. </ul>
  145. </li>
  146. <li class="item" data-name="LuCI.Headers">
  147. <span class="title">
  148. <a href="LuCI.Headers.html">LuCI.Headers</a>
  149. </span>
  150. <ul class="members itemMembers">
  151. </ul>
  152. <ul class="typedefs itemMembers">
  153. </ul>
  154. <ul class="typedefs itemMembers">
  155. </ul>
  156. <ul class="methods itemMembers">
  157. <span class="subtitle">Methods</span>
  158. <li data-name="LuCI.Headers#get"><a href="LuCI.Headers.html#get">get</a></li>
  159. <li data-name="LuCI.Headers#has"><a href="LuCI.Headers.html#has">has</a></li>
  160. </ul>
  161. <ul class="events itemMembers">
  162. </ul>
  163. </li>
  164. <li class="item" data-name="LuCI.Network">
  165. <span class="title">
  166. <a href="LuCI.Network.html">LuCI.Network</a>
  167. </span>
  168. <ul class="members itemMembers">
  169. </ul>
  170. <ul class="typedefs itemMembers">
  171. <span class="subtitle">Typedefs</span>
  172. <li data-name="LuCI.Network.SwitchTopology"><a href="LuCI.Network.html#.SwitchTopology">SwitchTopology</a></li>
  173. <li data-name="LuCI.Network.WifiEncryption"><a href="LuCI.Network.html#.WifiEncryption">WifiEncryption</a></li>
  174. <li data-name="LuCI.Network.WifiPeerEntry"><a href="LuCI.Network.html#.WifiPeerEntry">WifiPeerEntry</a></li>
  175. <li data-name="LuCI.Network.WifiRateEntry"><a href="LuCI.Network.html#.WifiRateEntry">WifiRateEntry</a></li>
  176. <li data-name="LuCI.Network.WifiScanResult"><a href="LuCI.Network.html#.WifiScanResult">WifiScanResult</a></li>
  177. </ul>
  178. <ul class="typedefs itemMembers">
  179. </ul>
  180. <ul class="methods itemMembers">
  181. <span class="subtitle">Methods</span>
  182. <li data-name="LuCI.Network#addNetwork"><a href="LuCI.Network.html#addNetwork">addNetwork</a></li>
  183. <li data-name="LuCI.Network#addWifiNetwork"><a href="LuCI.Network.html#addWifiNetwork">addWifiNetwork</a></li>
  184. <li data-name="LuCI.Network#deleteNetwork"><a href="LuCI.Network.html#deleteNetwork">deleteNetwork</a></li>
  185. <li data-name="LuCI.Network#deleteWifiNetwork"><a href="LuCI.Network.html#deleteWifiNetwork">deleteWifiNetwork</a></li>
  186. <li data-name="LuCI.Network#flushCache"><a href="LuCI.Network.html#flushCache">flushCache</a></li>
  187. <li data-name="LuCI.Network#formatWifiEncryption"><a href="LuCI.Network.html#formatWifiEncryption">formatWifiEncryption</a></li>
  188. <li data-name="LuCI.Network#getDevice"><a href="LuCI.Network.html#getDevice">getDevice</a></li>
  189. <li data-name="LuCI.Network#getDevices"><a href="LuCI.Network.html#getDevices">getDevices</a></li>
  190. <li data-name="LuCI.Network#getDSLModemType"><a href="LuCI.Network.html#getDSLModemType">getDSLModemType</a></li>
  191. <li data-name="LuCI.Network#getHostHints"><a href="LuCI.Network.html#getHostHints">getHostHints</a></li>
  192. <li data-name="LuCI.Network#getIfnameOf"><a href="LuCI.Network.html#getIfnameOf">getIfnameOf</a></li>
  193. <li data-name="LuCI.Network#getNetwork"><a href="LuCI.Network.html#getNetwork">getNetwork</a></li>
  194. <li data-name="LuCI.Network#getNetworks"><a href="LuCI.Network.html#getNetworks">getNetworks</a></li>
  195. <li data-name="LuCI.Network#getProtocol"><a href="LuCI.Network.html#getProtocol">getProtocol</a></li>
  196. <li data-name="LuCI.Network#getProtocols"><a href="LuCI.Network.html#getProtocols">getProtocols</a></li>
  197. <li data-name="LuCI.Network#getSwitchTopologies"><a href="LuCI.Network.html#getSwitchTopologies">getSwitchTopologies</a></li>
  198. <li data-name="LuCI.Network#getWAN6Networks"><a href="LuCI.Network.html#getWAN6Networks">getWAN6Networks</a></li>
  199. <li data-name="LuCI.Network#getWANNetworks"><a href="LuCI.Network.html#getWANNetworks">getWANNetworks</a></li>
  200. <li data-name="LuCI.Network#getWifiDevice"><a href="LuCI.Network.html#getWifiDevice">getWifiDevice</a></li>
  201. <li data-name="LuCI.Network#getWifiDevices"><a href="LuCI.Network.html#getWifiDevices">getWifiDevices</a></li>
  202. <li data-name="LuCI.Network#getWifiNetwork"><a href="LuCI.Network.html#getWifiNetwork">getWifiNetwork</a></li>
  203. <li data-name="LuCI.Network#getWifiNetworks"><a href="LuCI.Network.html#getWifiNetworks">getWifiNetworks</a></li>
  204. <li data-name="LuCI.Network#isIgnoredDevice"><a href="LuCI.Network.html#isIgnoredDevice">isIgnoredDevice</a></li>
  205. <li data-name="LuCI.Network#maskToPrefix"><a href="LuCI.Network.html#maskToPrefix">maskToPrefix</a></li>
  206. <li data-name="LuCI.Network#prefixToMask"><a href="LuCI.Network.html#prefixToMask">prefixToMask</a></li>
  207. <li data-name="LuCI.Network#registerErrorCode"><a href="LuCI.Network.html#registerErrorCode">registerErrorCode</a></li>
  208. <li data-name="LuCI.Network#registerPatternVirtual"><a href="LuCI.Network.html#registerPatternVirtual">registerPatternVirtual</a></li>
  209. <li data-name="LuCI.Network#registerProtocol"><a href="LuCI.Network.html#registerProtocol">registerProtocol</a></li>
  210. <li data-name="LuCI.Network#renameNetwork"><a href="LuCI.Network.html#renameNetwork">renameNetwork</a></li>
  211. </ul>
  212. <ul class="events itemMembers">
  213. </ul>
  214. </li>
  215. <li class="item" data-name="LuCI.Network.Device">
  216. <span class="title">
  217. <a href="LuCI.Network.Device.html">LuCI.Network.Device</a>
  218. </span>
  219. <ul class="members itemMembers">
  220. </ul>
  221. <ul class="typedefs itemMembers">
  222. </ul>
  223. <ul class="typedefs itemMembers">
  224. </ul>
  225. <ul class="methods itemMembers">
  226. <span class="subtitle">Methods</span>
  227. <li data-name="LuCI.Network.Device#getBridgeID"><a href="LuCI.Network.Device.html#getBridgeID">getBridgeID</a></li>
  228. <li data-name="LuCI.Network.Device#getBridgeSTP"><a href="LuCI.Network.Device.html#getBridgeSTP">getBridgeSTP</a></li>
  229. <li data-name="LuCI.Network.Device#getI18n"><a href="LuCI.Network.Device.html#getI18n">getI18n</a></li>
  230. <li data-name="LuCI.Network.Device#getIP6Addrs"><a href="LuCI.Network.Device.html#getIP6Addrs">getIP6Addrs</a></li>
  231. <li data-name="LuCI.Network.Device#getIPAddrs"><a href="LuCI.Network.Device.html#getIPAddrs">getIPAddrs</a></li>
  232. <li data-name="LuCI.Network.Device#getMAC"><a href="LuCI.Network.Device.html#getMAC">getMAC</a></li>
  233. <li data-name="LuCI.Network.Device#getMTU"><a href="LuCI.Network.Device.html#getMTU">getMTU</a></li>
  234. <li data-name="LuCI.Network.Device#getName"><a href="LuCI.Network.Device.html#getName">getName</a></li>
  235. <li data-name="LuCI.Network.Device#getNetwork"><a href="LuCI.Network.Device.html#getNetwork">getNetwork</a></li>
  236. <li data-name="LuCI.Network.Device#getNetworks"><a href="LuCI.Network.Device.html#getNetworks">getNetworks</a></li>
  237. <li data-name="LuCI.Network.Device#getPorts"><a href="LuCI.Network.Device.html#getPorts">getPorts</a></li>
  238. <li data-name="LuCI.Network.Device#getRXBytes"><a href="LuCI.Network.Device.html#getRXBytes">getRXBytes</a></li>
  239. <li data-name="LuCI.Network.Device#getRXPackets"><a href="LuCI.Network.Device.html#getRXPackets">getRXPackets</a></li>
  240. <li data-name="LuCI.Network.Device#getShortName"><a href="LuCI.Network.Device.html#getShortName">getShortName</a></li>
  241. <li data-name="LuCI.Network.Device#getTXBytes"><a href="LuCI.Network.Device.html#getTXBytes">getTXBytes</a></li>
  242. <li data-name="LuCI.Network.Device#getTXPackets"><a href="LuCI.Network.Device.html#getTXPackets">getTXPackets</a></li>
  243. <li data-name="LuCI.Network.Device#getType"><a href="LuCI.Network.Device.html#getType">getType</a></li>
  244. <li data-name="LuCI.Network.Device#getTypeI18n"><a href="LuCI.Network.Device.html#getTypeI18n">getTypeI18n</a></li>
  245. <li data-name="LuCI.Network.Device#getWifiNetwork"><a href="LuCI.Network.Device.html#getWifiNetwork">getWifiNetwork</a></li>
  246. <li data-name="LuCI.Network.Device#isBridge"><a href="LuCI.Network.Device.html#isBridge">isBridge</a></li>
  247. <li data-name="LuCI.Network.Device#isBridgePort"><a href="LuCI.Network.Device.html#isBridgePort">isBridgePort</a></li>
  248. <li data-name="LuCI.Network.Device#isUp"><a href="LuCI.Network.Device.html#isUp">isUp</a></li>
  249. </ul>
  250. <ul class="events itemMembers">
  251. </ul>
  252. </li>
  253. <li class="item" data-name="LuCI.Network.Hosts">
  254. <span class="title">
  255. <a href="LuCI.Network.Hosts.html">LuCI.Network.Hosts</a>
  256. </span>
  257. <ul class="members itemMembers">
  258. </ul>
  259. <ul class="typedefs itemMembers">
  260. </ul>
  261. <ul class="typedefs itemMembers">
  262. </ul>
  263. <ul class="methods itemMembers">
  264. <span class="subtitle">Methods</span>
  265. <li data-name="LuCI.Network.Hosts#getHostnameByIP6Addr"><a href="LuCI.Network.Hosts.html#getHostnameByIP6Addr">getHostnameByIP6Addr</a></li>
  266. <li data-name="LuCI.Network.Hosts#getHostnameByIPAddr"><a href="LuCI.Network.Hosts.html#getHostnameByIPAddr">getHostnameByIPAddr</a></li>
  267. <li data-name="LuCI.Network.Hosts#getHostnameByMACAddr"><a href="LuCI.Network.Hosts.html#getHostnameByMACAddr">getHostnameByMACAddr</a></li>
  268. <li data-name="LuCI.Network.Hosts#getIP6AddrByMACAddr"><a href="LuCI.Network.Hosts.html#getIP6AddrByMACAddr">getIP6AddrByMACAddr</a></li>
  269. <li data-name="LuCI.Network.Hosts#getIPAddrByMACAddr"><a href="LuCI.Network.Hosts.html#getIPAddrByMACAddr">getIPAddrByMACAddr</a></li>
  270. <li data-name="LuCI.Network.Hosts#getMACAddrByIP6Addr"><a href="LuCI.Network.Hosts.html#getMACAddrByIP6Addr">getMACAddrByIP6Addr</a></li>
  271. <li data-name="LuCI.Network.Hosts#getMACAddrByIPAddr"><a href="LuCI.Network.Hosts.html#getMACAddrByIPAddr">getMACAddrByIPAddr</a></li>
  272. <li data-name="LuCI.Network.Hosts#getMACHints"><a href="LuCI.Network.Hosts.html#getMACHints">getMACHints</a></li>
  273. </ul>
  274. <ul class="events itemMembers">
  275. </ul>
  276. </li>
  277. <li class="item" data-name="LuCI.Network.Protocol">
  278. <span class="title">
  279. <a href="LuCI.Network.Protocol.html">LuCI.Network.Protocol</a>
  280. </span>
  281. <ul class="members itemMembers">
  282. </ul>
  283. <ul class="typedefs itemMembers">
  284. </ul>
  285. <ul class="typedefs itemMembers">
  286. </ul>
  287. <ul class="methods itemMembers">
  288. <span class="subtitle">Methods</span>
  289. <li data-name="LuCI.Network.Protocol#addDevice"><a href="LuCI.Network.Protocol.html#addDevice">addDevice</a></li>
  290. <li data-name="LuCI.Network.Protocol#containsDevice"><a href="LuCI.Network.Protocol.html#containsDevice">containsDevice</a></li>
  291. <li data-name="LuCI.Network.Protocol#deleteDevice"><a href="LuCI.Network.Protocol.html#deleteDevice">deleteDevice</a></li>
  292. <li data-name="LuCI.Network.Protocol#get"><a href="LuCI.Network.Protocol.html#get">get</a></li>
  293. <li data-name="LuCI.Network.Protocol#getDevice"><a href="LuCI.Network.Protocol.html#getDevice">getDevice</a></li>
  294. <li data-name="LuCI.Network.Protocol#getDevices"><a href="LuCI.Network.Protocol.html#getDevices">getDevices</a></li>
  295. <li data-name="LuCI.Network.Protocol#getDNS6Addrs"><a href="LuCI.Network.Protocol.html#getDNS6Addrs">getDNS6Addrs</a></li>
  296. <li data-name="LuCI.Network.Protocol#getDNSAddrs"><a href="LuCI.Network.Protocol.html#getDNSAddrs">getDNSAddrs</a></li>
  297. <li data-name="LuCI.Network.Protocol#getErrors"><a href="LuCI.Network.Protocol.html#getErrors">getErrors</a></li>
  298. <li data-name="LuCI.Network.Protocol#getExpiry"><a href="LuCI.Network.Protocol.html#getExpiry">getExpiry</a></li>
  299. <li data-name="LuCI.Network.Protocol#getGateway6Addr"><a href="LuCI.Network.Protocol.html#getGateway6Addr">getGateway6Addr</a></li>
  300. <li data-name="LuCI.Network.Protocol#getGatewayAddr"><a href="LuCI.Network.Protocol.html#getGatewayAddr">getGatewayAddr</a></li>
  301. <li data-name="LuCI.Network.Protocol#getI18n"><a href="LuCI.Network.Protocol.html#getI18n">getI18n</a></li>
  302. <li data-name="LuCI.Network.Protocol#getIfname"><a href="LuCI.Network.Protocol.html#getIfname">getIfname</a></li>
  303. <li data-name="LuCI.Network.Protocol#getIP6Addr"><a href="LuCI.Network.Protocol.html#getIP6Addr">getIP6Addr</a></li>
  304. <li data-name="LuCI.Network.Protocol#getIP6Addrs"><a href="LuCI.Network.Protocol.html#getIP6Addrs">getIP6Addrs</a></li>
  305. <li data-name="LuCI.Network.Protocol#getIP6Prefix"><a href="LuCI.Network.Protocol.html#getIP6Prefix">getIP6Prefix</a></li>
  306. <li data-name="LuCI.Network.Protocol#getIPAddr"><a href="LuCI.Network.Protocol.html#getIPAddr">getIPAddr</a></li>
  307. <li data-name="LuCI.Network.Protocol#getIPAddrs"><a href="LuCI.Network.Protocol.html#getIPAddrs">getIPAddrs</a></li>
  308. <li data-name="LuCI.Network.Protocol#getL2Device"><a href="LuCI.Network.Protocol.html#getL2Device">getL2Device</a></li>
  309. <li data-name="LuCI.Network.Protocol#getL3Device"><a href="LuCI.Network.Protocol.html#getL3Device">getL3Device</a></li>
  310. <li data-name="LuCI.Network.Protocol#getMetric"><a href="LuCI.Network.Protocol.html#getMetric">getMetric</a></li>
  311. <li data-name="LuCI.Network.Protocol#getName"><a href="LuCI.Network.Protocol.html#getName">getName</a></li>
  312. <li data-name="LuCI.Network.Protocol#getNetmask"><a href="LuCI.Network.Protocol.html#getNetmask">getNetmask</a></li>
  313. <li data-name="LuCI.Network.Protocol#getOpkgPackage"><a href="LuCI.Network.Protocol.html#getOpkgPackage">getOpkgPackage</a></li>
  314. <li data-name="LuCI.Network.Protocol#getProtocol"><a href="LuCI.Network.Protocol.html#getProtocol">getProtocol</a></li>
  315. <li data-name="LuCI.Network.Protocol#getType"><a href="LuCI.Network.Protocol.html#getType">getType</a></li>
  316. <li data-name="LuCI.Network.Protocol#getUptime"><a href="LuCI.Network.Protocol.html#getUptime">getUptime</a></li>
  317. <li data-name="LuCI.Network.Protocol#getZoneName"><a href="LuCI.Network.Protocol.html#getZoneName">getZoneName</a></li>
  318. <li data-name="LuCI.Network.Protocol#isAlias"><a href="LuCI.Network.Protocol.html#isAlias">isAlias</a></li>
  319. <li data-name="LuCI.Network.Protocol#isBridge"><a href="LuCI.Network.Protocol.html#isBridge">isBridge</a></li>
  320. <li data-name="LuCI.Network.Protocol#isDynamic"><a href="LuCI.Network.Protocol.html#isDynamic">isDynamic</a></li>
  321. <li data-name="LuCI.Network.Protocol#isEmpty"><a href="LuCI.Network.Protocol.html#isEmpty">isEmpty</a></li>
  322. <li data-name="LuCI.Network.Protocol#isFloating"><a href="LuCI.Network.Protocol.html#isFloating">isFloating</a></li>
  323. <li data-name="LuCI.Network.Protocol#isInstalled"><a href="LuCI.Network.Protocol.html#isInstalled">isInstalled</a></li>
  324. <li data-name="LuCI.Network.Protocol#isUp"><a href="LuCI.Network.Protocol.html#isUp">isUp</a></li>
  325. <li data-name="LuCI.Network.Protocol#isVirtual"><a href="LuCI.Network.Protocol.html#isVirtual">isVirtual</a></li>
  326. <li data-name="LuCI.Network.Protocol#set"><a href="LuCI.Network.Protocol.html#set">set</a></li>
  327. </ul>
  328. <ul class="events itemMembers">
  329. </ul>
  330. </li>
  331. <li class="item" data-name="LuCI.Network.WifiDevice">
  332. <span class="title">
  333. <a href="LuCI.Network.WifiDevice.html">LuCI.Network.WifiDevice</a>
  334. </span>
  335. <ul class="members itemMembers">
  336. </ul>
  337. <ul class="typedefs itemMembers">
  338. </ul>
  339. <ul class="typedefs itemMembers">
  340. </ul>
  341. <ul class="methods itemMembers">
  342. <span class="subtitle">Methods</span>
  343. <li data-name="LuCI.Network.WifiDevice#addWifiNetwork"><a href="LuCI.Network.WifiDevice.html#addWifiNetwork">addWifiNetwork</a></li>
  344. <li data-name="LuCI.Network.WifiDevice#deleteWifiNetwork"><a href="LuCI.Network.WifiDevice.html#deleteWifiNetwork">deleteWifiNetwork</a></li>
  345. <li data-name="LuCI.Network.WifiDevice#get"><a href="LuCI.Network.WifiDevice.html#get">get</a></li>
  346. <li data-name="LuCI.Network.WifiDevice#getHTModes"><a href="LuCI.Network.WifiDevice.html#getHTModes">getHTModes</a></li>
  347. <li data-name="LuCI.Network.WifiDevice#getHWModes"><a href="LuCI.Network.WifiDevice.html#getHWModes">getHWModes</a></li>
  348. <li data-name="LuCI.Network.WifiDevice#getI18n"><a href="LuCI.Network.WifiDevice.html#getI18n">getI18n</a></li>
  349. <li data-name="LuCI.Network.WifiDevice#getName"><a href="LuCI.Network.WifiDevice.html#getName">getName</a></li>
  350. <li data-name="LuCI.Network.WifiDevice#getScanList"><a href="LuCI.Network.WifiDevice.html#getScanList">getScanList</a></li>
  351. <li data-name="LuCI.Network.WifiDevice#getWifiNetwork"><a href="LuCI.Network.WifiDevice.html#getWifiNetwork">getWifiNetwork</a></li>
  352. <li data-name="LuCI.Network.WifiDevice#getWifiNetworks"><a href="LuCI.Network.WifiDevice.html#getWifiNetworks">getWifiNetworks</a></li>
  353. <li data-name="LuCI.Network.WifiDevice#isDisabled"><a href="LuCI.Network.WifiDevice.html#isDisabled">isDisabled</a></li>
  354. <li data-name="LuCI.Network.WifiDevice#isUp"><a href="LuCI.Network.WifiDevice.html#isUp">isUp</a></li>
  355. <li data-name="LuCI.Network.WifiDevice#set"><a href="LuCI.Network.WifiDevice.html#set">set</a></li>
  356. </ul>
  357. <ul class="events itemMembers">
  358. </ul>
  359. </li>
  360. <li class="item" data-name="LuCI.Network.WifiNetwork">
  361. <span class="title">
  362. <a href="LuCI.Network.WifiNetwork.html">LuCI.Network.WifiNetwork</a>
  363. </span>
  364. <ul class="members itemMembers">
  365. </ul>
  366. <ul class="typedefs itemMembers">
  367. </ul>
  368. <ul class="typedefs itemMembers">
  369. </ul>
  370. <ul class="methods itemMembers">
  371. <span class="subtitle">Methods</span>
  372. <li data-name="LuCI.Network.WifiNetwork#disconnectClient"><a href="LuCI.Network.WifiNetwork.html#disconnectClient">disconnectClient</a></li>
  373. <li data-name="LuCI.Network.WifiNetwork#get"><a href="LuCI.Network.WifiNetwork.html#get">get</a></li>
  374. <li data-name="LuCI.Network.WifiNetwork#getActiveBSSID"><a href="LuCI.Network.WifiNetwork.html#getActiveBSSID">getActiveBSSID</a></li>
  375. <li data-name="LuCI.Network.WifiNetwork#getActiveEncryption"><a href="LuCI.Network.WifiNetwork.html#getActiveEncryption">getActiveEncryption</a></li>
  376. <li data-name="LuCI.Network.WifiNetwork#getActiveMode"><a href="LuCI.Network.WifiNetwork.html#getActiveMode">getActiveMode</a></li>
  377. <li data-name="LuCI.Network.WifiNetwork#getActiveModeI18n"><a href="LuCI.Network.WifiNetwork.html#getActiveModeI18n">getActiveModeI18n</a></li>
  378. <li data-name="LuCI.Network.WifiNetwork#getActiveSSID"><a href="LuCI.Network.WifiNetwork.html#getActiveSSID">getActiveSSID</a></li>
  379. <li data-name="LuCI.Network.WifiNetwork#getAssocList"><a href="LuCI.Network.WifiNetwork.html#getAssocList">getAssocList</a></li>
  380. <li data-name="LuCI.Network.WifiNetwork#getBitRate"><a href="LuCI.Network.WifiNetwork.html#getBitRate">getBitRate</a></li>
  381. <li data-name="LuCI.Network.WifiNetwork#getBSSID"><a href="LuCI.Network.WifiNetwork.html#getBSSID">getBSSID</a></li>
  382. <li data-name="LuCI.Network.WifiNetwork#getChannel"><a href="LuCI.Network.WifiNetwork.html#getChannel">getChannel</a></li>
  383. <li data-name="LuCI.Network.WifiNetwork#getCountryCode"><a href="LuCI.Network.WifiNetwork.html#getCountryCode">getCountryCode</a></li>
  384. <li data-name="LuCI.Network.WifiNetwork#getDevice"><a href="LuCI.Network.WifiNetwork.html#getDevice">getDevice</a></li>
  385. <li data-name="LuCI.Network.WifiNetwork#getFrequency"><a href="LuCI.Network.WifiNetwork.html#getFrequency">getFrequency</a></li>
  386. <li data-name="LuCI.Network.WifiNetwork#getI18n"><a href="LuCI.Network.WifiNetwork.html#getI18n">getI18n</a></li>
  387. <li data-name="LuCI.Network.WifiNetwork#getID"><a href="LuCI.Network.WifiNetwork.html#getID">getID</a></li>
  388. <li data-name="LuCI.Network.WifiNetwork#getIfname"><a href="LuCI.Network.WifiNetwork.html#getIfname">getIfname</a></li>
  389. <li data-name="LuCI.Network.WifiNetwork#getMeshID"><a href="LuCI.Network.WifiNetwork.html#getMeshID">getMeshID</a></li>
  390. <li data-name="LuCI.Network.WifiNetwork#getMode"><a href="LuCI.Network.WifiNetwork.html#getMode">getMode</a></li>
  391. <li data-name="LuCI.Network.WifiNetwork#getName"><a href="LuCI.Network.WifiNetwork.html#getName">getName</a></li>
  392. <li data-name="LuCI.Network.WifiNetwork#getNetwork"><a href="LuCI.Network.WifiNetwork.html#getNetwork">getNetwork</a></li>
  393. <li data-name="LuCI.Network.WifiNetwork#getNetworkNames"><a href="LuCI.Network.WifiNetwork.html#getNetworkNames">getNetworkNames</a></li>
  394. <li data-name="LuCI.Network.WifiNetwork#getNetworks"><a href="LuCI.Network.WifiNetwork.html#getNetworks">getNetworks</a></li>
  395. <li data-name="LuCI.Network.WifiNetwork#getNoise"><a href="LuCI.Network.WifiNetwork.html#getNoise">getNoise</a></li>
  396. <li data-name="LuCI.Network.WifiNetwork#getShortName"><a href="LuCI.Network.WifiNetwork.html#getShortName">getShortName</a></li>
  397. <li data-name="LuCI.Network.WifiNetwork#getSignal"><a href="LuCI.Network.WifiNetwork.html#getSignal">getSignal</a></li>
  398. <li data-name="LuCI.Network.WifiNetwork#getSignalLevel"><a href="LuCI.Network.WifiNetwork.html#getSignalLevel">getSignalLevel</a></li>
  399. <li data-name="LuCI.Network.WifiNetwork#getSignalPercent"><a href="LuCI.Network.WifiNetwork.html#getSignalPercent">getSignalPercent</a></li>
  400. <li data-name="LuCI.Network.WifiNetwork#getSSID"><a href="LuCI.Network.WifiNetwork.html#getSSID">getSSID</a></li>
  401. <li data-name="LuCI.Network.WifiNetwork#getTXPower"><a href="LuCI.Network.WifiNetwork.html#getTXPower">getTXPower</a></li>
  402. <li data-name="LuCI.Network.WifiNetwork#getTXPowerOffset"><a href="LuCI.Network.WifiNetwork.html#getTXPowerOffset">getTXPowerOffset</a></li>
  403. <li data-name="LuCI.Network.WifiNetwork#getWifiDevice"><a href="LuCI.Network.WifiNetwork.html#getWifiDevice">getWifiDevice</a></li>
  404. <li data-name="LuCI.Network.WifiNetwork#getWifiDeviceName"><a href="LuCI.Network.WifiNetwork.html#getWifiDeviceName">getWifiDeviceName</a></li>
  405. <li data-name="LuCI.Network.WifiNetwork#isClientDisconnectSupported"><a href="LuCI.Network.WifiNetwork.html#isClientDisconnectSupported">isClientDisconnectSupported</a></li>
  406. <li data-name="LuCI.Network.WifiNetwork#isDisabled"><a href="LuCI.Network.WifiNetwork.html#isDisabled">isDisabled</a></li>
  407. <li data-name="LuCI.Network.WifiNetwork#isUp"><a href="LuCI.Network.WifiNetwork.html#isUp">isUp</a></li>
  408. <li data-name="LuCI.Network.WifiNetwork#set"><a href="LuCI.Network.WifiNetwork.html#set">set</a></li>
  409. </ul>
  410. <ul class="events itemMembers">
  411. </ul>
  412. </li>
  413. <li class="item" data-name="LuCI.Poll">
  414. <span class="title">
  415. <a href="LuCI.Poll.html">LuCI.Poll</a>
  416. </span>
  417. <ul class="members itemMembers">
  418. </ul>
  419. <ul class="typedefs itemMembers">
  420. </ul>
  421. <ul class="typedefs itemMembers">
  422. </ul>
  423. <ul class="methods itemMembers">
  424. <span class="subtitle">Methods</span>
  425. <li data-name="LuCI.Poll#active"><a href="LuCI.Poll.html#active">active</a></li>
  426. <li data-name="LuCI.Poll#add"><a href="LuCI.Poll.html#add">add</a></li>
  427. <li data-name="LuCI.Poll#remove"><a href="LuCI.Poll.html#remove">remove</a></li>
  428. <li data-name="LuCI.Poll#start"><a href="LuCI.Poll.html#start">start</a></li>
  429. <li data-name="LuCI.Poll#stop"><a href="LuCI.Poll.html#stop">stop</a></li>
  430. </ul>
  431. <ul class="events itemMembers">
  432. </ul>
  433. </li>
  434. <li class="item" data-name="LuCI.Request">
  435. <span class="title">
  436. <a href="LuCI.Request.html">LuCI.Request</a>
  437. </span>
  438. <ul class="members itemMembers">
  439. </ul>
  440. <ul class="typedefs itemMembers">
  441. <span class="subtitle">Typedefs</span>
  442. <li data-name="LuCI.Request.interceptorFn"><a href="LuCI.Request.html#.interceptorFn">interceptorFn</a></li>
  443. <li data-name="LuCI.Request.RequestOptions"><a href="LuCI.Request.html#.RequestOptions">RequestOptions</a></li>
  444. </ul>
  445. <ul class="typedefs itemMembers">
  446. </ul>
  447. <ul class="methods itemMembers">
  448. <span class="subtitle">Methods</span>
  449. <li data-name="LuCI.Request#addInterceptor"><a href="LuCI.Request.html#addInterceptor">addInterceptor</a></li>
  450. <li data-name="LuCI.Request#expandURL"><a href="LuCI.Request.html#expandURL">expandURL</a></li>
  451. <li data-name="LuCI.Request#get"><a href="LuCI.Request.html#get">get</a></li>
  452. <li data-name="LuCI.Request#post"><a href="LuCI.Request.html#post">post</a></li>
  453. <li data-name="LuCI.Request#removeInterceptor"><a href="LuCI.Request.html#removeInterceptor">removeInterceptor</a></li>
  454. <li data-name="LuCI.Request#request"><a href="LuCI.Request.html#request">request</a></li>
  455. </ul>
  456. <ul class="events itemMembers">
  457. </ul>
  458. </li>
  459. <li class="item" data-name="LuCI.Request.poll">
  460. <span class="title">
  461. <a href="LuCI.Request.poll.html">LuCI.Request.poll</a>
  462. </span>
  463. <ul class="members itemMembers">
  464. </ul>
  465. <ul class="typedefs itemMembers">
  466. <span class="subtitle">Typedefs</span>
  467. <li data-name="LuCI.Request.poll~callbackFn"><a href="LuCI.Request.poll.html#~callbackFn">callbackFn</a></li>
  468. </ul>
  469. <ul class="typedefs itemMembers">
  470. </ul>
  471. <ul class="methods itemMembers">
  472. <span class="subtitle">Methods</span>
  473. <li data-name="LuCI.Request.poll#active"><a href="LuCI.Request.poll.html#active">active</a></li>
  474. <li data-name="LuCI.Request.poll#add"><a href="LuCI.Request.poll.html#add">add</a></li>
  475. <li data-name="LuCI.Request.poll#remove"><a href="LuCI.Request.poll.html#remove">remove</a></li>
  476. <li data-name="LuCI.Request.poll#start"><a href="LuCI.Request.poll.html#start">start</a></li>
  477. <li data-name="LuCI.Request.poll#stop"><a href="LuCI.Request.poll.html#stop">stop</a></li>
  478. </ul>
  479. <ul class="events itemMembers">
  480. </ul>
  481. </li>
  482. <li class="item" data-name="LuCI.Response">
  483. <span class="title">
  484. <a href="LuCI.Response.html">LuCI.Response</a>
  485. </span>
  486. <ul class="members itemMembers">
  487. <span class="subtitle">Members</span>
  488. <li data-name="LuCI.Response#duration"><a href="LuCI.Response.html#duration">duration</a></li>
  489. <li data-name="LuCI.Response#headers"><a href="LuCI.Response.html#headers">headers</a></li>
  490. <li data-name="LuCI.Response#ok"><a href="LuCI.Response.html#ok">ok</a></li>
  491. <li data-name="LuCI.Response#status"><a href="LuCI.Response.html#status">status</a></li>
  492. <li data-name="LuCI.Response#statusText"><a href="LuCI.Response.html#statusText">statusText</a></li>
  493. <li data-name="LuCI.Response#url"><a href="LuCI.Response.html#url">url</a></li>
  494. </ul>
  495. <ul class="typedefs itemMembers">
  496. </ul>
  497. <ul class="typedefs itemMembers">
  498. </ul>
  499. <ul class="methods itemMembers">
  500. <span class="subtitle">Methods</span>
  501. <li data-name="LuCI.Response#clone"><a href="LuCI.Response.html#clone">clone</a></li>
  502. <li data-name="LuCI.Response#json"><a href="LuCI.Response.html#json">json</a></li>
  503. <li data-name="LuCI.Response#text"><a href="LuCI.Response.html#text">text</a></li>
  504. </ul>
  505. <ul class="events itemMembers">
  506. </ul>
  507. </li>
  508. <li class="item" data-name="LuCI.rpc">
  509. <span class="title">
  510. <a href="LuCI.rpc.html">LuCI.rpc</a>
  511. </span>
  512. <ul class="members itemMembers">
  513. </ul>
  514. <ul class="typedefs itemMembers">
  515. <span class="subtitle">Typedefs</span>
  516. <li data-name="LuCI.rpc.DeclareOptions"><a href="LuCI.rpc.html#.DeclareOptions">DeclareOptions</a></li>
  517. <li data-name="LuCI.rpc~filterFn"><a href="LuCI.rpc.html#~filterFn">filterFn</a></li>
  518. <li data-name="LuCI.rpc~interceptorFn"><a href="LuCI.rpc.html#~interceptorFn">interceptorFn</a></li>
  519. <li data-name="LuCI.rpc~invokeFn"><a href="LuCI.rpc.html#~invokeFn">invokeFn</a></li>
  520. </ul>
  521. <ul class="typedefs itemMembers">
  522. </ul>
  523. <ul class="methods itemMembers">
  524. <span class="subtitle">Methods</span>
  525. <li data-name="LuCI.rpc#addInterceptor"><a href="LuCI.rpc.html#addInterceptor">addInterceptor</a></li>
  526. <li data-name="LuCI.rpc#declare"><a href="LuCI.rpc.html#declare">declare</a></li>
  527. <li data-name="LuCI.rpc#getBaseURL"><a href="LuCI.rpc.html#getBaseURL">getBaseURL</a></li>
  528. <li data-name="LuCI.rpc#getSessionID"><a href="LuCI.rpc.html#getSessionID">getSessionID</a></li>
  529. <li data-name="LuCI.rpc#getStatusText"><a href="LuCI.rpc.html#getStatusText">getStatusText</a></li>
  530. <li data-name="LuCI.rpc#list"><a href="LuCI.rpc.html#list">list</a></li>
  531. <li data-name="LuCI.rpc#removeInterceptor"><a href="LuCI.rpc.html#removeInterceptor">removeInterceptor</a></li>
  532. <li data-name="LuCI.rpc#setBaseURL"><a href="LuCI.rpc.html#setBaseURL">setBaseURL</a></li>
  533. <li data-name="LuCI.rpc#setSessionID"><a href="LuCI.rpc.html#setSessionID">setSessionID</a></li>
  534. </ul>
  535. <ul class="events itemMembers">
  536. </ul>
  537. </li>
  538. <li class="item" data-name="LuCI.uci">
  539. <span class="title">
  540. <a href="LuCI.uci.html">LuCI.uci</a>
  541. </span>
  542. <ul class="members itemMembers">
  543. </ul>
  544. <ul class="typedefs itemMembers">
  545. <span class="subtitle">Typedefs</span>
  546. <li data-name="LuCI.uci.ChangeRecord"><a href="LuCI.uci.html#.ChangeRecord">ChangeRecord</a></li>
  547. <li data-name="LuCI.uci.SectionObject"><a href="LuCI.uci.html#.SectionObject">SectionObject</a></li>
  548. <li data-name="LuCI.uci~sectionsFn"><a href="LuCI.uci.html#~sectionsFn">sectionsFn</a></li>
  549. </ul>
  550. <ul class="typedefs itemMembers">
  551. </ul>
  552. <ul class="methods itemMembers">
  553. <span class="subtitle">Methods</span>
  554. <li data-name="LuCI.uci#add"><a href="LuCI.uci.html#add">add</a></li>
  555. <li data-name="LuCI.uci#apply"><a href="LuCI.uci.html#apply">apply</a></li>
  556. <li data-name="LuCI.uci#changes"><a href="LuCI.uci.html#changes">changes</a></li>
  557. <li data-name="LuCI.uci#createSID"><a href="LuCI.uci.html#createSID">createSID</a></li>
  558. <li data-name="LuCI.uci#get"><a href="LuCI.uci.html#get">get</a></li>
  559. <li data-name="LuCI.uci#get_first"><a href="LuCI.uci.html#get_first">get_first</a></li>
  560. <li data-name="LuCI.uci#load"><a href="LuCI.uci.html#load">load</a></li>
  561. <li data-name="LuCI.uci#move"><a href="LuCI.uci.html#move">move</a></li>
  562. <li data-name="LuCI.uci#remove"><a href="LuCI.uci.html#remove">remove</a></li>
  563. <li data-name="LuCI.uci#resolveSID"><a href="LuCI.uci.html#resolveSID">resolveSID</a></li>
  564. <li data-name="LuCI.uci#save"><a href="LuCI.uci.html#save">save</a></li>
  565. <li data-name="LuCI.uci#sections"><a href="LuCI.uci.html#sections">sections</a></li>
  566. <li data-name="LuCI.uci#set"><a href="LuCI.uci.html#set">set</a></li>
  567. <li data-name="LuCI.uci#set_first"><a href="LuCI.uci.html#set_first">set_first</a></li>
  568. <li data-name="LuCI.uci#unload"><a href="LuCI.uci.html#unload">unload</a></li>
  569. <li data-name="LuCI.uci#unset"><a href="LuCI.uci.html#unset">unset</a></li>
  570. <li data-name="LuCI.uci#unset_first"><a href="LuCI.uci.html#unset_first">unset_first</a></li>
  571. </ul>
  572. <ul class="events itemMembers">
  573. </ul>
  574. </li>
  575. <li class="item" data-name="LuCI.view">
  576. <span class="title">
  577. <a href="LuCI.view.html">LuCI.view</a>
  578. </span>
  579. <ul class="members itemMembers">
  580. </ul>
  581. <ul class="typedefs itemMembers">
  582. </ul>
  583. <ul class="typedefs itemMembers">
  584. </ul>
  585. <ul class="methods itemMembers">
  586. <span class="subtitle">Methods</span>
  587. <li data-name="LuCI.view#addFooter"><a href="LuCI.view.html#addFooter">addFooter</a></li>
  588. <li data-name="LuCI.view#handleReset"><a href="LuCI.view.html#handleReset">handleReset</a></li>
  589. <li data-name="LuCI.view#handleSave"><a href="LuCI.view.html#handleSave">handleSave</a></li>
  590. <li data-name="LuCI.view#handleSaveApply"><a href="LuCI.view.html#handleSaveApply">handleSaveApply</a></li>
  591. <li data-name="LuCI.view#load"><a href="LuCI.view.html#load">load</a></li>
  592. <li data-name="LuCI.view#render"><a href="LuCI.view.html#render">render</a></li>
  593. </ul>
  594. <ul class="events itemMembers">
  595. </ul>
  596. </li>
  597. <li class="item" data-name="LuCI.XHR">
  598. <span class="title">
  599. <a href="LuCI.XHR.html">LuCI.XHR</a>
  600. </span>
  601. <ul class="members itemMembers">
  602. </ul>
  603. <ul class="typedefs itemMembers">
  604. </ul>
  605. <ul class="typedefs itemMembers">
  606. </ul>
  607. <ul class="methods itemMembers">
  608. <span class="subtitle">Methods</span>
  609. <li data-name="LuCI.XHR#abort"><a href="LuCI.XHR.html#abort">abort</a></li>
  610. <li data-name="LuCI.XHR#busy"><a href="LuCI.XHR.html#busy">busy</a></li>
  611. <li data-name="LuCI.XHR#cancel"><a href="LuCI.XHR.html#cancel">cancel</a></li>
  612. <li data-name="LuCI.XHR#get"><a href="LuCI.XHR.html#get">get</a></li>
  613. <li data-name="LuCI.XHR#post"><a href="LuCI.XHR.html#post">post</a></li>
  614. <li data-name="LuCI.XHR#send_form"><a href="LuCI.XHR.html#send_form">send_form</a></li>
  615. </ul>
  616. <ul class="events itemMembers">
  617. </ul>
  618. </li>
  619. </ul>
  620. </div>
  621. <div class="main">
  622. <h1 class="page-title" data-filename="uci.js.html">Source: uci.js</h1>
  623. <section>
  624. <article>
  625. <pre id="source-code" class="prettyprint source "><code>'use strict';
  626. 'require rpc';
  627. /**
  628. * @class uci
  629. * @memberof LuCI
  630. * @hideconstructor
  631. * @classdesc
  632. *
  633. * The `LuCI.uci` class utilizes {@link LuCI.rpc} to declare low level
  634. * remote UCI `ubus` procedures and implements a local caching and data
  635. * manipulation layer on top to allow for synchroneous operations on
  636. * UCI configuration data.
  637. */
  638. return L.Class.extend(/** @lends LuCI.uci.prototype */ {
  639. __init__: function() {
  640. this.state = {
  641. newidx: 0,
  642. values: { },
  643. creates: { },
  644. changes: { },
  645. deletes: { },
  646. reorder: { }
  647. };
  648. this.loaded = {};
  649. },
  650. callLoad: rpc.declare({
  651. object: 'uci',
  652. method: 'get',
  653. params: [ 'config' ],
  654. expect: { values: { } }
  655. }),
  656. callOrder: rpc.declare({
  657. object: 'uci',
  658. method: 'order',
  659. params: [ 'config', 'sections' ]
  660. }),
  661. callAdd: rpc.declare({
  662. object: 'uci',
  663. method: 'add',
  664. params: [ 'config', 'type', 'name', 'values' ],
  665. expect: { section: '' }
  666. }),
  667. callSet: rpc.declare({
  668. object: 'uci',
  669. method: 'set',
  670. params: [ 'config', 'section', 'values' ]
  671. }),
  672. callDelete: rpc.declare({
  673. object: 'uci',
  674. method: 'delete',
  675. params: [ 'config', 'section', 'options' ]
  676. }),
  677. callApply: rpc.declare({
  678. object: 'uci',
  679. method: 'apply',
  680. params: [ 'timeout', 'rollback' ]
  681. }),
  682. callConfirm: rpc.declare({
  683. object: 'uci',
  684. method: 'confirm'
  685. }),
  686. /**
  687. * Generates a new, unique section ID for the given configuration.
  688. *
  689. * Note that the generated ID is temporary, it will get replaced by an
  690. * identifier in the form `cfgXXXXXX` once the configuration is saved
  691. * by the remote `ubus` UCI api.
  692. *
  693. * @param {string} config
  694. * The configuration to generate the new section ID for.
  695. *
  696. * @returns {string}
  697. * A newly generated, unique section ID in the form `newXXXXXX`
  698. * where `X` denotes a hexadecimal digit.
  699. */
  700. createSID: function(conf) {
  701. var v = this.state.values,
  702. n = this.state.creates,
  703. sid;
  704. do {
  705. sid = "new%06x".format(Math.random() * 0xFFFFFF);
  706. } while ((n[conf] &amp;&amp; n[conf][sid]) || (v[conf] &amp;&amp; v[conf][sid]));
  707. return sid;
  708. },
  709. /**
  710. * Resolves a given section ID in extended notation to the internal
  711. * section ID value.
  712. *
  713. * @param {string} config
  714. * The configuration to resolve the section ID for.
  715. *
  716. * @param {string} sid
  717. * The section ID to resolve. If the ID is in the form `@typename[#]`,
  718. * it will get resolved to an internal anonymous ID in the forms
  719. * `cfgXXXXXX`/`newXXXXXX` or to the name of a section in case it points
  720. * to a named section. When the given ID is not in extended notation,
  721. * it will be returned as-is.
  722. *
  723. * @returns {string|null}
  724. * Returns the resolved section ID or the original given ID if it was
  725. * not in extended notation. Returns `null` when an extended ID could
  726. * not be resolved to existing section ID.
  727. */
  728. resolveSID: function(conf, sid) {
  729. if (typeof(sid) != 'string')
  730. return sid;
  731. var m = /^@([a-zA-Z0-9_-]+)\[(-?[0-9]+)\]$/.exec(sid);
  732. if (m) {
  733. var type = m[1],
  734. pos = +m[2],
  735. sections = this.sections(conf, type),
  736. section = sections[pos >= 0 ? pos : sections.length + pos];
  737. return section ? section['.name'] : null;
  738. }
  739. return sid;
  740. },
  741. /* private */
  742. reorderSections: function() {
  743. var v = this.state.values,
  744. n = this.state.creates,
  745. r = this.state.reorder,
  746. tasks = [];
  747. if (Object.keys(r).length === 0)
  748. return Promise.resolve();
  749. /*
  750. gather all created and existing sections, sort them according
  751. to their index value and issue an uci order call
  752. */
  753. for (var c in r) {
  754. var o = [ ];
  755. if (n[c])
  756. for (var s in n[c])
  757. o.push(n[c][s]);
  758. for (var s in v[c])
  759. o.push(v[c][s]);
  760. if (o.length > 0) {
  761. o.sort(function(a, b) {
  762. return (a['.index'] - b['.index']);
  763. });
  764. var sids = [ ];
  765. for (var i = 0; i &lt; o.length; i++)
  766. sids.push(o[i]['.name']);
  767. tasks.push(this.callOrder(c, sids));
  768. }
  769. }
  770. this.state.reorder = { };
  771. return Promise.all(tasks);
  772. },
  773. /* private */
  774. loadPackage: function(packageName) {
  775. if (this.loaded[packageName] == null)
  776. return (this.loaded[packageName] = this.callLoad(packageName));
  777. return Promise.resolve(this.loaded[packageName]);
  778. },
  779. /**
  780. * Loads the given UCI configurations from the remote `ubus` api.
  781. *
  782. * Loaded configurations are cached and only loaded once. Subsequent
  783. * load operations of the same configurations will return the cached
  784. * data.
  785. *
  786. * To force reloading a configuration, it has to be unloaded with
  787. * {@link LuCI.uci#unload uci.unload()} first.
  788. *
  789. * @param {string|string[]} config
  790. * The name of the configuration or an array of configuration
  791. * names to load.
  792. *
  793. * @returns {Promise&lt;string[]>}
  794. * Returns a promise resolving to the names of the configurations
  795. * that have been successfully loaded.
  796. */
  797. load: function(packages) {
  798. var self = this,
  799. pkgs = [ ],
  800. tasks = [];
  801. if (!Array.isArray(packages))
  802. packages = [ packages ];
  803. for (var i = 0; i &lt; packages.length; i++)
  804. if (!self.state.values[packages[i]]) {
  805. pkgs.push(packages[i]);
  806. tasks.push(self.loadPackage(packages[i]));
  807. }
  808. return Promise.all(tasks).then(function(responses) {
  809. for (var i = 0; i &lt; responses.length; i++)
  810. self.state.values[pkgs[i]] = responses[i];
  811. if (responses.length)
  812. document.dispatchEvent(new CustomEvent('uci-loaded'));
  813. return pkgs;
  814. });
  815. },
  816. /**
  817. * Unloads the given UCI configurations from the local cache.
  818. *
  819. * @param {string|string[]} config
  820. * The name of the configuration or an array of configuration
  821. * names to unload.
  822. */
  823. unload: function(packages) {
  824. if (!Array.isArray(packages))
  825. packages = [ packages ];
  826. for (var i = 0; i &lt; packages.length; i++) {
  827. delete this.state.values[packages[i]];
  828. delete this.state.creates[packages[i]];
  829. delete this.state.changes[packages[i]];
  830. delete this.state.deletes[packages[i]];
  831. delete this.loaded[packages[i]];
  832. }
  833. },
  834. /**
  835. * Adds a new section of the given type to the given configuration,
  836. * optionally named according to the given name.
  837. *
  838. * @param {string} config
  839. * The name of the configuration to add the section to.
  840. *
  841. * @param {string} type
  842. * The type of the section to add.
  843. *
  844. * @param {string} [name]
  845. * The name of the section to add. If the name is omitted, an anonymous
  846. * section will be added instead.
  847. *
  848. * @returns {string}
  849. * Returns the section ID of the newly added section which is equivalent
  850. * to the given name for non-anonymous sections.
  851. */
  852. add: function(conf, type, name) {
  853. var n = this.state.creates,
  854. sid = name || this.createSID(conf);
  855. if (!n[conf])
  856. n[conf] = { };
  857. n[conf][sid] = {
  858. '.type': type,
  859. '.name': sid,
  860. '.create': name,
  861. '.anonymous': !name,
  862. '.index': 1000 + this.state.newidx++
  863. };
  864. return sid;
  865. },
  866. /**
  867. * Removes the section with the given ID from the given configuration.
  868. *
  869. * @param {string} config
  870. * The name of the configuration to remove the section from.
  871. *
  872. * @param {string} sid
  873. * The ID of the section to remove.
  874. */
  875. remove: function(conf, sid) {
  876. var n = this.state.creates,
  877. c = this.state.changes,
  878. d = this.state.deletes;
  879. /* requested deletion of a just created section */
  880. if (n[conf] &amp;&amp; n[conf][sid]) {
  881. delete n[conf][sid];
  882. }
  883. else {
  884. if (c[conf])
  885. delete c[conf][sid];
  886. if (!d[conf])
  887. d[conf] = { };
  888. d[conf][sid] = true;
  889. }
  890. },
  891. /**
  892. * A section object represents the options and their corresponding values
  893. * enclosed within a configuration section, as well as some additional
  894. * meta data such as sort indexes and internal ID.
  895. *
  896. * Any internal metadata fields are prefixed with a dot which is isn't
  897. * an allowed character for normal option names.
  898. *
  899. * @typedef {Object&lt;string, boolean|number|string|string[]>} SectionObject
  900. * @memberof LuCI.uci
  901. *
  902. * @property {boolean} .anonymous
  903. * The `.anonymous` property specifies whether the configuration is
  904. * anonymous (`true`) or named (`false`).
  905. *
  906. * @property {number} .index
  907. * The `.index` property specifes the sort order of the section.
  908. *
  909. * @property {string} .name
  910. * The `.name` property holds the name of the section object. It may be
  911. * either an anonymous ID in the form `cfgXXXXXX` or `newXXXXXX` with `X`
  912. * being a hexadecimal digit or a string holding the name of the section.
  913. *
  914. * @property {string} .type
  915. * The `.type` property contains the type of the corresponding uci
  916. * section.
  917. *
  918. * @property {string|string[]} *
  919. * A section object may contain an arbitrary number of further properties
  920. * representing the uci option enclosed in the section.
  921. *
  922. * All option property names will be in the form `[A-Za-z0-9_]+` and
  923. * either contain a string value or an array of strings, in case the
  924. * underlying option is an UCI list.
  925. */
  926. /**
  927. * The sections callback is invoked for each section found within
  928. * the given configuration and receives the section object and its
  929. * associated name as arguments.
  930. *
  931. * @callback LuCI.uci~sectionsFn
  932. *
  933. * @param {LuCI.uci.SectionObject} section
  934. * The section object.
  935. *
  936. * @param {string} sid
  937. * The name or ID of the section.
  938. */
  939. /**
  940. * Enumerates the sections of the given configuration, optionally
  941. * filtered by type.
  942. *
  943. * @param {string} config
  944. * The name of the configuration to enumerate the sections for.
  945. *
  946. * @param {string} [type]
  947. * Enumerate only sections of the given type. If omitted, enumerate
  948. * all sections.
  949. *
  950. * @param {LuCI.uci~sectionsFn} [cb]
  951. * An optional callback to invoke for each enumerated section.
  952. *
  953. * @returns {Array&lt;LuCI.uci.SectionObject>}
  954. * Returns a sorted array of the section objects within the given
  955. * configuration, filtered by type of a type has been specified.
  956. */
  957. sections: function(conf, type, cb) {
  958. var sa = [ ],
  959. v = this.state.values[conf],
  960. n = this.state.creates[conf],
  961. c = this.state.changes[conf],
  962. d = this.state.deletes[conf];
  963. if (!v)
  964. return sa;
  965. for (var s in v)
  966. if (!d || d[s] !== true)
  967. if (!type || v[s]['.type'] == type)
  968. sa.push(Object.assign({ }, v[s], c ? c[s] : undefined));
  969. if (n)
  970. for (var s in n)
  971. if (!type || n[s]['.type'] == type)
  972. sa.push(Object.assign({ }, n[s]));
  973. sa.sort(function(a, b) {
  974. return a['.index'] - b['.index'];
  975. });
  976. for (var i = 0; i &lt; sa.length; i++)
  977. sa[i]['.index'] = i;
  978. if (typeof(cb) == 'function')
  979. for (var i = 0; i &lt; sa.length; i++)
  980. cb.call(this, sa[i], sa[i]['.name']);
  981. return sa;
  982. },
  983. /**
  984. * Gets the value of the given option within the specified section
  985. * of the given configuration or the entire section object if the
  986. * option name is omitted.
  987. *
  988. * @param {string} config
  989. * The name of the configuration to read the value from.
  990. *
  991. * @param {string} sid
  992. * The name or ID of the section to read.
  993. *
  994. * @param {string} [option]
  995. * The option name to read the value from. If the option name is
  996. * omitted or `null`, the entire section is returned instead.
  997. *
  998. * @returns {null|string|string[]|LuCI.uci.SectionObject}
  999. * - Returns a string containing the option value in case of a
  1000. * plain UCI option.
  1001. * - Returns an array of strings containing the option values in
  1002. * case of `option` pointing to an UCI list.
  1003. * - Returns a {@link LuCI.uci.SectionObject section object} if
  1004. * the `option` argument has been omitted or is `null`.
  1005. * - Returns `null` if the config, section or option has not been
  1006. * found or if the corresponding configuration is not loaded.
  1007. */
  1008. get: function(conf, sid, opt) {
  1009. var v = this.state.values,
  1010. n = this.state.creates,
  1011. c = this.state.changes,
  1012. d = this.state.deletes;
  1013. sid = this.resolveSID(conf, sid);
  1014. if (sid == null)
  1015. return null;
  1016. /* requested option in a just created section */
  1017. if (n[conf] &amp;&amp; n[conf][sid]) {
  1018. if (!n[conf])
  1019. return undefined;
  1020. if (opt == null)
  1021. return n[conf][sid];
  1022. return n[conf][sid][opt];
  1023. }
  1024. /* requested an option value */
  1025. if (opt != null) {
  1026. /* check whether option was deleted */
  1027. if (d[conf] &amp;&amp; d[conf][sid]) {
  1028. if (d[conf][sid] === true)
  1029. return undefined;
  1030. for (var i = 0; i &lt; d[conf][sid].length; i++)
  1031. if (d[conf][sid][i] == opt)
  1032. return undefined;
  1033. }
  1034. /* check whether option was changed */
  1035. if (c[conf] &amp;&amp; c[conf][sid] &amp;&amp; c[conf][sid][opt] != null)
  1036. return c[conf][sid][opt];
  1037. /* return base value */
  1038. if (v[conf] &amp;&amp; v[conf][sid])
  1039. return v[conf][sid][opt];
  1040. return undefined;
  1041. }
  1042. /* requested an entire section */
  1043. if (v[conf])
  1044. return v[conf][sid];
  1045. return undefined;
  1046. },
  1047. /**
  1048. * Sets the value of the given option within the specified section
  1049. * of the given configuration.
  1050. *
  1051. * If either config, section or option is null, or if `option` begins
  1052. * with a dot, the function will do nothing.
  1053. *
  1054. * @param {string} config
  1055. * The name of the configuration to set the option value in.
  1056. *
  1057. * @param {string} sid
  1058. * The name or ID of the section to set the option value in.
  1059. *
  1060. * @param {string} option
  1061. * The option name to set the value for.
  1062. *
  1063. * @param {null|string|string[]} value
  1064. * The option value to set. If the value is `null` or an empty string,
  1065. * the option will be removed, otherwise it will be set or overwritten
  1066. * with the given value.
  1067. */
  1068. set: function(conf, sid, opt, val) {
  1069. var v = this.state.values,
  1070. n = this.state.creates,
  1071. c = this.state.changes,
  1072. d = this.state.deletes;
  1073. sid = this.resolveSID(conf, sid);
  1074. if (sid == null || opt == null || opt.charAt(0) == '.')
  1075. return;
  1076. if (n[conf] &amp;&amp; n[conf][sid]) {
  1077. if (val != null)
  1078. n[conf][sid][opt] = val;
  1079. else
  1080. delete n[conf][sid][opt];
  1081. }
  1082. else if (val != null &amp;&amp; val !== '') {
  1083. /* do not set within deleted section */
  1084. if (d[conf] &amp;&amp; d[conf][sid] === true)
  1085. return;
  1086. /* only set in existing sections */
  1087. if (!v[conf] || !v[conf][sid])
  1088. return;
  1089. if (!c[conf])
  1090. c[conf] = {};
  1091. if (!c[conf][sid])
  1092. c[conf][sid] = {};
  1093. /* undelete option */
  1094. if (d[conf] &amp;&amp; d[conf][sid])
  1095. d[conf][sid] = d[conf][sid].filter(function(o) { return o !== opt });
  1096. c[conf][sid][opt] = val;
  1097. }
  1098. else {
  1099. /* only delete in existing sections */
  1100. if (!(v[conf] &amp;&amp; v[conf][sid] &amp;&amp; v[conf][sid].hasOwnProperty(opt)) &amp;&amp;
  1101. !(c[conf] &amp;&amp; c[conf][sid] &amp;&amp; c[conf][sid].hasOwnProperty(opt)))
  1102. return;
  1103. if (!d[conf])
  1104. d[conf] = { };
  1105. if (!d[conf][sid])
  1106. d[conf][sid] = [ ];
  1107. if (d[conf][sid] !== true)
  1108. d[conf][sid].push(opt);
  1109. }
  1110. },
  1111. /**
  1112. * Remove the given option within the specified section of the given
  1113. * configuration.
  1114. *
  1115. * This function is a convenience wrapper around
  1116. * `uci.set(config, section, option, null)`.
  1117. *
  1118. * @param {string} config
  1119. * The name of the configuration to remove the option from.
  1120. *
  1121. * @param {string} sid
  1122. * The name or ID of the section to remove the option from.
  1123. *
  1124. * @param {string} option
  1125. * The name of the option to remove.
  1126. */
  1127. unset: function(conf, sid, opt) {
  1128. return this.set(conf, sid, opt, null);
  1129. },
  1130. /**
  1131. * Gets the value of the given option or the entire section object of
  1132. * the first found section of the specified type or the first found
  1133. * section of the entire configuration if no type is specfied.
  1134. *
  1135. * @param {string} config
  1136. * The name of the configuration to read the value from.
  1137. *
  1138. * @param {string} [type]
  1139. * The type of the first section to find. If it is `null`, the first
  1140. * section of the entire config is read, otherwise the first section
  1141. * matching the given type.
  1142. *
  1143. * @param {string} [option]
  1144. * The option name to read the value from. If the option name is
  1145. * omitted or `null`, the entire section is returned instead.
  1146. *
  1147. * @returns {null|string|string[]|LuCI.uci.SectionObject}
  1148. * - Returns a string containing the option value in case of a
  1149. * plain UCI option.
  1150. * - Returns an array of strings containing the option values in
  1151. * case of `option` pointing to an UCI list.
  1152. * - Returns a {@link LuCI.uci.SectionObject section object} if
  1153. * the `option` argument has been omitted or is `null`.
  1154. * - Returns `null` if the config, section or option has not been
  1155. * found or if the corresponding configuration is not loaded.
  1156. */
  1157. get_first: function(conf, type, opt) {
  1158. var sid = null;
  1159. this.sections(conf, type, function(s) {
  1160. if (sid == null)
  1161. sid = s['.name'];
  1162. });
  1163. return this.get(conf, sid, opt);
  1164. },
  1165. /**
  1166. * Sets the value of the given option within the first found section
  1167. * of the given configuration matching the specified type or within
  1168. * the first section of the entire config when no type has is specified.
  1169. *
  1170. * If either config, type or option is null, or if `option` begins
  1171. * with a dot, the function will do nothing.
  1172. *
  1173. * @param {string} config
  1174. * The name of the configuration to set the option value in.
  1175. *
  1176. * @param {string} [type]
  1177. * The type of the first section to find. If it is `null`, the first
  1178. * section of the entire config is written to, otherwise the first
  1179. * section matching the given type is used.
  1180. *
  1181. * @param {string} option
  1182. * The option name to set the value for.
  1183. *
  1184. * @param {null|string|string[]} value
  1185. * The option value to set. If the value is `null` or an empty string,
  1186. * the option will be removed, otherwise it will be set or overwritten
  1187. * with the given value.
  1188. */
  1189. set_first: function(conf, type, opt, val) {
  1190. var sid = null;
  1191. this.sections(conf, type, function(s) {
  1192. if (sid == null)
  1193. sid = s['.name'];
  1194. });
  1195. return this.set(conf, sid, opt, val);
  1196. },
  1197. /**
  1198. * Removes the given option within the first found section of the given
  1199. * configuration matching the specified type or within the first section
  1200. * of the entire config when no type has is specified.
  1201. *
  1202. * This function is a convenience wrapper around
  1203. * `uci.set_first(config, type, option, null)`.
  1204. *
  1205. * @param {string} config
  1206. * The name of the configuration to set the option value in.
  1207. *
  1208. * @param {string} [type]
  1209. * The type of the first section to find. If it is `null`, the first
  1210. * section of the entire config is written to, otherwise the first
  1211. * section matching the given type is used.
  1212. *
  1213. * @param {string} option
  1214. * The option name to set the value for.
  1215. */
  1216. unset_first: function(conf, type, opt) {
  1217. return this.set_first(conf, type, opt, null);
  1218. },
  1219. /**
  1220. * Move the first specified section within the given configuration
  1221. * before or after the second specified section.
  1222. *
  1223. * @param {string} config
  1224. * The configuration to move the section within.
  1225. *
  1226. * @param {string} sid1
  1227. * The ID of the section to move within the configuration.
  1228. *
  1229. * @param {string} [sid2]
  1230. * The ID of the target section for the move operation. If the
  1231. * `after` argument is `false` or not specified, the section named by
  1232. * `sid1` will be moved before this target section, if the `after`
  1233. * argument is `true`, the `sid1` section will be moved after this
  1234. * section.
  1235. *
  1236. * When the `sid2` argument is `null`, the section specified by `sid1`
  1237. * is moved to the end of the configuration.
  1238. *
  1239. * @param {boolean} [after=false]
  1240. * When `true`, the section `sid1` is moved after the section `sid2`,
  1241. * when `false`, the section `sid1` is moved before `sid2`.
  1242. *
  1243. * If `sid2` is null, then this parameter has no effect and the section
  1244. * `sid1` is moved to the end of the configuration instead.
  1245. *
  1246. * @returns {boolean}
  1247. * Returns `true` when the section was successfully moved, or `false`
  1248. * when either the section specified by `sid1` or by `sid2` is not found.
  1249. */
  1250. move: function(conf, sid1, sid2, after) {
  1251. var sa = this.sections(conf),
  1252. s1 = null, s2 = null;
  1253. sid1 = this.resolveSID(conf, sid1);
  1254. sid2 = this.resolveSID(conf, sid2);
  1255. for (var i = 0; i &lt; sa.length; i++) {
  1256. if (sa[i]['.name'] != sid1)
  1257. continue;
  1258. s1 = sa[i];
  1259. sa.splice(i, 1);
  1260. break;
  1261. }
  1262. if (s1 == null)
  1263. return false;
  1264. if (sid2 == null) {
  1265. sa.push(s1);
  1266. }
  1267. else {
  1268. for (var i = 0; i &lt; sa.length; i++) {
  1269. if (sa[i]['.name'] != sid2)
  1270. continue;
  1271. s2 = sa[i];
  1272. sa.splice(i + !!after, 0, s1);
  1273. break;
  1274. }
  1275. if (s2 == null)
  1276. return false;
  1277. }
  1278. for (var i = 0; i &lt; sa.length; i++)
  1279. this.get(conf, sa[i]['.name'])['.index'] = i;
  1280. this.state.reorder[conf] = true;
  1281. return true;
  1282. },
  1283. /**
  1284. * Submits all local configuration changes to the remove `ubus` api,
  1285. * adds, removes and reorders remote sections as needed and reloads
  1286. * all loaded configurations to resynchronize the local state with
  1287. * the remote configuration values.
  1288. *
  1289. * @returns {string[]}
  1290. * Returns a promise resolving to an array of configuration names which
  1291. * have been reloaded by the save operation.
  1292. */
  1293. save: function() {
  1294. var v = this.state.values,
  1295. n = this.state.creates,
  1296. c = this.state.changes,
  1297. d = this.state.deletes,
  1298. r = this.state.reorder,
  1299. self = this,
  1300. snew = [ ],
  1301. pkgs = { },
  1302. tasks = [];
  1303. if (n)
  1304. for (var conf in n) {
  1305. for (var sid in n[conf]) {
  1306. var r = {
  1307. config: conf,
  1308. values: { }
  1309. };
  1310. for (var k in n[conf][sid]) {
  1311. if (k == '.type')
  1312. r.type = n[conf][sid][k];
  1313. else if (k == '.create')
  1314. r.name = n[conf][sid][k];
  1315. else if (k.charAt(0) != '.')
  1316. r.values[k] = n[conf][sid][k];
  1317. }
  1318. snew.push(n[conf][sid]);
  1319. tasks.push(self.callAdd(r.config, r.type, r.name, r.values));
  1320. }
  1321. pkgs[conf] = true;
  1322. }
  1323. if (c)
  1324. for (var conf in c) {
  1325. for (var sid in c[conf])
  1326. tasks.push(self.callSet(conf, sid, c[conf][sid]));
  1327. pkgs[conf] = true;
  1328. }
  1329. if (d)
  1330. for (var conf in d) {
  1331. for (var sid in d[conf]) {
  1332. var o = d[conf][sid];
  1333. tasks.push(self.callDelete(conf, sid, (o === true) ? null : o));
  1334. }
  1335. pkgs[conf] = true;
  1336. }
  1337. if (r)
  1338. for (var conf in r)
  1339. pkgs[conf] = true;
  1340. return Promise.all(tasks).then(function(responses) {
  1341. /*
  1342. array "snew" holds references to the created uci sections,
  1343. use it to assign the returned names of the new sections
  1344. */
  1345. for (var i = 0; i &lt; snew.length; i++)
  1346. snew[i]['.name'] = responses[i];
  1347. return self.reorderSections();
  1348. }).then(function() {
  1349. pkgs = Object.keys(pkgs);
  1350. self.unload(pkgs);
  1351. return self.load(pkgs);
  1352. });
  1353. },
  1354. /**
  1355. * Instructs the remote `ubus` UCI api to commit all saved changes with
  1356. * rollback protection and attempts to confirm the pending commit
  1357. * operation to cancel the rollback timer.
  1358. *
  1359. * @param {number} [timeout=10]
  1360. * Override the confirmation timeout after which a rollback is triggered.
  1361. *
  1362. * @returns {Promise&lt;number>}
  1363. * Returns a promise resolving/rejecting with the `ubus` RPC status code.
  1364. */
  1365. apply: function(timeout) {
  1366. var self = this,
  1367. date = new Date();
  1368. if (typeof(timeout) != 'number' || timeout &lt; 1)
  1369. timeout = 10;
  1370. return self.callApply(timeout, true).then(function(rv) {
  1371. if (rv != 0)
  1372. return Promise.reject(rv);
  1373. var try_deadline = date.getTime() + 1000 * timeout;
  1374. var try_confirm = function() {
  1375. return self.callConfirm().then(function(rv) {
  1376. if (rv != 0) {
  1377. if (date.getTime() &lt; try_deadline)
  1378. window.setTimeout(try_confirm, 250);
  1379. else
  1380. return Promise.reject(rv);
  1381. }
  1382. return rv;
  1383. });
  1384. };
  1385. window.setTimeout(try_confirm, 1000);
  1386. });
  1387. },
  1388. /**
  1389. * An UCI change record is a plain array containing the change operation
  1390. * name as first element, the affected section ID as second argument
  1391. * and an optional third and fourth argument whose meanings depend on
  1392. * the operation.
  1393. *
  1394. * @typedef {string[]} ChangeRecord
  1395. * @memberof LuCI.uci
  1396. *
  1397. * @property {string} 0
  1398. * The operation name - may be one of `add`, `set`, `remove`, `order`,
  1399. * `list-add`, `list-del` or `rename`.
  1400. *
  1401. * @property {string} 1
  1402. * The section ID targeted by the operation.
  1403. *
  1404. * @property {string} 2
  1405. * The meaning of the third element depends on the operation.
  1406. * - For `add` it is type of the section that has been added
  1407. * - For `set` it either is the option name if a fourth element exists,
  1408. * or the type of a named section which has been added when the change
  1409. * entry only contains three elements.
  1410. * - For `remove` it contains the name of the option that has been
  1411. * removed.
  1412. * - For `order` it specifies the new sort index of the section.
  1413. * - For `list-add` it contains the name of the list option a new value
  1414. * has been added to.
  1415. * - For `list-del` it contains the name of the list option a value has
  1416. * been removed from.
  1417. * - For `rename` it contains the name of the option that has been
  1418. * renamed if a fourth element exists, else it contains the new name
  1419. * a section has been renamed to if the change entry only contains
  1420. * three elements.
  1421. *
  1422. * @property {string} 4
  1423. * The meaning of the fourth element depends on the operation.
  1424. * - For `set` it is the value an option has been set to.
  1425. * - For `list-add` it is the new value that has been added to a
  1426. * list option.
  1427. * - For `rename` it is the new name of an option that has been
  1428. * renamed.
  1429. */
  1430. /**
  1431. * Fetches uncommitted UCI changes from the remote `ubus` RPC api.
  1432. *
  1433. * @method
  1434. * @returns {Promise&lt;Object&lt;string, Array&lt;LuCI.uci.ChangeRecord>>>}
  1435. * Returns a promise resolving to an object containing the configuration
  1436. * names as keys and arrays of related change records as values.
  1437. */
  1438. changes: rpc.declare({
  1439. object: 'uci',
  1440. method: 'changes',
  1441. expect: { changes: { } }
  1442. })
  1443. });
  1444. </code></pre>
  1445. </article>
  1446. </section>
  1447. <footer>
  1448. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Nov 07 2019 12:36:05 GMT+0100 (Central European Standard Time)
  1449. </footer>
  1450. </div>
  1451. </div>
  1452. <script>prettyPrint();</script>
  1453. <script src="scripts/jaguar.js"></script>
  1454. </body>
  1455. </html>