summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/resolv.h
blob: ff48d35caf603e8ad5a32d3cb04bb157816e58c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef _IPXE_RESOLV_H
#define _IPXE_RESOLV_H

/** @file
 *
 * Name resolution
 *
 */

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#include <ipxe/interface.h>
#include <ipxe/tables.h>

struct sockaddr;

/** A name resolver */
struct resolver {
	/** Name of this resolver (e.g. "DNS") */
	const char *name;
	/** Start name resolution
	 *
	 * @v resolv		Name resolution interface
	 * @v name		Name to resolve
	 * @v sa		Socket address to complete
	 * @ret rc		Return status code
	 */
	int ( * resolv ) ( struct interface *resolv, const char *name,
			   struct sockaddr *sa );
};

/** Numeric resolver priority */
#define RESOLV_NUMERIC 01

/** Normal resolver priority */
#define RESOLV_NORMAL 02

/** Resolvers table */
#define RESOLVERS __table ( struct resolver, "resolvers" )

/** Register as a name resolver */
#define __resolver( resolv_order ) __table_entry ( RESOLVERS, resolv_order )

extern void resolv_done ( struct interface *intf, struct sockaddr *sa );
#define resolv_done_TYPE( object_type ) \
	typeof ( void ( object_type, struct sockaddr *sa ) )

extern int resolv ( struct interface *resolv, const char *name,
		    struct sockaddr *sa );

#endif /* _IPXE_RESOLV_H */