library init: be recursive
[platform/upstream/c-ares.git] / ares.h
diff --git a/ares.h b/ares.h
index a4a119e..9b3f376 100644 (file)
--- a/ares.h
+++ b/ares.h
@@ -1,6 +1,6 @@
 
-/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
- * Copyright (C) 2007-2011 by Daniel Stenberg
+/* Copyright 1998 by the Massachusetts Institute of Technology.
+ * Copyright (C) 2007-2013 by Daniel Stenberg
  *
  * Permission to use, copy, modify, and distribute this
  * software and its documentation for any purpose and without
@@ -75,22 +75,18 @@ extern "C" {
 ** c-ares external API function linkage decorations.
 */
 
-#if !defined(CARES_STATICLIB) && \
-   (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
-   /* __declspec function decoration for Win32 and Symbian DLL's */
+#ifdef CARES_STATICLIB
+#  define CARES_EXTERN
+#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
 #  if defined(CARES_BUILDING_LIBRARY)
 #    define CARES_EXTERN  __declspec(dllexport)
 #  else
 #    define CARES_EXTERN  __declspec(dllimport)
 #  endif
+#elif defined(CARES_BUILDING_LIBRARY) && defined(CARES_SYMBOL_HIDING)
+#  define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
 #else
-   /* visibility function decoration for other cases */
-#  if !defined(CARES_SYMBOL_HIDING) || \
-     defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
-#    define CARES_EXTERN
-#  else
-#    define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
-#  endif
+#  define CARES_EXTERN
 #endif
 
 
@@ -143,6 +139,7 @@ extern "C" {
 #define ARES_FLAG_NOSEARCH      (1 << 5)
 #define ARES_FLAG_NOALIASES     (1 << 6)
 #define ARES_FLAG_NOCHECKRESP   (1 << 7)
+#define ARES_FLAG_EDNS          (1 << 8)
 
 /* Option mask values */
 #define ARES_OPT_FLAGS          (1 << 0)
@@ -160,6 +157,7 @@ extern "C" {
 #define ARES_OPT_SOCK_RCVBUF    (1 << 12)
 #define ARES_OPT_TIMEOUTMS      (1 << 13)
 #define ARES_OPT_ROTATE         (1 << 14)
+#define ARES_OPT_EDNSPSZ        (1 << 15)
 
 /* Nameinfo flag values */
 #define ARES_NI_NOFQDN                  (1 << 0)
@@ -265,6 +263,7 @@ struct ares_options {
   void *sock_state_cb_data;
   struct apattern *sortlist;
   int nsort;
+  int ednspsz;
 };
 
 struct hostent;
@@ -403,6 +402,15 @@ CARES_EXTERN void ares_process_fd(ares_channel channel,
                                   ares_socket_t read_fd,
                                   ares_socket_t write_fd);
 
+CARES_EXTERN int ares_create_query(const char *name,
+                                   int dnsclass,
+                                   int type,
+                                   unsigned short id,
+                                   int rd,
+                                   unsigned char **buf,
+                                   int *buflen,
+                                   int max_udp_size);
+
 CARES_EXTERN int ares_mkquery(const char *name,
                               int dnsclass,
                               int type,
@@ -476,6 +484,16 @@ struct ares_naptr_reply {
   unsigned short           preference;
 };
 
+struct ares_soa_reply {
+  char        *nsname;
+  char        *hostmaster;
+  unsigned int serial;
+  unsigned int refresh;
+  unsigned int retry;
+  unsigned int expire;
+  unsigned int minttl;
+};
+
 /*
 ** Parse the buffer, starting at *abuf and of length alen bytes, previously
 ** obtained from an ares_search call.  Put the results in *host, if nonnull.
@@ -523,6 +541,10 @@ CARES_EXTERN int ares_parse_naptr_reply(const unsigned char* abuf,
                                         int alen,
                                         struct ares_naptr_reply** naptr_out);
 
+CARES_EXTERN int ares_parse_soa_reply(const unsigned char* abuf,
+                                     int alen,
+                                     struct ares_soa_reply** soa_out);
+
 CARES_EXTERN void ares_free_string(void *str);
 
 CARES_EXTERN void ares_free_hostent(struct hostent *host);
@@ -551,6 +573,12 @@ CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
 CARES_EXTERN int ares_get_servers(ares_channel channel,
                                   struct ares_addr_node **servers);
 
+CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst,
+                                        ares_socklen_t size);
+
+CARES_EXTERN int ares_inet_pton(int af, const char *src, void *dst);
+
+
 #ifdef  __cplusplus
 }
 #endif