Parses OpenNTPD’s ntpd.conf
Author: Jasper Lievisse Adriaanse jasper@jasper.la
| Ntpd | Parses OpenNTPD’s ntpd.conf |
| Reference | This lens is used to parse OpenNTPD’s configuration file, ntpd.conf. |
| Usage Example | To be documented |
| License | This file is licensed under the LGPL v2+, like the rest of Augeas. |
| Configuration files | This lens applies to /etc/ntpd.conf. |
| Utility variables/ | |
| comment | |
| empty | |
| eol | |
| space | |
| word | |
| device_re | |
| address_re | |
| stratum_re | value between 1 and 15 |
| refid_re | string with length < 5 |
| weight_re | value between 1 and 10 |
| rtable_re | |
| correction_re | should actually only match between -127000000 and 127000000 |
| key_opt_rtable_line | A subnode with a keyword, an optional routing table id and an end of line. |
| key_opt_weight_rtable_line | A subnode with a keyword, an optional routing table id, an optional weight-value and an end of line. |
| opt_value | A subnode for optional values. |
| Keywords | |
| listen | listen on address [rtable table-id] |
| server | server address [weight weight-value] [rtable table-id] |
| servers | servers address [weight weight-value] [rtable table-id] |
| sensor | sensor device [correction microseconds] [weight weight-value] [refid string] [stratum stratum-value] |
| Lens | |
| keyword | |
| lns | |
| filter |
This lens is used to parse OpenNTPD’s configuration file, ntpd.conf. http://openntpd.org/
This lens applies to /etc/ntpd.conf. See filter.
let key_opt_rtable_line (kw:regexp) (sto:lens) = let rtable = [ Util.del_str "rtable" . space . label "rtable" . store rtable_re ] in [ key kw . space . sto . (space . rtable)? . eol ]
A subnode with a keyword, an optional routing table id and an end of line.
| kw:regexp | the pattern to match as key |
| sto:lens | the storing lens |
let key_opt_weight_rtable_line (kw:regexp) (sto:lens) = let rtable = [ Util.del_str "rtable" . space . label "rtable" . store rtable_re ] in let weight = [ Util.del_str "weight" . space . label "weight" . store weight_re ] in [ key kw . space . sto . (space . weight)? . (space . rtable)? . eol ]
A subnode with a keyword, an optional routing table id, an optional weight-value and an end of line. of line.
| kw:regexp | the pattern to match as key |
| sto:lens | the storing lens |
let sensor = let device = [ label "device" . store device_re ] in let correction = opt_value "correction" correction_re in let weight = opt_value "weight" weight_re in let refid = opt_value "refid" refid_re in let stratum = opt_value "stratum" stratum_re in [ key "sensor" . space . device . (space . correction)? . (space . weight)? . (space . refid)? . (space . stratum)? . eol ]
sensor device [correction microseconds] [weight weight-value] [refid string] [stratum stratum-value]
let comment = Util.comment
let empty = Util.empty
let eol = Util.eol
let space = Sep.space
let word = Rx.word
let device_re = Rx.device_name | /\*/
let address_re = Rx.ip | /\*/ | Rx.hostname
value between 1 and 15
let stratum_re = /1[0-5]|[1-9]/
string with length < 5
let refid_re = /[A-Za-z0-9_.-]{1,5}/
value between 1 and 10
let weight_re = /10|[1-9]/
let rtable_re = Rx.byte
should actually only match between -127000000 and 127000000
let correction_re = Rx.relinteger_noplus
A subnode with a keyword, an optional routing table id and an end of line.
let key_opt_rtable_line (kw:regexp) (sto:lens) = let rtable = [ Util.del_str "rtable" . space . label "rtable" . store rtable_re ] in [ key kw . space . sto . (space . rtable)? . eol ]
A subnode with a keyword, an optional routing table id, an optional weight-value and an end of line.
let key_opt_weight_rtable_line (kw:regexp) (sto:lens) = let rtable = [ Util.del_str "rtable" . space . label "rtable" . store rtable_re ] in let weight = [ Util.del_str "weight" . space . label "weight" . store weight_re ] in [ key kw . space . sto . (space . weight)? . (space . rtable)? . eol ]
A subnode for optional values.
let opt_value (s:string) (r:regexp) = Build.key_value s space (store r)
listen on address [rtable table-id]
let listen = let addr = [ label "address" . store address_re ] in key_opt_rtable_line "listen on" addr
server address [weight weight-value] [rtable table-id]
let server = let addr = [ label "address" . store address_re ] in key_opt_weight_rtable_line "server" addr
servers address [weight weight-value] [rtable table-id]
let servers = let addr = [ label "address" . store address_re ] in key_opt_weight_rtable_line "servers" addr
sensor device [correction microseconds] [weight weight-value] [refid string] [stratum stratum-value]
let sensor = let device = [ label "device" . store device_re ] in let correction = opt_value "correction" correction_re in let weight = opt_value "weight" weight_re in let refid = opt_value "refid" refid_re in let stratum = opt_value "stratum" stratum_re in [ key "sensor" . space . device . (space . correction)? . (space . weight)? . (space . refid)? . (space . stratum)? . eol ]
let keyword = listen | server | servers | sensor
let lns = ( empty | comment | keyword )*