A working name resolution framework

This commit is contained in:
Michael Brown
2007-01-18 22:38:13 +00:00
parent 8bb9f726a0
commit 4e3976711d
7 changed files with 192 additions and 49 deletions

47
src/include/gpxe/resolv.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef _GPXE_RESOLV_H
#define _GPXE_RESOLV_H
/** @file
*
* Name resolution
*
*/
struct sockaddr;
#include <gpxe/async.h>
#include <gpxe/tables.h>
/** A name resolver */
struct resolver {
/** Name of this resolver (e.g. "DNS") */
const char *name;
/** Start name resolution
*
* @v name Host name to resolve
* @v sa Socket address to fill in
* @v parent Parent asynchronous operation
* @ret rc Return status code
*
* The asynchronous process must be prepared to accept
* SIGKILL.
*/
int ( * resolv ) ( const char *name, struct sockaddr *sa,
struct async *parent );
};
/** A name resolution in progress */
struct resolution {
/** Asynchronous operation */
struct async async;
/** Numner of active child resolvers */
unsigned int pending;
};
/** Register as a name resolver */
#define __resolver __table ( struct resolver, resolvers, 01 )
extern int resolv ( const char *name, struct sockaddr *sa,
struct async *parent );
#endif /* _GPXE_RESOLV_H */

View File

@@ -1,16 +0,0 @@
#ifndef RESOLV_H
#define RESOLV_H
#include <gpxe/in.h>
#include <gpxe/tables.h>
struct resolver {
const char *name;
int ( * resolv ) ( struct in_addr *address, const char *name );
};
#define __resolver __table ( struct resolver, resolver, 01 )
extern int resolv ( struct in_addr *address, const char *name );
#endif /* RESOLV_H */