Alien-cares

 view release on metacpan or  search on metacpan

libcares/ares_private.h  view on Meta::CPAN

  unsigned short next_id;
  /* key to use when generating new ids */
  rc4_key id_key;

  /* Generation number to use for the next TCP socket open/close */
  int tcp_connection_generation;

  /* The time at which we last called process_timeouts(). Uses integer seconds
     just to draw the line somewhere. */
  time_t last_timeout_processed;

  /* Last server we sent a query to. */
  int last_server;

  /* Circular, doubly-linked list of queries, bucketed various ways.... */
  /* All active queries in a single list: */
  struct list_node all_queries;
  /* Queries bucketed by qid, for quickly dispatching DNS responses: */
#define ARES_QID_TABLE_SIZE 2048
  struct list_node queries_by_qid[ARES_QID_TABLE_SIZE];
  /* Queries bucketed by timeout, for quickly handling timeouts: */
#define ARES_TIMEOUT_TABLE_SIZE 1024
  struct list_node queries_by_timeout[ARES_TIMEOUT_TABLE_SIZE];

  ares_sock_state_cb sock_state_cb;
  void *sock_state_cb_data;

  ares_sock_create_callback sock_create_cb;
  void *sock_create_cb_data;

  ares_sock_config_callback sock_config_cb;
  void *sock_config_cb_data;

  const struct ares_socket_functions * sock_funcs;
  void *sock_func_cb_data;

  /* Path for resolv.conf file, configurable via ares_options */
  char *resolvconf_path;
};

/* Does the domain end in ".onion" or ".onion."? Case-insensitive. */
int ares__is_onion_domain(const char *name);

/* Memory management functions */
extern void *(*ares_malloc)(size_t size);
extern void *(*ares_realloc)(void *ptr, size_t size);
extern void (*ares_free)(void *ptr);

/* return true if now is exactly check time or later */
int ares__timedout(struct timeval *now,
                   struct timeval *check);

void ares__send_query(ares_channel channel, struct query *query,
                      struct timeval *now);
void ares__close_sockets(ares_channel channel, struct server_state *server);
int ares__get_hostent(FILE *fp, int family, struct hostent **host);
int ares__read_line(FILE *fp, char **buf, size_t *bufsize);
void ares__free_query(struct query *query);
unsigned short ares__generate_new_id(rc4_key* key);
struct timeval ares__tvnow(void);
int ares__expand_name_for_response(const unsigned char *encoded,
                                   const unsigned char *abuf, int alen,
                                   char **s, long *enclen);
void ares__init_servers_state(ares_channel channel);
void ares__destroy_servers_state(ares_channel channel);
struct ares_addrinfo *ares__malloc_addrinfo(void);
struct ares_addrinfo *ares__append_addrinfo(struct ares_addrinfo *ai,
                                            struct ares_addrinfo **head_ai);
int ares__get_addrinfo(FILE *fp,
                       const char *name,
                       unsigned short port,
                       const struct ares_addrinfo *hints,
                       struct ares_addrinfo **result);

int ares__parse_a_reply(const unsigned char *abuf,
                        int alen,
                        struct hostent **host,
                        struct ares_addrinfo **ai,
                        unsigned short port,
                        char **cname,
                        struct ares_addrttl *addrttls,
                        int *naddrttls);

int ares__parse_aaaa_reply(const unsigned char *abuf,
                           int alen,
                           struct hostent **host,
                           struct ares_addrinfo **ai,
                           unsigned short port,
                           char **cname,
                           struct ares_addr6ttl *addrttls,
                           int *naddrttls);

#if 0 /* Not used */
long ares__tvdiff(struct timeval t1, struct timeval t2);
#endif

void ares__socket_close(ares_channel, ares_socket_t);

#define ARES_SWAP_BYTE(a,b) \
  { unsigned char swapByte = *(a);  *(a) = *(b);  *(b) = swapByte; }

#define SOCK_STATE_CALLBACK(c, s, r, w)                                 \
  do {                                                                  \
    if ((c)->sock_state_cb)                                             \
      (c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w));       \
  } WHILE_FALSE

#ifdef CURLDEBUG
/* This is low-level hard-hacking memory leak tracking and similar. Using the
   libcurl lowlevel code from within library is ugly and only works when
   c-ares is built and linked with a similarly curldebug-enabled libcurl,
   but we do this anyway for convenience. */
#define HEADER_CURL_SETUP_ONCE_H
#include "../lib/memdebug.h"
#endif

#endif /* __ARES_PRIVATE_H */



( run in 0.957 second using v1.01-cache-2.11-cpan-5b529ec07f3 )