diff options
author | Michael Brown <mcb30@etherboot.org> | 2005-04-29 13:26:31 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2005-04-29 13:26:31 +0000 |
commit | 65dc273d7816a0a38064e4a6294ef40b32f4dcc7 (patch) | |
tree | 78d44dfa64ea61da60d148b9239601a3e018ba87 /src/core/resolv.c | |
parent | e4131ebb8469222f9bf864cba516e78b2530ffb3 (diff) | |
download | ipxe-65dc273d7816a0a38064e4a6294ef40b32f4dcc7.zip ipxe-65dc273d7816a0a38064e4a6294ef40b32f4dcc7.tar.gz ipxe-65dc273d7816a0a38064e4a6294ef40b32f4dcc7.tar.bz2 |
First version
Diffstat (limited to 'src/core/resolv.c')
-rw-r--r-- | src/core/resolv.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/resolv.c b/src/core/resolv.c new file mode 100644 index 0000000..24483b8 --- /dev/null +++ b/src/core/resolv.c @@ -0,0 +1,25 @@ +#include "resolv.h" + +static struct resolver resolvers[0] __table_start(resolver); +static struct resolver resolvers_end[0] __table_end(resolver); + +/* + * Resolve a name (which may be just a dotted quad IP address) to an + * IP address. + * + */ +int resolv ( struct in_addr *address, const char *name ) { + struct resolver *resolver; + + /* Check for a dotted quad IP address first */ + if ( inet_aton ( name, address ) ) + return 1; + + /* Try any compiled-in name resolution modules */ + for ( resolver = resolvers ; resolver < resolvers_end ; resolver++ ) { + if ( resolver->resolv ( address, name ) ) + return 1; + } + + return 0; +} |