summaryrefslogtreecommitdiffstats
path: root/include/resolv.h
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-05-14 04:16:35 +0000
committerErik Andersen <andersen@codepoet.org>2000-05-14 04:16:35 +0000
commit64bc6412188b141c010ac3b8e813b837dd991e80 (patch)
treeffa12b79ea4b13191754f54b872eb1a4f9e3a04b /include/resolv.h
downloaduClibc-alpine-64bc6412188b141c010ac3b8e813b837dd991e80.tar.bz2
uClibc-alpine-64bc6412188b141c010ac3b8e813b837dd991e80.tar.xz
Initial revision0_9_1
Diffstat (limited to 'include/resolv.h')
-rw-r--r--include/resolv.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/include/resolv.h b/include/resolv.h
new file mode 100644
index 000000000..53ee2f235
--- /dev/null
+++ b/include/resolv.h
@@ -0,0 +1,85 @@
+/* resolv.h: DNS Resolver
+ *
+ * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>,
+ * The Silver Hammer Group, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _RESOLV_H_
+#define _RESOLV_H_
+
+#include <netdb.h>
+#include <netinet/in.h>
+
+struct resolv_header {
+ int id;
+ int qr,opcode,aa,tc,rd,ra,rcode;
+ int qdcount;
+ int ancount;
+ int nscount;
+ int arcount;
+};
+
+struct resolv_question {
+ char * dotted;
+ int qtype;
+ int qclass;
+};
+
+struct resolv_answer {
+ char * dotted;
+ int atype;
+ int aclass;
+ int ttl;
+ int rdlength;
+ unsigned char * rdata;
+ int rdoffset;
+};
+
+int encode_header(struct resolv_header * h, unsigned char * dest, int maxlen);
+int decode_header(unsigned char * data, struct resolv_header * h);
+int encode_dotted(const char * dotted, unsigned char * dest, int maxlen);
+int decode_dotted(const unsigned char * message, int offset,
+ char * dest, int maxlen);
+int length_dotted(const unsigned char * message, int offset);
+int encode_question(struct resolv_question * q,
+ unsigned char * dest, int maxlen);
+int decode_question(unsigned char * message, int offset,
+ struct resolv_question * q);
+int length_question(unsigned char * message, int offset);
+int encode_answer(struct resolv_answer * a,
+ unsigned char * dest, int maxlen);
+int decode_answer(unsigned char * message, int offset,
+ struct resolv_answer * a);
+char * resolve_name(const char * name, int mailbox);
+
+int encode_packet(struct resolv_header * h,
+ struct resolv_question ** q,
+ struct resolv_question ** an,
+ struct resolv_question ** ns,
+ struct resolv_question ** ar,
+ unsigned char * dest, int maxlen);
+int decode_packet(unsigned char * data, struct resolv_header * h);
+
+int dns_lookup(const char * name, int type, int nscount, const char ** nsip,
+ unsigned char ** outpacket, struct resolv_answer * a);
+
+int resolve_address(const char * address,
+ int nscount, const char ** nsip,
+ struct in_addr * in);
+
+int resolve_mailbox(const char * address,
+ int nscount, const char ** nsip,
+ struct in_addr * in);
+
+extern int open_nameservers(void);
+extern void close_nameservers(void);
+
+extern struct hostent * gethostbyname(const char * name);
+extern struct hostent * gethostbyaddr(const char * addr, int len, int type);
+
+#endif /*_RESOLV_H_*/