mirror of
https://github.com/ipxe/ipxe
synced 2025-12-22 04:50:25 +03:00
A working name resolution framework
This commit is contained in:
47
src/include/gpxe/resolv.h
Normal file
47
src/include/gpxe/resolv.h
Normal 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 */
|
||||
@@ -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 */
|
||||
Reference in New Issue
Block a user