summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe
diff options
context:
space:
mode:
authorMichael Brown2007-01-18 23:38:13 +0100
committerMichael Brown2007-01-18 23:38:13 +0100
commit4e3976711dec26ba1f462f19c4b865dea3dbe4d7 (patch)
treefab4b8042cdc2e01adc2b43f5f816611e5978068 /src/include/gpxe
parentWhen an async operation dies, orphan its children. (diff)
downloadipxe-4e3976711dec26ba1f462f19c4b865dea3dbe4d7.tar.gz
ipxe-4e3976711dec26ba1f462f19c4b865dea3dbe4d7.tar.xz
ipxe-4e3976711dec26ba1f462f19c4b865dea3dbe4d7.zip
A working name resolution framework
Diffstat (limited to 'src/include/gpxe')
-rw-r--r--src/include/gpxe/resolv.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/include/gpxe/resolv.h b/src/include/gpxe/resolv.h
new file mode 100644
index 000000000..71364012c
--- /dev/null
+++ b/src/include/gpxe/resolv.h
@@ -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 */