summaryrefslogtreecommitdiff
path: root/libc/inet
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2011-07-13 00:30:48 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-08-26 09:29:52 +0200
commit466f11015f44dd6be48bc0295196a83421bceea5 (patch)
tree523f094649a86d9aeae4bf77b398c0c545a495cb /libc/inet
parent6ca582ff96ae373e635a275626af1243a81d63a4 (diff)
inet/resolv: add ns_{put,get}{16,32}
This patch introduces a new config directive 'UCLIBC_HAS_RESOLVER_SUPPORT' and adds the new symbols conditionally. Signed-off-by: Daniel Mack <zonque@gmail.com>
Diffstat (limited to 'libc/inet')
-rw-r--r--libc/inet/Makefile.in2
-rw-r--r--libc/inet/ns_netint.c8
-rw-r--r--libc/inet/resolv.c26
3 files changed, 36 insertions, 0 deletions
diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in
index d58822074..6c2c576f8 100644
--- a/libc/inet/Makefile.in
+++ b/libc/inet/Makefile.in
@@ -40,6 +40,8 @@ CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \
CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \
res_init.c res_query.c res_comp.c ns_name.c \
_res_state.c
+CSRC-$(findstring y,$(UCLIBC_HAS_RESOLVER_SUPPORT)) += \
+ ns_netint.c
## # unused ATM
## CSRC-y += encodep.c decodep.c formquery.c
diff --git a/libc/inet/ns_netint.c b/libc/inet/ns_netint.c
new file mode 100644
index 000000000..acf88dc68
--- /dev/null
+++ b/libc/inet/ns_netint.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_ns_netint
+#include RESOLVER
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 9f5d11853..a347ca5f6 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -3326,6 +3326,32 @@ int res_querydomain(const char *name, const char *domain, int class, int type,
libc_hidden_def(res_querydomain)
#endif /* L_res_query */
+#ifdef L_ns_netint
+unsigned int ns_get16(const unsigned char *src)
+{
+ unsigned int dst;
+ NS_GET16(dst, src);
+ return dst;
+}
+
+unsigned long ns_get32(const unsigned char *src)
+{
+ unsigned long dst;
+ NS_GET32(dst, src);
+ return dst;
+}
+
+void ns_put16(unsigned int src, unsigned char *dst)
+{
+ NS_PUT16(src, dst);
+}
+
+void ns_put32(unsigned long src, unsigned char *dst)
+{
+ NS_PUT32(src, dst);
+}
+#endif /* L_ns_netint */
+
/* Unimplemented: */
/* res_mkquery */
/* res_send */