DNS Client Application

Requirements
------------

* Ethernet LAN for testing purposes.

* Galileo Gen 2 Development Board.

* USB-UART cable: CH340, FTDI 6-pin or equivalent for debugging.

* dnsmasq application. The dnsmasq version used in this sample is:

dnsmasq -v
Dnsmasq version 2.75  Copyright (c) 2000-2015 Simon Kelley

Building instructions
---------------------

* Read src/main.c, change the IP addresses according to the LAN
  environment.

* make pristine && make are enough to build this sample.

* Follow the steps indicated here:

  https://www.zephyrproject.org/doc/board/galileo.html

  to load the binary into the Galileo Dev Board.


Usage
-----

* Open a terminal window and type:

dnsmasq -d

* Connect the USB-UART cable to the Galileo. Open a terminal and run:

  screen /dev/ttyUSB0 115200

* Connect Galileo to the LAN, Turn on the board.

* The screen terminal window will show:

    WARNING: no console will be available to OS
    error: no suitable video mode found.

    -----------------------------------------
    Domain name: not_a_real_domain_name
    [fiber:82] DNS Create Query: 0, ID: 1
    [fiber:85] TX: 0
    [fiber:88] RX: -5

    -----------------------------------------
    Domain name: oops!
    [fiber:82] DNS Create Query: 0, ID: 2
    [fiber:85] TX: 0
    [fiber:88] RX: 0
    [fiber:95] DNS response: 2

    -----------------------------------------
    Domain name: zephyrproject.org
    [fiber:82] DNS Create Query: 0, ID: 3
    [fiber:85] TX: 0
    [fiber:88] RX: 0

    ****** DNS ANSWER: 0 ******
    Response: IP address            Size: 4:        140 211 169 8
    [fiber:95] DNS response: 0

    -----------------------------------------
    Domain name: www.google.com
    [fiber:82] DNS Create Query: 0, ID: 4
    [fiber:85] TX: 0
    [fiber:88] RX: 0

    ****** DNS ANSWER: 0 ******
    Response: IP address            Size: 4:        216 58 192 4
    [fiber:95] DNS response: 0

    -----------------------------------------
    Domain name: mail.yahoo.com
    [fiber:82] DNS Create Query: 0, ID: 5
    [fiber:85] TX: 0
    [fiber:88] RX: 0

    ****** DNS ANSWER: 0 ******
    Response: CNAME NO IP address           Size: 8:        5 108 111 103 105 110 192 17
    CNAME: login.yahoo.com

    ****** DNS ANSWER: 1 ******
    Response: CNAME NO IP address           Size: 35:       9 102 111 45 100 115 45 97 116 115 6 109 101 109 98 101 114 3 103 48 50 8 121 97 104 111 111 100 110 115 3 110 101 116 0
    CNAME: fo-ds-ats.member.g02.yahoodns.net

    ****** DNS ANSWER: 2 ******
    Response: IP address            Size: 4:        98 136 189 41
    [fiber:95] DNS response: 0

    -----------------------------------------
    Bye!
