dns.h 882 B

12345678910111213141516171819202122
  1. /* Minimal DNS resolver (A records over UDP, RFC 1035): see dns.c. */
  2. #ifndef DNS_H
  3. #define DNS_H
  4. /* Resolve `name` to an IPv4 address with a recursive query to the configured
  5. * resolver (DHCP option 6, else the gateway). Prints a `dns:` line.
  6. * Returns 0 on success. A raw owner polls the NIC directly; stack users are
  7. * driven by net_pump(). */
  8. int dns_resolve(const char *name, unsigned char ip[4]);
  9. /* Feed one received frame to the pending stack-mode query. Returns 1 when it
  10. * was a reply to that query (consumed), 0 otherwise. Called by net_pump(). */
  11. int dns_input(const unsigned char *frame, unsigned int len);
  12. /* Called by the reaper when a resolver process dies. */
  13. void dns_reap(unsigned int pid);
  14. /* `netdns [a.b.c.d]` (show/set the resolver) and `host <name>`. */
  15. void program_netdns_main(const char *arg);
  16. void program_host_main(const char *arg);
  17. #endif