diff options
| author | Robin Getz <rgetz@blackfin.uclinux.org> | 2009-07-20 14:53:54 -0400 | 
|---|---|---|
| committer | Ben Warren <biggerbadderben@gmail.com> | 2009-07-22 22:53:44 -0700 | 
| commit | 1a32bf41881b5dbe3119cb77a33572b4d462cabf (patch) | |
| tree | dda370cbcb7a6614e111ad2399661392322bab0b /net/dns.h | |
| parent | 88ad3fd91c83a4343b25385fd78fd8e29ebb723f (diff) | |
| download | olio-uboot-2014.01-1a32bf41881b5dbe3119cb77a33572b4d462cabf.tar.xz olio-uboot-2014.01-1a32bf41881b5dbe3119cb77a33572b4d462cabf.zip | |
Add DNS support
On 04 Oct 2008 Pieter posted a dns implementation for U-Boot.
http://www.mail-archive.com/u-boot-users@lists.sourceforge.net/msg10216.html
>
> DNS can be enabled by setting CFG_CMD_DNS. After performing a query,
> the serverip environment var is updated.
>
> Probably there are some cosmetic issues with the patch. Unfortunatly I
> do not have the time to correct these. So if anybody else likes DNS
> support in U-Boot and has the time, feel free to patch it in the main tree.
Here it is again - slightly modified & smaller:
  - update to 2009-06 (Pieter's patch was for U-Boot 1.2.0)
  - README.dns is added
  - syntax is changed (now takes a third option, the env var to store
    the result in)
  - add a random port() function in net.c
  - sort Makefile in ./net/Makefile
  - dns just returns unless a env var is given
  - run through checkpatch, and clean up style issues
  - remove packet from stack
  - cleaned up some comments
  - failure returns much faster (if server responds, don't wait for
    timeout)
  - use built in functions (memcpy) rather than byte copy.
Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: Pieter Voorthuijsen <pieter.voorthuijsen@prodrive.nl>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'net/dns.h')
| -rw-r--r-- | net/dns.h | 39 | 
1 files changed, 39 insertions, 0 deletions
| diff --git a/net/dns.h b/net/dns.h new file mode 100644 index 000000000..277c093ed --- /dev/null +++ b/net/dns.h @@ -0,0 +1,39 @@ +/* + * (C) Masami Komiya <mkomiya@sonare.it> 2005 + *  Copyright 2009, Robin Getz <rgetz@blackfin.uclinux.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2, or (at + * your option) any later version. + */ + +#ifndef __DNS_H__ +#define __DNS_H__ + +#define DNS_SERVICE_PORT 53 +#define DNS_TIMEOUT      10000UL + +/* http://en.wikipedia.org/wiki/List_of_DNS_record_types */ +enum dns_query_type { +	DNS_A_RECORD = 0x01, +	DNS_CNAME_RECORD = 0x05, +	DNS_MX_RECORD = 0x0f, +}; + +/* + * DNS network packet + */ +struct header { +	uint16_t	tid;		/* Transaction ID */ +	uint16_t	flags;		/* Flags */ +	uint16_t	nqueries;	/* Questions */ +	uint16_t	nanswers;	/* Answers */ +	uint16_t	nauth;		/* Authority PRs */ +	uint16_t	nother;		/* Other PRs */ +	unsigned char	data[1];	/* Data, variable length */ +}; + +extern void DnsStart(void);		/* Begin DNS */ + +#endif |