1 (* Dnsmasq module for Augeas
2 Author: Free Ekanayaka <free@64studio.com>
4 Reference: man dnsmasq (8)
6 "Format is one option per line, legal options are the same
7 as the long options legal on the command line. See
8 "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details."
16 (************************************************************************
18 *************************************************************************)
21 let spc = Util.del_ws_spc
22 let comment = Util.comment
23 let empty = Util.empty
25 let sep_eq = Sep.equal
26 let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
28 let slash = Util.del_str "/"
29 let sto_no_slash = store /([^\/ \t\n]+)/
30 let domains = slash . [ label "domain" . sto_no_slash . slash ]+
32 (************************************************************************
34 *************************************************************************)
36 let entry_re = Rx.word - /(address|server)/
37 let entry = [ key entry_re . (sep_eq . sto_to_eol)? . eol ]
39 (************************************************************************
41 *************************************************************************)
43 let address = [ key "address" . sep_eq . domains . sto_no_slash . eol ]
46 let port = [ Build.xchgs "#" "port" . store Rx.integer ]
47 in let source = [ Build.xchgs "@" "source" . store /[^#\/ \t\n]+/ . port? ]
48 in let srv_spec = store /(#|([^#@\/ \t\n]+))/ . port? . source?
49 in [ key "server" . sep_eq . domains? . srv_spec? . eol ]
51 (************************************************************************
53 *************************************************************************)
55 let lns = (comment|empty|address|server|entry) *
57 let filter = incl "/etc/dnsmasq.conf"
58 . incl "/etc/dnsmasq.d/*"
62 let xfm = transform lns filter