diff options
| author | Michael Brown | 2007-01-15 18:31:35 +0100 |
|---|---|---|
| committer | Michael Brown | 2007-01-15 18:31:35 +0100 |
| commit | 9af12d5fba1483ec5e95ac302b3f5c5aeb3662c1 (patch) | |
| tree | 3e97aec4cb3500383fdfda5e6027be5411c972a1 /src/include | |
| parent | Update TFTP and FTP to take the same temporary URI scheme as HTTP (diff) | |
| download | ipxe-9af12d5fba1483ec5e95ac302b3f5c5aeb3662c1.tar.gz ipxe-9af12d5fba1483ec5e95ac302b3f5c5aeb3662c1.tar.xz ipxe-9af12d5fba1483ec5e95ac302b3f5c5aeb3662c1.zip | |
A working DNS resolver (not yet tied in to anything)
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/errno.h | 1 | ||||
| -rw-r--r-- | src/include/gpxe/dns.h (renamed from src/include/dns.h) | 61 | ||||
| -rw-r--r-- | src/include/nmb.h | 2 |
3 files changed, 41 insertions, 23 deletions
diff --git a/src/include/errno.h b/src/include/errno.h index 3025fa965..541d9cbdb 100644 --- a/src/include/errno.h +++ b/src/include/errno.h @@ -137,6 +137,7 @@ #define EINVAL 0xdd /**< Invalid argument */ #define EIO 0xde /**< Input/output error */ #define EISCONN 0xdf /**< Transport endpoint is already connected */ +#define ELOOP 0xf8 /**< Too many symbolic links */ #define EMFILE 0xe0 /**< Too many open files */ #define EMSGSIZE 0xe1 /**< Message too long */ #define ENAMETOOLONG 0xe2 /**< File name too long */ diff --git a/src/include/dns.h b/src/include/gpxe/dns.h index c72c6909b..49292d588 100644 --- a/src/include/dns.h +++ b/src/include/gpxe/dns.h @@ -1,10 +1,16 @@ -#ifndef DNS_RESOLVER_H -#define DNS_RESOLVER_H +#ifndef _GPXE_DNS_H +#define _GPXE_DNS_H -#include "stdint.h" +/** @file + * + * DNS protocol + * + */ + +#include <stdint.h> #include <gpxe/in.h> -#include "ip.h" -#include "udp.h" +#include <gpxe/async.h> +#include <gpxe/retry.h> /* * Constants @@ -33,7 +39,7 @@ #define DNS_FLAG_RCODE_NX ( 0x03 << 0 ) #define DNS_FLAG_RCODE(flags) ( (flags) & ( 0x0f << 0 ) ) -#define DNS_UDP_PORT 53 +#define DNS_PORT 53 #define DNS_MAX_RETRIES 3 #define DNS_MAX_CNAME_RECURSION 0x30 @@ -56,13 +62,11 @@ struct dns_query_info { } __attribute__ (( packed )); struct dns_query { - struct iphdr ip; - struct udphdr udp; struct dns_header dns; char payload[ 256 + sizeof ( struct dns_query_info ) ]; } __attribute__ (( packed )); -struct dns_rr_info { +struct dns_rr_info_common { uint16_t type; uint16_t class; uint32_t ttl; @@ -70,23 +74,36 @@ struct dns_rr_info { } __attribute__ (( packed )); struct dns_rr_info_a { - struct dns_rr_info info; + struct dns_rr_info_common common; struct in_addr in_addr; } __attribute__ (( packed )); struct dns_rr_info_cname { - struct dns_rr_info info; - char cname[0]; + struct dns_rr_info_common common; + char cname[0]; } __attribute__ (( packed )); -/* - * Functions in dns.c (used by nmb.c) - * - */ -extern struct dns_header * dns_query ( struct dns_query *query, - unsigned int query_len, - struct sockaddr_in *nameserver ); -extern struct dns_rr_info * dns_find_rr ( struct dns_query *query, - struct dns_header *reply ); +union dns_rr_info { + struct dns_rr_info_common common; + struct dns_rr_info_a a; + struct dns_rr_info_cname cname; +}; + +struct dns_request { + + struct sockaddr_tcpip *st; + + struct async async; + struct dns_query query; + struct dns_query_info *qinfo; + + unsigned int recursion; + + struct udp_connection udp; + struct retry_timer timer; +}; + +extern int dns_resolv ( const char *name, struct sockaddr_tcpip *st, + struct async *parent ); -#endif /* DNS_RESOLVER_H */ +#endif /* _GPXE_DNS_H */ diff --git a/src/include/nmb.h b/src/include/nmb.h index 7948d9e48..3e551ffd5 100644 --- a/src/include/nmb.h +++ b/src/include/nmb.h @@ -1,7 +1,7 @@ #ifndef NMB_H #define NMB_H -#include "dns.h" +#include <gpxe/dns.h> /* * NetBIOS name query packets are basically the same as DNS packets, |
