Home | History | Annotate | Download | only in dbus
      1 DBus support must be enabled at compile-time and run-time. Ensure 
      2 that src/config.h contains the line
      3 
      4 #define HAVE_DBUS.
      5 
      6 and that /etc/dnsmasq.conf contains the line
      7 
      8 enable-dbus
      9 
     10 Because dnsmasq can operate stand-alone from the DBus, and may need to provide
     11 service before the dbus daemon is available, it will continue to run
     12 if the DBus connection is not available at startup. The DBus will be polled 
     13 every 250ms until a connection is established. Start of polling and final
     14 connection establishment are both logged. When dnsmasq establishes a
     15 connection to the dbus, it sends the signal "Up". Anything controlling
     16 the server settings in dnsmasq should re-invoke the SetServers method
     17 (q.v.) when it sees this signal. This allows dnsmasq to be restarted
     18 and avoids startup races with the provider of nameserver information.
     19 
     20 
     21 Dnsmasq provides one service on the DBus: uk.org.thekelleys.dnsmasq
     22 and a single object: /uk/org/thekelleys/dnsmasq
     23 
     24 1. METHODS
     25 ----------
     26 
     27 Methods are of the form
     28 
     29 uk.org.thekelleys.<method>
     30 
     31 Available methods are:
     32 
     33 GetVersion
     34 ----------
     35 Returns a string containing the version of dnsmasq running.
     36 
     37 ClearCache
     38 ----------
     39 Returns nothing. Clears the domain name cache and re-reads
     40 /etc/hosts. The same as sending dnsmasq a HUP signal.
     41 
     42 SetServers
     43 ----------
     44 Returns nothing. Takes a set of arguments representing the new
     45 upstream DNS servers to be used by dnsmasq. IPv4 addresses are
     46 represented as a UINT32 (in network byte order) and IPv6 addresses
     47 are represented as sixteen BYTEs (since there is no UINT128 type).
     48 Each server address may be followed by one or more STRINGS, which are
     49 the domains for which the preceding server should be used.
     50 
     51 Examples.
     52 
     53 UINT32: <address1>
     54 UNIT32: <address2>
     55 
     56 is equivalent to
     57 
     58 --server=<address1> --server=<address2>
     59 
     60 
     61 UINT32 <address1>
     62 UINT32 <address2>
     63 STRING "somedomain.com"
     64 
     65 is equivalent to
     66 
     67 --server=<address1> --server=/somedomain.com/<address2> 
     68 
     69 UINT32 <address1>
     70 UINT32 <address2>
     71 STRING "somedomain.com"
     72 UINT32 <address3>
     73 STRING "anotherdomain.com"
     74 STRING "thirddomain.com"
     75 
     76 is equivalent to
     77 
     78 --server=<address1> 
     79 --server=/somedomain.com/<address2> 
     80 --server=/anotherdomain.com/thirddomain.com/<address3>
     81 
     82 Am IPv4 address of 0.0.0.0 is interpreted as "no address, local only",
     83 so
     84 
     85 UINT32: <0.0.0.0>
     86 STRING  "local.domain"
     87 
     88 is equivalent to
     89 
     90 --local=/local.domain/
     91 
     92 
     93 Each call to SetServers completely replaces the set of servers
     94 specified by via the DBus, but it leaves any servers specified via the
     95 command line or /etc/dnsmasq.conf or /etc/resolv.conf alone.
     96 
     97 2. SIGNALS
     98 ----------
     99 
    100 If dnsmasq's DHCP server is active, it will send signals over DBUS whenever
    101 the DHCP lease database changes. Think of these signals as transactions on
    102 a database with the IP address acting as the primary key.
    103 
    104 Signals are of the form:
    105 
    106 uk.org.thekelleys.<signal>
    107 
    108 and their parameters are:
    109 
    110 STRING "192.168.1.115"
    111 STRING "01:23:45:67:89:ab"
    112 STRING "hostname.or.fqdn"
    113 
    114 
    115 Available signals are:
    116 
    117 DhcpLeaseAdded
    118 ---------------
    119 
    120 This signal is emitted when a DHCP lease for a given IP address is created.
    121 
    122 DhcpLeaseDeleted
    123 ----------------
    124 
    125 This signal is emitted when a DHCP lease for a given IP address is deleted.
    126 
    127 DhcpLeaseUpdated
    128 ----------------
    129 
    130 This signal is emitted when a DHCP lease for a given IP address is updated.
    131  
    132