[git commit] inet/resolv: Add dn_comp

Daniel Mack zonque at gmail.com
Fri Aug 26 07:49:55 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=05ff11da8f47e95e16c2d6db93fd6273dc35445e
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Signed-off-by: Daniel Mack <zonque at gmail.com>
---
 include/resolv.h   |    4 ++--
 libc/inet/resolv.c |   15 ++++++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/resolv.h b/include/resolv.h
index cba26f0..0afb375 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -332,9 +332,9 @@ __END_DECLS
 #if 0
 #define b64_ntop		__b64_ntop
 #define b64_pton		__b64_pton
-#define dn_comp			__dn_comp
 #define dn_count_labels		__dn_count_labels
 #endif
+#define dn_comp			__dn_comp
 #define dn_expand		__dn_expand
 #if 0
 #define dn_skipname		__dn_skipname
@@ -404,9 +404,9 @@ const u_char *	p_fqname (const u_char *, const u_char *, FILE *) __THROW;
 const char *	p_option (u_long option) __THROW;
 char *		p_secstodate (u_long) __THROW;
 int		dn_count_labels (const char *) __THROW;
+#endif
 int		dn_comp (const char *, u_char *, int, u_char **, u_char **)
      __THROW;
-#endif
 int		dn_expand (const u_char *, const u_char *, const u_char *,
 			   char *, int) __THROW;
 #if 0
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 64e99ba..a74ab30 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -2659,6 +2659,20 @@ int dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
 		dst[0] = '\0';
 	return n;
 }
+
+/*
+ * Pack domain name 'exp_dn' in presentation form into 'comp_dn'.
+ * Return the size of the compressed name or -1.
+ * 'length' is the size of the array pointed to by 'comp_dn'.
+ */
+int
+dn_comp(const char *src, u_char *dst, int dstsiz,
+		u_char **dnptrs, u_char **lastdnptr)
+{
+	return ns_name_compress(src, dst, (size_t) dstsiz,
+			(const u_char **) dnptrs,
+			(const u_char **) lastdnptr);
+}
 #endif /* L_res_comp */
 
 
@@ -3823,4 +3837,3 @@ void ns_put32(unsigned long src, unsigned char *dst)
 /* Unimplemented: */
 /* res_mkquery */
 /* res_send */
-/* dn_comp */
-- 
1.7.3.4



More information about the uClibc-cvs mailing list